From 83156759d2486f1757b9df0ff0d2c05e2ee2fe24 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sat, 24 Apr 2021 06:42:47 +0200 Subject: [PATCH] first commit --- LICENSE.txt | 340 + README.md | 47 + admin/README.txt | 47 + admin/access.xml | 425 + admin/assets/css/admin.css | 29 + admin/assets/css/administration_part.css | 27 + admin/assets/css/administration_parts.css | 27 + admin/assets/css/antenatal_care.css | 27 + admin/assets/css/antenatal_cares.css | 27 + admin/assets/css/breast_cancer.css | 27 + admin/assets/css/breast_cancers.css | 27 + admin/assets/css/cervical_cancer.css | 27 + admin/assets/css/cervical_cancers.css | 27 + admin/assets/css/clinic.css | 27 + admin/assets/css/clinics.css | 27 + admin/assets/css/counseling_type.css | 27 + admin/assets/css/counseling_types.css | 27 + admin/assets/css/dashboard.css | 177 + admin/assets/css/diagnosis_type.css | 27 + admin/assets/css/diagnosis_types.css | 27 + admin/assets/css/family_planning.css | 27 + admin/assets/css/family_plannings.css | 27 + admin/assets/css/foetal_engagement.css | 27 + admin/assets/css/foetal_engagements.css | 27 + admin/assets/css/foetal_lie.css | 27 + admin/assets/css/foetal_lies.css | 27 + admin/assets/css/foetal_presentation.css | 27 + admin/assets/css/foetal_presentations.css | 27 + admin/assets/css/general_medical_check_up.css | 27 + .../assets/css/general_medical_check_ups.css | 27 + admin/assets/css/health_education.css | 27 + admin/assets/css/health_education_topic.css | 27 + admin/assets/css/health_education_topics.css | 27 + admin/assets/css/health_educations.css | 27 + .../assets/css/hiv_counseling_and_testing.css | 27 + .../css/hiv_counselings_and_testings.css | 27 + admin/assets/css/immunisation.css | 27 + admin/assets/css/immunisation_type.css | 27 + admin/assets/css/immunisation_types.css | 27 + .../assets/css/immunisation_vaccine_type.css | 27 + .../assets/css/immunisation_vaccine_types.css | 27 + admin/assets/css/immunisations.css | 27 + admin/assets/css/index.html | 1 + admin/assets/css/medication.css | 27 + admin/assets/css/medications.css | 27 + admin/assets/css/nonpay_reason.css | 27 + admin/assets/css/nonpay_reasons.css | 27 + admin/assets/css/patient_queue.css | 27 + admin/assets/css/payment.css | 27 + admin/assets/css/payment_amount.css | 27 + admin/assets/css/payment_amounts.css | 27 + admin/assets/css/payment_type.css | 27 + admin/assets/css/payment_types.css | 27 + admin/assets/css/payments.css | 27 + admin/assets/css/planning_type.css | 27 + admin/assets/css/planning_types.css | 27 + .../css/prostate_and_testicular_cancer.css | 27 + .../css/prostate_and_testicular_cancers.css | 27 + admin/assets/css/referral.css | 27 + admin/assets/css/referrals.css | 27 + admin/assets/css/site.css | 27 + admin/assets/css/sites.css | 27 + admin/assets/css/strength.css | 27 + admin/assets/css/strengths.css | 27 + admin/assets/css/test.css | 27 + admin/assets/css/testing_reason.css | 27 + admin/assets/css/testing_reasons.css | 27 + admin/assets/css/tests.css | 27 + admin/assets/css/tuberculoses.css | 27 + admin/assets/css/tuberculosis.css | 27 + admin/assets/css/unit.css | 27 + admin/assets/css/units.css | 27 + admin/assets/css/vmmc.css | 27 + admin/assets/css/vmmcs.css | 27 + .../images/icons/antenatal_care_add.png | Bin 0 -> 19476 bytes admin/assets/images/icons/antenatal_cares.png | Bin 0 -> 16919 bytes .../assets/images/icons/breast_cancer_add.png | Bin 0 -> 13993 bytes admin/assets/images/icons/breast_cancers.png | Bin 0 -> 13216 bytes .../images/icons/cervical_cancer_add.png | Bin 0 -> 12687 bytes .../assets/images/icons/cervical_cancers.png | Bin 0 -> 12002 bytes .../images/icons/family_planning_add.png | Bin 0 -> 33783 bytes .../assets/images/icons/family_plannings.png | Bin 0 -> 32277 bytes .../icons/general_medical_check_up_add.png | Bin 0 -> 18575 bytes .../icons/general_medical_check_ups.png | Bin 0 -> 18406 bytes .../images/icons/health_education_add.png | Bin 0 -> 31653 bytes .../assets/images/icons/health_educations.png | Bin 0 -> 32210 bytes .../icons/hiv_counseling_and_testing_add.png | Bin 0 -> 18517 bytes .../icons/hiv_counselings_and_testings.png | Bin 0 -> 16678 bytes .../assets/images/icons/immunisation_add.png | Bin 0 -> 16668 bytes admin/assets/images/icons/immunisations.png | Bin 0 -> 14028 bytes admin/assets/images/icons/index.html | 1 + admin/assets/images/icons/payment_add.png | Bin 0 -> 22492 bytes admin/assets/images/icons/payments.png | Bin 0 -> 21674 bytes .../prostate_and_testicular_cancer_add.png | Bin 0 -> 17627 bytes .../icons/prostate_and_testicular_cancers.png | Bin 0 -> 16940 bytes admin/assets/images/icons/test_add.png | Bin 0 -> 16010 bytes admin/assets/images/icons/tests.png | Bin 0 -> 13515 bytes admin/assets/images/icons/tuberculoses.png | Bin 0 -> 13917 bytes .../assets/images/icons/tuberculosis_add.png | Bin 0 -> 16460 bytes admin/assets/images/icons/vmmc_add.png | Bin 0 -> 18566 bytes admin/assets/images/icons/vmmcs.png | Bin 0 -> 17134 bytes admin/assets/images/import.gif | Bin 0 -> 65516 bytes admin/assets/images/index.html | 1 + admin/assets/images/vdm-component.jpg | Bin 0 -> 43165 bytes admin/assets/index.html | 1 + admin/assets/js/admin.js | 25 + admin/assets/js/index.html | 1 + admin/config.xml | 87 + admin/controller.php | 158 + admin/controllers/administration_part.php | 330 + admin/controllers/administration_parts.php | 122 + admin/controllers/ajax.json.php | 111 + admin/controllers/antenatal_care.php | 330 + admin/controllers/antenatal_cares.php | 122 + admin/controllers/breast_cancer.php | 330 + admin/controllers/breast_cancers.php | 122 + admin/controllers/cervical_cancer.php | 330 + admin/controllers/cervical_cancers.php | 122 + admin/controllers/clinic.php | 330 + admin/controllers/clinics.php | 122 + admin/controllers/counseling_type.php | 330 + admin/controllers/counseling_types.php | 122 + admin/controllers/diagnosis_type.php | 330 + admin/controllers/diagnosis_types.php | 122 + admin/controllers/ehealth_portal.php | 35 + admin/controllers/family_planning.php | 330 + admin/controllers/family_plannings.php | 122 + admin/controllers/foetal_engagement.php | 330 + admin/controllers/foetal_engagements.php | 122 + admin/controllers/foetal_lie.php | 330 + admin/controllers/foetal_lies.php | 122 + admin/controllers/foetal_presentation.php | 330 + admin/controllers/foetal_presentations.php | 122 + .../controllers/general_medical_check_up.php | 330 + .../controllers/general_medical_check_ups.php | 122 + admin/controllers/health_education.php | 330 + admin/controllers/health_education_topic.php | 330 + admin/controllers/health_education_topics.php | 122 + admin/controllers/health_educations.php | 122 + .../hiv_counseling_and_testing.php | 330 + .../hiv_counselings_and_testings.php | 122 + admin/controllers/immunisation.php | 330 + admin/controllers/immunisation_type.php | 330 + admin/controllers/immunisation_types.php | 122 + .../controllers/immunisation_vaccine_type.php | 330 + .../immunisation_vaccine_types.php | 122 + admin/controllers/immunisations.php | 122 + admin/controllers/import.php | 69 + admin/controllers/index.html | 1 + admin/controllers/medication.php | 330 + admin/controllers/medications.php | 122 + admin/controllers/nonpay_reason.php | 330 + admin/controllers/nonpay_reasons.php | 122 + admin/controllers/patient_queue.php | 46 + admin/controllers/payment.php | 330 + admin/controllers/payment_amount.php | 330 + admin/controllers/payment_amounts.php | 122 + admin/controllers/payment_type.php | 330 + admin/controllers/payment_types.php | 122 + admin/controllers/payments.php | 122 + admin/controllers/planning_type.php | 330 + admin/controllers/planning_types.php | 122 + .../prostate_and_testicular_cancer.php | 330 + .../prostate_and_testicular_cancers.php | 122 + admin/controllers/referral.php | 330 + admin/controllers/referrals.php | 122 + admin/controllers/site.php | 330 + admin/controllers/sites.php | 122 + admin/controllers/strength.php | 330 + admin/controllers/strengths.php | 122 + admin/controllers/test.php | 330 + admin/controllers/testing_reason.php | 330 + admin/controllers/testing_reasons.php | 122 + admin/controllers/tests.php | 122 + admin/controllers/tuberculoses.php | 122 + admin/controllers/tuberculosis.php | 330 + admin/controllers/unit.php | 330 + admin/controllers/units.php | 122 + admin/controllers/vmmc.php | 330 + admin/controllers/vmmcs.php | 122 + admin/ehealth_portal.php | 53 + admin/helpers/ehealth_portal.php | 1664 ++++ admin/helpers/headercheck.php | 85 + admin/helpers/html/batch_.php | 92 + admin/helpers/html/index.html | 1 + admin/helpers/index.html | 1 + admin/index.html | 1 + .../en-GB/en-GB.com_ehealth_portal.ini | 2850 ++++++ .../en-GB/en-GB.com_ehealth_portal.sys.ini | 549 ++ admin/language/en-GB/index.html | 1 + admin/language/index.html | 1 + .../administration_part/details_above.php | 59 + .../administration_part/details_fullwidth.php | 58 + admin/layouts/administration_part/index.html | 1 + .../administration_part/publishing.php | 60 + .../administration_part/publlshing.php | 61 + .../vaccines_fullwidth.php | 150 + .../abdominal_examination_left.php | 59 + admin/layouts/antenatal_care/index.html | 1 + .../pregnancy_history_above.php | 58 + .../pregnancy_history_fullwidth.php | 58 + .../antenatal_care/pregnancy_history_left.php | 59 + .../pregnancy_history_right.php | 58 + admin/layouts/antenatal_care/publishing.php | 60 + admin/layouts/antenatal_care/publlshing.php | 61 + admin/layouts/batchselection.php | 62 + .../breast_cancer/breast_examination_left.php | 61 + .../breast_examination_right.php | 61 + admin/layouts/breast_cancer/index.html | 1 + admin/layouts/breast_cancer/publishing.php | 60 + admin/layouts/breast_cancer/publlshing.php | 61 + .../layouts/breast_cancer/referrals_left.php | 56 + .../layouts/breast_cancer/referrals_right.php | 56 + .../breast_cancer/risk_assesment_above.php | 58 + .../breast_cancer/risk_assesment_left.php | 64 + .../cervical_examination_left.php | 58 + admin/layouts/cervical_cancer/index.html | 1 + admin/layouts/cervical_cancer/publishing.php | 60 + admin/layouts/cervical_cancer/publlshing.php | 61 + .../cervical_cancer/referrals_left.php | 56 + .../cervical_cancer/referrals_right.php | 56 + .../cervical_cancer/risk_assesment_above.php | 58 + .../cervical_cancer/risk_assesment_left.php | 61 + .../cervical_cancer/risk_assesment_right.php | 61 + admin/layouts/clinic/details_above.php | 60 + admin/layouts/clinic/details_fullwidth.php | 58 + admin/layouts/clinic/index.html | 1 + admin/layouts/clinic/publishing.php | 60 + admin/layouts/clinic/publlshing.php | 61 + .../layouts/counseling_type/details_above.php | 59 + .../counseling_type/details_fullwidth.php | 58 + admin/layouts/counseling_type/index.html | 1 + admin/layouts/counseling_type/publishing.php | 60 + admin/layouts/counseling_type/publlshing.php | 61 + .../layouts/diagnosis_type/details_above.php | 59 + .../diagnosis_type/details_fullwidth.php | 58 + admin/layouts/diagnosis_type/index.html | 1 + admin/layouts/diagnosis_type/publishing.php | 60 + admin/layouts/diagnosis_type/publlshing.php | 61 + .../layouts/family_planning/details_above.php | 58 + .../layouts/family_planning/details_left.php | 56 + admin/layouts/family_planning/index.html | 1 + admin/layouts/family_planning/publishing.php | 60 + admin/layouts/family_planning/publlshing.php | 61 + .../foetal_engagement/details_above.php | 59 + .../foetal_engagement/details_fullwidth.php | 58 + admin/layouts/foetal_engagement/index.html | 1 + .../layouts/foetal_engagement/publishing.php | 60 + .../layouts/foetal_engagement/publlshing.php | 61 + admin/layouts/foetal_lie/details_above.php | 59 + .../layouts/foetal_lie/details_fullwidth.php | 58 + admin/layouts/foetal_lie/index.html | 1 + admin/layouts/foetal_lie/publishing.php | 60 + admin/layouts/foetal_lie/publlshing.php | 61 + .../foetal_presentation/details_above.php | 59 + .../foetal_presentation/details_fullwidth.php | 58 + admin/layouts/foetal_presentation/index.html | 1 + .../foetal_presentation/publishing.php | 60 + .../foetal_presentation/publlshing.php | 61 + .../diagnosis_fullwidth.php | 58 + .../dispensing_fullwidth.php | 58 + .../general_medical_check_up/index.html | 1 + .../general_medical_check_up/publishing.php | 60 + .../general_medical_check_up/publlshing.php | 61 + .../referrals_left.php | 56 + .../referrals_right.php | 56 + .../vital_signs_above.php | 58 + .../vital_signs_fullwidth.php | 60 + .../vital_signs_left.php | 61 + .../vital_signs_right.php | 60 + .../health_education/details_above.php | 59 + .../layouts/health_education/details_left.php | 56 + admin/layouts/health_education/index.html | 1 + admin/layouts/health_education/publishing.php | 60 + admin/layouts/health_education/publlshing.php | 61 + .../health_education_topic/details_above.php | 59 + .../details_fullwidth.php | 58 + .../layouts/health_education_topic/index.html | 1 + .../health_education_topic/publishing.php | 60 + .../health_education_topic/publlshing.php | 61 + .../details_above.php | 58 + .../details_left.php | 63 + .../hiv_counseling_and_testing/index.html | 1 + .../hiv_counseling_and_testing/publishing.php | 60 + .../hiv_counseling_and_testing/publlshing.php | 61 + .../referrals_left.php | 56 + .../referrals_right.php | 56 + admin/layouts/immunisation/details_above.php | 58 + .../immunisation/details_fullwidth.php | 58 + admin/layouts/immunisation/details_left.php | 56 + admin/layouts/immunisation/details_under.php | 59 + admin/layouts/immunisation/index.html | 1 + admin/layouts/immunisation/publishing.php | 60 + admin/layouts/immunisation/publlshing.php | 61 + admin/layouts/immunisation/referrals_left.php | 56 + .../layouts/immunisation/referrals_right.php | 56 + .../immunisation_type/details_above.php | 59 + .../immunisation_type/details_fullwidth.php | 58 + admin/layouts/immunisation_type/index.html | 1 + .../layouts/immunisation_type/publishing.php | 60 + .../layouts/immunisation_type/publlshing.php | 61 + .../details_above.php | 59 + .../details_fullwidth.php | 58 + .../details_left.php | 56 + .../immunisation_vaccine_type/index.html | 1 + .../immunisation_vaccine_type/publishing.php | 60 + .../immunisation_vaccine_type/publlshing.php | 61 + admin/layouts/index.html | 1 + admin/layouts/medication/details_above.php | 59 + .../layouts/medication/details_fullwidth.php | 58 + admin/layouts/medication/index.html | 1 + admin/layouts/medication/publishing.php | 60 + admin/layouts/medication/publlshing.php | 61 + admin/layouts/nonpay_reason/details_above.php | 59 + .../nonpay_reason/details_fullwidth.php | 58 + admin/layouts/nonpay_reason/index.html | 1 + admin/layouts/nonpay_reason/publishing.php | 60 + admin/layouts/nonpay_reason/publlshing.php | 61 + admin/layouts/payment/details_above.php | 59 + admin/layouts/payment/details_left.php | 59 + admin/layouts/payment/index.html | 1 + admin/layouts/payment/publishing.php | 60 + admin/layouts/payment/publlshing.php | 61 + .../layouts/payment_amount/details_above.php | 59 + .../payment_amount/details_fullwidth.php | 58 + admin/layouts/payment_amount/index.html | 1 + admin/layouts/payment_amount/publishing.php | 60 + admin/layouts/payment_amount/publlshing.php | 61 + admin/layouts/payment_type/details_above.php | 59 + .../payment_type/details_fullwidth.php | 58 + admin/layouts/payment_type/index.html | 1 + admin/layouts/payment_type/publishing.php | 60 + admin/layouts/payment_type/publlshing.php | 61 + admin/layouts/planning_type/details_above.php | 59 + .../planning_type/details_fullwidth.php | 58 + admin/layouts/planning_type/index.html | 1 + admin/layouts/planning_type/publishing.php | 60 + admin/layouts/planning_type/publlshing.php | 61 + .../details_above.php | 58 + .../details_left.php | 63 + .../details_right.php | 61 + .../prostate_and_testicular_cancer/index.html | 1 + .../publishing.php | 60 + .../publlshing.php | 61 + .../referrals_left.php | 56 + .../referrals_right.php | 56 + admin/layouts/referral/details_above.php | 59 + admin/layouts/referral/details_fullwidth.php | 58 + admin/layouts/referral/index.html | 1 + admin/layouts/referral/publishing.php | 60 + admin/layouts/referral/publlshing.php | 61 + admin/layouts/site/details_above.php | 59 + admin/layouts/site/details_fullwidth.php | 58 + admin/layouts/site/details_left.php | 56 + admin/layouts/site/index.html | 1 + admin/layouts/site/publishing.php | 60 + admin/layouts/site/publlshing.php | 61 + admin/layouts/strength/details_above.php | 59 + admin/layouts/strength/details_fullwidth.php | 58 + admin/layouts/strength/index.html | 1 + admin/layouts/strength/publishing.php | 60 + admin/layouts/strength/publlshing.php | 61 + admin/layouts/test/cholesterol_left.php | 56 + admin/layouts/test/glucose_left.php | 57 + admin/layouts/test/haemoglobin_left.php | 56 + admin/layouts/test/hepatitis_b_left.php | 57 + admin/layouts/test/index.html | 1 + admin/layouts/test/malaria_left.php | 57 + admin/layouts/test/pregnancy_left.php | 57 + admin/layouts/test/publishing.php | 60 + admin/layouts/test/publlshing.php | 61 + admin/layouts/test/referrals_left.php | 56 + admin/layouts/test/referrals_right.php | 56 + admin/layouts/test/syphillis_left.php | 57 + admin/layouts/test/urine_above.php | 58 + admin/layouts/test/urine_left.php | 56 + .../layouts/testing_reason/details_above.php | 59 + .../testing_reason/details_fullwidth.php | 58 + admin/layouts/testing_reason/index.html | 1 + admin/layouts/testing_reason/publishing.php | 60 + admin/layouts/testing_reason/publlshing.php | 61 + admin/layouts/tuberculosis/index.html | 1 + admin/layouts/tuberculosis/publishing.php | 60 + admin/layouts/tuberculosis/publlshing.php | 61 + admin/layouts/tuberculosis/referrals_left.php | 56 + .../layouts/tuberculosis/referrals_right.php | 56 + .../layouts/tuberculosis/screening_above.php | 58 + admin/layouts/tuberculosis/screening_left.php | 63 + .../layouts/tuberculosis/screening_right.php | 60 + .../tuberculosis/sputum_collection_left.php | 61 + admin/layouts/unit/details_above.php | 59 + admin/layouts/unit/details_fullwidth.php | 58 + admin/layouts/unit/index.html | 1 + admin/layouts/unit/publishing.php | 60 + admin/layouts/unit/publlshing.php | 61 + admin/layouts/vmmc/details_above.php | 59 + admin/layouts/vmmc/details_left.php | 59 + admin/layouts/vmmc/index.html | 1 + admin/layouts/vmmc/publishing.php | 60 + admin/layouts/vmmc/publlshing.php | 61 + admin/layouts/vmmc/referrals_left.php | 56 + admin/layouts/vmmc/referrals_right.php | 56 + admin/models/administration_part.php | 1074 +++ admin/models/administration_parts.php | 414 + admin/models/ajax.php | 66 + admin/models/antenatal_care.php | 880 ++ admin/models/antenatal_cares.php | 460 + admin/models/breast_cancer.php | 895 ++ admin/models/breast_cancers.php | 657 ++ admin/models/cervical_cancer.php | 889 ++ admin/models/cervical_cancers.php | 566 ++ admin/models/clinic.php | 998 +++ admin/models/clinics.php | 414 + admin/models/counseling_type.php | 997 +++ admin/models/counseling_types.php | 414 + admin/models/diagnosis_type.php | 997 +++ admin/models/diagnosis_types.php | 414 + admin/models/ehealth_portal.php | 345 + admin/models/family_planning.php | 878 ++ admin/models/family_plannings.php | 435 + admin/models/fields/administrationparts.php | 188 + .../fields/antenatalcaresfilterpatient.php | 81 + .../fields/breastcancersfilterpatient.php | 81 + .../fields/cervicalcancersfilterpatient.php | 81 + admin/models/fields/diagnosis.php | 188 + admin/models/fields/familyplanning.php | 188 + .../fields/familyplanningsfilterpatient.php | 81 + admin/models/fields/foetalengagement.php | 188 + admin/models/fields/foetallie.php | 188 + admin/models/fields/foetalpresentation.php | 188 + .../generalmedicalcheckupsfilterpatient.php | 81 + .../healtheducationsfiltereducationtype.php | 85 + .../fields/healtheducationsfilterpatient.php | 80 + admin/models/fields/healtheducationtopics.php | 188 + ...hivcounselingsandtestingsfilterpatient.php | 81 + .../fields/immunisationsfilterpatient.php | 81 + admin/models/fields/immunisationtype.php | 84 + .../fields/immunisationvaccinetypes.php | 188 + admin/models/fields/index.html | 1 + admin/models/fields/medication.php | 84 + admin/models/fields/nonpayreason.php | 188 + admin/models/fields/paymentsfilterpatient.php | 81 + .../fields/paymentsfilterpaymentamount.php | 84 + .../fields/paymentsfilterpaymentcategory.php | 85 + admin/models/fields/paymenttype.php | 188 + ...stateandtesticularcancersfilterpatient.php | 81 + admin/models/fields/referrals.php | 192 + admin/models/fields/stengths.php | 84 + admin/models/fields/testingreason.php | 188 + admin/models/fields/testsfilterpatient.php | 81 + .../fields/tuberculosesfilterpatient.php | 81 + admin/models/fields/units.php | 84 + admin/models/fields/vmmcsfilterpatient.php | 81 + admin/models/foetal_engagement.php | 997 +++ admin/models/foetal_engagements.php | 414 + admin/models/foetal_lie.php | 997 +++ admin/models/foetal_lies.php | 414 + admin/models/foetal_presentation.php | 997 +++ admin/models/foetal_presentations.php | 414 + admin/models/forms/administration_part.xml | 156 + admin/models/forms/antenatal_care.xml | 250 + admin/models/forms/breast_cancer.xml | 453 + admin/models/forms/cervical_cancer.xml | 366 + admin/models/forms/clinic.xml | 173 + admin/models/forms/counseling_type.xml | 156 + admin/models/forms/diagnosis_type.xml | 156 + admin/models/forms/family_planning.xml | 136 + .../forms/filter_administration_parts.xml | 69 + admin/models/forms/filter_antenatal_cares.xml | 81 + admin/models/forms/filter_breast_cancers.xml | 74 + .../models/forms/filter_cervical_cancers.xml | 74 + admin/models/forms/filter_clinics.xml | 69 + .../models/forms/filter_counseling_types.xml | 69 + admin/models/forms/filter_diagnosis_types.xml | 69 + .../models/forms/filter_family_plannings.xml | 76 + .../forms/filter_foetal_engagements.xml | 69 + admin/models/forms/filter_foetal_lies.xml | 69 + .../forms/filter_foetal_presentations.xml | 69 + .../filter_general_medical_check_ups.xml | 94 + .../forms/filter_health_education_topics.xml | 69 + .../models/forms/filter_health_educations.xml | 84 + .../filter_hiv_counselings_and_testings.xml | 74 + .../forms/filter_immunisation_types.xml | 69 + .../filter_immunisation_vaccine_types.xml | 78 + admin/models/forms/filter_immunisations.xml | 74 + admin/models/forms/filter_medications.xml | 69 + admin/models/forms/filter_nonpay_reasons.xml | 69 + admin/models/forms/filter_payment_amounts.xml | 69 + admin/models/forms/filter_payment_types.xml | 69 + admin/models/forms/filter_payments.xml | 87 + admin/models/forms/filter_planning_types.xml | 69 + ...filter_prostate_and_testicular_cancers.xml | 74 + admin/models/forms/filter_referrals.xml | 69 + admin/models/forms/filter_sites.xml | 71 + admin/models/forms/filter_strengths.xml | 69 + admin/models/forms/filter_testing_reasons.xml | 69 + admin/models/forms/filter_tests.xml | 74 + admin/models/forms/filter_tuberculoses.xml | 74 + admin/models/forms/filter_units.xml | 69 + admin/models/forms/filter_vmmcs.xml | 82 + admin/models/forms/foetal_engagement.xml | 156 + admin/models/forms/foetal_lie.xml | 156 + admin/models/forms/foetal_presentation.xml | 156 + .../models/forms/general_medical_check_up.xml | 388 + admin/models/forms/health_education.xml | 152 + admin/models/forms/health_education_topic.xml | 156 + .../forms/hiv_counseling_and_testing.xml | 285 + admin/models/forms/immunisation.xml | 231 + admin/models/forms/immunisation_type.xml | 156 + .../forms/immunisation_vaccine_type.xml | 167 + admin/models/forms/index.html | 1 + admin/models/forms/medication.xml | 156 + admin/models/forms/nonpay_reason.xml | 156 + admin/models/forms/payment.xml | 200 + admin/models/forms/payment_amount.xml | 156 + admin/models/forms/payment_type.xml | 156 + admin/models/forms/planning_type.xml | 156 + .../forms/prostate_and_testicular_cancer.xml | 343 + admin/models/forms/referral.xml | 156 + admin/models/forms/site.xml | 172 + admin/models/forms/strength.xml | 156 + admin/models/forms/test.xml | 369 + admin/models/forms/testing_reason.xml | 156 + admin/models/forms/tuberculosis.xml | 469 + admin/models/forms/unit.xml | 156 + admin/models/forms/vmmc.xml | 227 + admin/models/general_medical_check_up.php | 940 ++ admin/models/general_medical_check_ups.php | 520 ++ admin/models/health_education.php | 879 ++ admin/models/health_education_topic.php | 997 +++ admin/models/health_education_topics.php | 414 + admin/models/health_educations.php | 529 ++ admin/models/hiv_counseling_and_testing.php | 876 ++ admin/models/hiv_counselings_and_testings.php | 563 ++ admin/models/immunisation.php | 914 ++ admin/models/immunisation_type.php | 997 +++ admin/models/immunisation_types.php | 414 + admin/models/immunisation_vaccine_type.php | 1000 +++ admin/models/immunisation_vaccine_types.php | 444 + admin/models/immunisations.php | 468 + admin/models/import.php | 755 ++ admin/models/index.html | 1 + admin/models/medication.php | 997 +++ admin/models/medications.php | 414 + admin/models/nonpay_reason.php | 997 +++ admin/models/nonpay_reasons.php | 414 + admin/models/patient_queue.php | 166 + admin/models/payment.php | 882 ++ admin/models/payment_amount.php | 997 +++ admin/models/payment_amounts.php | 414 + admin/models/payment_type.php | 997 +++ admin/models/payment_types.php | 414 + admin/models/payments.php | 567 ++ admin/models/planning_type.php | 997 +++ admin/models/planning_types.php | 414 + .../models/prostate_and_testicular_cancer.php | 884 ++ .../prostate_and_testicular_cancers.php | 550 ++ admin/models/referral.php | 997 +++ admin/models/referrals.php | 414 + admin/models/rules/index.html | 1 + admin/models/site.php | 1017 +++ admin/models/sites.php | 423 + admin/models/strength.php | 997 +++ admin/models/strengths.php | 414 + admin/models/test.php | 909 ++ admin/models/testing_reason.php | 997 +++ admin/models/testing_reasons.php | 414 + admin/models/tests.php | 588 ++ admin/models/tuberculoses.php | 681 ++ admin/models/tuberculosis.php | 910 ++ admin/models/unit.php | 997 +++ admin/models/units.php | 414 + admin/models/vmmc.php | 909 ++ admin/models/vmmcs.php | 565 ++ admin/sql/index.html | 1 + admin/sql/install.mysql.utf8.sql | 1029 +++ admin/sql/uninstall.mysql.utf8.sql | 34 + admin/sql/updates/index.html | 1 + admin/sql/updates/mysql/1.0.2.sql | 1 + admin/sql/updates/mysql/1.0.3.sql | 34 + admin/sql/updates/mysql/1.0.4.sql | 3 + admin/sql/updates/mysql/index.html | 1 + admin/tables/administration_part.php | 350 + admin/tables/antenatal_care.php | 337 + admin/tables/breast_cancer.php | 337 + admin/tables/cervical_cancer.php | 337 + admin/tables/clinic.php | 350 + admin/tables/counseling_type.php | 350 + admin/tables/diagnosis_type.php | 350 + admin/tables/family_planning.php | 337 + admin/tables/foetal_engagement.php | 350 + admin/tables/foetal_lie.php | 350 + admin/tables/foetal_presentation.php | 350 + admin/tables/general_medical_check_up.php | 337 + admin/tables/health_education.php | 337 + admin/tables/health_education_topic.php | 350 + admin/tables/hiv_counseling_and_testing.php | 337 + admin/tables/immunisation.php | 337 + admin/tables/immunisation_type.php | 350 + admin/tables/immunisation_vaccine_type.php | 350 + admin/tables/index.html | 1 + admin/tables/medication.php | 350 + admin/tables/nonpay_reason.php | 350 + admin/tables/payment.php | 337 + admin/tables/payment_amount.php | 350 + admin/tables/payment_type.php | 350 + admin/tables/planning_type.php | 350 + .../tables/prostate_and_testicular_cancer.php | 337 + admin/tables/referral.php | 350 + admin/tables/site.php | 350 + admin/tables/strength.php | 350 + admin/tables/test.php | 337 + admin/tables/testing_reason.php | 350 + admin/tables/tuberculosis.php | 337 + admin/tables/unit.php | 350 + admin/tables/vmmc.php | 337 + .../views/administration_part/submitbutton.js | 39 + admin/views/administration_part/tmpl/edit.php | 132 + .../views/administration_part/tmpl/index.html | 1 + admin/views/administration_part/view.html.php | 236 + admin/views/administration_parts/index.html | 1 + .../administration_parts/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../tmpl/default_body.php | 108 + .../tmpl/default_foot.php | 32 + .../tmpl/default_head.php | 64 + .../tmpl/default_toolbar.php | 59 + .../administration_parts/tmpl/index.html | 1 + .../views/administration_parts/view.html.php | 244 + admin/views/antenatal_care/submitbutton.js | 39 + admin/views/antenatal_care/tmpl/edit.php | 134 + admin/views/antenatal_care/tmpl/index.html | 1 + admin/views/antenatal_care/view.html.php | 209 + admin/views/antenatal_cares/index.html | 1 + admin/views/antenatal_cares/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../antenatal_cares/tmpl/default_body.php | 117 + .../antenatal_cares/tmpl/default_foot.php | 32 + .../antenatal_cares/tmpl/default_head.php | 76 + .../antenatal_cares/tmpl/default_toolbar.php | 59 + admin/views/antenatal_cares/tmpl/index.html | 1 + admin/views/antenatal_cares/view.html.php | 283 + admin/views/breast_cancer/submitbutton.js | 39 + admin/views/breast_cancer/tmpl/edit.php | 140 + admin/views/breast_cancer/tmpl/index.html | 1 + admin/views/breast_cancer/view.html.php | 209 + admin/views/breast_cancers/index.html | 1 + admin/views/breast_cancers/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../breast_cancers/tmpl/default_body.php | 153 + .../breast_cancers/tmpl/default_foot.php | 32 + .../breast_cancers/tmpl/default_head.php | 112 + .../breast_cancers/tmpl/default_toolbar.php | 59 + admin/views/breast_cancers/tmpl/index.html | 1 + admin/views/breast_cancers/view.html.php | 263 + admin/views/cervical_cancer/submitbutton.js | 39 + admin/views/cervical_cancer/tmpl/edit.php | 140 + admin/views/cervical_cancer/tmpl/index.html | 1 + admin/views/cervical_cancer/view.html.php | 209 + admin/views/cervical_cancers/index.html | 1 + admin/views/cervical_cancers/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../cervical_cancers/tmpl/default_body.php | 132 + .../cervical_cancers/tmpl/default_foot.php | 32 + .../cervical_cancers/tmpl/default_head.php | 91 + .../cervical_cancers/tmpl/default_toolbar.php | 59 + admin/views/cervical_cancers/tmpl/index.html | 1 + admin/views/cervical_cancers/view.html.php | 263 + admin/views/clinic/submitbutton.js | 39 + admin/views/clinic/tmpl/edit.php | 120 + admin/views/clinic/tmpl/index.html | 1 + admin/views/clinic/view.html.php | 209 + admin/views/clinics/index.html | 1 + admin/views/clinics/tmpl/default.php | 80 + .../views/clinics/tmpl/default_batch_body.php | 32 + .../clinics/tmpl/default_batch_footer.php | 37 + admin/views/clinics/tmpl/default_body.php | 108 + admin/views/clinics/tmpl/default_foot.php | 32 + admin/views/clinics/tmpl/default_head.php | 64 + admin/views/clinics/tmpl/default_toolbar.php | 59 + admin/views/clinics/tmpl/index.html | 1 + admin/views/clinics/view.html.php | 244 + admin/views/counseling_type/submitbutton.js | 39 + admin/views/counseling_type/tmpl/edit.php | 120 + admin/views/counseling_type/tmpl/index.html | 1 + admin/views/counseling_type/view.html.php | 209 + admin/views/counseling_types/index.html | 1 + admin/views/counseling_types/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../counseling_types/tmpl/default_body.php | 108 + .../counseling_types/tmpl/default_foot.php | 32 + .../counseling_types/tmpl/default_head.php | 64 + .../counseling_types/tmpl/default_toolbar.php | 59 + admin/views/counseling_types/tmpl/index.html | 1 + admin/views/counseling_types/view.html.php | 244 + admin/views/diagnosis_type/submitbutton.js | 39 + admin/views/diagnosis_type/tmpl/edit.php | 120 + admin/views/diagnosis_type/tmpl/index.html | 1 + admin/views/diagnosis_type/view.html.php | 209 + admin/views/diagnosis_types/index.html | 1 + admin/views/diagnosis_types/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../diagnosis_types/tmpl/default_body.php | 108 + .../diagnosis_types/tmpl/default_foot.php | 32 + .../diagnosis_types/tmpl/default_head.php | 64 + .../diagnosis_types/tmpl/default_toolbar.php | 59 + admin/views/diagnosis_types/tmpl/index.html | 1 + admin/views/diagnosis_types/view.html.php | 244 + admin/views/ehealth_portal/index.html | 1 + admin/views/ehealth_portal/tmpl/default.php | 47 + .../ehealth_portal/tmpl/default_main.php | 44 + .../views/ehealth_portal/tmpl/default_vdm.php | 52 + admin/views/ehealth_portal/tmpl/index.html | 1 + admin/views/ehealth_portal/view.html.php | 102 + admin/views/family_planning/submitbutton.js | 39 + admin/views/family_planning/tmpl/edit.php | 118 + admin/views/family_planning/tmpl/index.html | 1 + admin/views/family_planning/view.html.php | 209 + admin/views/family_plannings/index.html | 1 + admin/views/family_plannings/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../family_plannings/tmpl/default_body.php | 111 + .../family_plannings/tmpl/default_foot.php | 32 + .../family_plannings/tmpl/default_head.php | 64 + .../family_plannings/tmpl/default_toolbar.php | 59 + admin/views/family_plannings/tmpl/index.html | 1 + admin/views/family_plannings/view.html.php | 264 + admin/views/foetal_engagement/submitbutton.js | 39 + admin/views/foetal_engagement/tmpl/edit.php | 120 + admin/views/foetal_engagement/tmpl/index.html | 1 + admin/views/foetal_engagement/view.html.php | 209 + admin/views/foetal_engagements/index.html | 1 + .../views/foetal_engagements/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../foetal_engagements/tmpl/default_body.php | 108 + .../foetal_engagements/tmpl/default_foot.php | 32 + .../foetal_engagements/tmpl/default_head.php | 64 + .../tmpl/default_toolbar.php | 59 + .../views/foetal_engagements/tmpl/index.html | 1 + admin/views/foetal_engagements/view.html.php | 244 + admin/views/foetal_lie/submitbutton.js | 39 + admin/views/foetal_lie/tmpl/edit.php | 120 + admin/views/foetal_lie/tmpl/index.html | 1 + admin/views/foetal_lie/view.html.php | 209 + admin/views/foetal_lies/index.html | 1 + admin/views/foetal_lies/tmpl/default.php | 80 + .../foetal_lies/tmpl/default_batch_body.php | 32 + .../foetal_lies/tmpl/default_batch_footer.php | 37 + admin/views/foetal_lies/tmpl/default_body.php | 108 + admin/views/foetal_lies/tmpl/default_foot.php | 32 + admin/views/foetal_lies/tmpl/default_head.php | 64 + .../foetal_lies/tmpl/default_toolbar.php | 59 + admin/views/foetal_lies/tmpl/index.html | 1 + admin/views/foetal_lies/view.html.php | 244 + .../views/foetal_presentation/submitbutton.js | 39 + admin/views/foetal_presentation/tmpl/edit.php | 120 + .../views/foetal_presentation/tmpl/index.html | 1 + admin/views/foetal_presentation/view.html.php | 209 + admin/views/foetal_presentations/index.html | 1 + .../foetal_presentations/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../tmpl/default_body.php | 108 + .../tmpl/default_foot.php | 32 + .../tmpl/default_head.php | 64 + .../tmpl/default_toolbar.php | 59 + .../foetal_presentations/tmpl/index.html | 1 + .../views/foetal_presentations/view.html.php | 244 + .../general_medical_check_up/submitbutton.js | 39 + .../general_medical_check_up/tmpl/edit.php | 181 + .../general_medical_check_up/tmpl/index.html | 1 + .../general_medical_check_up/view.html.php | 209 + .../general_medical_check_ups/index.html | 1 + .../tmpl/default.php | 96 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../tmpl/default_body.php | 153 + .../tmpl/default_foot.php | 32 + .../tmpl/default_head.php | 112 + .../tmpl/default_toolbar.php | 59 + .../general_medical_check_ups/tmpl/index.html | 1 + .../general_medical_check_ups/view.html.php | 273 + admin/views/health_education/submitbutton.js | 39 + admin/views/health_education/tmpl/edit.php | 118 + admin/views/health_education/tmpl/index.html | 1 + admin/views/health_education/view.html.php | 209 + .../health_education_topic/submitbutton.js | 39 + .../health_education_topic/tmpl/edit.php | 120 + .../health_education_topic/tmpl/index.html | 1 + .../health_education_topic/view.html.php | 209 + .../views/health_education_topics/index.html | 1 + .../health_education_topics/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../tmpl/default_body.php | 108 + .../tmpl/default_foot.php | 32 + .../tmpl/default_head.php | 64 + .../tmpl/default_toolbar.php | 59 + .../health_education_topics/tmpl/index.html | 1 + .../health_education_topics/view.html.php | 244 + admin/views/health_educations/index.html | 1 + .../views/health_educations/tmpl/default.php | 81 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../health_educations/tmpl/default_body.php | 108 + .../health_educations/tmpl/default_foot.php | 32 + .../health_educations/tmpl/default_head.php | 67 + .../tmpl/default_toolbar.php | 59 + admin/views/health_educations/tmpl/index.html | 1 + admin/views/health_educations/view.html.php | 284 + .../submitbutton.js | 39 + .../hiv_counseling_and_testing/tmpl/edit.php | 129 + .../tmpl/index.html | 1 + .../hiv_counseling_and_testing/view.html.php | 209 + .../hiv_counselings_and_testings/index.html | 1 + .../tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../tmpl/default_body.php | 132 + .../tmpl/default_foot.php | 32 + .../tmpl/default_head.php | 91 + .../tmpl/default_toolbar.php | 59 + .../tmpl/index.html | 1 + .../view.html.php | 263 + admin/views/immunisation/submitbutton.js | 39 + admin/views/immunisation/tmpl/edit.php | 160 + admin/views/immunisation/tmpl/index.html | 1 + admin/views/immunisation/view.html.php | 211 + admin/views/immunisation_type/submitbutton.js | 39 + admin/views/immunisation_type/tmpl/edit.php | 120 + admin/views/immunisation_type/tmpl/index.html | 1 + admin/views/immunisation_type/view.html.php | 209 + admin/views/immunisation_types/index.html | 1 + .../views/immunisation_types/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../immunisation_types/tmpl/default_body.php | 108 + .../immunisation_types/tmpl/default_foot.php | 32 + .../immunisation_types/tmpl/default_head.php | 64 + .../tmpl/default_toolbar.php | 59 + .../views/immunisation_types/tmpl/index.html | 1 + admin/views/immunisation_types/view.html.php | 244 + .../immunisation_vaccine_type/submitbutton.js | 39 + .../immunisation_vaccine_type/tmpl/edit.php | 123 + .../immunisation_vaccine_type/tmpl/index.html | 1 + .../immunisation_vaccine_type/view.html.php | 209 + .../immunisation_vaccine_types/index.html | 1 + .../tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../tmpl/default_body.php | 111 + .../tmpl/default_foot.php | 32 + .../tmpl/default_head.php | 67 + .../tmpl/default_toolbar.php | 59 + .../tmpl/index.html | 1 + .../immunisation_vaccine_types/view.html.php | 265 + admin/views/immunisations/index.html | 1 + admin/views/immunisations/tmpl/default.php | 80 + .../immunisations/tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../views/immunisations/tmpl/default_body.php | 117 + .../views/immunisations/tmpl/default_foot.php | 32 + .../views/immunisations/tmpl/default_head.php | 76 + .../immunisations/tmpl/default_toolbar.php | 59 + admin/views/immunisations/tmpl/index.html | 1 + admin/views/immunisations/view.html.php | 263 + admin/views/import/index.html | 1 + admin/views/import/tmpl/default.php | 231 + admin/views/import/tmpl/index.html | 1 + admin/views/import/view.html.php | 107 + admin/views/index.html | 1 + admin/views/medication/submitbutton.js | 39 + admin/views/medication/tmpl/edit.php | 120 + admin/views/medication/tmpl/index.html | 1 + admin/views/medication/view.html.php | 209 + admin/views/medications/index.html | 1 + admin/views/medications/tmpl/default.php | 80 + .../medications/tmpl/default_batch_body.php | 32 + .../medications/tmpl/default_batch_footer.php | 37 + admin/views/medications/tmpl/default_body.php | 108 + admin/views/medications/tmpl/default_foot.php | 32 + admin/views/medications/tmpl/default_head.php | 64 + .../medications/tmpl/default_toolbar.php | 59 + admin/views/medications/tmpl/index.html | 1 + admin/views/medications/view.html.php | 244 + admin/views/nonpay_reason/submitbutton.js | 39 + admin/views/nonpay_reason/tmpl/edit.php | 120 + admin/views/nonpay_reason/tmpl/index.html | 1 + admin/views/nonpay_reason/view.html.php | 209 + admin/views/nonpay_reasons/index.html | 1 + admin/views/nonpay_reasons/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../nonpay_reasons/tmpl/default_body.php | 108 + .../nonpay_reasons/tmpl/default_foot.php | 32 + .../nonpay_reasons/tmpl/default_head.php | 64 + .../nonpay_reasons/tmpl/default_toolbar.php | 59 + admin/views/nonpay_reasons/tmpl/index.html | 1 + admin/views/nonpay_reasons/view.html.php | 244 + admin/views/patient_queue/index.html | 1 + admin/views/patient_queue/tmpl/default.php | 149 + admin/views/patient_queue/tmpl/index.html | 1 + admin/views/patient_queue/view.html.php | 132 + admin/views/payment/submitbutton.js | 39 + admin/views/payment/tmpl/edit.php | 152 + admin/views/payment/tmpl/index.html | 1 + admin/views/payment/view.html.php | 209 + admin/views/payment_amount/submitbutton.js | 39 + admin/views/payment_amount/tmpl/edit.php | 120 + admin/views/payment_amount/tmpl/index.html | 1 + admin/views/payment_amount/view.html.php | 209 + admin/views/payment_amounts/index.html | 1 + admin/views/payment_amounts/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../payment_amounts/tmpl/default_body.php | 108 + .../payment_amounts/tmpl/default_foot.php | 32 + .../payment_amounts/tmpl/default_head.php | 64 + .../payment_amounts/tmpl/default_toolbar.php | 59 + admin/views/payment_amounts/tmpl/index.html | 1 + admin/views/payment_amounts/view.html.php | 244 + admin/views/payment_type/submitbutton.js | 39 + admin/views/payment_type/tmpl/edit.php | 120 + admin/views/payment_type/tmpl/index.html | 1 + admin/views/payment_type/view.html.php | 209 + admin/views/payment_types/index.html | 1 + admin/views/payment_types/tmpl/default.php | 80 + .../payment_types/tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../views/payment_types/tmpl/default_body.php | 108 + .../views/payment_types/tmpl/default_foot.php | 32 + .../views/payment_types/tmpl/default_head.php | 64 + .../payment_types/tmpl/default_toolbar.php | 59 + admin/views/payment_types/tmpl/index.html | 1 + admin/views/payment_types/view.html.php | 244 + admin/views/payments/index.html | 1 + admin/views/payments/tmpl/default.php | 81 + .../payments/tmpl/default_batch_body.php | 32 + .../payments/tmpl/default_batch_footer.php | 37 + admin/views/payments/tmpl/default_body.php | 117 + admin/views/payments/tmpl/default_foot.php | 32 + admin/views/payments/tmpl/default_head.php | 76 + admin/views/payments/tmpl/default_toolbar.php | 59 + admin/views/payments/tmpl/index.html | 1 + admin/views/payments/view.html.php | 302 + admin/views/planning_type/submitbutton.js | 39 + admin/views/planning_type/tmpl/edit.php | 120 + admin/views/planning_type/tmpl/index.html | 1 + admin/views/planning_type/view.html.php | 209 + admin/views/planning_types/index.html | 1 + admin/views/planning_types/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../planning_types/tmpl/default_body.php | 108 + .../planning_types/tmpl/default_foot.php | 32 + .../planning_types/tmpl/default_head.php | 64 + .../planning_types/tmpl/default_toolbar.php | 59 + admin/views/planning_types/tmpl/index.html | 1 + admin/views/planning_types/view.html.php | 244 + .../submitbutton.js | 39 + .../tmpl/edit.php | 132 + .../tmpl/index.html | 1 + .../view.html.php | 209 + .../index.html | 1 + .../tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../tmpl/default_body.php | 150 + .../tmpl/default_foot.php | 32 + .../tmpl/default_head.php | 88 + .../tmpl/default_toolbar.php | 59 + .../tmpl/index.html | 1 + .../view.html.php | 263 + admin/views/referral/submitbutton.js | 39 + admin/views/referral/tmpl/edit.php | 120 + admin/views/referral/tmpl/index.html | 1 + admin/views/referral/view.html.php | 209 + admin/views/referrals/index.html | 1 + admin/views/referrals/tmpl/default.php | 80 + .../referrals/tmpl/default_batch_body.php | 32 + .../referrals/tmpl/default_batch_footer.php | 37 + admin/views/referrals/tmpl/default_body.php | 108 + admin/views/referrals/tmpl/default_foot.php | 32 + admin/views/referrals/tmpl/default_head.php | 64 + .../views/referrals/tmpl/default_toolbar.php | 59 + admin/views/referrals/tmpl/index.html | 1 + admin/views/referrals/view.html.php | 244 + admin/views/site/submitbutton.js | 39 + admin/views/site/tmpl/edit.php | 123 + admin/views/site/tmpl/index.html | 1 + admin/views/site/view.html.php | 209 + admin/views/sites/index.html | 1 + admin/views/sites/tmpl/default.php | 80 + admin/views/sites/tmpl/default_batch_body.php | 32 + .../views/sites/tmpl/default_batch_footer.php | 37 + admin/views/sites/tmpl/default_body.php | 111 + admin/views/sites/tmpl/default_foot.php | 32 + admin/views/sites/tmpl/default_head.php | 67 + admin/views/sites/tmpl/default_toolbar.php | 59 + admin/views/sites/tmpl/index.html | 1 + admin/views/sites/view.html.php | 245 + admin/views/strength/submitbutton.js | 39 + admin/views/strength/tmpl/edit.php | 120 + admin/views/strength/tmpl/index.html | 1 + admin/views/strength/view.html.php | 209 + admin/views/strengths/index.html | 1 + admin/views/strengths/tmpl/default.php | 80 + .../strengths/tmpl/default_batch_body.php | 32 + .../strengths/tmpl/default_batch_footer.php | 37 + admin/views/strengths/tmpl/default_body.php | 108 + admin/views/strengths/tmpl/default_foot.php | 32 + admin/views/strengths/tmpl/default_head.php | 64 + .../views/strengths/tmpl/default_toolbar.php | 59 + admin/views/strengths/tmpl/index.html | 1 + admin/views/strengths/view.html.php | 244 + admin/views/test/submitbutton.js | 39 + admin/views/test/tmpl/edit.php | 185 + admin/views/test/tmpl/index.html | 1 + admin/views/test/view.html.php | 209 + admin/views/testing_reason/submitbutton.js | 39 + admin/views/testing_reason/tmpl/edit.php | 120 + admin/views/testing_reason/tmpl/index.html | 1 + admin/views/testing_reason/view.html.php | 209 + admin/views/testing_reasons/index.html | 1 + admin/views/testing_reasons/tmpl/default.php | 80 + .../tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../testing_reasons/tmpl/default_body.php | 108 + .../testing_reasons/tmpl/default_foot.php | 32 + .../testing_reasons/tmpl/default_head.php | 64 + .../testing_reasons/tmpl/default_toolbar.php | 59 + admin/views/testing_reasons/tmpl/index.html | 1 + admin/views/testing_reasons/view.html.php | 244 + admin/views/tests/index.html | 1 + admin/views/tests/tmpl/default.php | 80 + admin/views/tests/tmpl/default_batch_body.php | 32 + .../views/tests/tmpl/default_batch_footer.php | 37 + admin/views/tests/tmpl/default_body.php | 147 + admin/views/tests/tmpl/default_foot.php | 32 + admin/views/tests/tmpl/default_head.php | 106 + admin/views/tests/tmpl/default_toolbar.php | 59 + admin/views/tests/tmpl/index.html | 1 + admin/views/tests/view.html.php | 263 + admin/views/tuberculoses/index.html | 1 + admin/views/tuberculoses/tmpl/default.php | 80 + .../tuberculoses/tmpl/default_batch_body.php | 32 + .../tmpl/default_batch_footer.php | 37 + .../views/tuberculoses/tmpl/default_body.php | 162 + .../views/tuberculoses/tmpl/default_foot.php | 32 + .../views/tuberculoses/tmpl/default_head.php | 121 + .../tuberculoses/tmpl/default_toolbar.php | 59 + admin/views/tuberculoses/tmpl/index.html | 1 + admin/views/tuberculoses/view.html.php | 263 + admin/views/tuberculosis/submitbutton.js | 39 + admin/views/tuberculosis/tmpl/edit.php | 140 + admin/views/tuberculosis/tmpl/index.html | 1 + admin/views/tuberculosis/view.html.php | 209 + admin/views/unit/submitbutton.js | 39 + admin/views/unit/tmpl/edit.php | 120 + admin/views/unit/tmpl/index.html | 1 + admin/views/unit/view.html.php | 209 + admin/views/units/index.html | 1 + admin/views/units/tmpl/default.php | 80 + admin/views/units/tmpl/default_batch_body.php | 32 + .../views/units/tmpl/default_batch_footer.php | 37 + admin/views/units/tmpl/default_body.php | 108 + admin/views/units/tmpl/default_foot.php | 32 + admin/views/units/tmpl/default_head.php | 64 + admin/views/units/tmpl/default_toolbar.php | 59 + admin/views/units/tmpl/index.html | 1 + admin/views/units/view.html.php | 244 + admin/views/vmmc/submitbutton.js | 39 + admin/views/vmmc/tmpl/edit.php | 163 + admin/views/vmmc/tmpl/index.html | 1 + admin/views/vmmc/view.html.php | 209 + admin/views/vmmcs/index.html | 1 + admin/views/vmmcs/tmpl/default.php | 81 + admin/views/vmmcs/tmpl/default_batch_body.php | 32 + .../views/vmmcs/tmpl/default_batch_footer.php | 37 + admin/views/vmmcs/tmpl/default_body.php | 120 + admin/views/vmmcs/tmpl/default_foot.php | 32 + admin/views/vmmcs/tmpl/default_head.php | 79 + admin/views/vmmcs/tmpl/default_toolbar.php | 59 + admin/views/vmmcs/tmpl/index.html | 1 + admin/views/vmmcs/view.html.php | 283 + ehealth_portal.xml | 95 + index.html | 1 + libraries/phpspreadsheet/vendor/.htaccess | 9 + libraries/phpspreadsheet/vendor/autoload.php | 7 + .../vendor/composer/ClassLoader.php | 445 + .../phpspreadsheet/vendor/composer/LICENSE | 56 + .../vendor/composer/autoload_classmap.php | 240 + .../vendor/composer/autoload_files.php | 67 + .../vendor/composer/autoload_namespaces.php | 9 + .../vendor/composer/autoload_psr4.php | 13 + .../vendor/composer/autoload_real.php | 70 + .../vendor/composer/autoload_static.php | 348 + .../vendor/composer/installed.json | 315 + libraries/phpspreadsheet/vendor/htaccess.txt | 9 + libraries/phpspreadsheet/vendor/index.html | 1 + .../markbaker/complex/classes/Autoloader.php | 53 + .../markbaker/complex/classes/Bootstrap.php | 38 + .../markbaker/complex/classes/src/Complex.php | 390 + .../complex/classes/src/Exception.php | 13 + .../complex/classes/src/functions/abs.php | 29 + .../complex/classes/src/functions/acos.php | 38 + .../complex/classes/src/functions/acosh.php | 34 + .../complex/classes/src/functions/acot.php | 25 + .../complex/classes/src/functions/acoth.php | 25 + .../complex/classes/src/functions/acsc.php | 29 + .../complex/classes/src/functions/acsch.php | 29 + .../classes/src/functions/argument.php | 28 + .../complex/classes/src/functions/asec.php | 29 + .../complex/classes/src/functions/asech.php | 29 + .../complex/classes/src/functions/asin.php | 37 + .../complex/classes/src/functions/asinh.php | 33 + .../complex/classes/src/functions/atan.php | 45 + .../complex/classes/src/functions/atanh.php | 38 + .../classes/src/functions/conjugate.php | 28 + .../complex/classes/src/functions/cos.php | 34 + .../complex/classes/src/functions/cosh.php | 32 + .../complex/classes/src/functions/cot.php | 29 + .../complex/classes/src/functions/coth.php | 24 + .../complex/classes/src/functions/csc.php | 29 + .../complex/classes/src/functions/csch.php | 29 + .../complex/classes/src/functions/exp.php | 34 + .../complex/classes/src/functions/inverse.php | 29 + .../complex/classes/src/functions/ln.php | 33 + .../complex/classes/src/functions/log10.php | 32 + .../complex/classes/src/functions/log2.php | 32 + .../classes/src/functions/negative.php | 31 + .../complex/classes/src/functions/pow.php | 40 + .../complex/classes/src/functions/rho.php | 28 + .../complex/classes/src/functions/sec.php | 25 + .../complex/classes/src/functions/sech.php | 25 + .../complex/classes/src/functions/sin.php | 32 + .../complex/classes/src/functions/sinh.php | 32 + .../complex/classes/src/functions/sqrt.php | 29 + .../complex/classes/src/functions/tan.php | 40 + .../complex/classes/src/functions/tanh.php | 35 + .../complex/classes/src/functions/theta.php | 38 + .../complex/classes/src/operations/add.php | 46 + .../classes/src/operations/divideby.php | 56 + .../classes/src/operations/divideinto.php | 56 + .../classes/src/operations/multiply.php | 48 + .../classes/src/operations/subtract.php | 46 + .../vendor/markbaker/matrix/buildPhar.php | 62 + .../markbaker/matrix/classes/Autoloader.php | 53 + .../markbaker/matrix/classes/Bootstrap.php | 38 + .../markbaker/matrix/classes/src/Builder.php | 70 + .../matrix/classes/src/Exception.php | 13 + .../matrix/classes/src/Functions.php | 337 + .../markbaker/matrix/classes/src/Matrix.php | 400 + .../matrix/classes/src/Operators/Addition.php | 68 + .../classes/src/Operators/DirectSum.php | 64 + .../matrix/classes/src/Operators/Division.php | 38 + .../classes/src/Operators/Multiplication.php | 77 + .../matrix/classes/src/Operators/Operator.php | 78 + .../classes/src/Operators/Subtraction.php | 68 + .../matrix/classes/src/functions/adjoint.php | 30 + .../classes/src/functions/antidiagonal.php | 29 + .../classes/src/functions/cofactors.php | 30 + .../classes/src/functions/determinant.php | 30 + .../matrix/classes/src/functions/diagonal.php | 30 + .../matrix/classes/src/functions/identity.php | 30 + .../matrix/classes/src/functions/inverse.php | 30 + .../matrix/classes/src/functions/minors.php | 30 + .../matrix/classes/src/functions/trace.php | 30 + .../classes/src/functions/transpose.php | 30 + .../matrix/classes/src/operations/add.php | 44 + .../classes/src/operations/directsum.php | 44 + .../classes/src/operations/divideby.php | 44 + .../classes/src/operations/divideinto.php | 44 + .../classes/src/operations/multiply.php | 44 + .../classes/src/operations/subtract.php | 44 + .../phpspreadsheet/bin/migrate-from-phpexcel | 8 + .../phpoffice/phpspreadsheet/bin/pre-commit | 33 + .../phpspreadsheet/src/Bootstrap.php | 22 + .../Calculation/Calculation.php | 4795 ++++++++++ .../PhpSpreadsheet/Calculation/Category.php | 19 + .../PhpSpreadsheet/Calculation/Database.php | 632 ++ .../PhpSpreadsheet/Calculation/DateTime.php | 1691 ++++ .../Engine/CyclicReferenceStack.php | 73 + .../Calculation/Engine/Logger.php | 128 + .../Calculation/Engineering.php | 2807 ++++++ .../PhpSpreadsheet/Calculation/Exception.php | 26 + .../Calculation/ExceptionHandler.php | 22 + .../PhpSpreadsheet/Calculation/Financial.php | 2439 +++++ .../Calculation/FormulaParser.php | 623 ++ .../Calculation/FormulaToken.php | 150 + .../PhpSpreadsheet/Calculation/Functions.php | 680 ++ .../PhpSpreadsheet/Calculation/Logical.php | 375 + .../PhpSpreadsheet/Calculation/LookupRef.php | 968 ++ .../PhpSpreadsheet/Calculation/MathTrig.php | 1752 ++++ .../Calculation/Statistical.php | 3773 ++++++++ .../PhpSpreadsheet/Calculation/TextData.php | 674 ++ .../Calculation/Token/Stack.php | 149 + .../Calculation/functionlist.txt | 390 + .../Calculation/locale/bg/config | 27 + .../Calculation/locale/bg/functions | 417 + .../Calculation/locale/cs/config | 23 + .../Calculation/locale/cs/functions | 416 + .../Calculation/locale/da/config | 25 + .../Calculation/locale/da/functions | 416 + .../Calculation/locale/de/config | 24 + .../Calculation/locale/de/functions | 416 + .../Calculation/locale/en/uk/config | 8 + .../Calculation/locale/es/config | 24 + .../Calculation/locale/es/functions | 416 + .../Calculation/locale/fi/config | 24 + .../Calculation/locale/fi/functions | 416 + .../Calculation/locale/fr/config | 24 + .../Calculation/locale/fr/functions | 416 + .../Calculation/locale/hu/config | 23 + .../Calculation/locale/hu/functions | 416 + .../Calculation/locale/it/config | 24 + .../Calculation/locale/it/functions | 416 + .../Calculation/locale/nl/config | 24 + .../Calculation/locale/nl/functions | 416 + .../Calculation/locale/no/config | 24 + .../Calculation/locale/no/functions | 416 + .../Calculation/locale/pl/config | 24 + .../Calculation/locale/pl/functions | 416 + .../Calculation/locale/pt/br/config | 24 + .../Calculation/locale/pt/br/functions | 408 + .../Calculation/locale/pt/config | 24 + .../Calculation/locale/pt/functions | 408 + .../Calculation/locale/ru/config | 24 + .../Calculation/locale/ru/functions | 416 + .../Calculation/locale/sv/config | 24 + .../Calculation/locale/sv/functions | 408 + .../Calculation/locale/tr/config | 24 + .../Calculation/locale/tr/functions | 416 + .../Cell/AdvancedValueBinder.php | 176 + .../src/PhpSpreadsheet/Cell/Cell.php | 701 ++ .../src/PhpSpreadsheet/Cell/Coordinate.php | 520 ++ .../src/PhpSpreadsheet/Cell/DataType.php | 85 + .../PhpSpreadsheet/Cell/DataValidation.php | 481 + .../src/PhpSpreadsheet/Cell/DataValidator.php | 77 + .../Cell/DefaultValueBinder.php | 82 + .../src/PhpSpreadsheet/Cell/Hyperlink.php | 113 + .../src/PhpSpreadsheet/Cell/IValueBinder.php | 16 + .../PhpSpreadsheet/Cell/StringValueBinder.php | 31 + .../src/PhpSpreadsheet/Chart/Axis.php | 557 ++ .../src/PhpSpreadsheet/Chart/Chart.php | 680 ++ .../src/PhpSpreadsheet/Chart/DataSeries.php | 390 + .../PhpSpreadsheet/Chart/DataSeriesValues.php | 401 + .../src/PhpSpreadsheet/Chart/Exception.php | 9 + .../src/PhpSpreadsheet/Chart/GridLines.php | 455 + .../src/PhpSpreadsheet/Chart/Layout.php | 483 + .../src/PhpSpreadsheet/Chart/Legend.php | 158 + .../src/PhpSpreadsheet/Chart/PlotArea.php | 112 + .../src/PhpSpreadsheet/Chart/Properties.php | 369 + .../Chart/Renderer/IRenderer.php | 24 + .../PhpSpreadsheet/Chart/Renderer/JpGraph.php | 856 ++ .../Chart/Renderer/PHP Charting Libraries.txt | 20 + .../Chart/Renderer/Polyfill.php | 9 + .../src/PhpSpreadsheet/Chart/Title.php | 66 + .../src/PhpSpreadsheet/Collection/Cells.php | 506 ++ .../Collection/CellsFactory.php | 21 + .../src/PhpSpreadsheet/Collection/Memory.php | 79 + .../src/PhpSpreadsheet/Comment.php | 331 + .../PhpSpreadsheet/Document/Properties.php | 629 ++ .../src/PhpSpreadsheet/Document/Security.php | 205 + .../src/PhpSpreadsheet/Exception.php | 7 + .../src/PhpSpreadsheet/HashTable.php | 179 + .../src/PhpSpreadsheet/Helper/Html.php | 841 ++ .../src/PhpSpreadsheet/Helper/Migrator.php | 333 + .../src/PhpSpreadsheet/Helper/Sample.php | 230 + .../src/PhpSpreadsheet/IComparable.php | 13 + .../src/PhpSpreadsheet/IOFactory.php | 228 + .../src/PhpSpreadsheet/NamedRange.php | 240 + .../src/PhpSpreadsheet/Reader/BaseReader.php | 160 + .../src/PhpSpreadsheet/Reader/Csv.php | 563 ++ .../Reader/DefaultReadFilter.php | 20 + .../src/PhpSpreadsheet/Reader/Exception.php | 9 + .../src/PhpSpreadsheet/Reader/Gnumeric.php | 889 ++ .../src/PhpSpreadsheet/Reader/Html.php | 969 ++ .../src/PhpSpreadsheet/Reader/IReadFilter.php | 17 + .../src/PhpSpreadsheet/Reader/IReader.php | 137 + .../src/PhpSpreadsheet/Reader/Ods.php | 708 ++ .../PhpSpreadsheet/Reader/Ods/Properties.php | 135 + .../Reader/Security/XmlScanner.php | 154 + .../src/PhpSpreadsheet/Reader/Slk.php | 496 + .../src/PhpSpreadsheet/Reader/Xls.php | 7947 +++++++++++++++++ .../src/PhpSpreadsheet/Reader/Xls/Color.php | 36 + .../PhpSpreadsheet/Reader/Xls/Color/BIFF5.php | 81 + .../PhpSpreadsheet/Reader/Xls/Color/BIFF8.php | 81 + .../Reader/Xls/Color/BuiltIn.php | 35 + .../PhpSpreadsheet/Reader/Xls/ErrorCode.php | 32 + .../src/PhpSpreadsheet/Reader/Xls/Escher.php | 677 ++ .../src/PhpSpreadsheet/Reader/Xls/MD5.php | 184 + .../src/PhpSpreadsheet/Reader/Xls/RC4.php | 61 + .../Reader/Xls/Style/Border.php | 42 + .../Reader/Xls/Style/FillPattern.php | 47 + .../src/PhpSpreadsheet/Reader/Xlsx.php | 2040 +++++ .../PhpSpreadsheet/Reader/Xlsx/AutoFilter.php | 145 + .../Reader/Xlsx/BaseParserClass.php | 19 + .../src/PhpSpreadsheet/Reader/Xlsx/Chart.php | 570 ++ .../Reader/Xlsx/ColumnAndRowAttributes.php | 204 + .../Reader/Xlsx/ConditionalStyles.php | 94 + .../Reader/Xlsx/DataValidations.php | 50 + .../PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php | 58 + .../PhpSpreadsheet/Reader/Xlsx/PageSetup.php | 150 + .../PhpSpreadsheet/Reader/Xlsx/Properties.php | 91 + .../Reader/Xlsx/SheetViewOptions.php | 124 + .../PhpSpreadsheet/Reader/Xlsx/SheetViews.php | 137 + .../src/PhpSpreadsheet/Reader/Xlsx/Styles.php | 281 + .../src/PhpSpreadsheet/Reader/Xlsx/Theme.php | 93 + .../src/PhpSpreadsheet/Reader/Xml.php | 881 ++ .../PhpSpreadsheet/Reader/chunkReadFilter.php | 35 + .../src/PhpSpreadsheet/ReferenceHelper.php | 910 ++ .../PhpSpreadsheet/RichText/ITextElement.php | 36 + .../src/PhpSpreadsheet/RichText/RichText.php | 177 + .../src/PhpSpreadsheet/RichText/Run.php | 65 + .../PhpSpreadsheet/RichText/TextElement.php | 86 + .../src/PhpSpreadsheet/Settings.php | 167 + .../src/PhpSpreadsheet/Shared/CodePage.php | 138 + .../src/PhpSpreadsheet/Shared/Date.php | 493 + .../src/PhpSpreadsheet/Shared/Drawing.php | 249 + .../src/PhpSpreadsheet/Shared/Escher.php | 64 + .../Shared/Escher/DgContainer.php | 52 + .../Escher/DgContainer/SpgrContainer.php | 79 + .../DgContainer/SpgrContainer/SpContainer.php | 369 + .../Shared/Escher/DggContainer.php | 175 + .../Escher/DggContainer/BstoreContainer.php | 34 + .../DggContainer/BstoreContainer/BSE.php | 89 + .../DggContainer/BstoreContainer/BSE/Blip.php | 60 + .../src/PhpSpreadsheet/Shared/File.php | 144 + .../src/PhpSpreadsheet/Shared/Font.php | 762 ++ .../PhpSpreadsheet/Shared/JAMA/CHANGELOG.TXT | 16 + .../Shared/JAMA/CholeskyDecomposition.php | 147 + .../Shared/JAMA/EigenvalueDecomposition.php | 861 ++ .../Shared/JAMA/LUDecomposition.php | 285 + .../src/PhpSpreadsheet/Shared/JAMA/Matrix.php | 1233 +++ .../Shared/JAMA/QRDecomposition.php | 249 + .../JAMA/SingularValueDecomposition.php | 528 ++ .../Shared/JAMA/utils/Maths.php | 30 + .../src/PhpSpreadsheet/Shared/OLE.php | 573 ++ .../Shared/OLE/ChainedBlockStream.php | 196 + .../src/PhpSpreadsheet/Shared/OLE/PPS.php | 238 + .../PhpSpreadsheet/Shared/OLE/PPS/File.php | 66 + .../PhpSpreadsheet/Shared/OLE/PPS/Root.php | 466 + .../src/PhpSpreadsheet/Shared/OLERead.php | 352 + .../PhpSpreadsheet/Shared/PasswordHasher.php | 37 + .../PhpSpreadsheet/Shared/StringHelper.php | 722 ++ .../src/PhpSpreadsheet/Shared/TimeZone.php | 87 + .../PhpSpreadsheet/Shared/Trend/BestFit.php | 463 + .../Shared/Trend/ExponentialBestFit.php | 122 + .../Shared/Trend/LinearBestFit.php | 81 + .../Shared/Trend/LogarithmicBestFit.php | 90 + .../Shared/Trend/PolynomialBestFit.php | 200 + .../Shared/Trend/PowerBestFit.php | 114 + .../src/PhpSpreadsheet/Shared/Trend/Trend.php | 120 + .../src/PhpSpreadsheet/Shared/XMLWriter.php | 92 + .../src/PhpSpreadsheet/Shared/Xls.php | 281 + .../src/PhpSpreadsheet/Spreadsheet.php | 1490 +++ .../src/PhpSpreadsheet/Style/Alignment.php | 466 + .../src/PhpSpreadsheet/Style/Border.php | 239 + .../src/PhpSpreadsheet/Style/Borders.php | 423 + .../src/PhpSpreadsheet/Style/Color.php | 411 + .../src/PhpSpreadsheet/Style/Conditional.php | 273 + .../src/PhpSpreadsheet/Style/Fill.php | 326 + .../src/PhpSpreadsheet/Style/Font.php | 556 ++ .../src/PhpSpreadsheet/Style/NumberFormat.php | 820 ++ .../src/PhpSpreadsheet/Style/Protection.php | 190 + .../src/PhpSpreadsheet/Style/Style.php | 641 ++ .../src/PhpSpreadsheet/Style/Supervisor.php | 117 + .../PhpSpreadsheet/Worksheet/AutoFilter.php | 873 ++ .../Worksheet/AutoFilter/Column.php | 388 + .../Worksheet/AutoFilter/Column/Rule.php | 455 + .../PhpSpreadsheet/Worksheet/BaseDrawing.php | 537 ++ .../PhpSpreadsheet/Worksheet/CellIterator.php | 61 + .../src/PhpSpreadsheet/Worksheet/Column.php | 64 + .../Worksheet/ColumnCellIterator.php | 197 + .../Worksheet/ColumnDimension.php | 115 + .../Worksheet/ColumnIterator.php | 175 + .../PhpSpreadsheet/Worksheet/Dimension.php | 165 + .../src/PhpSpreadsheet/Worksheet/Drawing.php | 116 + .../Worksheet/Drawing/Shadow.php | 289 + .../PhpSpreadsheet/Worksheet/HeaderFooter.php | 491 + .../Worksheet/HeaderFooterDrawing.php | 24 + .../src/PhpSpreadsheet/Worksheet/Iterator.php | 87 + .../Worksheet/MemoryDrawing.php | 169 + .../PhpSpreadsheet/Worksheet/PageMargins.php | 214 + .../PhpSpreadsheet/Worksheet/PageSetup.php | 851 ++ .../PhpSpreadsheet/Worksheet/Protection.php | 586 ++ .../src/PhpSpreadsheet/Worksheet/Row.php | 74 + .../Worksheet/RowCellIterator.php | 205 + .../PhpSpreadsheet/Worksheet/RowDimension.php | 115 + .../PhpSpreadsheet/Worksheet/RowIterator.php | 170 + .../PhpSpreadsheet/Worksheet/SheetView.php | 199 + .../PhpSpreadsheet/Worksheet/Worksheet.php | 3079 +++++++ .../src/PhpSpreadsheet/Writer/BaseWriter.php | 86 + .../src/PhpSpreadsheet/Writer/Csv.php | 342 + .../src/PhpSpreadsheet/Writer/Exception.php | 9 + .../src/PhpSpreadsheet/Writer/Html.php | 1690 ++++ .../src/PhpSpreadsheet/Writer/IWriter.php | 93 + .../src/PhpSpreadsheet/Writer/Ods.php | 178 + .../Writer/Ods/Cell/Comment.php | 33 + .../src/PhpSpreadsheet/Writer/Ods/Content.php | 395 + .../src/PhpSpreadsheet/Writer/Ods/Meta.php | 77 + .../src/PhpSpreadsheet/Writer/Ods/MetaInf.php | 62 + .../PhpSpreadsheet/Writer/Ods/Mimetype.php | 20 + .../PhpSpreadsheet/Writer/Ods/Settings.php | 54 + .../src/PhpSpreadsheet/Writer/Ods/Styles.php | 70 + .../PhpSpreadsheet/Writer/Ods/Thumbnails.php | 20 + .../PhpSpreadsheet/Writer/Ods/WriterPart.php | 35 + .../src/PhpSpreadsheet/Writer/Pdf.php | 283 + .../src/PhpSpreadsheet/Writer/Pdf/Dompdf.php | 78 + .../src/PhpSpreadsheet/Writer/Pdf/Mpdf.php | 112 + .../src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php | 98 + .../src/PhpSpreadsheet/Writer/Xls.php | 946 ++ .../PhpSpreadsheet/Writer/Xls/BIFFwriter.php | 224 + .../src/PhpSpreadsheet/Writer/Xls/Escher.php | 510 ++ .../src/PhpSpreadsheet/Writer/Xls/Font.php | 149 + .../src/PhpSpreadsheet/Writer/Xls/Parser.php | 1438 +++ .../PhpSpreadsheet/Writer/Xls/Workbook.php | 1150 +++ .../PhpSpreadsheet/Writer/Xls/Worksheet.php | 4484 ++++++++++ .../src/PhpSpreadsheet/Writer/Xls/Xf.php | 548 ++ .../src/PhpSpreadsheet/Writer/Xlsx.php | 558 ++ .../src/PhpSpreadsheet/Writer/Xlsx/Chart.php | 1541 ++++ .../PhpSpreadsheet/Writer/Xlsx/Comments.php | 242 + .../Writer/Xlsx/ContentTypes.php | 249 + .../PhpSpreadsheet/Writer/Xlsx/DocProps.php | 251 + .../PhpSpreadsheet/Writer/Xlsx/Drawing.php | 519 ++ .../src/PhpSpreadsheet/Writer/Xlsx/Rels.php | 466 + .../PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php | 49 + .../PhpSpreadsheet/Writer/Xlsx/RelsVBA.php | 44 + .../Writer/Xlsx/StringTable.php | 281 + .../src/PhpSpreadsheet/Writer/Xlsx/Style.php | 686 ++ .../src/PhpSpreadsheet/Writer/Xlsx/Theme.php | 846 ++ .../PhpSpreadsheet/Writer/Xlsx/Workbook.php | 426 + .../PhpSpreadsheet/Writer/Xlsx/Worksheet.php | 1241 +++ .../PhpSpreadsheet/Writer/Xlsx/WriterPart.php | 35 + .../vendor/psr/simple-cache/.editorconfig | 12 + .../vendor/psr/simple-cache/LICENSE.md | 21 + .../vendor/psr/simple-cache/README.md | 8 + .../vendor/psr/simple-cache/composer.json | 25 + .../psr/simple-cache/src/CacheException.php | 10 + .../psr/simple-cache/src/CacheInterface.php | 114 + .../src/InvalidArgumentException.php | 13 + libraries/phpspreadsheet/vendor/web.config | 8 + media/css/index.html | 1 + media/images/index.html | 1 + media/index.html | 1 + media/js/administration_part.js | 25 + media/js/antenatal_care.js | 25 + media/js/breast_cancer.js | 25 + media/js/cervical_cancer.js | 25 + media/js/clinic.js | 25 + media/js/counseling_type.js | 25 + media/js/diagnosis_type.js | 25 + media/js/family_planning.js | 25 + media/js/foetal_engagement.js | 25 + media/js/foetal_lie.js | 25 + media/js/foetal_presentation.js | 25 + media/js/general_medical_check_up.js | 25 + media/js/health_education.js | 25 + media/js/health_education_topic.js | 25 + media/js/hiv_counseling_and_testing.js | 25 + media/js/immunisation.js | 97 + media/js/immunisation_type.js | 25 + media/js/immunisation_vaccine_type.js | 25 + media/js/index.html | 1 + media/js/medication.js | 25 + media/js/nonpay_reason.js | 25 + media/js/payment.js | 118 + media/js/payment_amount.js | 25 + media/js/payment_type.js | 25 + media/js/planning_type.js | 25 + media/js/prostate_and_testicular_cancer.js | 25 + media/js/referral.js | 25 + media/js/site.js | 25 + media/js/strength.js | 25 + media/js/test.js | 25 + media/js/testing_reason.js | 25 + media/js/tuberculosis.js | 25 + media/js/unit.js | 25 + media/js/vmmc.js | 221 + script.php | 4565 ++++++++++ 1489 files changed, 263146 insertions(+) create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 admin/README.txt create mode 100644 admin/access.xml create mode 100644 admin/assets/css/admin.css create mode 100644 admin/assets/css/administration_part.css create mode 100644 admin/assets/css/administration_parts.css create mode 100644 admin/assets/css/antenatal_care.css create mode 100644 admin/assets/css/antenatal_cares.css create mode 100644 admin/assets/css/breast_cancer.css create mode 100644 admin/assets/css/breast_cancers.css create mode 100644 admin/assets/css/cervical_cancer.css create mode 100644 admin/assets/css/cervical_cancers.css create mode 100644 admin/assets/css/clinic.css create mode 100644 admin/assets/css/clinics.css create mode 100644 admin/assets/css/counseling_type.css create mode 100644 admin/assets/css/counseling_types.css create mode 100644 admin/assets/css/dashboard.css create mode 100644 admin/assets/css/diagnosis_type.css create mode 100644 admin/assets/css/diagnosis_types.css create mode 100644 admin/assets/css/family_planning.css create mode 100644 admin/assets/css/family_plannings.css create mode 100644 admin/assets/css/foetal_engagement.css create mode 100644 admin/assets/css/foetal_engagements.css create mode 100644 admin/assets/css/foetal_lie.css create mode 100644 admin/assets/css/foetal_lies.css create mode 100644 admin/assets/css/foetal_presentation.css create mode 100644 admin/assets/css/foetal_presentations.css create mode 100644 admin/assets/css/general_medical_check_up.css create mode 100644 admin/assets/css/general_medical_check_ups.css create mode 100644 admin/assets/css/health_education.css create mode 100644 admin/assets/css/health_education_topic.css create mode 100644 admin/assets/css/health_education_topics.css create mode 100644 admin/assets/css/health_educations.css create mode 100644 admin/assets/css/hiv_counseling_and_testing.css create mode 100644 admin/assets/css/hiv_counselings_and_testings.css create mode 100644 admin/assets/css/immunisation.css create mode 100644 admin/assets/css/immunisation_type.css create mode 100644 admin/assets/css/immunisation_types.css create mode 100644 admin/assets/css/immunisation_vaccine_type.css create mode 100644 admin/assets/css/immunisation_vaccine_types.css create mode 100644 admin/assets/css/immunisations.css create mode 100644 admin/assets/css/index.html create mode 100644 admin/assets/css/medication.css create mode 100644 admin/assets/css/medications.css create mode 100644 admin/assets/css/nonpay_reason.css create mode 100644 admin/assets/css/nonpay_reasons.css create mode 100644 admin/assets/css/patient_queue.css create mode 100644 admin/assets/css/payment.css create mode 100644 admin/assets/css/payment_amount.css create mode 100644 admin/assets/css/payment_amounts.css create mode 100644 admin/assets/css/payment_type.css create mode 100644 admin/assets/css/payment_types.css create mode 100644 admin/assets/css/payments.css create mode 100644 admin/assets/css/planning_type.css create mode 100644 admin/assets/css/planning_types.css create mode 100644 admin/assets/css/prostate_and_testicular_cancer.css create mode 100644 admin/assets/css/prostate_and_testicular_cancers.css create mode 100644 admin/assets/css/referral.css create mode 100644 admin/assets/css/referrals.css create mode 100644 admin/assets/css/site.css create mode 100644 admin/assets/css/sites.css create mode 100644 admin/assets/css/strength.css create mode 100644 admin/assets/css/strengths.css create mode 100644 admin/assets/css/test.css create mode 100644 admin/assets/css/testing_reason.css create mode 100644 admin/assets/css/testing_reasons.css create mode 100644 admin/assets/css/tests.css create mode 100644 admin/assets/css/tuberculoses.css create mode 100644 admin/assets/css/tuberculosis.css create mode 100644 admin/assets/css/unit.css create mode 100644 admin/assets/css/units.css create mode 100644 admin/assets/css/vmmc.css create mode 100644 admin/assets/css/vmmcs.css create mode 100644 admin/assets/images/icons/antenatal_care_add.png create mode 100644 admin/assets/images/icons/antenatal_cares.png create mode 100644 admin/assets/images/icons/breast_cancer_add.png create mode 100644 admin/assets/images/icons/breast_cancers.png create mode 100644 admin/assets/images/icons/cervical_cancer_add.png create mode 100644 admin/assets/images/icons/cervical_cancers.png create mode 100644 admin/assets/images/icons/family_planning_add.png create mode 100644 admin/assets/images/icons/family_plannings.png create mode 100644 admin/assets/images/icons/general_medical_check_up_add.png create mode 100644 admin/assets/images/icons/general_medical_check_ups.png create mode 100644 admin/assets/images/icons/health_education_add.png create mode 100644 admin/assets/images/icons/health_educations.png create mode 100644 admin/assets/images/icons/hiv_counseling_and_testing_add.png create mode 100644 admin/assets/images/icons/hiv_counselings_and_testings.png create mode 100644 admin/assets/images/icons/immunisation_add.png create mode 100644 admin/assets/images/icons/immunisations.png create mode 100644 admin/assets/images/icons/index.html create mode 100644 admin/assets/images/icons/payment_add.png create mode 100644 admin/assets/images/icons/payments.png create mode 100644 admin/assets/images/icons/prostate_and_testicular_cancer_add.png create mode 100644 admin/assets/images/icons/prostate_and_testicular_cancers.png create mode 100644 admin/assets/images/icons/test_add.png create mode 100644 admin/assets/images/icons/tests.png create mode 100644 admin/assets/images/icons/tuberculoses.png create mode 100644 admin/assets/images/icons/tuberculosis_add.png create mode 100644 admin/assets/images/icons/vmmc_add.png create mode 100644 admin/assets/images/icons/vmmcs.png create mode 100644 admin/assets/images/import.gif create mode 100644 admin/assets/images/index.html create mode 100644 admin/assets/images/vdm-component.jpg create mode 100644 admin/assets/index.html create mode 100644 admin/assets/js/admin.js create mode 100644 admin/assets/js/index.html create mode 100644 admin/config.xml create mode 100644 admin/controller.php create mode 100644 admin/controllers/administration_part.php create mode 100644 admin/controllers/administration_parts.php create mode 100644 admin/controllers/ajax.json.php create mode 100644 admin/controllers/antenatal_care.php create mode 100644 admin/controllers/antenatal_cares.php create mode 100644 admin/controllers/breast_cancer.php create mode 100644 admin/controllers/breast_cancers.php create mode 100644 admin/controllers/cervical_cancer.php create mode 100644 admin/controllers/cervical_cancers.php create mode 100644 admin/controllers/clinic.php create mode 100644 admin/controllers/clinics.php create mode 100644 admin/controllers/counseling_type.php create mode 100644 admin/controllers/counseling_types.php create mode 100644 admin/controllers/diagnosis_type.php create mode 100644 admin/controllers/diagnosis_types.php create mode 100644 admin/controllers/ehealth_portal.php create mode 100644 admin/controllers/family_planning.php create mode 100644 admin/controllers/family_plannings.php create mode 100644 admin/controllers/foetal_engagement.php create mode 100644 admin/controllers/foetal_engagements.php create mode 100644 admin/controllers/foetal_lie.php create mode 100644 admin/controllers/foetal_lies.php create mode 100644 admin/controllers/foetal_presentation.php create mode 100644 admin/controllers/foetal_presentations.php create mode 100644 admin/controllers/general_medical_check_up.php create mode 100644 admin/controllers/general_medical_check_ups.php create mode 100644 admin/controllers/health_education.php create mode 100644 admin/controllers/health_education_topic.php create mode 100644 admin/controllers/health_education_topics.php create mode 100644 admin/controllers/health_educations.php create mode 100644 admin/controllers/hiv_counseling_and_testing.php create mode 100644 admin/controllers/hiv_counselings_and_testings.php create mode 100644 admin/controllers/immunisation.php create mode 100644 admin/controllers/immunisation_type.php create mode 100644 admin/controllers/immunisation_types.php create mode 100644 admin/controllers/immunisation_vaccine_type.php create mode 100644 admin/controllers/immunisation_vaccine_types.php create mode 100644 admin/controllers/immunisations.php create mode 100644 admin/controllers/import.php create mode 100644 admin/controllers/index.html create mode 100644 admin/controllers/medication.php create mode 100644 admin/controllers/medications.php create mode 100644 admin/controllers/nonpay_reason.php create mode 100644 admin/controllers/nonpay_reasons.php create mode 100644 admin/controllers/patient_queue.php create mode 100644 admin/controllers/payment.php create mode 100644 admin/controllers/payment_amount.php create mode 100644 admin/controllers/payment_amounts.php create mode 100644 admin/controllers/payment_type.php create mode 100644 admin/controllers/payment_types.php create mode 100644 admin/controllers/payments.php create mode 100644 admin/controllers/planning_type.php create mode 100644 admin/controllers/planning_types.php create mode 100644 admin/controllers/prostate_and_testicular_cancer.php create mode 100644 admin/controllers/prostate_and_testicular_cancers.php create mode 100644 admin/controllers/referral.php create mode 100644 admin/controllers/referrals.php create mode 100644 admin/controllers/site.php create mode 100644 admin/controllers/sites.php create mode 100644 admin/controllers/strength.php create mode 100644 admin/controllers/strengths.php create mode 100644 admin/controllers/test.php create mode 100644 admin/controllers/testing_reason.php create mode 100644 admin/controllers/testing_reasons.php create mode 100644 admin/controllers/tests.php create mode 100644 admin/controllers/tuberculoses.php create mode 100644 admin/controllers/tuberculosis.php create mode 100644 admin/controllers/unit.php create mode 100644 admin/controllers/units.php create mode 100644 admin/controllers/vmmc.php create mode 100644 admin/controllers/vmmcs.php create mode 100644 admin/ehealth_portal.php create mode 100644 admin/helpers/ehealth_portal.php create mode 100644 admin/helpers/headercheck.php create mode 100644 admin/helpers/html/batch_.php create mode 100644 admin/helpers/html/index.html create mode 100644 admin/helpers/index.html create mode 100644 admin/index.html create mode 100644 admin/language/en-GB/en-GB.com_ehealth_portal.ini create mode 100644 admin/language/en-GB/en-GB.com_ehealth_portal.sys.ini create mode 100644 admin/language/en-GB/index.html create mode 100644 admin/language/index.html create mode 100644 admin/layouts/administration_part/details_above.php create mode 100644 admin/layouts/administration_part/details_fullwidth.php create mode 100644 admin/layouts/administration_part/index.html create mode 100644 admin/layouts/administration_part/publishing.php create mode 100644 admin/layouts/administration_part/publlshing.php create mode 100644 admin/layouts/administration_part/vaccines_fullwidth.php create mode 100644 admin/layouts/antenatal_care/abdominal_examination_left.php create mode 100644 admin/layouts/antenatal_care/index.html create mode 100644 admin/layouts/antenatal_care/pregnancy_history_above.php create mode 100644 admin/layouts/antenatal_care/pregnancy_history_fullwidth.php create mode 100644 admin/layouts/antenatal_care/pregnancy_history_left.php create mode 100644 admin/layouts/antenatal_care/pregnancy_history_right.php create mode 100644 admin/layouts/antenatal_care/publishing.php create mode 100644 admin/layouts/antenatal_care/publlshing.php create mode 100644 admin/layouts/batchselection.php create mode 100644 admin/layouts/breast_cancer/breast_examination_left.php create mode 100644 admin/layouts/breast_cancer/breast_examination_right.php create mode 100644 admin/layouts/breast_cancer/index.html create mode 100644 admin/layouts/breast_cancer/publishing.php create mode 100644 admin/layouts/breast_cancer/publlshing.php create mode 100644 admin/layouts/breast_cancer/referrals_left.php create mode 100644 admin/layouts/breast_cancer/referrals_right.php create mode 100644 admin/layouts/breast_cancer/risk_assesment_above.php create mode 100644 admin/layouts/breast_cancer/risk_assesment_left.php create mode 100644 admin/layouts/cervical_cancer/cervical_examination_left.php create mode 100644 admin/layouts/cervical_cancer/index.html create mode 100644 admin/layouts/cervical_cancer/publishing.php create mode 100644 admin/layouts/cervical_cancer/publlshing.php create mode 100644 admin/layouts/cervical_cancer/referrals_left.php create mode 100644 admin/layouts/cervical_cancer/referrals_right.php create mode 100644 admin/layouts/cervical_cancer/risk_assesment_above.php create mode 100644 admin/layouts/cervical_cancer/risk_assesment_left.php create mode 100644 admin/layouts/cervical_cancer/risk_assesment_right.php create mode 100644 admin/layouts/clinic/details_above.php create mode 100644 admin/layouts/clinic/details_fullwidth.php create mode 100644 admin/layouts/clinic/index.html create mode 100644 admin/layouts/clinic/publishing.php create mode 100644 admin/layouts/clinic/publlshing.php create mode 100644 admin/layouts/counseling_type/details_above.php create mode 100644 admin/layouts/counseling_type/details_fullwidth.php create mode 100644 admin/layouts/counseling_type/index.html create mode 100644 admin/layouts/counseling_type/publishing.php create mode 100644 admin/layouts/counseling_type/publlshing.php create mode 100644 admin/layouts/diagnosis_type/details_above.php create mode 100644 admin/layouts/diagnosis_type/details_fullwidth.php create mode 100644 admin/layouts/diagnosis_type/index.html create mode 100644 admin/layouts/diagnosis_type/publishing.php create mode 100644 admin/layouts/diagnosis_type/publlshing.php create mode 100644 admin/layouts/family_planning/details_above.php create mode 100644 admin/layouts/family_planning/details_left.php create mode 100644 admin/layouts/family_planning/index.html create mode 100644 admin/layouts/family_planning/publishing.php create mode 100644 admin/layouts/family_planning/publlshing.php create mode 100644 admin/layouts/foetal_engagement/details_above.php create mode 100644 admin/layouts/foetal_engagement/details_fullwidth.php create mode 100644 admin/layouts/foetal_engagement/index.html create mode 100644 admin/layouts/foetal_engagement/publishing.php create mode 100644 admin/layouts/foetal_engagement/publlshing.php create mode 100644 admin/layouts/foetal_lie/details_above.php create mode 100644 admin/layouts/foetal_lie/details_fullwidth.php create mode 100644 admin/layouts/foetal_lie/index.html create mode 100644 admin/layouts/foetal_lie/publishing.php create mode 100644 admin/layouts/foetal_lie/publlshing.php create mode 100644 admin/layouts/foetal_presentation/details_above.php create mode 100644 admin/layouts/foetal_presentation/details_fullwidth.php create mode 100644 admin/layouts/foetal_presentation/index.html create mode 100644 admin/layouts/foetal_presentation/publishing.php create mode 100644 admin/layouts/foetal_presentation/publlshing.php create mode 100644 admin/layouts/general_medical_check_up/diagnosis_fullwidth.php create mode 100644 admin/layouts/general_medical_check_up/dispensing_fullwidth.php create mode 100644 admin/layouts/general_medical_check_up/index.html create mode 100644 admin/layouts/general_medical_check_up/publishing.php create mode 100644 admin/layouts/general_medical_check_up/publlshing.php create mode 100644 admin/layouts/general_medical_check_up/referrals_left.php create mode 100644 admin/layouts/general_medical_check_up/referrals_right.php create mode 100644 admin/layouts/general_medical_check_up/vital_signs_above.php create mode 100644 admin/layouts/general_medical_check_up/vital_signs_fullwidth.php create mode 100644 admin/layouts/general_medical_check_up/vital_signs_left.php create mode 100644 admin/layouts/general_medical_check_up/vital_signs_right.php create mode 100644 admin/layouts/health_education/details_above.php create mode 100644 admin/layouts/health_education/details_left.php create mode 100644 admin/layouts/health_education/index.html create mode 100644 admin/layouts/health_education/publishing.php create mode 100644 admin/layouts/health_education/publlshing.php create mode 100644 admin/layouts/health_education_topic/details_above.php create mode 100644 admin/layouts/health_education_topic/details_fullwidth.php create mode 100644 admin/layouts/health_education_topic/index.html create mode 100644 admin/layouts/health_education_topic/publishing.php create mode 100644 admin/layouts/health_education_topic/publlshing.php create mode 100644 admin/layouts/hiv_counseling_and_testing/details_above.php create mode 100644 admin/layouts/hiv_counseling_and_testing/details_left.php create mode 100644 admin/layouts/hiv_counseling_and_testing/index.html create mode 100644 admin/layouts/hiv_counseling_and_testing/publishing.php create mode 100644 admin/layouts/hiv_counseling_and_testing/publlshing.php create mode 100644 admin/layouts/hiv_counseling_and_testing/referrals_left.php create mode 100644 admin/layouts/hiv_counseling_and_testing/referrals_right.php create mode 100644 admin/layouts/immunisation/details_above.php create mode 100644 admin/layouts/immunisation/details_fullwidth.php create mode 100644 admin/layouts/immunisation/details_left.php create mode 100644 admin/layouts/immunisation/details_under.php create mode 100644 admin/layouts/immunisation/index.html create mode 100644 admin/layouts/immunisation/publishing.php create mode 100644 admin/layouts/immunisation/publlshing.php create mode 100644 admin/layouts/immunisation/referrals_left.php create mode 100644 admin/layouts/immunisation/referrals_right.php create mode 100644 admin/layouts/immunisation_type/details_above.php create mode 100644 admin/layouts/immunisation_type/details_fullwidth.php create mode 100644 admin/layouts/immunisation_type/index.html create mode 100644 admin/layouts/immunisation_type/publishing.php create mode 100644 admin/layouts/immunisation_type/publlshing.php create mode 100644 admin/layouts/immunisation_vaccine_type/details_above.php create mode 100644 admin/layouts/immunisation_vaccine_type/details_fullwidth.php create mode 100644 admin/layouts/immunisation_vaccine_type/details_left.php create mode 100644 admin/layouts/immunisation_vaccine_type/index.html create mode 100644 admin/layouts/immunisation_vaccine_type/publishing.php create mode 100644 admin/layouts/immunisation_vaccine_type/publlshing.php create mode 100644 admin/layouts/index.html create mode 100644 admin/layouts/medication/details_above.php create mode 100644 admin/layouts/medication/details_fullwidth.php create mode 100644 admin/layouts/medication/index.html create mode 100644 admin/layouts/medication/publishing.php create mode 100644 admin/layouts/medication/publlshing.php create mode 100644 admin/layouts/nonpay_reason/details_above.php create mode 100644 admin/layouts/nonpay_reason/details_fullwidth.php create mode 100644 admin/layouts/nonpay_reason/index.html create mode 100644 admin/layouts/nonpay_reason/publishing.php create mode 100644 admin/layouts/nonpay_reason/publlshing.php create mode 100644 admin/layouts/payment/details_above.php create mode 100644 admin/layouts/payment/details_left.php create mode 100644 admin/layouts/payment/index.html create mode 100644 admin/layouts/payment/publishing.php create mode 100644 admin/layouts/payment/publlshing.php create mode 100644 admin/layouts/payment_amount/details_above.php create mode 100644 admin/layouts/payment_amount/details_fullwidth.php create mode 100644 admin/layouts/payment_amount/index.html create mode 100644 admin/layouts/payment_amount/publishing.php create mode 100644 admin/layouts/payment_amount/publlshing.php create mode 100644 admin/layouts/payment_type/details_above.php create mode 100644 admin/layouts/payment_type/details_fullwidth.php create mode 100644 admin/layouts/payment_type/index.html create mode 100644 admin/layouts/payment_type/publishing.php create mode 100644 admin/layouts/payment_type/publlshing.php create mode 100644 admin/layouts/planning_type/details_above.php create mode 100644 admin/layouts/planning_type/details_fullwidth.php create mode 100644 admin/layouts/planning_type/index.html create mode 100644 admin/layouts/planning_type/publishing.php create mode 100644 admin/layouts/planning_type/publlshing.php create mode 100644 admin/layouts/prostate_and_testicular_cancer/details_above.php create mode 100644 admin/layouts/prostate_and_testicular_cancer/details_left.php create mode 100644 admin/layouts/prostate_and_testicular_cancer/details_right.php create mode 100644 admin/layouts/prostate_and_testicular_cancer/index.html create mode 100644 admin/layouts/prostate_and_testicular_cancer/publishing.php create mode 100644 admin/layouts/prostate_and_testicular_cancer/publlshing.php create mode 100644 admin/layouts/prostate_and_testicular_cancer/referrals_left.php create mode 100644 admin/layouts/prostate_and_testicular_cancer/referrals_right.php create mode 100644 admin/layouts/referral/details_above.php create mode 100644 admin/layouts/referral/details_fullwidth.php create mode 100644 admin/layouts/referral/index.html create mode 100644 admin/layouts/referral/publishing.php create mode 100644 admin/layouts/referral/publlshing.php create mode 100644 admin/layouts/site/details_above.php create mode 100644 admin/layouts/site/details_fullwidth.php create mode 100644 admin/layouts/site/details_left.php create mode 100644 admin/layouts/site/index.html create mode 100644 admin/layouts/site/publishing.php create mode 100644 admin/layouts/site/publlshing.php create mode 100644 admin/layouts/strength/details_above.php create mode 100644 admin/layouts/strength/details_fullwidth.php create mode 100644 admin/layouts/strength/index.html create mode 100644 admin/layouts/strength/publishing.php create mode 100644 admin/layouts/strength/publlshing.php create mode 100644 admin/layouts/test/cholesterol_left.php create mode 100644 admin/layouts/test/glucose_left.php create mode 100644 admin/layouts/test/haemoglobin_left.php create mode 100644 admin/layouts/test/hepatitis_b_left.php create mode 100644 admin/layouts/test/index.html create mode 100644 admin/layouts/test/malaria_left.php create mode 100644 admin/layouts/test/pregnancy_left.php create mode 100644 admin/layouts/test/publishing.php create mode 100644 admin/layouts/test/publlshing.php create mode 100644 admin/layouts/test/referrals_left.php create mode 100644 admin/layouts/test/referrals_right.php create mode 100644 admin/layouts/test/syphillis_left.php create mode 100644 admin/layouts/test/urine_above.php create mode 100644 admin/layouts/test/urine_left.php create mode 100644 admin/layouts/testing_reason/details_above.php create mode 100644 admin/layouts/testing_reason/details_fullwidth.php create mode 100644 admin/layouts/testing_reason/index.html create mode 100644 admin/layouts/testing_reason/publishing.php create mode 100644 admin/layouts/testing_reason/publlshing.php create mode 100644 admin/layouts/tuberculosis/index.html create mode 100644 admin/layouts/tuberculosis/publishing.php create mode 100644 admin/layouts/tuberculosis/publlshing.php create mode 100644 admin/layouts/tuberculosis/referrals_left.php create mode 100644 admin/layouts/tuberculosis/referrals_right.php create mode 100644 admin/layouts/tuberculosis/screening_above.php create mode 100644 admin/layouts/tuberculosis/screening_left.php create mode 100644 admin/layouts/tuberculosis/screening_right.php create mode 100644 admin/layouts/tuberculosis/sputum_collection_left.php create mode 100644 admin/layouts/unit/details_above.php create mode 100644 admin/layouts/unit/details_fullwidth.php create mode 100644 admin/layouts/unit/index.html create mode 100644 admin/layouts/unit/publishing.php create mode 100644 admin/layouts/unit/publlshing.php create mode 100644 admin/layouts/vmmc/details_above.php create mode 100644 admin/layouts/vmmc/details_left.php create mode 100644 admin/layouts/vmmc/index.html create mode 100644 admin/layouts/vmmc/publishing.php create mode 100644 admin/layouts/vmmc/publlshing.php create mode 100644 admin/layouts/vmmc/referrals_left.php create mode 100644 admin/layouts/vmmc/referrals_right.php create mode 100644 admin/models/administration_part.php create mode 100644 admin/models/administration_parts.php create mode 100644 admin/models/ajax.php create mode 100644 admin/models/antenatal_care.php create mode 100644 admin/models/antenatal_cares.php create mode 100644 admin/models/breast_cancer.php create mode 100644 admin/models/breast_cancers.php create mode 100644 admin/models/cervical_cancer.php create mode 100644 admin/models/cervical_cancers.php create mode 100644 admin/models/clinic.php create mode 100644 admin/models/clinics.php create mode 100644 admin/models/counseling_type.php create mode 100644 admin/models/counseling_types.php create mode 100644 admin/models/diagnosis_type.php create mode 100644 admin/models/diagnosis_types.php create mode 100644 admin/models/ehealth_portal.php create mode 100644 admin/models/family_planning.php create mode 100644 admin/models/family_plannings.php create mode 100644 admin/models/fields/administrationparts.php create mode 100644 admin/models/fields/antenatalcaresfilterpatient.php create mode 100644 admin/models/fields/breastcancersfilterpatient.php create mode 100644 admin/models/fields/cervicalcancersfilterpatient.php create mode 100644 admin/models/fields/diagnosis.php create mode 100644 admin/models/fields/familyplanning.php create mode 100644 admin/models/fields/familyplanningsfilterpatient.php create mode 100644 admin/models/fields/foetalengagement.php create mode 100644 admin/models/fields/foetallie.php create mode 100644 admin/models/fields/foetalpresentation.php create mode 100644 admin/models/fields/generalmedicalcheckupsfilterpatient.php create mode 100644 admin/models/fields/healtheducationsfiltereducationtype.php create mode 100644 admin/models/fields/healtheducationsfilterpatient.php create mode 100644 admin/models/fields/healtheducationtopics.php create mode 100644 admin/models/fields/hivcounselingsandtestingsfilterpatient.php create mode 100644 admin/models/fields/immunisationsfilterpatient.php create mode 100644 admin/models/fields/immunisationtype.php create mode 100644 admin/models/fields/immunisationvaccinetypes.php create mode 100644 admin/models/fields/index.html create mode 100644 admin/models/fields/medication.php create mode 100644 admin/models/fields/nonpayreason.php create mode 100644 admin/models/fields/paymentsfilterpatient.php create mode 100644 admin/models/fields/paymentsfilterpaymentamount.php create mode 100644 admin/models/fields/paymentsfilterpaymentcategory.php create mode 100644 admin/models/fields/paymenttype.php create mode 100644 admin/models/fields/prostateandtesticularcancersfilterpatient.php create mode 100644 admin/models/fields/referrals.php create mode 100644 admin/models/fields/stengths.php create mode 100644 admin/models/fields/testingreason.php create mode 100644 admin/models/fields/testsfilterpatient.php create mode 100644 admin/models/fields/tuberculosesfilterpatient.php create mode 100644 admin/models/fields/units.php create mode 100644 admin/models/fields/vmmcsfilterpatient.php create mode 100644 admin/models/foetal_engagement.php create mode 100644 admin/models/foetal_engagements.php create mode 100644 admin/models/foetal_lie.php create mode 100644 admin/models/foetal_lies.php create mode 100644 admin/models/foetal_presentation.php create mode 100644 admin/models/foetal_presentations.php create mode 100644 admin/models/forms/administration_part.xml create mode 100644 admin/models/forms/antenatal_care.xml create mode 100644 admin/models/forms/breast_cancer.xml create mode 100644 admin/models/forms/cervical_cancer.xml create mode 100644 admin/models/forms/clinic.xml create mode 100644 admin/models/forms/counseling_type.xml create mode 100644 admin/models/forms/diagnosis_type.xml create mode 100644 admin/models/forms/family_planning.xml create mode 100644 admin/models/forms/filter_administration_parts.xml create mode 100644 admin/models/forms/filter_antenatal_cares.xml create mode 100644 admin/models/forms/filter_breast_cancers.xml create mode 100644 admin/models/forms/filter_cervical_cancers.xml create mode 100644 admin/models/forms/filter_clinics.xml create mode 100644 admin/models/forms/filter_counseling_types.xml create mode 100644 admin/models/forms/filter_diagnosis_types.xml create mode 100644 admin/models/forms/filter_family_plannings.xml create mode 100644 admin/models/forms/filter_foetal_engagements.xml create mode 100644 admin/models/forms/filter_foetal_lies.xml create mode 100644 admin/models/forms/filter_foetal_presentations.xml create mode 100644 admin/models/forms/filter_general_medical_check_ups.xml create mode 100644 admin/models/forms/filter_health_education_topics.xml create mode 100644 admin/models/forms/filter_health_educations.xml create mode 100644 admin/models/forms/filter_hiv_counselings_and_testings.xml create mode 100644 admin/models/forms/filter_immunisation_types.xml create mode 100644 admin/models/forms/filter_immunisation_vaccine_types.xml create mode 100644 admin/models/forms/filter_immunisations.xml create mode 100644 admin/models/forms/filter_medications.xml create mode 100644 admin/models/forms/filter_nonpay_reasons.xml create mode 100644 admin/models/forms/filter_payment_amounts.xml create mode 100644 admin/models/forms/filter_payment_types.xml create mode 100644 admin/models/forms/filter_payments.xml create mode 100644 admin/models/forms/filter_planning_types.xml create mode 100644 admin/models/forms/filter_prostate_and_testicular_cancers.xml create mode 100644 admin/models/forms/filter_referrals.xml create mode 100644 admin/models/forms/filter_sites.xml create mode 100644 admin/models/forms/filter_strengths.xml create mode 100644 admin/models/forms/filter_testing_reasons.xml create mode 100644 admin/models/forms/filter_tests.xml create mode 100644 admin/models/forms/filter_tuberculoses.xml create mode 100644 admin/models/forms/filter_units.xml create mode 100644 admin/models/forms/filter_vmmcs.xml create mode 100644 admin/models/forms/foetal_engagement.xml create mode 100644 admin/models/forms/foetal_lie.xml create mode 100644 admin/models/forms/foetal_presentation.xml create mode 100644 admin/models/forms/general_medical_check_up.xml create mode 100644 admin/models/forms/health_education.xml create mode 100644 admin/models/forms/health_education_topic.xml create mode 100644 admin/models/forms/hiv_counseling_and_testing.xml create mode 100644 admin/models/forms/immunisation.xml create mode 100644 admin/models/forms/immunisation_type.xml create mode 100644 admin/models/forms/immunisation_vaccine_type.xml create mode 100644 admin/models/forms/index.html create mode 100644 admin/models/forms/medication.xml create mode 100644 admin/models/forms/nonpay_reason.xml create mode 100644 admin/models/forms/payment.xml create mode 100644 admin/models/forms/payment_amount.xml create mode 100644 admin/models/forms/payment_type.xml create mode 100644 admin/models/forms/planning_type.xml create mode 100644 admin/models/forms/prostate_and_testicular_cancer.xml create mode 100644 admin/models/forms/referral.xml create mode 100644 admin/models/forms/site.xml create mode 100644 admin/models/forms/strength.xml create mode 100644 admin/models/forms/test.xml create mode 100644 admin/models/forms/testing_reason.xml create mode 100644 admin/models/forms/tuberculosis.xml create mode 100644 admin/models/forms/unit.xml create mode 100644 admin/models/forms/vmmc.xml create mode 100644 admin/models/general_medical_check_up.php create mode 100644 admin/models/general_medical_check_ups.php create mode 100644 admin/models/health_education.php create mode 100644 admin/models/health_education_topic.php create mode 100644 admin/models/health_education_topics.php create mode 100644 admin/models/health_educations.php create mode 100644 admin/models/hiv_counseling_and_testing.php create mode 100644 admin/models/hiv_counselings_and_testings.php create mode 100644 admin/models/immunisation.php create mode 100644 admin/models/immunisation_type.php create mode 100644 admin/models/immunisation_types.php create mode 100644 admin/models/immunisation_vaccine_type.php create mode 100644 admin/models/immunisation_vaccine_types.php create mode 100644 admin/models/immunisations.php create mode 100644 admin/models/import.php create mode 100644 admin/models/index.html create mode 100644 admin/models/medication.php create mode 100644 admin/models/medications.php create mode 100644 admin/models/nonpay_reason.php create mode 100644 admin/models/nonpay_reasons.php create mode 100644 admin/models/patient_queue.php create mode 100644 admin/models/payment.php create mode 100644 admin/models/payment_amount.php create mode 100644 admin/models/payment_amounts.php create mode 100644 admin/models/payment_type.php create mode 100644 admin/models/payment_types.php create mode 100644 admin/models/payments.php create mode 100644 admin/models/planning_type.php create mode 100644 admin/models/planning_types.php create mode 100644 admin/models/prostate_and_testicular_cancer.php create mode 100644 admin/models/prostate_and_testicular_cancers.php create mode 100644 admin/models/referral.php create mode 100644 admin/models/referrals.php create mode 100644 admin/models/rules/index.html create mode 100644 admin/models/site.php create mode 100644 admin/models/sites.php create mode 100644 admin/models/strength.php create mode 100644 admin/models/strengths.php create mode 100644 admin/models/test.php create mode 100644 admin/models/testing_reason.php create mode 100644 admin/models/testing_reasons.php create mode 100644 admin/models/tests.php create mode 100644 admin/models/tuberculoses.php create mode 100644 admin/models/tuberculosis.php create mode 100644 admin/models/unit.php create mode 100644 admin/models/units.php create mode 100644 admin/models/vmmc.php create mode 100644 admin/models/vmmcs.php create mode 100644 admin/sql/index.html create mode 100644 admin/sql/install.mysql.utf8.sql create mode 100644 admin/sql/uninstall.mysql.utf8.sql create mode 100644 admin/sql/updates/index.html create mode 100644 admin/sql/updates/mysql/1.0.2.sql create mode 100644 admin/sql/updates/mysql/1.0.3.sql create mode 100644 admin/sql/updates/mysql/1.0.4.sql create mode 100644 admin/sql/updates/mysql/index.html create mode 100644 admin/tables/administration_part.php create mode 100644 admin/tables/antenatal_care.php create mode 100644 admin/tables/breast_cancer.php create mode 100644 admin/tables/cervical_cancer.php create mode 100644 admin/tables/clinic.php create mode 100644 admin/tables/counseling_type.php create mode 100644 admin/tables/diagnosis_type.php create mode 100644 admin/tables/family_planning.php create mode 100644 admin/tables/foetal_engagement.php create mode 100644 admin/tables/foetal_lie.php create mode 100644 admin/tables/foetal_presentation.php create mode 100644 admin/tables/general_medical_check_up.php create mode 100644 admin/tables/health_education.php create mode 100644 admin/tables/health_education_topic.php create mode 100644 admin/tables/hiv_counseling_and_testing.php create mode 100644 admin/tables/immunisation.php create mode 100644 admin/tables/immunisation_type.php create mode 100644 admin/tables/immunisation_vaccine_type.php create mode 100644 admin/tables/index.html create mode 100644 admin/tables/medication.php create mode 100644 admin/tables/nonpay_reason.php create mode 100644 admin/tables/payment.php create mode 100644 admin/tables/payment_amount.php create mode 100644 admin/tables/payment_type.php create mode 100644 admin/tables/planning_type.php create mode 100644 admin/tables/prostate_and_testicular_cancer.php create mode 100644 admin/tables/referral.php create mode 100644 admin/tables/site.php create mode 100644 admin/tables/strength.php create mode 100644 admin/tables/test.php create mode 100644 admin/tables/testing_reason.php create mode 100644 admin/tables/tuberculosis.php create mode 100644 admin/tables/unit.php create mode 100644 admin/tables/vmmc.php create mode 100644 admin/views/administration_part/submitbutton.js create mode 100644 admin/views/administration_part/tmpl/edit.php create mode 100644 admin/views/administration_part/tmpl/index.html create mode 100644 admin/views/administration_part/view.html.php create mode 100644 admin/views/administration_parts/index.html create mode 100644 admin/views/administration_parts/tmpl/default.php create mode 100644 admin/views/administration_parts/tmpl/default_batch_body.php create mode 100644 admin/views/administration_parts/tmpl/default_batch_footer.php create mode 100644 admin/views/administration_parts/tmpl/default_body.php create mode 100644 admin/views/administration_parts/tmpl/default_foot.php create mode 100644 admin/views/administration_parts/tmpl/default_head.php create mode 100644 admin/views/administration_parts/tmpl/default_toolbar.php create mode 100644 admin/views/administration_parts/tmpl/index.html create mode 100644 admin/views/administration_parts/view.html.php create mode 100644 admin/views/antenatal_care/submitbutton.js create mode 100644 admin/views/antenatal_care/tmpl/edit.php create mode 100644 admin/views/antenatal_care/tmpl/index.html create mode 100644 admin/views/antenatal_care/view.html.php create mode 100644 admin/views/antenatal_cares/index.html create mode 100644 admin/views/antenatal_cares/tmpl/default.php create mode 100644 admin/views/antenatal_cares/tmpl/default_batch_body.php create mode 100644 admin/views/antenatal_cares/tmpl/default_batch_footer.php create mode 100644 admin/views/antenatal_cares/tmpl/default_body.php create mode 100644 admin/views/antenatal_cares/tmpl/default_foot.php create mode 100644 admin/views/antenatal_cares/tmpl/default_head.php create mode 100644 admin/views/antenatal_cares/tmpl/default_toolbar.php create mode 100644 admin/views/antenatal_cares/tmpl/index.html create mode 100644 admin/views/antenatal_cares/view.html.php create mode 100644 admin/views/breast_cancer/submitbutton.js create mode 100644 admin/views/breast_cancer/tmpl/edit.php create mode 100644 admin/views/breast_cancer/tmpl/index.html create mode 100644 admin/views/breast_cancer/view.html.php create mode 100644 admin/views/breast_cancers/index.html create mode 100644 admin/views/breast_cancers/tmpl/default.php create mode 100644 admin/views/breast_cancers/tmpl/default_batch_body.php create mode 100644 admin/views/breast_cancers/tmpl/default_batch_footer.php create mode 100644 admin/views/breast_cancers/tmpl/default_body.php create mode 100644 admin/views/breast_cancers/tmpl/default_foot.php create mode 100644 admin/views/breast_cancers/tmpl/default_head.php create mode 100644 admin/views/breast_cancers/tmpl/default_toolbar.php create mode 100644 admin/views/breast_cancers/tmpl/index.html create mode 100644 admin/views/breast_cancers/view.html.php create mode 100644 admin/views/cervical_cancer/submitbutton.js create mode 100644 admin/views/cervical_cancer/tmpl/edit.php create mode 100644 admin/views/cervical_cancer/tmpl/index.html create mode 100644 admin/views/cervical_cancer/view.html.php create mode 100644 admin/views/cervical_cancers/index.html create mode 100644 admin/views/cervical_cancers/tmpl/default.php create mode 100644 admin/views/cervical_cancers/tmpl/default_batch_body.php create mode 100644 admin/views/cervical_cancers/tmpl/default_batch_footer.php create mode 100644 admin/views/cervical_cancers/tmpl/default_body.php create mode 100644 admin/views/cervical_cancers/tmpl/default_foot.php create mode 100644 admin/views/cervical_cancers/tmpl/default_head.php create mode 100644 admin/views/cervical_cancers/tmpl/default_toolbar.php create mode 100644 admin/views/cervical_cancers/tmpl/index.html create mode 100644 admin/views/cervical_cancers/view.html.php create mode 100644 admin/views/clinic/submitbutton.js create mode 100644 admin/views/clinic/tmpl/edit.php create mode 100644 admin/views/clinic/tmpl/index.html create mode 100644 admin/views/clinic/view.html.php create mode 100644 admin/views/clinics/index.html create mode 100644 admin/views/clinics/tmpl/default.php create mode 100644 admin/views/clinics/tmpl/default_batch_body.php create mode 100644 admin/views/clinics/tmpl/default_batch_footer.php create mode 100644 admin/views/clinics/tmpl/default_body.php create mode 100644 admin/views/clinics/tmpl/default_foot.php create mode 100644 admin/views/clinics/tmpl/default_head.php create mode 100644 admin/views/clinics/tmpl/default_toolbar.php create mode 100644 admin/views/clinics/tmpl/index.html create mode 100644 admin/views/clinics/view.html.php create mode 100644 admin/views/counseling_type/submitbutton.js create mode 100644 admin/views/counseling_type/tmpl/edit.php create mode 100644 admin/views/counseling_type/tmpl/index.html create mode 100644 admin/views/counseling_type/view.html.php create mode 100644 admin/views/counseling_types/index.html create mode 100644 admin/views/counseling_types/tmpl/default.php create mode 100644 admin/views/counseling_types/tmpl/default_batch_body.php create mode 100644 admin/views/counseling_types/tmpl/default_batch_footer.php create mode 100644 admin/views/counseling_types/tmpl/default_body.php create mode 100644 admin/views/counseling_types/tmpl/default_foot.php create mode 100644 admin/views/counseling_types/tmpl/default_head.php create mode 100644 admin/views/counseling_types/tmpl/default_toolbar.php create mode 100644 admin/views/counseling_types/tmpl/index.html create mode 100644 admin/views/counseling_types/view.html.php create mode 100644 admin/views/diagnosis_type/submitbutton.js create mode 100644 admin/views/diagnosis_type/tmpl/edit.php create mode 100644 admin/views/diagnosis_type/tmpl/index.html create mode 100644 admin/views/diagnosis_type/view.html.php create mode 100644 admin/views/diagnosis_types/index.html create mode 100644 admin/views/diagnosis_types/tmpl/default.php create mode 100644 admin/views/diagnosis_types/tmpl/default_batch_body.php create mode 100644 admin/views/diagnosis_types/tmpl/default_batch_footer.php create mode 100644 admin/views/diagnosis_types/tmpl/default_body.php create mode 100644 admin/views/diagnosis_types/tmpl/default_foot.php create mode 100644 admin/views/diagnosis_types/tmpl/default_head.php create mode 100644 admin/views/diagnosis_types/tmpl/default_toolbar.php create mode 100644 admin/views/diagnosis_types/tmpl/index.html create mode 100644 admin/views/diagnosis_types/view.html.php create mode 100644 admin/views/ehealth_portal/index.html create mode 100644 admin/views/ehealth_portal/tmpl/default.php create mode 100644 admin/views/ehealth_portal/tmpl/default_main.php create mode 100644 admin/views/ehealth_portal/tmpl/default_vdm.php create mode 100644 admin/views/ehealth_portal/tmpl/index.html create mode 100644 admin/views/ehealth_portal/view.html.php create mode 100644 admin/views/family_planning/submitbutton.js create mode 100644 admin/views/family_planning/tmpl/edit.php create mode 100644 admin/views/family_planning/tmpl/index.html create mode 100644 admin/views/family_planning/view.html.php create mode 100644 admin/views/family_plannings/index.html create mode 100644 admin/views/family_plannings/tmpl/default.php create mode 100644 admin/views/family_plannings/tmpl/default_batch_body.php create mode 100644 admin/views/family_plannings/tmpl/default_batch_footer.php create mode 100644 admin/views/family_plannings/tmpl/default_body.php create mode 100644 admin/views/family_plannings/tmpl/default_foot.php create mode 100644 admin/views/family_plannings/tmpl/default_head.php create mode 100644 admin/views/family_plannings/tmpl/default_toolbar.php create mode 100644 admin/views/family_plannings/tmpl/index.html create mode 100644 admin/views/family_plannings/view.html.php create mode 100644 admin/views/foetal_engagement/submitbutton.js create mode 100644 admin/views/foetal_engagement/tmpl/edit.php create mode 100644 admin/views/foetal_engagement/tmpl/index.html create mode 100644 admin/views/foetal_engagement/view.html.php create mode 100644 admin/views/foetal_engagements/index.html create mode 100644 admin/views/foetal_engagements/tmpl/default.php create mode 100644 admin/views/foetal_engagements/tmpl/default_batch_body.php create mode 100644 admin/views/foetal_engagements/tmpl/default_batch_footer.php create mode 100644 admin/views/foetal_engagements/tmpl/default_body.php create mode 100644 admin/views/foetal_engagements/tmpl/default_foot.php create mode 100644 admin/views/foetal_engagements/tmpl/default_head.php create mode 100644 admin/views/foetal_engagements/tmpl/default_toolbar.php create mode 100644 admin/views/foetal_engagements/tmpl/index.html create mode 100644 admin/views/foetal_engagements/view.html.php create mode 100644 admin/views/foetal_lie/submitbutton.js create mode 100644 admin/views/foetal_lie/tmpl/edit.php create mode 100644 admin/views/foetal_lie/tmpl/index.html create mode 100644 admin/views/foetal_lie/view.html.php create mode 100644 admin/views/foetal_lies/index.html create mode 100644 admin/views/foetal_lies/tmpl/default.php create mode 100644 admin/views/foetal_lies/tmpl/default_batch_body.php create mode 100644 admin/views/foetal_lies/tmpl/default_batch_footer.php create mode 100644 admin/views/foetal_lies/tmpl/default_body.php create mode 100644 admin/views/foetal_lies/tmpl/default_foot.php create mode 100644 admin/views/foetal_lies/tmpl/default_head.php create mode 100644 admin/views/foetal_lies/tmpl/default_toolbar.php create mode 100644 admin/views/foetal_lies/tmpl/index.html create mode 100644 admin/views/foetal_lies/view.html.php create mode 100644 admin/views/foetal_presentation/submitbutton.js create mode 100644 admin/views/foetal_presentation/tmpl/edit.php create mode 100644 admin/views/foetal_presentation/tmpl/index.html create mode 100644 admin/views/foetal_presentation/view.html.php create mode 100644 admin/views/foetal_presentations/index.html create mode 100644 admin/views/foetal_presentations/tmpl/default.php create mode 100644 admin/views/foetal_presentations/tmpl/default_batch_body.php create mode 100644 admin/views/foetal_presentations/tmpl/default_batch_footer.php create mode 100644 admin/views/foetal_presentations/tmpl/default_body.php create mode 100644 admin/views/foetal_presentations/tmpl/default_foot.php create mode 100644 admin/views/foetal_presentations/tmpl/default_head.php create mode 100644 admin/views/foetal_presentations/tmpl/default_toolbar.php create mode 100644 admin/views/foetal_presentations/tmpl/index.html create mode 100644 admin/views/foetal_presentations/view.html.php create mode 100644 admin/views/general_medical_check_up/submitbutton.js create mode 100644 admin/views/general_medical_check_up/tmpl/edit.php create mode 100644 admin/views/general_medical_check_up/tmpl/index.html create mode 100644 admin/views/general_medical_check_up/view.html.php create mode 100644 admin/views/general_medical_check_ups/index.html create mode 100644 admin/views/general_medical_check_ups/tmpl/default.php create mode 100644 admin/views/general_medical_check_ups/tmpl/default_batch_body.php create mode 100644 admin/views/general_medical_check_ups/tmpl/default_batch_footer.php create mode 100644 admin/views/general_medical_check_ups/tmpl/default_body.php create mode 100644 admin/views/general_medical_check_ups/tmpl/default_foot.php create mode 100644 admin/views/general_medical_check_ups/tmpl/default_head.php create mode 100644 admin/views/general_medical_check_ups/tmpl/default_toolbar.php create mode 100644 admin/views/general_medical_check_ups/tmpl/index.html create mode 100644 admin/views/general_medical_check_ups/view.html.php create mode 100644 admin/views/health_education/submitbutton.js create mode 100644 admin/views/health_education/tmpl/edit.php create mode 100644 admin/views/health_education/tmpl/index.html create mode 100644 admin/views/health_education/view.html.php create mode 100644 admin/views/health_education_topic/submitbutton.js create mode 100644 admin/views/health_education_topic/tmpl/edit.php create mode 100644 admin/views/health_education_topic/tmpl/index.html create mode 100644 admin/views/health_education_topic/view.html.php create mode 100644 admin/views/health_education_topics/index.html create mode 100644 admin/views/health_education_topics/tmpl/default.php create mode 100644 admin/views/health_education_topics/tmpl/default_batch_body.php create mode 100644 admin/views/health_education_topics/tmpl/default_batch_footer.php create mode 100644 admin/views/health_education_topics/tmpl/default_body.php create mode 100644 admin/views/health_education_topics/tmpl/default_foot.php create mode 100644 admin/views/health_education_topics/tmpl/default_head.php create mode 100644 admin/views/health_education_topics/tmpl/default_toolbar.php create mode 100644 admin/views/health_education_topics/tmpl/index.html create mode 100644 admin/views/health_education_topics/view.html.php create mode 100644 admin/views/health_educations/index.html create mode 100644 admin/views/health_educations/tmpl/default.php create mode 100644 admin/views/health_educations/tmpl/default_batch_body.php create mode 100644 admin/views/health_educations/tmpl/default_batch_footer.php create mode 100644 admin/views/health_educations/tmpl/default_body.php create mode 100644 admin/views/health_educations/tmpl/default_foot.php create mode 100644 admin/views/health_educations/tmpl/default_head.php create mode 100644 admin/views/health_educations/tmpl/default_toolbar.php create mode 100644 admin/views/health_educations/tmpl/index.html create mode 100644 admin/views/health_educations/view.html.php create mode 100644 admin/views/hiv_counseling_and_testing/submitbutton.js create mode 100644 admin/views/hiv_counseling_and_testing/tmpl/edit.php create mode 100644 admin/views/hiv_counseling_and_testing/tmpl/index.html create mode 100644 admin/views/hiv_counseling_and_testing/view.html.php create mode 100644 admin/views/hiv_counselings_and_testings/index.html create mode 100644 admin/views/hiv_counselings_and_testings/tmpl/default.php create mode 100644 admin/views/hiv_counselings_and_testings/tmpl/default_batch_body.php create mode 100644 admin/views/hiv_counselings_and_testings/tmpl/default_batch_footer.php create mode 100644 admin/views/hiv_counselings_and_testings/tmpl/default_body.php create mode 100644 admin/views/hiv_counselings_and_testings/tmpl/default_foot.php create mode 100644 admin/views/hiv_counselings_and_testings/tmpl/default_head.php create mode 100644 admin/views/hiv_counselings_and_testings/tmpl/default_toolbar.php create mode 100644 admin/views/hiv_counselings_and_testings/tmpl/index.html create mode 100644 admin/views/hiv_counselings_and_testings/view.html.php create mode 100644 admin/views/immunisation/submitbutton.js create mode 100644 admin/views/immunisation/tmpl/edit.php create mode 100644 admin/views/immunisation/tmpl/index.html create mode 100644 admin/views/immunisation/view.html.php create mode 100644 admin/views/immunisation_type/submitbutton.js create mode 100644 admin/views/immunisation_type/tmpl/edit.php create mode 100644 admin/views/immunisation_type/tmpl/index.html create mode 100644 admin/views/immunisation_type/view.html.php create mode 100644 admin/views/immunisation_types/index.html create mode 100644 admin/views/immunisation_types/tmpl/default.php create mode 100644 admin/views/immunisation_types/tmpl/default_batch_body.php create mode 100644 admin/views/immunisation_types/tmpl/default_batch_footer.php create mode 100644 admin/views/immunisation_types/tmpl/default_body.php create mode 100644 admin/views/immunisation_types/tmpl/default_foot.php create mode 100644 admin/views/immunisation_types/tmpl/default_head.php create mode 100644 admin/views/immunisation_types/tmpl/default_toolbar.php create mode 100644 admin/views/immunisation_types/tmpl/index.html create mode 100644 admin/views/immunisation_types/view.html.php create mode 100644 admin/views/immunisation_vaccine_type/submitbutton.js create mode 100644 admin/views/immunisation_vaccine_type/tmpl/edit.php create mode 100644 admin/views/immunisation_vaccine_type/tmpl/index.html create mode 100644 admin/views/immunisation_vaccine_type/view.html.php create mode 100644 admin/views/immunisation_vaccine_types/index.html create mode 100644 admin/views/immunisation_vaccine_types/tmpl/default.php create mode 100644 admin/views/immunisation_vaccine_types/tmpl/default_batch_body.php create mode 100644 admin/views/immunisation_vaccine_types/tmpl/default_batch_footer.php create mode 100644 admin/views/immunisation_vaccine_types/tmpl/default_body.php create mode 100644 admin/views/immunisation_vaccine_types/tmpl/default_foot.php create mode 100644 admin/views/immunisation_vaccine_types/tmpl/default_head.php create mode 100644 admin/views/immunisation_vaccine_types/tmpl/default_toolbar.php create mode 100644 admin/views/immunisation_vaccine_types/tmpl/index.html create mode 100644 admin/views/immunisation_vaccine_types/view.html.php create mode 100644 admin/views/immunisations/index.html create mode 100644 admin/views/immunisations/tmpl/default.php create mode 100644 admin/views/immunisations/tmpl/default_batch_body.php create mode 100644 admin/views/immunisations/tmpl/default_batch_footer.php create mode 100644 admin/views/immunisations/tmpl/default_body.php create mode 100644 admin/views/immunisations/tmpl/default_foot.php create mode 100644 admin/views/immunisations/tmpl/default_head.php create mode 100644 admin/views/immunisations/tmpl/default_toolbar.php create mode 100644 admin/views/immunisations/tmpl/index.html create mode 100644 admin/views/immunisations/view.html.php create mode 100644 admin/views/import/index.html create mode 100644 admin/views/import/tmpl/default.php create mode 100644 admin/views/import/tmpl/index.html create mode 100644 admin/views/import/view.html.php create mode 100644 admin/views/index.html create mode 100644 admin/views/medication/submitbutton.js create mode 100644 admin/views/medication/tmpl/edit.php create mode 100644 admin/views/medication/tmpl/index.html create mode 100644 admin/views/medication/view.html.php create mode 100644 admin/views/medications/index.html create mode 100644 admin/views/medications/tmpl/default.php create mode 100644 admin/views/medications/tmpl/default_batch_body.php create mode 100644 admin/views/medications/tmpl/default_batch_footer.php create mode 100644 admin/views/medications/tmpl/default_body.php create mode 100644 admin/views/medications/tmpl/default_foot.php create mode 100644 admin/views/medications/tmpl/default_head.php create mode 100644 admin/views/medications/tmpl/default_toolbar.php create mode 100644 admin/views/medications/tmpl/index.html create mode 100644 admin/views/medications/view.html.php create mode 100644 admin/views/nonpay_reason/submitbutton.js create mode 100644 admin/views/nonpay_reason/tmpl/edit.php create mode 100644 admin/views/nonpay_reason/tmpl/index.html create mode 100644 admin/views/nonpay_reason/view.html.php create mode 100644 admin/views/nonpay_reasons/index.html create mode 100644 admin/views/nonpay_reasons/tmpl/default.php create mode 100644 admin/views/nonpay_reasons/tmpl/default_batch_body.php create mode 100644 admin/views/nonpay_reasons/tmpl/default_batch_footer.php create mode 100644 admin/views/nonpay_reasons/tmpl/default_body.php create mode 100644 admin/views/nonpay_reasons/tmpl/default_foot.php create mode 100644 admin/views/nonpay_reasons/tmpl/default_head.php create mode 100644 admin/views/nonpay_reasons/tmpl/default_toolbar.php create mode 100644 admin/views/nonpay_reasons/tmpl/index.html create mode 100644 admin/views/nonpay_reasons/view.html.php create mode 100644 admin/views/patient_queue/index.html create mode 100644 admin/views/patient_queue/tmpl/default.php create mode 100644 admin/views/patient_queue/tmpl/index.html create mode 100644 admin/views/patient_queue/view.html.php create mode 100644 admin/views/payment/submitbutton.js create mode 100644 admin/views/payment/tmpl/edit.php create mode 100644 admin/views/payment/tmpl/index.html create mode 100644 admin/views/payment/view.html.php create mode 100644 admin/views/payment_amount/submitbutton.js create mode 100644 admin/views/payment_amount/tmpl/edit.php create mode 100644 admin/views/payment_amount/tmpl/index.html create mode 100644 admin/views/payment_amount/view.html.php create mode 100644 admin/views/payment_amounts/index.html create mode 100644 admin/views/payment_amounts/tmpl/default.php create mode 100644 admin/views/payment_amounts/tmpl/default_batch_body.php create mode 100644 admin/views/payment_amounts/tmpl/default_batch_footer.php create mode 100644 admin/views/payment_amounts/tmpl/default_body.php create mode 100644 admin/views/payment_amounts/tmpl/default_foot.php create mode 100644 admin/views/payment_amounts/tmpl/default_head.php create mode 100644 admin/views/payment_amounts/tmpl/default_toolbar.php create mode 100644 admin/views/payment_amounts/tmpl/index.html create mode 100644 admin/views/payment_amounts/view.html.php create mode 100644 admin/views/payment_type/submitbutton.js create mode 100644 admin/views/payment_type/tmpl/edit.php create mode 100644 admin/views/payment_type/tmpl/index.html create mode 100644 admin/views/payment_type/view.html.php create mode 100644 admin/views/payment_types/index.html create mode 100644 admin/views/payment_types/tmpl/default.php create mode 100644 admin/views/payment_types/tmpl/default_batch_body.php create mode 100644 admin/views/payment_types/tmpl/default_batch_footer.php create mode 100644 admin/views/payment_types/tmpl/default_body.php create mode 100644 admin/views/payment_types/tmpl/default_foot.php create mode 100644 admin/views/payment_types/tmpl/default_head.php create mode 100644 admin/views/payment_types/tmpl/default_toolbar.php create mode 100644 admin/views/payment_types/tmpl/index.html create mode 100644 admin/views/payment_types/view.html.php create mode 100644 admin/views/payments/index.html create mode 100644 admin/views/payments/tmpl/default.php create mode 100644 admin/views/payments/tmpl/default_batch_body.php create mode 100644 admin/views/payments/tmpl/default_batch_footer.php create mode 100644 admin/views/payments/tmpl/default_body.php create mode 100644 admin/views/payments/tmpl/default_foot.php create mode 100644 admin/views/payments/tmpl/default_head.php create mode 100644 admin/views/payments/tmpl/default_toolbar.php create mode 100644 admin/views/payments/tmpl/index.html create mode 100644 admin/views/payments/view.html.php create mode 100644 admin/views/planning_type/submitbutton.js create mode 100644 admin/views/planning_type/tmpl/edit.php create mode 100644 admin/views/planning_type/tmpl/index.html create mode 100644 admin/views/planning_type/view.html.php create mode 100644 admin/views/planning_types/index.html create mode 100644 admin/views/planning_types/tmpl/default.php create mode 100644 admin/views/planning_types/tmpl/default_batch_body.php create mode 100644 admin/views/planning_types/tmpl/default_batch_footer.php create mode 100644 admin/views/planning_types/tmpl/default_body.php create mode 100644 admin/views/planning_types/tmpl/default_foot.php create mode 100644 admin/views/planning_types/tmpl/default_head.php create mode 100644 admin/views/planning_types/tmpl/default_toolbar.php create mode 100644 admin/views/planning_types/tmpl/index.html create mode 100644 admin/views/planning_types/view.html.php create mode 100644 admin/views/prostate_and_testicular_cancer/submitbutton.js create mode 100644 admin/views/prostate_and_testicular_cancer/tmpl/edit.php create mode 100644 admin/views/prostate_and_testicular_cancer/tmpl/index.html create mode 100644 admin/views/prostate_and_testicular_cancer/view.html.php create mode 100644 admin/views/prostate_and_testicular_cancers/index.html create mode 100644 admin/views/prostate_and_testicular_cancers/tmpl/default.php create mode 100644 admin/views/prostate_and_testicular_cancers/tmpl/default_batch_body.php create mode 100644 admin/views/prostate_and_testicular_cancers/tmpl/default_batch_footer.php create mode 100644 admin/views/prostate_and_testicular_cancers/tmpl/default_body.php create mode 100644 admin/views/prostate_and_testicular_cancers/tmpl/default_foot.php create mode 100644 admin/views/prostate_and_testicular_cancers/tmpl/default_head.php create mode 100644 admin/views/prostate_and_testicular_cancers/tmpl/default_toolbar.php create mode 100644 admin/views/prostate_and_testicular_cancers/tmpl/index.html create mode 100644 admin/views/prostate_and_testicular_cancers/view.html.php create mode 100644 admin/views/referral/submitbutton.js create mode 100644 admin/views/referral/tmpl/edit.php create mode 100644 admin/views/referral/tmpl/index.html create mode 100644 admin/views/referral/view.html.php create mode 100644 admin/views/referrals/index.html create mode 100644 admin/views/referrals/tmpl/default.php create mode 100644 admin/views/referrals/tmpl/default_batch_body.php create mode 100644 admin/views/referrals/tmpl/default_batch_footer.php create mode 100644 admin/views/referrals/tmpl/default_body.php create mode 100644 admin/views/referrals/tmpl/default_foot.php create mode 100644 admin/views/referrals/tmpl/default_head.php create mode 100644 admin/views/referrals/tmpl/default_toolbar.php create mode 100644 admin/views/referrals/tmpl/index.html create mode 100644 admin/views/referrals/view.html.php create mode 100644 admin/views/site/submitbutton.js create mode 100644 admin/views/site/tmpl/edit.php create mode 100644 admin/views/site/tmpl/index.html create mode 100644 admin/views/site/view.html.php create mode 100644 admin/views/sites/index.html create mode 100644 admin/views/sites/tmpl/default.php create mode 100644 admin/views/sites/tmpl/default_batch_body.php create mode 100644 admin/views/sites/tmpl/default_batch_footer.php create mode 100644 admin/views/sites/tmpl/default_body.php create mode 100644 admin/views/sites/tmpl/default_foot.php create mode 100644 admin/views/sites/tmpl/default_head.php create mode 100644 admin/views/sites/tmpl/default_toolbar.php create mode 100644 admin/views/sites/tmpl/index.html create mode 100644 admin/views/sites/view.html.php create mode 100644 admin/views/strength/submitbutton.js create mode 100644 admin/views/strength/tmpl/edit.php create mode 100644 admin/views/strength/tmpl/index.html create mode 100644 admin/views/strength/view.html.php create mode 100644 admin/views/strengths/index.html create mode 100644 admin/views/strengths/tmpl/default.php create mode 100644 admin/views/strengths/tmpl/default_batch_body.php create mode 100644 admin/views/strengths/tmpl/default_batch_footer.php create mode 100644 admin/views/strengths/tmpl/default_body.php create mode 100644 admin/views/strengths/tmpl/default_foot.php create mode 100644 admin/views/strengths/tmpl/default_head.php create mode 100644 admin/views/strengths/tmpl/default_toolbar.php create mode 100644 admin/views/strengths/tmpl/index.html create mode 100644 admin/views/strengths/view.html.php create mode 100644 admin/views/test/submitbutton.js create mode 100644 admin/views/test/tmpl/edit.php create mode 100644 admin/views/test/tmpl/index.html create mode 100644 admin/views/test/view.html.php create mode 100644 admin/views/testing_reason/submitbutton.js create mode 100644 admin/views/testing_reason/tmpl/edit.php create mode 100644 admin/views/testing_reason/tmpl/index.html create mode 100644 admin/views/testing_reason/view.html.php create mode 100644 admin/views/testing_reasons/index.html create mode 100644 admin/views/testing_reasons/tmpl/default.php create mode 100644 admin/views/testing_reasons/tmpl/default_batch_body.php create mode 100644 admin/views/testing_reasons/tmpl/default_batch_footer.php create mode 100644 admin/views/testing_reasons/tmpl/default_body.php create mode 100644 admin/views/testing_reasons/tmpl/default_foot.php create mode 100644 admin/views/testing_reasons/tmpl/default_head.php create mode 100644 admin/views/testing_reasons/tmpl/default_toolbar.php create mode 100644 admin/views/testing_reasons/tmpl/index.html create mode 100644 admin/views/testing_reasons/view.html.php create mode 100644 admin/views/tests/index.html create mode 100644 admin/views/tests/tmpl/default.php create mode 100644 admin/views/tests/tmpl/default_batch_body.php create mode 100644 admin/views/tests/tmpl/default_batch_footer.php create mode 100644 admin/views/tests/tmpl/default_body.php create mode 100644 admin/views/tests/tmpl/default_foot.php create mode 100644 admin/views/tests/tmpl/default_head.php create mode 100644 admin/views/tests/tmpl/default_toolbar.php create mode 100644 admin/views/tests/tmpl/index.html create mode 100644 admin/views/tests/view.html.php create mode 100644 admin/views/tuberculoses/index.html create mode 100644 admin/views/tuberculoses/tmpl/default.php create mode 100644 admin/views/tuberculoses/tmpl/default_batch_body.php create mode 100644 admin/views/tuberculoses/tmpl/default_batch_footer.php create mode 100644 admin/views/tuberculoses/tmpl/default_body.php create mode 100644 admin/views/tuberculoses/tmpl/default_foot.php create mode 100644 admin/views/tuberculoses/tmpl/default_head.php create mode 100644 admin/views/tuberculoses/tmpl/default_toolbar.php create mode 100644 admin/views/tuberculoses/tmpl/index.html create mode 100644 admin/views/tuberculoses/view.html.php create mode 100644 admin/views/tuberculosis/submitbutton.js create mode 100644 admin/views/tuberculosis/tmpl/edit.php create mode 100644 admin/views/tuberculosis/tmpl/index.html create mode 100644 admin/views/tuberculosis/view.html.php create mode 100644 admin/views/unit/submitbutton.js create mode 100644 admin/views/unit/tmpl/edit.php create mode 100644 admin/views/unit/tmpl/index.html create mode 100644 admin/views/unit/view.html.php create mode 100644 admin/views/units/index.html create mode 100644 admin/views/units/tmpl/default.php create mode 100644 admin/views/units/tmpl/default_batch_body.php create mode 100644 admin/views/units/tmpl/default_batch_footer.php create mode 100644 admin/views/units/tmpl/default_body.php create mode 100644 admin/views/units/tmpl/default_foot.php create mode 100644 admin/views/units/tmpl/default_head.php create mode 100644 admin/views/units/tmpl/default_toolbar.php create mode 100644 admin/views/units/tmpl/index.html create mode 100644 admin/views/units/view.html.php create mode 100644 admin/views/vmmc/submitbutton.js create mode 100644 admin/views/vmmc/tmpl/edit.php create mode 100644 admin/views/vmmc/tmpl/index.html create mode 100644 admin/views/vmmc/view.html.php create mode 100644 admin/views/vmmcs/index.html create mode 100644 admin/views/vmmcs/tmpl/default.php create mode 100644 admin/views/vmmcs/tmpl/default_batch_body.php create mode 100644 admin/views/vmmcs/tmpl/default_batch_footer.php create mode 100644 admin/views/vmmcs/tmpl/default_body.php create mode 100644 admin/views/vmmcs/tmpl/default_foot.php create mode 100644 admin/views/vmmcs/tmpl/default_head.php create mode 100644 admin/views/vmmcs/tmpl/default_toolbar.php create mode 100644 admin/views/vmmcs/tmpl/index.html create mode 100644 admin/views/vmmcs/view.html.php create mode 100644 ehealth_portal.xml create mode 100644 index.html create mode 100644 libraries/phpspreadsheet/vendor/.htaccess create mode 100644 libraries/phpspreadsheet/vendor/autoload.php create mode 100644 libraries/phpspreadsheet/vendor/composer/ClassLoader.php create mode 100644 libraries/phpspreadsheet/vendor/composer/LICENSE create mode 100644 libraries/phpspreadsheet/vendor/composer/autoload_classmap.php create mode 100644 libraries/phpspreadsheet/vendor/composer/autoload_files.php create mode 100644 libraries/phpspreadsheet/vendor/composer/autoload_namespaces.php create mode 100644 libraries/phpspreadsheet/vendor/composer/autoload_psr4.php create mode 100644 libraries/phpspreadsheet/vendor/composer/autoload_real.php create mode 100644 libraries/phpspreadsheet/vendor/composer/autoload_static.php create mode 100644 libraries/phpspreadsheet/vendor/composer/installed.json create mode 100644 libraries/phpspreadsheet/vendor/htaccess.txt create mode 100644 libraries/phpspreadsheet/vendor/index.html create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/Autoloader.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/Bootstrap.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/Complex.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/Exception.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/abs.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acos.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acosh.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acot.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acoth.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acsc.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acsch.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/argument.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asec.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asech.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asin.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asinh.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/atan.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/atanh.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/conjugate.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cos.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cosh.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cot.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/coth.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/csc.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/csch.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/exp.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/inverse.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/ln.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/log10.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/log2.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/negative.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/pow.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/rho.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sec.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sech.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sin.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sinh.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sqrt.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/tan.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/tanh.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/theta.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/add.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/divideby.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/divideinto.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/multiply.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/subtract.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/buildPhar.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/Autoloader.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/Bootstrap.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Builder.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Exception.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Functions.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Matrix.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Addition.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/DirectSum.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Division.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Multiplication.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Operator.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Subtraction.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/adjoint.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/antidiagonal.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/cofactors.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/determinant.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/diagonal.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/identity.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/inverse.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/minors.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/trace.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/transpose.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/add.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/directsum.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/divideby.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/divideinto.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/multiply.php create mode 100644 libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/subtract.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/bin/pre-commit create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/Bootstrap.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Category.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Database.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Exception.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ExceptionHandler.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaParser.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaToken.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/functionlist.txt create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/bg/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/bg/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/cs/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/cs/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/da/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/da/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/de/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/de/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/en/uk/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/es/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/es/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fi/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fi/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fr/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fr/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/hu/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/hu/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/it/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/it/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/nl/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/nl/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/no/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/no/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pl/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pl/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/br/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/br/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/sv/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/sv/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/tr/config create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/tr/functions create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidation.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DefaultValueBinder.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Hyperlink.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/IValueBinder.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/StringValueBinder.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Axis.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Chart.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeries.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Exception.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/GridLines.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Layout.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Legend.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/PlotArea.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Properties.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/PHP Charting Libraries.txt create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/Polyfill.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Title.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/CellsFactory.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Security.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Exception.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/HashTable.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Migrator.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Sample.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IComparable.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/NamedRange.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/DefaultReadFilter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Exception.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Gnumeric.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReadFilter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReader.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/Properties.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Security/XmlScanner.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Escher.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/RC4.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/Border.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Properties.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Theme.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/chunkReadFilter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/ITextElement.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/RichText.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/Run.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/TextElement.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/CodePage.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CHANGELOG.TXT create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/utils/Maths.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/File.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/PasswordHasher.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/TimeZone.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/BestFit.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Xls.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Fill.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/CellIterator.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Column.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnIterator.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Iterator.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageMargins.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Protection.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowCellIterator.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowIterator.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/SheetView.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Csv.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Exception.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/IWriter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Meta.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/MetaInf.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Mimetype.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Settings.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Styles.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/WriterPart.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Escher.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Font.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Parser.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Workbook.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Xf.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Chart.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Theme.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php create mode 100644 libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php create mode 100644 libraries/phpspreadsheet/vendor/psr/simple-cache/.editorconfig create mode 100644 libraries/phpspreadsheet/vendor/psr/simple-cache/LICENSE.md create mode 100644 libraries/phpspreadsheet/vendor/psr/simple-cache/README.md create mode 100644 libraries/phpspreadsheet/vendor/psr/simple-cache/composer.json create mode 100644 libraries/phpspreadsheet/vendor/psr/simple-cache/src/CacheException.php create mode 100644 libraries/phpspreadsheet/vendor/psr/simple-cache/src/CacheInterface.php create mode 100644 libraries/phpspreadsheet/vendor/psr/simple-cache/src/InvalidArgumentException.php create mode 100644 libraries/phpspreadsheet/vendor/web.config create mode 100644 media/css/index.html create mode 100644 media/images/index.html create mode 100644 media/index.html create mode 100644 media/js/administration_part.js create mode 100644 media/js/antenatal_care.js create mode 100644 media/js/breast_cancer.js create mode 100644 media/js/cervical_cancer.js create mode 100644 media/js/clinic.js create mode 100644 media/js/counseling_type.js create mode 100644 media/js/diagnosis_type.js create mode 100644 media/js/family_planning.js create mode 100644 media/js/foetal_engagement.js create mode 100644 media/js/foetal_lie.js create mode 100644 media/js/foetal_presentation.js create mode 100644 media/js/general_medical_check_up.js create mode 100644 media/js/health_education.js create mode 100644 media/js/health_education_topic.js create mode 100644 media/js/hiv_counseling_and_testing.js create mode 100644 media/js/immunisation.js create mode 100644 media/js/immunisation_type.js create mode 100644 media/js/immunisation_vaccine_type.js create mode 100644 media/js/index.html create mode 100644 media/js/medication.js create mode 100644 media/js/nonpay_reason.js create mode 100644 media/js/payment.js create mode 100644 media/js/payment_amount.js create mode 100644 media/js/payment_type.js create mode 100644 media/js/planning_type.js create mode 100644 media/js/prostate_and_testicular_cancer.js create mode 100644 media/js/referral.js create mode 100644 media/js/site.js create mode 100644 media/js/strength.js create mode 100644 media/js/test.js create mode 100644 media/js/testing_reason.js create mode 100644 media/js/tuberculosis.js create mode 100644 media/js/unit.js create mode 100644 media/js/vmmc.js create mode 100644 script.php diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..df50810 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,340 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..33befcd --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ + # eHealth Portal (1.0.5) + + ![eHealth Portal image](https://raw.githubusercontent.com/Namibia/eHealth-Portal/master/admin/assets/images/vdm-component.jpg "The eHealth Portal") + + eHealth Portal is a secure web-based viewer that offers health care providers that may not have access to one of the provincial clinical viewers, a single point of access to their patients' digital health information. + +# Build Details + ++ *Company*: [Vast Development Method](https://github.com/namibia/eHealth-Portal) ++ *Author*: [Oh Martin](mailto:oh.martin@vdm.io) ++ *Name*: [eHealth Portal](https://github.com/namibia/eHealth-Portal) ++ *First Build*: 13th August, 2020 ++ *Last Build*: 24th April, 2021 ++ *Version*: 1.0.5 ++ *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 + +## Build Time + +**425 Hours** or **53 Eight Hour Days** (actual time the author saved - +due to [Automated Component Builder](http://joomlacomponentbuilder.com)) + +> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, +> never making one mistake or taking any coffee break.) + ++ *Line count*: **152325** ++ *File count*: **1125** ++ *Folder count*: **176** + + **280 Hours** or **35 Eight Hour Days** (the actual time the author spent) + +> (with the following break down: +> **debugging @106hours** = codingtime / 4; +> **planning @61hours** = codingtime / 7; +> **mapping @42hours** = codingtime / 10; +> **office @71hours** = codingtime / 6;) + +**705 Hours** or **88 Eight Hour Days** +(a total of the realistic time frame for this project) + +> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, +> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) + +Project duration: **17.6 weeks** or **3.7 months** + +> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). +> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) \ No newline at end of file diff --git a/admin/README.txt b/admin/README.txt new file mode 100644 index 0000000..33befcd --- /dev/null +++ b/admin/README.txt @@ -0,0 +1,47 @@ + # eHealth Portal (1.0.5) + + ![eHealth Portal image](https://raw.githubusercontent.com/Namibia/eHealth-Portal/master/admin/assets/images/vdm-component.jpg "The eHealth Portal") + + eHealth Portal is a secure web-based viewer that offers health care providers that may not have access to one of the provincial clinical viewers, a single point of access to their patients' digital health information. + +# Build Details + ++ *Company*: [Vast Development Method](https://github.com/namibia/eHealth-Portal) ++ *Author*: [Oh Martin](mailto:oh.martin@vdm.io) ++ *Name*: [eHealth Portal](https://github.com/namibia/eHealth-Portal) ++ *First Build*: 13th August, 2020 ++ *Last Build*: 24th April, 2021 ++ *Version*: 1.0.5 ++ *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 + +## Build Time + +**425 Hours** or **53 Eight Hour Days** (actual time the author saved - +due to [Automated Component Builder](http://joomlacomponentbuilder.com)) + +> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, +> never making one mistake or taking any coffee break.) + ++ *Line count*: **152325** ++ *File count*: **1125** ++ *Folder count*: **176** + + **280 Hours** or **35 Eight Hour Days** (the actual time the author spent) + +> (with the following break down: +> **debugging @106hours** = codingtime / 4; +> **planning @61hours** = codingtime / 7; +> **mapping @42hours** = codingtime / 10; +> **office @71hours** = codingtime / 6;) + +**705 Hours** or **88 Eight Hour Days** +(a total of the realistic time frame for this project) + +> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, +> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) + +Project duration: **17.6 weeks** or **3.7 months** + +> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). +> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) \ No newline at end of file diff --git a/admin/access.xml b/admin/access.xml new file mode 100644 index 0000000..9ec6a16 --- /dev/null +++ b/admin/access.xml @@ -0,0 +1,425 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + + +
+
\ No newline at end of file diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css new file mode 100644 index 0000000..f213246 --- /dev/null +++ b/admin/assets/css/admin.css @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage admin.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ +.no-click { + pointer-events: none; +} + diff --git a/admin/assets/css/administration_part.css b/admin/assets/css/administration_part.css new file mode 100644 index 0000000..069514b --- /dev/null +++ b/admin/assets/css/administration_part.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage administration_part.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/administration_parts.css b/admin/assets/css/administration_parts.css new file mode 100644 index 0000000..6f8a1c4 --- /dev/null +++ b/admin/assets/css/administration_parts.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage administration_parts.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/antenatal_care.css b/admin/assets/css/antenatal_care.css new file mode 100644 index 0000000..842535f --- /dev/null +++ b/admin/assets/css/antenatal_care.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage antenatal_care.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/antenatal_cares.css b/admin/assets/css/antenatal_cares.css new file mode 100644 index 0000000..a5541be --- /dev/null +++ b/admin/assets/css/antenatal_cares.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage antenatal_cares.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/breast_cancer.css b/admin/assets/css/breast_cancer.css new file mode 100644 index 0000000..b5a6da2 --- /dev/null +++ b/admin/assets/css/breast_cancer.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage breast_cancer.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/breast_cancers.css b/admin/assets/css/breast_cancers.css new file mode 100644 index 0000000..5882222 --- /dev/null +++ b/admin/assets/css/breast_cancers.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage breast_cancers.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/cervical_cancer.css b/admin/assets/css/cervical_cancer.css new file mode 100644 index 0000000..6422f52 --- /dev/null +++ b/admin/assets/css/cervical_cancer.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage cervical_cancer.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/cervical_cancers.css b/admin/assets/css/cervical_cancers.css new file mode 100644 index 0000000..e973417 --- /dev/null +++ b/admin/assets/css/cervical_cancers.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage cervical_cancers.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/clinic.css b/admin/assets/css/clinic.css new file mode 100644 index 0000000..8859f2a --- /dev/null +++ b/admin/assets/css/clinic.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage clinic.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/clinics.css b/admin/assets/css/clinics.css new file mode 100644 index 0000000..bc1b5b7 --- /dev/null +++ b/admin/assets/css/clinics.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage clinics.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/counseling_type.css b/admin/assets/css/counseling_type.css new file mode 100644 index 0000000..9eb511d --- /dev/null +++ b/admin/assets/css/counseling_type.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage counseling_type.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/counseling_types.css b/admin/assets/css/counseling_types.css new file mode 100644 index 0000000..7452a12 --- /dev/null +++ b/admin/assets/css/counseling_types.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage counseling_types.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css new file mode 100644 index 0000000..03c540c --- /dev/null +++ b/admin/assets/css/dashboard.css @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage dashboard.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + +.dashboard-container { + margin-left: 10px; + margin-top: 10px; + width: 100%; +} +.dashboard-container [class*="span"] { + display: block; + float: none; + margin-left: 0; + width: auto; +} +.dashboard-container:before, .dashboard-container:after { + content: ""; + display: table; +} +.dashboard-container:after { + clear: both; +} +.dashboard-container [class*="span"] { + box-sizing: border-box; + display: block; + float: left; + min-height: 145px; + min-width: 96px; + width: 100%; +} +.dashboard-container [class*="span"]:first-child { + margin-left: 0; +} +.dashboard-wraper { + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 5px; + float: left; + margin: 1%; + padding: 3px; + width: 17%; + min-height: 194px; + min-width: 96px; +} +.dashboard-content a { + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + min-height: 89px; + padding: 10px; + text-align: center; + text-decoration: none; +} +.dashboard-content a:hover { + background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + color: hsl(200, 100%, 30%); + text-decoration: none; +} +.dashboard-title { + display: block; + padding-top: 5px; +} +.dashboard-info { + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + font-size: 12px; + padding: 10px; + text-align: center; +} +.dashboard-info span { + display: block; + text-align: center; +} +.dashboard-info img { + margin: 0 auto; +} +.dashboard-table { + border-top: 1px solid hsl(0, 0%, 87%); + margin-top: 5px; + width: 100%; +} +.dashboard-info h5 { + font-size: 11px; + font-weight: bold; +} +.dashboard-block { + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 76%); + border-radius: 3px; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; + margin-bottom: 20px; +} +.dashboard-block .dashboard-block-head { + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border-bottom: 1px solid hsl(0, 0%, 76%); + border-radius: 3px 3px 0 0; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); + height: 40px; + position: relative; +} +.dashboard-block .dashboard-block-head h5 { + font-size: 12px; + margin: 0; + padding-left: 10px; + padding-top: 11px; + text-transform: uppercase; +} +.dashboard-block .dashboard-block-content { + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 0 0 3px 3px; +} +.dashboard-block .dashboard-block-box { + background: none repeat scroll 0 0 hsl(0, 0%, 100%); + border-top: 1px solid hsl(0, 0%, 82%); + box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; +} +.dashboard-block .dashboard-block-content .dashboard-block-box { + margin-top: 0 !important; +} +.dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { + margin-bottom: 0 !important; +} +.dashboard-block-table { + background-color: hsla(0, 0%, 0%, 0); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 20px; + max-width: 100%; + width: 100%; +} +.dashboard-block-table th, .dashboard-block-table td { + border-top: 1px solid hsl(0, 0%, 87%); + line-height: 20px; + padding: 5px; + text-align: left; + vertical-align: middle; +} +.dashboard-badge { + background-color: hsl(0, 0%, 60%); + border-radius: 9px; + color: hsl(0, 0%, 100%); + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + padding: 1px 9px 2px; + text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); + vertical-align: baseline; + white-space: nowrap; +} \ No newline at end of file diff --git a/admin/assets/css/diagnosis_type.css b/admin/assets/css/diagnosis_type.css new file mode 100644 index 0000000..a22c8fc --- /dev/null +++ b/admin/assets/css/diagnosis_type.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage diagnosis_type.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/diagnosis_types.css b/admin/assets/css/diagnosis_types.css new file mode 100644 index 0000000..93f7f05 --- /dev/null +++ b/admin/assets/css/diagnosis_types.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage diagnosis_types.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/family_planning.css b/admin/assets/css/family_planning.css new file mode 100644 index 0000000..d9789f3 --- /dev/null +++ b/admin/assets/css/family_planning.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage family_planning.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/family_plannings.css b/admin/assets/css/family_plannings.css new file mode 100644 index 0000000..9ef7ffa --- /dev/null +++ b/admin/assets/css/family_plannings.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage family_plannings.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/foetal_engagement.css b/admin/assets/css/foetal_engagement.css new file mode 100644 index 0000000..f50b698 --- /dev/null +++ b/admin/assets/css/foetal_engagement.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_engagement.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/foetal_engagements.css b/admin/assets/css/foetal_engagements.css new file mode 100644 index 0000000..def308b --- /dev/null +++ b/admin/assets/css/foetal_engagements.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_engagements.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/foetal_lie.css b/admin/assets/css/foetal_lie.css new file mode 100644 index 0000000..bc01698 --- /dev/null +++ b/admin/assets/css/foetal_lie.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_lie.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/foetal_lies.css b/admin/assets/css/foetal_lies.css new file mode 100644 index 0000000..df76e4f --- /dev/null +++ b/admin/assets/css/foetal_lies.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_lies.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/foetal_presentation.css b/admin/assets/css/foetal_presentation.css new file mode 100644 index 0000000..3b76a26 --- /dev/null +++ b/admin/assets/css/foetal_presentation.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_presentation.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/foetal_presentations.css b/admin/assets/css/foetal_presentations.css new file mode 100644 index 0000000..c06c54f --- /dev/null +++ b/admin/assets/css/foetal_presentations.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_presentations.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/general_medical_check_up.css b/admin/assets/css/general_medical_check_up.css new file mode 100644 index 0000000..42fc41d --- /dev/null +++ b/admin/assets/css/general_medical_check_up.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage general_medical_check_up.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/general_medical_check_ups.css b/admin/assets/css/general_medical_check_ups.css new file mode 100644 index 0000000..79c9fbd --- /dev/null +++ b/admin/assets/css/general_medical_check_ups.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage general_medical_check_ups.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/health_education.css b/admin/assets/css/health_education.css new file mode 100644 index 0000000..47500b5 --- /dev/null +++ b/admin/assets/css/health_education.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage health_education.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/health_education_topic.css b/admin/assets/css/health_education_topic.css new file mode 100644 index 0000000..10cc0e9 --- /dev/null +++ b/admin/assets/css/health_education_topic.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage health_education_topic.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/health_education_topics.css b/admin/assets/css/health_education_topics.css new file mode 100644 index 0000000..1fa3fba --- /dev/null +++ b/admin/assets/css/health_education_topics.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage health_education_topics.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/health_educations.css b/admin/assets/css/health_educations.css new file mode 100644 index 0000000..57d250f --- /dev/null +++ b/admin/assets/css/health_educations.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage health_educations.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/hiv_counseling_and_testing.css b/admin/assets/css/hiv_counseling_and_testing.css new file mode 100644 index 0000000..92ca973 --- /dev/null +++ b/admin/assets/css/hiv_counseling_and_testing.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage hiv_counseling_and_testing.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/hiv_counselings_and_testings.css b/admin/assets/css/hiv_counselings_and_testings.css new file mode 100644 index 0000000..726bbbb --- /dev/null +++ b/admin/assets/css/hiv_counselings_and_testings.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage hiv_counselings_and_testings.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/immunisation.css b/admin/assets/css/immunisation.css new file mode 100644 index 0000000..ed78ba5 --- /dev/null +++ b/admin/assets/css/immunisation.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisation.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/immunisation_type.css b/admin/assets/css/immunisation_type.css new file mode 100644 index 0000000..c4eae75 --- /dev/null +++ b/admin/assets/css/immunisation_type.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisation_type.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/immunisation_types.css b/admin/assets/css/immunisation_types.css new file mode 100644 index 0000000..2272a25 --- /dev/null +++ b/admin/assets/css/immunisation_types.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisation_types.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/immunisation_vaccine_type.css b/admin/assets/css/immunisation_vaccine_type.css new file mode 100644 index 0000000..946da32 --- /dev/null +++ b/admin/assets/css/immunisation_vaccine_type.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisation_vaccine_type.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/immunisation_vaccine_types.css b/admin/assets/css/immunisation_vaccine_types.css new file mode 100644 index 0000000..4e76c45 --- /dev/null +++ b/admin/assets/css/immunisation_vaccine_types.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisation_vaccine_types.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/immunisations.css b/admin/assets/css/immunisations.css new file mode 100644 index 0000000..a5262f1 --- /dev/null +++ b/admin/assets/css/immunisations.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisations.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/index.html b/admin/assets/css/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/assets/css/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/assets/css/medication.css b/admin/assets/css/medication.css new file mode 100644 index 0000000..fde0c0d --- /dev/null +++ b/admin/assets/css/medication.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage medication.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/medications.css b/admin/assets/css/medications.css new file mode 100644 index 0000000..3296b23 --- /dev/null +++ b/admin/assets/css/medications.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage medications.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/nonpay_reason.css b/admin/assets/css/nonpay_reason.css new file mode 100644 index 0000000..7a1e619 --- /dev/null +++ b/admin/assets/css/nonpay_reason.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage nonpay_reason.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/nonpay_reasons.css b/admin/assets/css/nonpay_reasons.css new file mode 100644 index 0000000..3888658 --- /dev/null +++ b/admin/assets/css/nonpay_reasons.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage nonpay_reasons.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/patient_queue.css b/admin/assets/css/patient_queue.css new file mode 100644 index 0000000..7d41f85 --- /dev/null +++ b/admin/assets/css/patient_queue.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage patient_queue.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/payment.css b/admin/assets/css/payment.css new file mode 100644 index 0000000..d89e4cf --- /dev/null +++ b/admin/assets/css/payment.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payment.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/payment_amount.css b/admin/assets/css/payment_amount.css new file mode 100644 index 0000000..8bec62e --- /dev/null +++ b/admin/assets/css/payment_amount.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payment_amount.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/payment_amounts.css b/admin/assets/css/payment_amounts.css new file mode 100644 index 0000000..6bd6166 --- /dev/null +++ b/admin/assets/css/payment_amounts.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payment_amounts.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/payment_type.css b/admin/assets/css/payment_type.css new file mode 100644 index 0000000..c1b3feb --- /dev/null +++ b/admin/assets/css/payment_type.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payment_type.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/payment_types.css b/admin/assets/css/payment_types.css new file mode 100644 index 0000000..207da3d --- /dev/null +++ b/admin/assets/css/payment_types.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payment_types.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/payments.css b/admin/assets/css/payments.css new file mode 100644 index 0000000..474fb63 --- /dev/null +++ b/admin/assets/css/payments.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payments.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/planning_type.css b/admin/assets/css/planning_type.css new file mode 100644 index 0000000..f00bcba --- /dev/null +++ b/admin/assets/css/planning_type.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage planning_type.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/planning_types.css b/admin/assets/css/planning_types.css new file mode 100644 index 0000000..2d5eb18 --- /dev/null +++ b/admin/assets/css/planning_types.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage planning_types.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/prostate_and_testicular_cancer.css b/admin/assets/css/prostate_and_testicular_cancer.css new file mode 100644 index 0000000..2ab60eb --- /dev/null +++ b/admin/assets/css/prostate_and_testicular_cancer.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage prostate_and_testicular_cancer.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/prostate_and_testicular_cancers.css b/admin/assets/css/prostate_and_testicular_cancers.css new file mode 100644 index 0000000..299774e --- /dev/null +++ b/admin/assets/css/prostate_and_testicular_cancers.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage prostate_and_testicular_cancers.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/referral.css b/admin/assets/css/referral.css new file mode 100644 index 0000000..4ca2c49 --- /dev/null +++ b/admin/assets/css/referral.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage referral.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/referrals.css b/admin/assets/css/referrals.css new file mode 100644 index 0000000..85d0f3f --- /dev/null +++ b/admin/assets/css/referrals.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage referrals.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/site.css b/admin/assets/css/site.css new file mode 100644 index 0000000..4852fc7 --- /dev/null +++ b/admin/assets/css/site.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage site.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/sites.css b/admin/assets/css/sites.css new file mode 100644 index 0000000..1c19ebb --- /dev/null +++ b/admin/assets/css/sites.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage sites.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/strength.css b/admin/assets/css/strength.css new file mode 100644 index 0000000..ebb0137 --- /dev/null +++ b/admin/assets/css/strength.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage strength.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/strengths.css b/admin/assets/css/strengths.css new file mode 100644 index 0000000..7722210 --- /dev/null +++ b/admin/assets/css/strengths.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage strengths.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/test.css b/admin/assets/css/test.css new file mode 100644 index 0000000..efb92aa --- /dev/null +++ b/admin/assets/css/test.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage test.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/testing_reason.css b/admin/assets/css/testing_reason.css new file mode 100644 index 0000000..8c178a3 --- /dev/null +++ b/admin/assets/css/testing_reason.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage testing_reason.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/testing_reasons.css b/admin/assets/css/testing_reasons.css new file mode 100644 index 0000000..eb3ff89 --- /dev/null +++ b/admin/assets/css/testing_reasons.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage testing_reasons.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/tests.css b/admin/assets/css/tests.css new file mode 100644 index 0000000..e178c3a --- /dev/null +++ b/admin/assets/css/tests.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage tests.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/tuberculoses.css b/admin/assets/css/tuberculoses.css new file mode 100644 index 0000000..c430365 --- /dev/null +++ b/admin/assets/css/tuberculoses.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage tuberculoses.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/tuberculosis.css b/admin/assets/css/tuberculosis.css new file mode 100644 index 0000000..3fed89b --- /dev/null +++ b/admin/assets/css/tuberculosis.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage tuberculosis.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/unit.css b/admin/assets/css/unit.css new file mode 100644 index 0000000..d42991f --- /dev/null +++ b/admin/assets/css/unit.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage unit.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/units.css b/admin/assets/css/units.css new file mode 100644 index 0000000..b16b8a6 --- /dev/null +++ b/admin/assets/css/units.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage units.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/vmmc.css b/admin/assets/css/vmmc.css new file mode 100644 index 0000000..675c8d7 --- /dev/null +++ b/admin/assets/css/vmmc.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage vmmc.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/vmmcs.css b/admin/assets/css/vmmcs.css new file mode 100644 index 0000000..931de16 --- /dev/null +++ b/admin/assets/css/vmmcs.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage vmmcs.css + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/images/icons/antenatal_care_add.png b/admin/assets/images/icons/antenatal_care_add.png new file mode 100644 index 0000000000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Ftivd@fp}i8R0YV2#OXkM0!Az|Ib}b$wbnV z(f;NPq5RxrB-pnkJ=>;6pGgj7$SX!pD6O2naM6-8CzO^vipsky41&3q#JZrH6SU*wx?On_XCe2w>+S63^@k zAy)BwmKbU?AjmeTz>lNGE_I#rO@TFaVVz>x^FSB1*aHjqoM>!O}Q3!E5c)Jam1s(@m)35)$n1+&ifs$22b=kPhZzycc(N$SI6$Tq0R9;5plXU`9< z9kkhO_^es8G-YLFDj4_2ckS90Xm4+iF$|N+%gbj>W-||gAr23Dj#=R!aSkx%2Is+J zhM~f;(0oD8Bz280M}pCnnBdjWB50s+Rbc-m-r}f<#-Oi<97|L~4JUxlReJW8Q8sM6P3EA%H?i&bShJ8mJgK!xd{xK+xVEawO@ zDJ^kQgiPW|;1!}|voMt26!i}KhJq~M!x&A zZy)0Pz$3;}{qZ=~3 zfB!ei*MD6A02x2)%p6v*uR)}8c1|XJsF9Aee~Wn@>?;o&$e8}4!iBQeh(Lf2j^n=3 zn~mx+UowEvs*Q6mTforDWZt!U|;D z!DSmb@kbKv$H!Ly!13|z9Qg5Da2x=~$N%v7{{jpE)A+FLvFpcw00000NkvXXu0mjf D?2lja literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/antenatal_cares.png b/admin/assets/images/icons/antenatal_cares.png new file mode 100644 index 0000000000000000000000000000000000000000..b6fa0827cc132ab628fbd81667ee0b5007f921ab GIT binary patch literal 16919 zcmV)&K#aeMP)`^0t$+PsEDWth>9Z8oAlm7 z5<+_Km%Cgqd+k57WZ{hX|A{6b!ux!NJ1$pt=Y3zDH*YX-pYCbG?(_xRr#nmc0dSAg zeE{6!bRPisINb-pJx=!l@E57Nx`qXb!{LyG$z*mF78N_YckAN4)7SM+={^Ad0u>dP z5E0>F8u&EM>-CDXTAle~+GV1)wpQqNxdG*NIraMblIp6O;#D6nv)$?Iy%o9-fWJUR zMaBGxi15}9hhwzQ=XX2w2V4#ZkQ|btC|8xXPIt1nsAP}TVme!| zs}t}A{7NpD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k|YR-Ygsyty7qKEB#)ikn~fzu&yLtA)QQ z0Bpm|vbu1qyYA&2`RKQ3^(_Lzk-9~AD-?O)!j*+n)td7Qw*v?Ge*z2u5VXpLVr(|M P00000NkvXXu0mjfi+Y44 literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/breast_cancers.png b/admin/assets/images/icons/breast_cancers.png new file mode 100644 index 0000000000000000000000000000000000000000..aca58bad70805c71233fba98cf110a1f4d59d777 GIT binary patch literal 13216 zcmbum1ymbd*ESr22bba!f?IJd?og~qf#O~?XmJQ`MT@jJ#T^P1C z_|N@3&-+HSHzV^(TGZU+=sf-7r0s#O3JXIA1ou_};KVK}2 zr{7*F%Mkzo&B#H|(92LmUECV#^4!t}YGwP}*TwCr9{`Y$_I0zgcCz&XTiMz>xJp8f z+q)oO2OCLSgK6?dr++55&JQ6l^`MJsjM;9H6e?e=serpx$1R z5Xe(M_`f`HansQFZ+KVF|HSJlay-74ZajR?d3ju1c>bq`rgspscr z%cEoK3HA1{wpDy*>*~e$KOvri`Tq^@FX1OC4GnQ^4_i-Lk9W2BQWWIl z6BFc>73G)b6HyYA7vL2V`yc8GP-}0OCv*Qx-RA$Fx|WB-Q&w3z|DV8!Ydj^Cjir~R zf~D7!vroAq#LfG(@#*pLiVF#d3yN{_@`>~E{%e}S690~pii4*Y)Wh$eng7q+>)N{i zyY=r>aCZ1t7a07n=@YlK{wFCUA)b~`k^T47{8yL5|84}IM*cUr&s*Ck=>K=a{})R< zp>|$AmL9gU_D^B|FZRfJIM~?Rg5`CE!E6Q&t~O8~Pxk-SO6#|luJ*Q1yyf|afB%FF z!t)>RdHzZD|8ie~=l>QUiGK;fuzf=`u^?a8Of*jne7yW+uabBha zu1c~yG{@DQ?5aPdq%|;Q*7znIsL>ezp-(hbC4JGr`I7lduE#LDLF$)ukMyc)y~=~T zFWl^3H&k;5t7y_~6dA{s_CDpAEshQ`n()AVP4vKh1A zm`0+wIFoD?jWBF5lPi-q#Z=hBRq>;OXS!SHll~N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zeu``Q&7qI}Tf(!q1lY@RQH}XG){gcLf7>hW4IEpNI8Mf{Y>gb-G!Bk*#>In9r9ypZ zlopfYLiKzFI331-6n06<%x;`SoeEmtyK}G438ts(v;*Ej`B#;n?xUc+egAD&XHz<@ zyt8k~@74Px->h8Y>^3)+Te~(ZDS00AWabLj#h=o5XVjkg(!!vLP}~r?L$Rgr3at0- zPxq1K>yh|Oh~6=z8~@zr-gXS1pj3aU%eCQl9OR;T@b#5e$hn9VpX8_Do{I%QNBUiC z$c41jDi4j`_W=S(H=h3u=FicxM{d*5ki|jBPl?y@P#=@Ho&g%Yux~dS^A}T!BQz{6 z$x>YLt41d&KSu2pGk$;vcK(>#j+^zr>8g7S(1azRirrQypP$$Hc^(D&=R6+^DL%{( zT!D+weI7$$~Bc3LlgErPoa-2^uE4z zlbs7Ui#`wM+l^tk=M7Q*rx5ynHvG(h##y zBcL;5Fa6XsJuy+#?sdTK%^gSP?+0MlEKu^;V!AHxp?jQkcUP^bVDc^g8%oMT6CcGuzZkcOUOOu&aUo^)YLfJD_YHU zXr~)`*ZKZqz@?J`c^UncACYWvN_T5o(3-Sgw5y?LKf%Qv&mE=YJtff^spKP7GrhES z+Thn&ApUh{M=o7v$c{h|&AGS2J|KvtC&)3sU@S#x>jX34IhM0AdT9gcL2Rqk(-Uso z3WlFA1Mv9Wb{}XRw`vVG1iCJJ@z;8d+2e7WQ{YIo6Myv!+FOR6Rqa~_r0vRT tnJ|H3?P^a7<4$q@<0H8RU~DnDO`saP_@5VRR24N9YUM1#{x2L%N;v=k literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/cervical_cancer_add.png b/admin/assets/images/icons/cervical_cancer_add.png new file mode 100644 index 0000000000000000000000000000000000000000..fdd7a941f1020f95548bd7306d99b855712bd2bb GIT binary patch literal 12687 zcmbt)1yoyI)9y(K?p`R80tHHOcY=FMaV_rd!GpC>ij)Gy8%nWKpcHp0?pj<5v`BG^ zOK#rx{l0&F|GKi)y*KNeP)RQvJ8^9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a=Zjz(hOo z=4b_;n3I0y{aEYtvG&1Wb8oU~dm9NkiQoN_Y+rLL7H_jFi*rA6O)!zlz++KXrzjkv zQ?wrr$>J_E@@^XvF?xK z-ofJgWr;<5V#nv@>wg5(e@e1f_w{r=(R1`Gq+v& zV#3;99%q_Z^M$Yd_g>XJrV+x!QeUML*{&6<&Wp*u%{>Uxt62LvEh+xT`pFw9=h2kV zH(6P^IRg@_X&W^sUwe>^uq~&^-V^Z=i!v_UBdIK;>nL)5e8H*Kr#3LduPS-m3>oZA zVP7n}fE`}1NHWRtNWuTjqhyKtP}qB0M=@8y@}s%ENw$m#VjB3+s&ckb5|0t@<(i}D z^=y^Lal>0)KAqK6?R};t$3yr7_B3!zQ{PalMVCw(d$F-8CqKhWqf`j$J`KQZH# z&+o`e4IB350v6BKaVs8*xC5kt>6xVdpLGB4xu?oY+LtbQHck5DR5g=c0mKHEI@+Mp z$6IQV*7+lHz1>d9b00|K=f7KQ`tbO;Of6ycrux`t0?WpSA})N-UcF}4eu~Hg!94bOM&PX zM18b*6I8ZM8^AG!C_LnS7!lEu3g#vuaJo>YE?9N!*`y*6H-ReHKEO`84TiL(AHJIa z)Wa#jW0zevACnf&WfusNR45%tTQ7D(Qi1;5c8%U%8 literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/cervical_cancers.png b/admin/assets/images/icons/cervical_cancers.png new file mode 100644 index 0000000000000000000000000000000000000000..18aa6973ac4ad417e56199e9b62a808e655322ad GIT binary patch literal 12002 zcmWk!Wk6L+5I&dgk}l~^2?6O2N$KuR>ArM#H%K>vbX`I~kQNZ>?(V#g_hZleIA>?S znVmgT8>ONogN{Os0ssKIoUEkU8wLMAkPzOU1HvX_Zv@#{R>$@2{lfnPB+iiI1pp|@ zHWCslD%MVJPOjEY&J=PI5){r~oh)taEdaplU)~oh^)CnbLU*gz;tG-AR0StBJR}M= z@fa{}5*-sIGM0QKWziy@Y9F?g6dcJ&VI*vPJUA9ll?5#thUHrw!j? zyZNrW-SOAv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&-Qzu6wQ*$YgoALVTv_K z)ru=oF=dCpNoSvo)o=3t>w#)5TwsV8N2;h=H9QXoaqux!2HR)OwV?3uB;1O)P-+LU z*~dxcxYvhIf#;ZSWszbwZ@*@%CVYw-6<Z>Srn2wCJkz;mr#Oo= z3u$8KVE}X8h$7y#iuajM-;MAJp3e&WFG^>Owak{QA9POZjn|uDj1P_jiy>29n?*u0 zj%%f7`RDBD%0|xpZiS_kI7L($Lk->V)GqDN5KN7(?9->7NMQQm16fK*{m+U& zt$H|{9>zCW?M8eKx35@NiooT@Em3to(M1rRi^k~E)4`_al@b0`4Xkpi&*s~jM8zzxWUYuRx+uWh|v%?!t2FivktaGx%Z-{<+x z4YqtYce~0YSxj}4rc!t(n@2zK0e6ErIFwDU=o(4qE8-FJqkc;|YS+}dAbA)8&K|td zARjwJmz4+Q-m+15e|5pr2X^SrSZ+7Ru%FHL4o1`Ote`5D+5I0?aniwOiJL_6D$>6Ww;n3pSn>%L1^sGe) z8~_@!ahI*In$736;4W-qYc)B&dZ%|#q>XIvds-5uM71%{9Di-40Vee@xIb|==b=pt z<5LUhfZa8zX%zMj%Ep#1T5s}&))i14WLzt%JrTD=dv>w#a@D&^;2Z}wAu@}u_F~C+ pj@v=&CPvcU`E67_c@4z`1OiY{KI;7V_jZX0kdso9tP?j5{txGX-@E_- literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/family_planning_add.png b/admin/assets/images/icons/family_planning_add.png new file mode 100644 index 0000000000000000000000000000000000000000..0c181a98e49c4e6a95fbfdd87a9a783db3baa91d GIT binary patch literal 33783 zcmbTcb95%r(=Hm@m}Fwx<{Q4TZ6_1kwry+TiEZ1-#I|kc&hI+0M+_ z&Ct;lM99R>$dpLZ#_*S^lBuDIhr^gD9|#DznT3jmvxck;kFlK%gW-Q<7~E~_|Di!Z z_ypYT4UMf#or#Q0e_7b_lU#T7kPumz@RO*s%QDH@iEFpg&&)(u@#N650o`;dq&CQL$jg`U9@fRaAH#hfxI9OQd|4Gn0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JCN^0&G9zcm3kkwDBQA^&x8WFPYxv*+kz zVN#A@_;_iE_Ao{Rn~lwQcr9Zs#~MJuuk}9uM+(5n$8Ya(k~Z$70GxcB6o8YD|Fw_* Y4+n%ZnkPkMcmMzZ07*qoM6N<$f}^fQlK=n! literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/general_medical_check_up_add.png b/admin/assets/images/icons/general_medical_check_up_add.png new file mode 100644 index 0000000000000000000000000000000000000000..116ccf806b0a8735b239c80c858fc3eaf2481cf0 GIT binary patch literal 18575 zcmbrk1ymeO*Dg9RgADF21Hs+hJ;B}G-QC^YA$V{P?hqi5;KAKB!3i#x_xry8U;kNG z*1G4+>gn$4s{Pd7Pwl;{R&_@!DM%wD5Fh{m0OXG{5-RW4pnv}Gu%Os0Ay;d zrsbw3FUM!m`=2q4+J}%~}J_>54KDMU3X5_*`2m)Sw?*R7ZZpIKVdpieLJ}*J?f8p}I-~aQN znH=)3CT_NZh0iW?8WHd`r#jle`83PyPCRKJGogqIzaxxG&XT`cM~Khf3Ju9mnHU2 z^78);@8J3$zTTN*_A+*2W@Tbwwzp^gpAxQak{<6M|551wQNmTt+sT|+#oX1=-Nn>g z(!<=r?Zf|scqjA!8{l7!-&@Jc^C`KQyPCUrn43vi+nFmE+nWoLE15ew*_ks+IGVaS zx-iNczu#M%Iyx{pIavM=!H*8EZpIF#<{u>l$={)vtgX%X*w{E(S-H7bBsnCdBso}F zdDwWx#aSg-CD}PSIYq@d|A+WHy1V_m;{PRX_Ww^@(Z%}Rzl`nvPhj}u-(Abh*v(kN z*zMiycdy}OWO+YW)mT~h*m(F@xanC~`B+%~HQ*3|fAb|{?fTA&_dh=HA1_cfcm8+j z-%ep?{jVwrlsN=I;^A{7)qQLl-&o zf2?Qz$Lased;#YF8$km9YVbdz0dCv<|-)P^{ z4FKOwQp-*CKgt9C9sVEfjV;Yp%#F>woqw1M0083OK1ztHd9D2E0SB46yEFTp^|aLM z&&&Spm7D5qsE0OYrJ+G6#$YXA{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eWv$a}%g=!k{1e_b{POq-yOWaG4q~X)sQn8Z* zS@JAU%vDL$%_(des1Lm>tVlsn=P*Nnm(gz6t8+#&0XMWA;j{5t(lO zm-VTIsrhN*WWeXV4^Z5z65(*2|L=J8$8>n_-ZZpY7Dw0o^f=Enq6i{lJZKQPGNN#r zLCg)R2((CxtNsZJs+y>{b8dAFo}8ZP#fI6 zMgVAY`|)`^I+46L@$ope(8L)np}gNQ&wMfRvJ&2bE|7B`8Hy7KkG=tjV@Bj{Ega} zZasc-0uVe>eh$9}U)^WKL%rIVnGB6bdgK`TAt6-q#2bljve$AgsfM4vVy(lnTd6Nr zDs8(}rXCzW4&Cwr-vVojHv$m11mLGe0O&zMp{)NTfrxSLa!dWo0q7I8t$fO9v)dph zuaf|*h{f5C@2aYiRn*5j4{+&ef(bm Z1^~esYK+j2hQ$B?002ovPDHLkV1gsQ)?5Gp literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/health_educations.png b/admin/assets/images/icons/health_educations.png new file mode 100644 index 0000000000000000000000000000000000000000..3ea6034abb101cc05714953e997c364b6186de48 GIT binary patch literal 32210 zcmV)qK$^daP)-^`>0C=7M{22hR^PfKh;C2441?Z) zO05Q+(Ex+pLJ(BovD@IEUBJR<0H&%Y*|K3>`+I--s;?k^8r>G!^-0PxgzK5kF}-_okf z4V7{^n@VNlm8v48Gnld*%yPa^*5@-BEvdbv)H;;Og~+FRJ6qtNoJER}pU>vO5k{?2 zg&1s|%?wmaP-}ItIBhs}=mKh)Os#L*md7%wkiV|cjrih1AfL}=OEpa;S1Rjs#d57! zEG2#3y0W*0Y+Rn(jHFxg!&8V%ZVxu~l_e_{JSe0SBAj@fGp08f7J_N~d;i!UW&VU!gbDAalc zXQrT2Tz=GAtqM*KXIO(1Qz>j4?8Ang8{waxK`NR+rC3EWnTB4aA@{3bw37AfvszhsEWQGp1)cnw<@t zddpqESbL>o_Syo#5AVF*rYSyNF6Izgn8#8iic-GFfg~?5qBWdUl}dqJwu0Y3H-xJ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I{kXn>6|o* z#KcXcMb~&uUnlYd%;p$4rK)!<+4ZN}3BRFjis@9t2v@0ERujHt_&D1|m)A{Ac8l14 z@gaHnI!I2mAw#2@Dv%;BoGnWvo3h4DA@zncnijj0Js2Cu0_I1r01L)%(pj3XE}pC4 zfGjgi)BfEdTmVqNQ~}ds5UJf8&=pfL4%1q4|D@0c3%8u|bO~djv)FA&3!T?v&`4LO zhA}yY0BbTod)F`Qe~%u=#Q^^akL6j>r9SU}`+8pZ```6EdGv-obkXW0)iGw(w4L@e zk_C%Wm%s;J#c*Xt;VyO?;dTX3g9p>%NKm_~3B{dD z+H}1^$9s+cN$2@*JuD*nFUbHeKmLn6US@zl@W;yx@CW{QnF0R5A1^b&ANb>C2KWPi lyvzW9;E$IX;1B%q{{Rp{uOks$wYC5N002ovPDHLkV1jc{D?I=J literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/hiv_counseling_and_testing_add.png b/admin/assets/images/icons/hiv_counseling_and_testing_add.png new file mode 100644 index 0000000000000000000000000000000000000000..4624cafca17078215a34213037fcad07568537da GIT binary patch literal 18517 zcmV)2K+M01P)3za_@J3rAIOr>0*4|9UbO%?2^O4u*t<@cwd#x$PM!&=#=X7v zL-XGC&#RZLI=kpvDCGsmbD0$Ie*xM$5N>B~&;&b<8`JNqCq< z|Cf&cmv1II(~T7HA^H-plgI}@Pyw`r?2x4Ws}}(0Dy!Zd??^|BTSg#1G!944T6*eY z=$u*qx{n<8_ZJ<1)arAKz7<&flCbzG>P!AVorkUm`04~egA_MTF_*r#B)O1(st*e5 z1|gb?$4^lXKezgIhb88BeC+g#zh*^|^BteNdtCZUfeqj?@jL(jp(_GjbpSYBU3PkB zq-miwUVzf3VJNH}gi^5tuZtf34kcI)BI&=M@-Nq?yPH}($K{;Q=^GGV4m_&Hr=RoAA}a}9Pef)F z?&o|@QbDQ-0V~0INFA@Lny)3$*|l8mI;&VH0PHD&q>I~Ujt4PE)6ayZZx~5gqCETTa%OzEP3m5k>NZ&JI;K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YGc=a07wr2Y9fga zjR24^IYzH<%E1%PhCh9*_eUSu(R+XM;P3zWAJ={2yD)=}HDderPZxf9rd2F#Cxfui zGY*CA<1E?O6TnBUHVlm-xnMs4@MwZ~vNh4ztTsoPL#!wIq2C%^aoNxf?-_M=JpZm> z6$Q+|<7wEk_KMm$O#>}S8i>XaNr3tL0YG{j^oCGfyxwSxLvckv zjBgv-_QA0qp1aBF8-u<0xC2)H<8teF?^e+ipz^b^M>os#GTJw4a|9ao)SQG8QTKTO z%z?(%+SZ0paoaeIKd>qD^}_Go@tn0~6TAiv1i|gUv>tkYOfez1aTvz`xfNA`2})B0 z>cgqlS|!%7&jTO|X1jqdVBxk6;+o;xF8ovRiAUizbo@8mbHh#6L!XVPCX76|5pvHD zg5DH`NHSX6F6!F$c>pX{I_8L#!|=nE|NF^b!OIWN&cx#yxbqu-ai6(1R?wmEmX*9s zUbH!>)QQ;KeI5XfkURnJ01*G=z77Al@oMXj*Y55B%}hG35`X%{`WrkSkmczkk<&HTrmdWgoOcP1imR06F5>g?;JR0z;!8hhLrD=Z?P6 z=)?}HSK{W31psa9y8qby$6Dyw_66~qvrJ3L$AmHa6_K_(C_9)o9o*jD4ht79+)uGR zaEyTa)ZMV<-%f$!qJM{Vd;I(6&6_vv-~PV<0{}GyJ%$s0b@~7R002ovPDHLkV1oXS B7<&K! literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/immunisation_add.png b/admin/assets/images/icons/immunisation_add.png new file mode 100644 index 0000000000000000000000000000000000000000..d7056b14f094471b2ed7b4d74a0fc047fd41f886 GIT binary patch literal 16668 zcmV)*K#9MJP)L<@tVRX8Ucs+v}Z! zquNd&uyOHtRv#&7tuLc0n`08h$eRhY@Xyk2n2Y>p^Sw1cfp$cBL=6_S<-EiAKxarYQ{HPp-HcY?5|I`R;~Q_7sv+1-Ix1E zxLqk1fPzo`%rnpIFk38qZCwL@E;pZFxoWjz;>3vyyT#v6TmzumRR88TzuD2)*vQv4 zGzrH4@Z*(kH2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g(U9&b&5f_T3+qlxn;nxPvl<&$ZG* zOb`H<4;XI0u+!Em+i3C2PWrQfyA3zvA882vK=3C7!N(<~W$@7_O9=#j^#ehN*KP~~ z;L-rW<(K`l21q&kr;}Z9{>mt5BjhADpkk67LGUJmU~O?}DF=ePW^o{R0nV>!1O!45 z0GA#JPCwV+4+OIx5PTr;v;hQvHXsm45CkvHnLT?Gf#AcXAHkioX8i^4f6@CofpQ-~ z09+;@_>0Ak^noJ)5CUZ(Y3C^xLGb)N^X6^RRoB3WAAJOO%$)fK-v6@qc>=%W)Vb#e z0dVE9fvFwW;Atmf;4XNblb!wIefQqGMPE}3A1(bDK``reuO@K8`4vcB5CB(}K4={} z`UAlhAYuqq#w7!L4j(%BM*@MarUpT@=YOL+(aT3@ihdv1s~ryvdj;L6qqJ|LJ{2}K_eoDjIfiDtJ8LGbdu z_slz_)mIY}@b8#4ixNfmd*6o>k3j%jxj<;m2tGD2wUI|?y^NkB1nZH*ho8Cco_mfE z2tNDlbN=0T-9;hdJ>K)h+@;al8@qPx3Yz8e9R322@1=I4Zt5qba&Zif1RNc#}2!KzN}* yjsTp$J|WOmRN71Z`a()6kH;H=wjcTb0t^7_8X8Y%))!#_0000 \ No newline at end of file diff --git a/admin/assets/images/icons/payment_add.png b/admin/assets/images/icons/payment_add.png new file mode 100644 index 0000000000000000000000000000000000000000..4224ebe11781fd4cfc2d997f985725e92e6f0bce GIT binary patch literal 22492 zcmV(@K-RyBP)Apwb){FY-n(!A@4xrHsvZPFNQA_x!9!J7cT z8C`yS`##*ux8O1ZTz*_;fXk1|3~>2znE@_8zWpBlGx?I^IDc<%0DD2M5rpLL^L3hQ zeRd4+_xy%@Ti=6kcN0+Lt;t*U+x1>J&m<7^w^fb5`m6ub4M~!GNvZ7IaF{$e7{sS| zA8prlJN$9vdG1D%sGZ?(*ilL?@p}r}FZ{xPU3DkrQ&56NaP%M>-)41Fy z8Z7cTga-~Bn7-o3v6uDwB8dIVRt3Cg25OfM5BQpZeXwVE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xD-9#2qb~?_b^v?|O zkqg*T6SU?&K76G6(T(#gy)E{?TdWw)-hKCp9&hxa5B-R1L7r(KQMOkv8=E#}Cx2*d zkeWhQS5^auqJbueWyqw;=lPCeiM`5DbJKp}j{G_+H*Yo}UU4J-F7Vm$O zezG7e1n-~y*`xnBytX`_ti}~#0+P_L`y7rhElzy2t+mmklK0q~dz3c-74f9l8&7H+96rW?NaE6h)yt1>4FljY>yi7msrT-G zN98@!N16DwbZc0~5`YMKn_!XqB+Ouk-2vzgMe1Fr9T$`BAPmk=KT=(8{r>W~Qx{G@ zp6N;=6cFD}ni1$S1H5z?0K{G7?N!y6O}xJG{qx5P*Oli{wxK#nfi*%AgR93F!G>tD z4be5jpY+)!=<@SgeZ9OKd@)&D`Ruv#tAll{djpi%GLpaZ& z8@#-7!{o~Bat+TdON; z7dK-{woQf+<1-(nr&$R3G6Q_;8Nfa!dE3w19DjSEP%q90SCl7;M=En}jbV9_mAvOV zS(>4$dWia2Hy?^@93$f7MGe`=VaXc)jB(*mhc?*pUupVflLml@ziV1UbyZ=Z*I`4(Je rfXk1|3~>2znE@_8zAYdBzW@UO|Dhn@pynwP00000NkvXXu0mjfd8zSu literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/payments.png b/admin/assets/images/icons/payments.png new file mode 100644 index 0000000000000000000000000000000000000000..46da00656756ac303aa47d1961e437bce293b839 GIT binary patch literal 21674 zcmaHTRa6{J*EJd(26uNDAP|DPI}eb-eIP(^cZU$%CAbr0aCevB?ykYz2Kjg|{@Z`` z>gv8MIj3r$y?1x`e=4#Vs3fQ`FfbVMa#HFa&w&5k$e%viJ`s~q7#J!Tc`5O49+{^d z-qq$$u8R*(9rq_f=LHvM?hm(P_1`~v-ll{`(SdhmZ9)vhs;|4vy9<#K8BmyU<(N<< z=wVS&NhPCp_@u=VnNXFg;TvtDz?VeJGnU*1#8%wG!d2(l+2@@XH*2w*wEi#m8;6Z% zQ5Ifwp&o9FrQXnN=lf-gsyn^di|5L_;HH@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OPTK3`LiYD3GHA zQuiPJSb~=p#ixaT3u(KYmUFdL!Wl--Q{O2wzE4#M`SgjSbXSOAFitkrW>WDga6@b% z`!VP{W%wW})ch7dKFavkdit;>4b{p`hv30cURdNfwgQ%nhyt}b4(WgO&4SB>7OSWQ zxU?L%MzndY#Wk)pktA4~7zxh@#{76H35LMPu2!uv$~H zPfinNmjZ7$UY*pl=K=8CuzH2|o}y`qGuRuu_o)bxEq146PA&GYYRl1H-8eDjRb4P% zr$@Nly{iStWBx*9;a6J0m-vtCSspKywY1ggR0l1hF6H6r+_f~5qLJN##eb;r2D@;= z->rNR*p>fx&MRn`r{IG$S1`L!CsD$Zz63 z0CGA=XmJ`63z0$EZGv+b9KNx~1mll`X92$4Y|I;Hza+mderYzr9M0#!&6_(O(#|u! zsv)Lcu1`X<_Pc5D-&yxUs#x?wI(>eS1po+e*Nwlin3#PP6#sFPZQ_<7pch$Jvch?F z3sD!+yNVpEsc3}aoD6i6#UltJkGhWxMJEbvbHIZTI1*AJJJE0*|4{8}ysN|InJ1-c zWKN=P^T3SPVCTCrB@3yi0LP;QJ9C1ESJdpR8l&HsVHmGfSiEX`smVp)F9b@`;_%fR z1y@}pAY~)E_a>>;x+NN;w!@q0kFQ$z^CFU# zMMl#PhfOr6iEax5g&FR>(L=N>c|D4`n*!y;MVH4$j!#P>CzU4DDAK-v>Aw=V<~q@E zBY#{`EwB~KtOXngyikg=gV;#p{qYz-k;2tL79s&k=i3Fcs}4x^8Fg%>Q$?s!kT&#F z)LrY6nGwDc}fp9FM2x zs3?M$tQ>yygv#{1HoRa5=_VOI$WU${Fgy~hSPk5YqNw|(!H|2uf%KtG&mu*^jENynaPw#*FgUJ!#X7b*am4F_HoI0!>; zEam)s2{YauY-?kS| z9X-7N(BYS!I;g9v=n#0Okdt{WGnkXB!**I>BLDyZ M07*qoM6N<$g4Euv^8f$< literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/prostate_and_testicular_cancers.png b/admin/assets/images/icons/prostate_and_testicular_cancers.png new file mode 100644 index 0000000000000000000000000000000000000000..3ad91662fb79cb154cd318d4525f8ec34760b936 GIT binary patch literal 16940 zcmXuKWmr_-_dYxf0}MTM!_XZf-9v-Y4N?MFi&%M@Od({q8RhGjB*9qslT9U<_% zW$0Kf7n}wqe9y{!=a@Z01Aa4sblXAW6?5J~^2xAPc1mpjbZr5pSp<#&JQW^Xp3Dv7 z2<`Dt$QpHA{9Q{c=Zfi^3L*imij0Wmd6&rD(ZT*ki#Rj6W{=P%!2n~qx6D+2mz2QO zr~r;+U1S6Sm1<7j#L9n1AGZSIEq3xLMemm+l9kv30qH37(TUM);)-S0EL7+~i7>z} z$?kcW1;pQ%u=J559|nBJilFyy zW&lT42L^B=TAj<&IXwKA3XAo>9j82RXx?FX>_b$$;Dp6xG7NC9<{CxW#`1xoB^g}n z3!VPGh|?1F!u9_zqD}oNmdyJDdKrHMXeQ}z`RR19LbA(!KLQ0j(RuYpMaIXON2bvs zK8GNHTWS)tWQCm)X6HIccdNty102`3(a$b1{Gu)i(q=}MsAzX?KB32|7|=oJ)^n5b5dp>q!SfK)0?Ga5VkXePl0mJlC04#N}2Lel*+yTS#? zapMo5E5}L~1vv6ns@L(z34LCr{-2?hYsF^8ya13LN zwYgxNHR2DvS4LFSc|05wlPvJYkR&!YHekXJHkDeBn8X*TI3RUUSEmR3l@qYL$tac=F_Rtpy*zZXFf45>Hvh%< zKgigQA_wd4ai+yv_*-@EiY#Z1ez*t{h-Dl0QN9}^ytlVAE_mSN!vq-b=DnSQ1IygO zGT>L+p9N{UMCYjUpDQT;F$7coz{j7tJ!jLD?rI>SE+P|a56H8}mMEs+muoxkBV8jO z!R|rr*S1vc8y`)wGV5Hv#N?uAdjfF;)5-n#`t0;SA&TYgG?XNsb&~XM1|rCvcrU1E z9m#;AYB9p+L(B1q@fy2mTH=!V?C(nBNj5(_m*b+Lg(!ru32Ekec8Vdv8%{A-qyN-T zwfPrryKbFUs%?`fzsBQ_k0{}30GLB$(zyO&nz2am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YTZ%yp}p;vZHhHG>jpS<`EVAjbjoE@r?|I%DV2h=-bFlvj``@Vft-Z&si zyG8Wh;EuYZUcE+s{%n%tGty$e`x$rL%;7qMmBN5e+wP_e8>8cLyM>|S4ac$C{%Wd= zLmtmKI!uG0#&T4AtbNzNEer9*gcR1MFpVs}@&>&y{Plb^3^&eRRou+Lps zKlfSq`K~iOoMMII%3GYHWDXI0^rh4}*Yd!Br78MJ66eL8k@6h>z6=RR3d*y`#U@~i zFVP7vBVkRzM(1Bi7P+Wz;k=*i4caLbWn6)q6}Y`d3~Vq-AEX+;r{bCl8gP&*oWMfs zfUbOCIqg>aym6ORxP{lDv=!%9v?s;+zLm~0`i+QMmF))3xLX*b-8V+#)ki96MG>+l|ywk4$D^!Y%gGxKP3kq+o5+hK1()% z{=|@B65{yEqr=GjN0CtjhppTD#!%dzkO0X2V({tY{`^D314=&jUc+>E+bpeoS{}V4 zk=Z~vnqt#hCW!=lX4c7piZ}pC5ubt8u7;B*=K!ai3?W)+`|iIleXynM1dih}PZ_bL z3(6KYVJemQq0B+W|3W!$0E}F4CsF#JL*RubF3YL<{oCHO&EbDZV1i`Wn`=HX#qx^r) WBJ*VQPlN#g0000XW literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/test_add.png b/admin/assets/images/icons/test_add.png new file mode 100644 index 0000000000000000000000000000000000000000..75fabdff97b958ea88823c563941ac407e963ac3 GIT binary patch literal 16010 zcmbum1yo$mvM)Rg?k*t&1`Y1+?(PJF5AK5n9V`TgAi;vWOMu`W+}$05yW7YAoOAEG zZ+)`X_ui~Md!~1H{kprls&`j)SD31@3_1!i3IG5=my?xLfBS|0^F=~2vM9iw^M+u&4nm* zxRh9xoFu?j*0NqMU=1&2O*1cBGd^<)5n&WTPyROmd$6ks$kX1=0mAPoMDZ_N{l~h3zjxJyj7c&Qw87mtbh?|?4jgyO;n~f2~&dSEl!uob` zGqG{`ZSZm>^#qTunTg93YhcK>Qm+5)3hOv37E`c60#!gK1*w=;kU!LG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Q+iNepU)^4FgMxzmh>p?oZV@N-d#Y*FG+B)21&O11 z0OM**0ROPZ#Xpz=6>n}4bJ{p*c6X}0czn-onTBve)yaDPUk6{9zt>y9($p3=xHLdO zS9hW+GX9p$Im+`$(M*ej8z{rN6-Y#pB;vH4(D)q)K3R*0V68-$Ofss)GnZaVbT`>(|YZS&uFj5fyD~ zyCqm|ue{V(VeB_$BB04OwF^C# z8DDO$kC!~IL|>G%LeR-Ey>q`&q65Zh@(KFTwh=B#3KMt)M(HzcGORr=!GY+*>9GD4 z?=Bj|$8uZ}RoUfLBhT5+WXYYIIg>ppx8D(yUKNtRAE$}HYZt0|B@Tpzhv&fn^|0|u zvN7j0K<6F-`|KI^uo0qiwLre4!V;3WUDdaU!3QxqrKs)0PLDY~gV|40uHGqbUvs~* zV0%_k#1nc(3wq1Tk2A0B5cdH@ZiWnem%e44i{6i%p#wtXRBc(J1@!1MF%`r1*Re^7G!^Zze`an?U;)* zW!|DEy1qM4*iQpAd36DP_qDapS=M3sQ;GlmGw# literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/tests.png b/admin/assets/images/icons/tests.png new file mode 100644 index 0000000000000000000000000000000000000000..dae19113e23a2316057eeeb49d79972c5ff4d351 GIT binary patch literal 13515 zcmWk#WmuI>6Mjz6b?7cZq`UJF(kIyiR6qo=2;3z4|X+Q6X|4($(=e1YT@;3nRCn?EE>-f$cn4$%y z=r&6I;oBKhWrfM0M|@T!*4pvbpZUyI-?&lXdQf}o>68CS(rclix*k2s0Iom&TF!ys zljjabC}YV?rnT}fYo^T8k(MQ&cb()+_^AmPzBi_&B|&GoPZC=pza;cgyFQ=!5BT4L zg9kIjeDdy#<0U<>&b`hz$M=Ba_2dxk)`i2W1*@x5f za|w|@w9MB1YZ~HTMh6BAX2%yF=PP#|TE;c;E*iW(dip<{Yv>2QJ^U%fk*xYS$B+qh z5TSRV0#}Rg&EIM(|C(`kcTYBT!OKu%vUB2Ibpm4kp8LIhJCU3JaQFSQORIv%F$m6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K78p!u=QESu`2D`=D&Um~CYFG@0g^0{LKgv@xunWPMIJL=FnaJHZU80A-8%d%BTjE&fGd|S2m}28UUO|=cO;%900000NkvXXu0mjf7&QUS literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/tuberculosis_add.png b/admin/assets/images/icons/tuberculosis_add.png new file mode 100644 index 0000000000000000000000000000000000000000..6c43b9f54bf86aee96544d577a65faf2e19b465e GIT binary patch literal 16460 zcmbun1yE$ovM$=VyASRJ5 zZ^vq>RheI9Wo727tW~SSl@uhA;J?5F001OuDRGt0Z_qz)Sm@8s0YRe)002_iQccrY zQ(lhO#LkA%$kfgl$mnik|5*|eONpTGY(%|u4> zFA`@f0Wy()8YIz_S0WL!a|DubFtU9$VP;_=;pAjwVdvoFWMLp-WoBVzV*Wfhzp}9N za&Yppa*_P!MJ5PO!tZEm#;YR!?LUoumITNwoSp4?nV8(%+!)>180{R*nOJyuc>V!l zW&Qd|@zu%0*4fDYtF06HKM?=M5C=M$I9l2}TiV%@{DWy^Z0F)EKt}diPx4S zpsh3c|AhEd=KnXqzlcAnYNU(8maEOR<{10|< zI};b1Pci?C-Sqz-yP~7zr!^T_|DV9{%6}S?sgbjhxRLW`CqHe3<16#$!J@{(%*)En z%gja3%)-me{IB69;s3XGq%57B?HoP+8S(#&xhl}%-=%+>fVJhnsz^xwHEg^_CjS_N z0GX4~r$+xhB>z=q`M;~d&zAoU?q&h}g#LdQ{C|eNCkc&)rLC!*n-lH-Dy4~qk*zuK(_fkX@w-ZTAU;{Vlsey0DMg82VM z@IQRwlkeZ>K7H-e$(jD!%RdYM9VdXcpN%8$!6;Q{}4c4-?U zbD#>)$kfAO49E`v@Wo4ui>SG;p8CLL5tzFizWhD!F!wa`w2l5&_<}2)Vmk4dWIgfN zKkUkE7{Eh--V2G|&qy%{hHjWB@9H;Zi%$I%%&iMOAZpFLjB9Oz+HE7fX!(aNc5^BUKbzJu@2MQrq+mDp1sN*0e{~uR}V)>8zFz6 zwRoy-lnYfF>0?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#Bhp{&eWVN(H>p4X%2w1`}^3W^|Lpe0%rSo*Fw>vPHQg*JA62 z$xanyFlmTi7i52?Z~n|-LNSCkT)E)S`F4XE{2alDK4_w%kRUdMAXQ41QJAgxc<%#E zKB`@V@NaL7ZESlaevq)>V7Nn}?D29`y96(y{hHzR#hp(eFnmk`8hm3QLfsr>IiNI> z;x)V&`&c@vBMFW&hVP2((9q;FSVy*QrZK7*`vd2FZ3uZYRA#-qo@#glm15s`T6aX=%bx?We=cFeTf3BK{vc^K9=IaJAO)r?kn z>P}c$k3}7BN8N1`*TJ(IVnrg(51ZRr*^c|J!MAjwUd&?&o_s7i?dD{kJM>J~FEgk} zC4JKswbB6u{ptJr-tADN^vYyX2ARinKaEppM?M5LGQGO&pdn@#NdldLe~T9@$d-P) zkY1Ubrx6aTic9#zfcWXz`3Fw$00KIbp5Z`-0Xz+krV?AlM!U}kg9Kn=33+>c5CRqr zH?jBdv#LTq@R~l%SO91(cq6Mv{d>XT`1q+u^!?GJEi6nYM>J@N5j)?R10aSs|JgMXiR6FHe-s47G^K~C8w zk-s2Q;>DOL!$_8RKMq6*+SDsKx96xu>GU$24!D}_9%eZTG>bUm>#9hZDAMB}4e#76 zeAG4Y9)&#I$>$B>TManZ2)wQ6dpLH89c5^H8^bRlf%yZ@$J{7k7f=O)I7g3jpvz9W zBE>|QT_hP$8$a2%Atkz>AOv5ce7rE963-V!A?U{sa72JEzA&1j|9I*@e*z#ap&(u@ IY8dc;0h;C4Hvj+t literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/vmmc_add.png b/admin/assets/images/icons/vmmc_add.png new file mode 100644 index 0000000000000000000000000000000000000000..bd61fcf1b08f5e790dd520d1b862e51df2876266 GIT binary patch literal 18566 zcmV)MK)An&P)r|-MFYTtWR)m_sXNn=?)BB`YM^h{58b@lJP_kG`Y{C+<{mSwnj zT)2mLaR@Fdz{TUD0$e;UD!|3#f;^0sPdxL?GcZ3te{p1%IfyUkibW6w0cxC9b90rw zy;zhi6N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d+hh3YL4Xe3oG#oFZb7R~TBJ>N)uo z@%uSzeiigZjMFqK))_#2OZD5E-|G0inr;-ntGJlA<89FD$kt^@RppmJFrir`kP$>7 zp0gIhCbMa>=BRTf`mZw+qtj!@WhJXcA1OG*?hhzM4^Wpf3&l1ddV0j=2p zX~}}*&Hw@Tf_=ucs}Pv`^~B_Sc40=fc8X&UswvH7BgKoyxj$B_0H6w&^4Fb+2CEz! zd_9iKeQoA0d$s5_*uX3}P~2u+bxz3}3UXS`%MoKzOu~FIYCKe&O+OQzp9{=}a!?4X zB!~J7hSc~KE-JvAQvtNYhi5aM^#YZF+|~wDhuv%KbkvJ3g9ugxd4nj(Mf{hQ@5U!YRn2372wUU0H9|2v~Cqr2$x#u(1%!BTL*8t zq03tr)I`OC8t1QQH;ju4@a9qg?H~eJrG|!f_0(6PRv002ovPDHLkV1gCLP1*ne literal 0 HcmV?d00001 diff --git a/admin/assets/images/icons/vmmcs.png b/admin/assets/images/icons/vmmcs.png new file mode 100644 index 0000000000000000000000000000000000000000..6396ac4573ff21b60ef0e18e0a4f2bab72a61564 GIT binary patch literal 17134 zcmV)lK%c*fP)7g>_EYoyut^}ch?y?5qnkZpNkiLGnj-;8GF-kJNIbN=UlmhZcQBuTKe zUAmjFqyS3_urvxw3b3>-DZtXUqyS6Xk^(GkOA4^GEh)g#wxj?{+mZq-ZI`M7y!`UZ zFf%i=G&&1xG+e1{7DPdS3cJ}@UuJF2W^<-dU*uRQo=NI;;(PYD8;wS|;f5Q)U@)9s z0XA>m3_Ex3T$1)Fwq}=p`MTDs-|uUyyQQPKvBhe$=|{#Uk9_~pm;b2W6W{e-R)DFg zDJUx|%fF^y=z~_PbxF!an@KMU9o3FiTb9?~wZ6CgV|^=DSQ=W|z-B8!i_$|nne447 zFZ;=#{>wv``(o+vd+{3Vb~^}&T-r^)BwBgXi2^j1+uQ0&t<~9_dRKPuV~!4`S~N$kNvh>_a&U5yf>A_?&ff0AI9E;TsW~)uMb`*R( z8qHf1J!U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K@m?|7N@tOyI6noTtlI^yoi8T428&4QoJ%t2e2+#Ox{K4jE}X%r&S|6h0>uTZ1r^|yTW-nEO?wBn#b~w!m)7>STrc$#QorInE0Cm1 pZETmeB?Va8mK0!VlehmbzyM286FclUpuqqD002ovPDHLkV1jYk)mZ=l literal 0 HcmV?d00001 diff --git a/admin/assets/images/import.gif b/admin/assets/images/import.gif new file mode 100644 index 0000000000000000000000000000000000000000..4371cc618bdc1702aad69fc871a50182a01537ec GIT binary patch literal 65516 zcmdqJcT|&k*EM{lLkff*iV%9JhK_YYuOcWSC}JogO^67JfSAy$gx)1o0RibnQA1Nu zlp+W!Doq4M#X7cezDqO1c#rqYGvE6@&-1Qz^QTMKa&h)Pd!Mt#xAKAL(B)HYWBv zjSOr}G}Xy42>6H6AK={Fz&b$n>tFc#-vAI_sEVgNyia@8)cZZXL{l9OI`lB4{zdqU zU)e00xvE&|KzZPx-^SvRsvyg{J?Exsk6wQkdU>WH#9F;zc&R1yhW~|!s~zDs=kC3D z-xV?Z;?u8mMr2fUOl(|yLSj;K%BfUlT6#uiR(4KqUVcGg(dlAVNoiSmMdg{Q>YB5) zb@k^O8k?G1THD$?I?rF|x_Id_ySt~ium8%`fx({yAwoDnoClkOg#(jQfT&<51VBel5~}{90l-wHdm-V1Kl5<@p=%_Y3~I z!P-pEt-Sg887xWk=`N4Ra*1!n7=N(v=G_~xY<)MU!7_kllQ0bjiwc$&ENW1CZ5Q|t z7gtnwM1uwMORTLuKLplntxjKS@!$P}{K97bzb@ak>q9qg4v&nE-5Q^`JsFOd!XOaq zxY`9FXdwW21i-{wxRH-vybwY|o3V>8R{`|X2C?^xOUjvAcwc}LzVu-92%^N99mO*o z9CBcGe@`6N#ey#Ka<&s9xXG~Z@vIORLUsc*2v9LH%z8;?=Tms3FCm(EjED4?J)~L~ z&OZABlXV-;tAnx}k!LBjov|&mEV68^nK~sHG>)A;YgWqc}`$O%)!vDt0=WoEu zwe*aGAOH&w77{ET$U?A?*8Z7b;X%%U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q6nyl+l literal 0 HcmV?d00001 diff --git a/admin/assets/images/index.html b/admin/assets/images/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/assets/images/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/assets/images/vdm-component.jpg b/admin/assets/images/vdm-component.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e40289754133fee0eddba56c814415dc5b3a482c GIT binary patch literal 43165 zcmbTd1zc2J*Ef8IPHCj1yStPX)mx90LaTT0!YAr=;r}|CFO2z=M8`WIB2sF z0Q_8oZLo23a}s1@b8uxfwQw}EWHon$uz8s}v2n1nvjIY)UQVXwc9w4BW|r1q2Vu%@ z&Fz%rU<+YN9UdiiB_~Ns8?c;@i=~E-vZlF@ow2Pw<>g=| z=Va&LWMhZEcv(2O1$lS{Ir+%{5GB-_i-nb-x|GZxThLF!lz)Qq^z>x)ar5#x_bKLh@Su$02x34H~_%Z+|@}*Lq_wVD9B4olDk5M{!<_xxXT%6b%4?&i<~Ms z`2+WVL0INaE^Yt-QibYpSwPnlln;UO_MUD|5ADZL9@ot7frojhK)5bY2cbN{18@DC zXZ|Jgn-_cFEg%jSP?-mxoh%?04}1@lf9>IJ3FToGp?sJJ*wPcqPeFNVdv^#J%72IQ zxDZQIR{(%RduVsFG`E5B>`)%fMN?f8%0nw45}NhDc(Z@;ZkAq9KLJ3}(aHPQswSs5 zXCQ}`5q@$xOHX@CH#ZhlXlXQcv49pXh?A*aGxIREza`GpevKIjf8;-H|Iz(Vn`15j@Lxc46Z4-ovs3`64+Q{%h5xis zzXJe_5CEtf`&T^p5A)?;Wfg2`&iathf9QWJ@Q>vGn)#PK)(3n4`>^ z{GRtv9@_uw{lC1yL_tm zpbr=ZJ_FOhBCrZ<0sFu)a0%RkKp;dAItT|u2qFW~fS5p>AbyYtNE)OFQU~dQo`bAG z4j^}sA1D|U0g3~qfpS14pbwx%P$y^*G!B{vt%3GHr=S}cSQs=IT$m>?v@mQi{4nA$ z&tNoRj9{!`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& ze8F%(#H#fi9Va{OP@ECmd}K*NqUj>_>rzkSAbz_dh}=ZGAaL(QWwSk!u{VsAM2+a- ztaksmBlJbB?;X=74+*aqWL`E?+il%f1Na{G8136|@bH3>k0@UGE>X*q+W?zkm99fh zRxG!>Ty(X>fvzpyk^E`imYGO^;!?IL^6*FCA7rJqMPon^rHE7G%5_l8v+z_m=YEy_ zk0zWW>FN!RvF%?mwCD_%azuBS@p*?tEEnI7Q>G%~4`kcdJa_(K3m|&wMHDq6bD1Ba-Bj|RcCRk@Xsn_KU zKI;WiNh-BYi28gwCXI&b$`(2!TM72-Uw1Y*FG0o}@pV=w3Ai;53pJ4S^Q0qvL$M8U zRfLp9okRFPmqD7(^-4mlf3?}B1Qk4}DxCK`WPkRQ=SBbq1T^7ZbNJ+I7pjWJK;N17 z7%1!PH0`?&$n5?F-gB*h9yJ(yam%Q6)x)>sQuc{rB&T*uoJ@T1gogwDVrfNEsNE6m zoS+6l)l4l67S6B>sgjS`wSX3ZS+fVha4pYB1h@@-Tgu$mF`@z%(+X=1=j{I#ZPxK| zuBhQHWt(iOsx \ No newline at end of file diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js new file mode 100644 index 0000000..4c77a9e --- /dev/null +++ b/admin/assets/js/admin.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage admin.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* JS Document */ diff --git a/admin/assets/js/index.html b/admin/assets/js/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/assets/js/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/config.xml b/admin/config.xml new file mode 100644 index 0000000..1d11e57 --- /dev/null +++ b/admin/config.xml @@ -0,0 +1,87 @@ + + +

+ + + + + + + + + + + + + + + + + + +
+
+ +
+ \ No newline at end of file diff --git a/admin/controller.php b/admin/controller.php new file mode 100644 index 0000000..515f0c9 --- /dev/null +++ b/admin/controller.php @@ -0,0 +1,158 @@ + + @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\Utilities\ArrayHelper; + +/** + * General Controller of Ehealth_portal component + */ +class Ehealth_portalController extends JControllerLegacy +{ + /** + * Constructor. + * + * @param array $config An optional associative array of configuration settings. + * Recognized key values include 'name', 'default_task', 'model_path', and + * 'view_path' (this list is not meant to be comprehensive). + * + * @since 3.0 + */ + public function __construct($config = array()) + { + // set the default view + $config['default_view'] = 'ehealth_portal'; + + parent::__construct($config); + } + + /** + * display task + * + * @return void + */ + function display($cachable = false, $urlparams = false) + { + // set default view if not set + $view = $this->input->getCmd('view', 'ehealth_portal'); + $data = $this->getViewRelation($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); + + // Check for edit form. + if(Ehealth_portalHelper::checkArray($data)) + { + if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_ehealth_portal.edit.'.$data['view'], $id)) + { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + // check if item was opend from other then its own list view + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); + // set redirect + if ($refid > 0 && Ehealth_portalHelper::checkString($ref)) + { + // redirect to item of ref + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + } + elseif (Ehealth_portalHelper::checkString($ref)) + { + + // redirect to ref + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view='.(string)$ref, false)); + } + else + { + // normal redirect back to the list view + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view='.$data['views'], false)); + } + + return false; + } + } + + return parent::display($cachable, $urlparams); + } + + protected function getViewRelation($view) + { + // check the we have a value + if (Ehealth_portalHelper::checkString($view)) + { + // the view relationships + $views = array( + 'payment' => 'payments', + 'general_medical_check_up' => 'general_medical_check_ups', + 'antenatal_care' => 'antenatal_cares', + 'immunisation' => 'immunisations', + 'vmmc' => 'vmmcs', + 'prostate_and_testicular_cancer' => 'prostate_and_testicular_cancers', + 'tuberculosis' => 'tuberculoses', + 'hiv_counseling_and_testing' => 'hiv_counselings_and_testings', + 'family_planning' => 'family_plannings', + 'health_education' => 'health_educations', + 'cervical_cancer' => 'cervical_cancers', + 'breast_cancer' => 'breast_cancers', + 'test' => 'tests', + 'immunisation_vaccine_type' => 'immunisation_vaccine_types', + 'foetal_presentation' => 'foetal_presentations', + 'foetal_lie' => 'foetal_lies', + 'counseling_type' => 'counseling_types', + 'foetal_engagement' => 'foetal_engagements', + 'health_education_topic' => 'health_education_topics', + 'testing_reason' => 'testing_reasons', + 'clinic' => 'clinics', + 'immunisation_type' => 'immunisation_types', + 'unit' => 'units', + 'referral' => 'referrals', + 'planning_type' => 'planning_types', + 'diagnosis_type' => 'diagnosis_types', + 'nonpay_reason' => 'nonpay_reasons', + 'medication' => 'medications', + 'payment_amount' => 'payment_amounts', + 'administration_part' => 'administration_parts', + 'payment_type' => 'payment_types', + 'strength' => 'strengths', + 'site' => 'sites' + ); + // check if this is a list view + if (in_array($view, $views)) + { + // this is a list view + return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); + } + // check if it is an edit view + elseif (array_key_exists($view, $views)) + { + // this is a edit view + return array('edit' => true, 'view' => $view, 'views' => $views[$view]); + } + } + return false; + } +} diff --git a/admin/controllers/administration_part.php b/admin/controllers/administration_part.php new file mode 100644 index 0000000..2be12c7 --- /dev/null +++ b/admin/controllers/administration_part.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Administration_part Controller + */ +class Ehealth_portalControllerAdministration_part extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Administration_parts'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('administration_part.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.administration_part.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.administration_part.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Administration_part', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=administration_parts' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/administration_parts.php b/admin/controllers/administration_parts.php new file mode 100644 index 0000000..2c65ab6 --- /dev/null +++ b/admin/controllers/administration_parts.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Administration_parts Controller + */ +class Ehealth_portalControllerAdministration_parts extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Administration_part', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('administration_part.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Administration_parts'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Administration_parts_'.$date->format('jS_F_Y'),'Administration parts exported ('.$date->format('jS F, Y').')','administration parts'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=administration_parts', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('administration_part.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Administration_parts'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('administration_part_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'administration_parts'); + $session->set('dataType_VDM_IMPORTINTO', 'administration_part'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_ADMINISTRATION_PARTS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=administration_parts', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php new file mode 100644 index 0000000..ba457c8 --- /dev/null +++ b/admin/controllers/ajax.json.php @@ -0,0 +1,111 @@ + + @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\Utilities\ArrayHelper; + +/** + * Ehealth_portal Ajax Controller + */ +class Ehealth_portalControllerAjax extends JControllerLegacy +{ + public function __construct($config) + { + parent::__construct($config); + // make sure all json stuff are set + JFactory::getDocument()->setMimeEncoding( 'application/json' ); + JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"'); + JResponse::setHeader("Access-Control-Allow-Origin", "*"); + // load the tasks + $this->registerTask('getImmunisationVaccineType', 'ajax'); + } + + public function ajax() + { + $user = JFactory::getUser(); + $jinput = JFactory::getApplication()->input; + // Check Token! + $token = JSession::getFormToken(); + $call_token = $jinput->get('token', 0, 'ALNUM'); + if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) + { + $task = $this->getTask(); + switch($task) + { + case 'getImmunisationVaccineType': + try + { + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $administration_partValue = $jinput->get('administration_part', NULL, 'INT'); + if($administration_partValue && $user->id != 0) + { + $result = $this->getModel('ajax')->getImmunisationVaccineType($administration_partValue); + } + else + { + $result = false; + } + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode($e).");"; + } + else + { + echo "(".json_encode($e).");"; + } + } + break; + } + } + else + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode(false).");"; + } + else + { + echo "(".json_encode(false).");"; + } + } + } +} diff --git a/admin/controllers/antenatal_care.php b/admin/controllers/antenatal_care.php new file mode 100644 index 0000000..a696c95 --- /dev/null +++ b/admin/controllers/antenatal_care.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Antenatal_care Controller + */ +class Ehealth_portalControllerAntenatal_care extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Antenatal_cares'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('antenatal_care.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.antenatal_care.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.antenatal_care.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Antenatal_care', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=antenatal_cares' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/antenatal_cares.php b/admin/controllers/antenatal_cares.php new file mode 100644 index 0000000..5ced554 --- /dev/null +++ b/admin/controllers/antenatal_cares.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Antenatal_cares Controller + */ +class Ehealth_portalControllerAntenatal_cares extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_ANTENATAL_CARES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Antenatal_care', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('antenatal_care.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Antenatal_cares'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Antenatal_cares_'.$date->format('jS_F_Y'),'Antenatal cares exported ('.$date->format('jS F, Y').')','antenatal cares'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=antenatal_cares', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('antenatal_care.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Antenatal_cares'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('antenatal_care_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'antenatal_cares'); + $session->set('dataType_VDM_IMPORTINTO', 'antenatal_care'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_ANTENATAL_CARES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=antenatal_cares', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/breast_cancer.php b/admin/controllers/breast_cancer.php new file mode 100644 index 0000000..8198a51 --- /dev/null +++ b/admin/controllers/breast_cancer.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Breast_cancer Controller + */ +class Ehealth_portalControllerBreast_cancer extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Breast_cancers'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('breast_cancer.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.breast_cancer.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.breast_cancer.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Breast_cancer', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=breast_cancers' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/breast_cancers.php b/admin/controllers/breast_cancers.php new file mode 100644 index 0000000..1cda41d --- /dev/null +++ b/admin/controllers/breast_cancers.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Breast_cancers Controller + */ +class Ehealth_portalControllerBreast_cancers extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_BREAST_CANCERS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Breast_cancer', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('breast_cancer.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Breast_cancers'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Breast_cancers_'.$date->format('jS_F_Y'),'Breast cancers exported ('.$date->format('jS F, Y').')','breast cancers'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=breast_cancers', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('breast_cancer.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Breast_cancers'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('breast_cancer_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'breast_cancers'); + $session->set('dataType_VDM_IMPORTINTO', 'breast_cancer'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_BREAST_CANCERS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=breast_cancers', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/cervical_cancer.php b/admin/controllers/cervical_cancer.php new file mode 100644 index 0000000..4577bae --- /dev/null +++ b/admin/controllers/cervical_cancer.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Cervical_cancer Controller + */ +class Ehealth_portalControllerCervical_cancer extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Cervical_cancers'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('cervical_cancer.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.cervical_cancer.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.cervical_cancer.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Cervical_cancer', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=cervical_cancers' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/cervical_cancers.php b/admin/controllers/cervical_cancers.php new file mode 100644 index 0000000..f084aa5 --- /dev/null +++ b/admin/controllers/cervical_cancers.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Cervical_cancers Controller + */ +class Ehealth_portalControllerCervical_cancers extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_CERVICAL_CANCERS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Cervical_cancer', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('cervical_cancer.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Cervical_cancers'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Cervical_cancers_'.$date->format('jS_F_Y'),'Cervical cancers exported ('.$date->format('jS F, Y').')','cervical cancers'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=cervical_cancers', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('cervical_cancer.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Cervical_cancers'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('cervical_cancer_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'cervical_cancers'); + $session->set('dataType_VDM_IMPORTINTO', 'cervical_cancer'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_CERVICAL_CANCERS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=cervical_cancers', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/clinic.php b/admin/controllers/clinic.php new file mode 100644 index 0000000..3de67bc --- /dev/null +++ b/admin/controllers/clinic.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Clinic Controller + */ +class Ehealth_portalControllerClinic extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Clinics'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('clinic.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.clinic.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.clinic.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Clinic', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=clinics' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/clinics.php b/admin/controllers/clinics.php new file mode 100644 index 0000000..2dd41e1 --- /dev/null +++ b/admin/controllers/clinics.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Clinics Controller + */ +class Ehealth_portalControllerClinics extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_CLINICS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Clinic', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('clinic.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Clinics'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Clinics_'.$date->format('jS_F_Y'),'Clinics exported ('.$date->format('jS F, Y').')','clinics'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=clinics', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('clinic.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Clinics'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('clinic_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'clinics'); + $session->set('dataType_VDM_IMPORTINTO', 'clinic'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_CLINICS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=clinics', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/counseling_type.php b/admin/controllers/counseling_type.php new file mode 100644 index 0000000..8c24230 --- /dev/null +++ b/admin/controllers/counseling_type.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Counseling_type Controller + */ +class Ehealth_portalControllerCounseling_type extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Counseling_types'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('counseling_type.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.counseling_type.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.counseling_type.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Counseling_type', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=counseling_types' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/counseling_types.php b/admin/controllers/counseling_types.php new file mode 100644 index 0000000..292bfc9 --- /dev/null +++ b/admin/controllers/counseling_types.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Counseling_types Controller + */ +class Ehealth_portalControllerCounseling_types extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_COUNSELING_TYPES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Counseling_type', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('counseling_type.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Counseling_types'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Counseling_types_'.$date->format('jS_F_Y'),'Counseling types exported ('.$date->format('jS F, Y').')','counseling types'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=counseling_types', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('counseling_type.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Counseling_types'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('counseling_type_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'counseling_types'); + $session->set('dataType_VDM_IMPORTINTO', 'counseling_type'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_COUNSELING_TYPES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=counseling_types', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/diagnosis_type.php b/admin/controllers/diagnosis_type.php new file mode 100644 index 0000000..9a21865 --- /dev/null +++ b/admin/controllers/diagnosis_type.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Diagnosis_type Controller + */ +class Ehealth_portalControllerDiagnosis_type extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Diagnosis_types'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('diagnosis_type.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.diagnosis_type.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.diagnosis_type.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Diagnosis_type', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=diagnosis_types' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/diagnosis_types.php b/admin/controllers/diagnosis_types.php new file mode 100644 index 0000000..9221645 --- /dev/null +++ b/admin/controllers/diagnosis_types.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Diagnosis_types Controller + */ +class Ehealth_portalControllerDiagnosis_types extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Diagnosis_type', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('diagnosis_type.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Diagnosis_types'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Diagnosis_types_'.$date->format('jS_F_Y'),'Diagnosis types exported ('.$date->format('jS F, Y').')','diagnosis types'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=diagnosis_types', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('diagnosis_type.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Diagnosis_types'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('diagnosis_type_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'diagnosis_types'); + $session->set('dataType_VDM_IMPORTINTO', 'diagnosis_type'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_DIAGNOSIS_TYPES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=diagnosis_types', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/ehealth_portal.php b/admin/controllers/ehealth_portal.php new file mode 100644 index 0000000..8711457 --- /dev/null +++ b/admin/controllers/ehealth_portal.php @@ -0,0 +1,35 @@ + + @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'); + +/** + * Ehealth_portal Controller + */ +class Ehealth_portalControllerEhealth_portal extends JControllerAdmin +{ + +} diff --git a/admin/controllers/family_planning.php b/admin/controllers/family_planning.php new file mode 100644 index 0000000..5c7524d --- /dev/null +++ b/admin/controllers/family_planning.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Family_planning Controller + */ +class Ehealth_portalControllerFamily_planning extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Family_plannings'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('family_planning.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.family_planning.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.family_planning.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Family_planning', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=family_plannings' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/family_plannings.php b/admin/controllers/family_plannings.php new file mode 100644 index 0000000..06f389f --- /dev/null +++ b/admin/controllers/family_plannings.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Family_plannings Controller + */ +class Ehealth_portalControllerFamily_plannings extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_FAMILY_PLANNINGS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Family_planning', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('family_planning.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Family_plannings'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Family_plannings_'.$date->format('jS_F_Y'),'Family plannings exported ('.$date->format('jS F, Y').')','family plannings'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=family_plannings', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('family_planning.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Family_plannings'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('family_planning_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'family_plannings'); + $session->set('dataType_VDM_IMPORTINTO', 'family_planning'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_FAMILY_PLANNINGS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=family_plannings', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/foetal_engagement.php b/admin/controllers/foetal_engagement.php new file mode 100644 index 0000000..c9e2eae --- /dev/null +++ b/admin/controllers/foetal_engagement.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_engagement Controller + */ +class Ehealth_portalControllerFoetal_engagement extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Foetal_engagements'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('foetal_engagement.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.foetal_engagement.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.foetal_engagement.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Foetal_engagement', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_engagements' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/foetal_engagements.php b/admin/controllers/foetal_engagements.php new file mode 100644 index 0000000..b724ebb --- /dev/null +++ b/admin/controllers/foetal_engagements.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_engagements Controller + */ +class Ehealth_portalControllerFoetal_engagements extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Foetal_engagement', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('foetal_engagement.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Foetal_engagements'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Foetal_engagements_'.$date->format('jS_F_Y'),'Foetal engagements exported ('.$date->format('jS F, Y').')','foetal engagements'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_engagements', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('foetal_engagement.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Foetal_engagements'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('foetal_engagement_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'foetal_engagements'); + $session->set('dataType_VDM_IMPORTINTO', 'foetal_engagement'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_FOETAL_ENGAGEMENTS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_engagements', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/foetal_lie.php b/admin/controllers/foetal_lie.php new file mode 100644 index 0000000..f327d09 --- /dev/null +++ b/admin/controllers/foetal_lie.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_lie Controller + */ +class Ehealth_portalControllerFoetal_lie extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Foetal_lies'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('foetal_lie.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.foetal_lie.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.foetal_lie.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Foetal_lie', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_lies' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/foetal_lies.php b/admin/controllers/foetal_lies.php new file mode 100644 index 0000000..40b3f6a --- /dev/null +++ b/admin/controllers/foetal_lies.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_lies Controller + */ +class Ehealth_portalControllerFoetal_lies extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_FOETAL_LIES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Foetal_lie', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('foetal_lie.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Foetal_lies'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Foetal_lies_'.$date->format('jS_F_Y'),'Foetal lies exported ('.$date->format('jS F, Y').')','foetal lies'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_lies', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('foetal_lie.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Foetal_lies'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('foetal_lie_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'foetal_lies'); + $session->set('dataType_VDM_IMPORTINTO', 'foetal_lie'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_FOETAL_LIES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_lies', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/foetal_presentation.php b/admin/controllers/foetal_presentation.php new file mode 100644 index 0000000..4629c50 --- /dev/null +++ b/admin/controllers/foetal_presentation.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_presentation Controller + */ +class Ehealth_portalControllerFoetal_presentation extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Foetal_presentations'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('foetal_presentation.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.foetal_presentation.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.foetal_presentation.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Foetal_presentation', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_presentations' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/foetal_presentations.php b/admin/controllers/foetal_presentations.php new file mode 100644 index 0000000..b810c5c --- /dev/null +++ b/admin/controllers/foetal_presentations.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_presentations Controller + */ +class Ehealth_portalControllerFoetal_presentations extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Foetal_presentation', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('foetal_presentation.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Foetal_presentations'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Foetal_presentations_'.$date->format('jS_F_Y'),'Foetal presentations exported ('.$date->format('jS F, Y').')','foetal presentations'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_presentations', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('foetal_presentation.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Foetal_presentations'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('foetal_presentation_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'foetal_presentations'); + $session->set('dataType_VDM_IMPORTINTO', 'foetal_presentation'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_FOETAL_PRESENTATIONS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=foetal_presentations', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/general_medical_check_up.php b/admin/controllers/general_medical_check_up.php new file mode 100644 index 0000000..d569fc5 --- /dev/null +++ b/admin/controllers/general_medical_check_up.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * General_medical_check_up Controller + */ +class Ehealth_portalControllerGeneral_medical_check_up extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'General_medical_check_ups'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('general_medical_check_up.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.general_medical_check_up.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.general_medical_check_up.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('General_medical_check_up', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=general_medical_check_ups' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/general_medical_check_ups.php b/admin/controllers/general_medical_check_ups.php new file mode 100644 index 0000000..b71e3a1 --- /dev/null +++ b/admin/controllers/general_medical_check_ups.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * General_medical_check_ups Controller + */ +class Ehealth_portalControllerGeneral_medical_check_ups extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'General_medical_check_up', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('general_medical_check_up.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('General_medical_check_ups'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'General_medical_check_ups_'.$date->format('jS_F_Y'),'General medical check ups exported ('.$date->format('jS F, Y').')','general medical check ups'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=general_medical_check_ups', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('general_medical_check_up.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('General_medical_check_ups'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('general_medical_check_up_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'general_medical_check_ups'); + $session->set('dataType_VDM_IMPORTINTO', 'general_medical_check_up'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_GENERAL_MEDICAL_CHECK_UPS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=general_medical_check_ups', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/health_education.php b/admin/controllers/health_education.php new file mode 100644 index 0000000..197d416 --- /dev/null +++ b/admin/controllers/health_education.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Health_education Controller + */ +class Ehealth_portalControllerHealth_education extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Health_educations'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('health_education.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.health_education.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.health_education.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Health_education', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=health_educations' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/health_education_topic.php b/admin/controllers/health_education_topic.php new file mode 100644 index 0000000..fb43b44 --- /dev/null +++ b/admin/controllers/health_education_topic.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Health_education_topic Controller + */ +class Ehealth_portalControllerHealth_education_topic extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Health_education_topics'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('health_education_topic.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.health_education_topic.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.health_education_topic.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Health_education_topic', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=health_education_topics' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/health_education_topics.php b/admin/controllers/health_education_topics.php new file mode 100644 index 0000000..917557b --- /dev/null +++ b/admin/controllers/health_education_topics.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Health_education_topics Controller + */ +class Ehealth_portalControllerHealth_education_topics extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Health_education_topic', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('health_education_topic.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Health_education_topics'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Health_education_topics_'.$date->format('jS_F_Y'),'Health education topics exported ('.$date->format('jS F, Y').')','health education topics'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=health_education_topics', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('health_education_topic.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Health_education_topics'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('health_education_topic_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'health_education_topics'); + $session->set('dataType_VDM_IMPORTINTO', 'health_education_topic'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_HEALTH_EDUCATION_TOPICS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=health_education_topics', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/health_educations.php b/admin/controllers/health_educations.php new file mode 100644 index 0000000..2a257d3 --- /dev/null +++ b/admin/controllers/health_educations.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Health_educations Controller + */ +class Ehealth_portalControllerHealth_educations extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Health_education', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('health_education.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Health_educations'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Health_educations_'.$date->format('jS_F_Y'),'Health educations exported ('.$date->format('jS F, Y').')','health educations'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=health_educations', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('health_education.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Health_educations'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('health_education_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'health_educations'); + $session->set('dataType_VDM_IMPORTINTO', 'health_education'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_HEALTH_EDUCATIONS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=health_educations', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/hiv_counseling_and_testing.php b/admin/controllers/hiv_counseling_and_testing.php new file mode 100644 index 0000000..5fc9ad8 --- /dev/null +++ b/admin/controllers/hiv_counseling_and_testing.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Hiv_counseling_and_testing Controller + */ +class Ehealth_portalControllerHiv_counseling_and_testing extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Hiv_counselings_and_testings'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('hiv_counseling_and_testing.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.hiv_counseling_and_testing.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.hiv_counseling_and_testing.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Hiv_counseling_and_testing', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=hiv_counselings_and_testings' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/hiv_counselings_and_testings.php b/admin/controllers/hiv_counselings_and_testings.php new file mode 100644 index 0000000..2a646e0 --- /dev/null +++ b/admin/controllers/hiv_counselings_and_testings.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Hiv_counselings_and_testings Controller + */ +class Ehealth_portalControllerHiv_counselings_and_testings extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Hiv_counseling_and_testing', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('hiv_counseling_and_testing.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Hiv_counselings_and_testings'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Hiv_counselings_and_testings_'.$date->format('jS_F_Y'),'Hiv counselings and testings exported ('.$date->format('jS F, Y').')','hiv counselings and testings'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=hiv_counselings_and_testings', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('hiv_counseling_and_testing.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Hiv_counselings_and_testings'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('hiv_counseling_and_testing_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'hiv_counselings_and_testings'); + $session->set('dataType_VDM_IMPORTINTO', 'hiv_counseling_and_testing'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_HIV_COUNSELINGS_AND_TESTINGS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=hiv_counselings_and_testings', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/immunisation.php b/admin/controllers/immunisation.php new file mode 100644 index 0000000..3501617 --- /dev/null +++ b/admin/controllers/immunisation.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisation Controller + */ +class Ehealth_portalControllerImmunisation extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Immunisations'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('immunisation.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.immunisation.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.immunisation.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Immunisation', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisations' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/immunisation_type.php b/admin/controllers/immunisation_type.php new file mode 100644 index 0000000..b33e8f4 --- /dev/null +++ b/admin/controllers/immunisation_type.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisation_type Controller + */ +class Ehealth_portalControllerImmunisation_type extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Immunisation_types'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('immunisation_type.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.immunisation_type.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.immunisation_type.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Immunisation_type', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisation_types' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/immunisation_types.php b/admin/controllers/immunisation_types.php new file mode 100644 index 0000000..8f0c4b0 --- /dev/null +++ b/admin/controllers/immunisation_types.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisation_types Controller + */ +class Ehealth_portalControllerImmunisation_types extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_IMMUNISATION_TYPES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Immunisation_type', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('immunisation_type.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Immunisation_types'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Immunisation_types_'.$date->format('jS_F_Y'),'Immunisation types exported ('.$date->format('jS F, Y').')','immunisation types'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisation_types', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('immunisation_type.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Immunisation_types'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('immunisation_type_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'immunisation_types'); + $session->set('dataType_VDM_IMPORTINTO', 'immunisation_type'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_IMMUNISATION_TYPES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisation_types', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/immunisation_vaccine_type.php b/admin/controllers/immunisation_vaccine_type.php new file mode 100644 index 0000000..1dcae70 --- /dev/null +++ b/admin/controllers/immunisation_vaccine_type.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisation_vaccine_type Controller + */ +class Ehealth_portalControllerImmunisation_vaccine_type extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Immunisation_vaccine_types'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('immunisation_vaccine_type.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.immunisation_vaccine_type.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.immunisation_vaccine_type.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Immunisation_vaccine_type', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisation_vaccine_types' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/immunisation_vaccine_types.php b/admin/controllers/immunisation_vaccine_types.php new file mode 100644 index 0000000..9d91dd5 --- /dev/null +++ b/admin/controllers/immunisation_vaccine_types.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisation_vaccine_types Controller + */ +class Ehealth_portalControllerImmunisation_vaccine_types extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Immunisation_vaccine_type', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('immunisation_vaccine_type.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Immunisation_vaccine_types'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Immunisation_vaccine_types_'.$date->format('jS_F_Y'),'Immunisation vaccine types exported ('.$date->format('jS F, Y').')','immunisation vaccine types'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisation_vaccine_types', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('immunisation_vaccine_type.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Immunisation_vaccine_types'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('immunisation_vaccine_type_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'immunisation_vaccine_types'); + $session->set('dataType_VDM_IMPORTINTO', 'immunisation_vaccine_type'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_IMMUNISATION_VACCINE_TYPES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisation_vaccine_types', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/immunisations.php b/admin/controllers/immunisations.php new file mode 100644 index 0000000..6086c98 --- /dev/null +++ b/admin/controllers/immunisations.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisations Controller + */ +class Ehealth_portalControllerImmunisations extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_IMMUNISATIONS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Immunisation', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('immunisation.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Immunisations'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Immunisations_'.$date->format('jS_F_Y'),'Immunisations exported ('.$date->format('jS F, Y').')','immunisations'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisations', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('immunisation.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Immunisations'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('immunisation_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'immunisations'); + $session->set('dataType_VDM_IMPORTINTO', 'immunisation'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_IMMUNISATIONS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=immunisations', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/import.php b/admin/controllers/import.php new file mode 100644 index 0000000..070b725 --- /dev/null +++ b/admin/controllers/import.php @@ -0,0 +1,69 @@ + + @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\Utilities\ArrayHelper; + +/** + * Ehealth_portal Import Controller + */ +class Ehealth_portalControllerImport extends JControllerLegacy +{ + /** + * Import an spreadsheet. + * + * @return void + */ + public function import() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $model = $this->getModel('import'); + if ($model->import()) + { + $cache = JFactory::getCache('mod_menu'); + $cache->clean(); + // TODO: Reset the users acl here as well to kill off any missing bits + } + + $app = JFactory::getApplication(); + $redirect_url = $app->getUserState('com_ehealth_portal.redirect_url'); + if (empty($redirect_url)) + { + $redirect_url = JRoute::_('index.php?option=com_ehealth_portal&view=import', false); + } + else + { + // wipe out the user state when we're going to redirect + $app->setUserState('com_ehealth_portal.redirect_url', ''); + $app->setUserState('com_ehealth_portal.message', ''); + $app->setUserState('com_ehealth_portal.extension_message', ''); + } + $this->setRedirect($redirect_url); + } +} diff --git a/admin/controllers/index.html b/admin/controllers/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/controllers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/controllers/medication.php b/admin/controllers/medication.php new file mode 100644 index 0000000..ecd8451 --- /dev/null +++ b/admin/controllers/medication.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Medication Controller + */ +class Ehealth_portalControllerMedication extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Medications'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('medication.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.medication.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.medication.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Medication', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=medications' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/medications.php b/admin/controllers/medications.php new file mode 100644 index 0000000..d9d6950 --- /dev/null +++ b/admin/controllers/medications.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Medications Controller + */ +class Ehealth_portalControllerMedications extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_MEDICATIONS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Medication', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('medication.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Medications'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Medications_'.$date->format('jS_F_Y'),'Medications exported ('.$date->format('jS F, Y').')','medications'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=medications', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('medication.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Medications'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('medication_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'medications'); + $session->set('dataType_VDM_IMPORTINTO', 'medication'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_MEDICATIONS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=medications', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/nonpay_reason.php b/admin/controllers/nonpay_reason.php new file mode 100644 index 0000000..7408608 --- /dev/null +++ b/admin/controllers/nonpay_reason.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Nonpay_reason Controller + */ +class Ehealth_portalControllerNonpay_reason extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Nonpay_reasons'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('nonpay_reason.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.nonpay_reason.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.nonpay_reason.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Nonpay_reason', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=nonpay_reasons' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/nonpay_reasons.php b/admin/controllers/nonpay_reasons.php new file mode 100644 index 0000000..4d6a6d6 --- /dev/null +++ b/admin/controllers/nonpay_reasons.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Nonpay_reasons Controller + */ +class Ehealth_portalControllerNonpay_reasons extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_NONPAY_REASONS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Nonpay_reason', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('nonpay_reason.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Nonpay_reasons'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Nonpay_reasons_'.$date->format('jS_F_Y'),'Nonpay reasons exported ('.$date->format('jS F, Y').')','nonpay reasons'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=nonpay_reasons', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('nonpay_reason.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Nonpay_reasons'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('nonpay_reason_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'nonpay_reasons'); + $session->set('dataType_VDM_IMPORTINTO', 'nonpay_reason'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_NONPAY_REASONS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=nonpay_reasons', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/patient_queue.php b/admin/controllers/patient_queue.php new file mode 100644 index 0000000..e67cc17 --- /dev/null +++ b/admin/controllers/patient_queue.php @@ -0,0 +1,46 @@ + + @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\Utilities\ArrayHelper; + +/** + * Ehealth_portal Patient_queue Controller + */ +class Ehealth_portalControllerPatient_queue extends JControllerLegacy +{ + public function __construct($config) + { + parent::__construct($config); + } + + public function dashboard() + { + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal', false)); + return; + } +} diff --git a/admin/controllers/payment.php b/admin/controllers/payment.php new file mode 100644 index 0000000..d3e066b --- /dev/null +++ b/admin/controllers/payment.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payment Controller + */ +class Ehealth_portalControllerPayment extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Payments'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('payment.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.payment.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.payment.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Payment', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payments' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/payment_amount.php b/admin/controllers/payment_amount.php new file mode 100644 index 0000000..8ef70ff --- /dev/null +++ b/admin/controllers/payment_amount.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payment_amount Controller + */ +class Ehealth_portalControllerPayment_amount extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Payment_amounts'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('payment_amount.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.payment_amount.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.payment_amount.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Payment_amount', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payment_amounts' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/payment_amounts.php b/admin/controllers/payment_amounts.php new file mode 100644 index 0000000..f62c6bc --- /dev/null +++ b/admin/controllers/payment_amounts.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payment_amounts Controller + */ +class Ehealth_portalControllerPayment_amounts extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Payment_amount', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('payment_amount.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Payment_amounts'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Payment_amounts_'.$date->format('jS_F_Y'),'Payment amounts exported ('.$date->format('jS F, Y').')','payment amounts'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payment_amounts', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('payment_amount.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Payment_amounts'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('payment_amount_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'payment_amounts'); + $session->set('dataType_VDM_IMPORTINTO', 'payment_amount'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PAYMENT_AMOUNTS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payment_amounts', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/payment_type.php b/admin/controllers/payment_type.php new file mode 100644 index 0000000..afbb061 --- /dev/null +++ b/admin/controllers/payment_type.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payment_type Controller + */ +class Ehealth_portalControllerPayment_type extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Payment_types'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('payment_type.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.payment_type.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.payment_type.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Payment_type', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payment_types' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/payment_types.php b/admin/controllers/payment_types.php new file mode 100644 index 0000000..2e7aa34 --- /dev/null +++ b/admin/controllers/payment_types.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payment_types Controller + */ +class Ehealth_portalControllerPayment_types extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_PAYMENT_TYPES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Payment_type', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('payment_type.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Payment_types'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Payment_types_'.$date->format('jS_F_Y'),'Payment types exported ('.$date->format('jS F, Y').')','payment types'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payment_types', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('payment_type.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Payment_types'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('payment_type_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'payment_types'); + $session->set('dataType_VDM_IMPORTINTO', 'payment_type'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PAYMENT_TYPES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payment_types', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/payments.php b/admin/controllers/payments.php new file mode 100644 index 0000000..40346a2 --- /dev/null +++ b/admin/controllers/payments.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payments Controller + */ +class Ehealth_portalControllerPayments extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_PAYMENTS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Payment', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('payment.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Payments'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Payments_'.$date->format('jS_F_Y'),'Payments exported ('.$date->format('jS F, Y').')','payments'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payments', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('payment.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Payments'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('payment_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'payments'); + $session->set('dataType_VDM_IMPORTINTO', 'payment'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PAYMENTS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=payments', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/planning_type.php b/admin/controllers/planning_type.php new file mode 100644 index 0000000..2df221f --- /dev/null +++ b/admin/controllers/planning_type.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Planning_type Controller + */ +class Ehealth_portalControllerPlanning_type extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Planning_types'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('planning_type.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.planning_type.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.planning_type.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Planning_type', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=planning_types' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/planning_types.php b/admin/controllers/planning_types.php new file mode 100644 index 0000000..9c00959 --- /dev/null +++ b/admin/controllers/planning_types.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Planning_types Controller + */ +class Ehealth_portalControllerPlanning_types extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_PLANNING_TYPES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Planning_type', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('planning_type.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Planning_types'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Planning_types_'.$date->format('jS_F_Y'),'Planning types exported ('.$date->format('jS F, Y').')','planning types'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=planning_types', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('planning_type.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Planning_types'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('planning_type_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'planning_types'); + $session->set('dataType_VDM_IMPORTINTO', 'planning_type'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PLANNING_TYPES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=planning_types', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/prostate_and_testicular_cancer.php b/admin/controllers/prostate_and_testicular_cancer.php new file mode 100644 index 0000000..ef5b347 --- /dev/null +++ b/admin/controllers/prostate_and_testicular_cancer.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Prostate_and_testicular_cancer Controller + */ +class Ehealth_portalControllerProstate_and_testicular_cancer extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Prostate_and_testicular_cancers'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('prostate_and_testicular_cancer.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.prostate_and_testicular_cancer.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.prostate_and_testicular_cancer.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Prostate_and_testicular_cancer', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=prostate_and_testicular_cancers' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/prostate_and_testicular_cancers.php b/admin/controllers/prostate_and_testicular_cancers.php new file mode 100644 index 0000000..aeacb47 --- /dev/null +++ b/admin/controllers/prostate_and_testicular_cancers.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Prostate_and_testicular_cancers Controller + */ +class Ehealth_portalControllerProstate_and_testicular_cancers extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Prostate_and_testicular_cancer', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('prostate_and_testicular_cancer.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Prostate_and_testicular_cancers'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Prostate_and_testicular_cancers_'.$date->format('jS_F_Y'),'Prostate and testicular cancers exported ('.$date->format('jS F, Y').')','prostate and testicular cancers'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=prostate_and_testicular_cancers', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('prostate_and_testicular_cancer.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Prostate_and_testicular_cancers'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('prostate_and_testicular_cancer_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'prostate_and_testicular_cancers'); + $session->set('dataType_VDM_IMPORTINTO', 'prostate_and_testicular_cancer'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PROSTATE_AND_TESTICULAR_CANCERS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=prostate_and_testicular_cancers', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/referral.php b/admin/controllers/referral.php new file mode 100644 index 0000000..83a82c2 --- /dev/null +++ b/admin/controllers/referral.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Referral Controller + */ +class Ehealth_portalControllerReferral extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Referrals'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('referral.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.referral.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.referral.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Referral', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=referrals' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/referrals.php b/admin/controllers/referrals.php new file mode 100644 index 0000000..d814f97 --- /dev/null +++ b/admin/controllers/referrals.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Referrals Controller + */ +class Ehealth_portalControllerReferrals extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_REFERRALS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Referral', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('referral.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Referrals'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Referrals_'.$date->format('jS_F_Y'),'Referrals exported ('.$date->format('jS F, Y').')','referrals'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=referrals', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('referral.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Referrals'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('referral_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'referrals'); + $session->set('dataType_VDM_IMPORTINTO', 'referral'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_REFERRALS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=referrals', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/site.php b/admin/controllers/site.php new file mode 100644 index 0000000..85d1e09 --- /dev/null +++ b/admin/controllers/site.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Site Controller + */ +class Ehealth_portalControllerSite extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Sites'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('site.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.site.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.site.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Site', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=sites' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/sites.php b/admin/controllers/sites.php new file mode 100644 index 0000000..6ef0b9c --- /dev/null +++ b/admin/controllers/sites.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Sites Controller + */ +class Ehealth_portalControllerSites extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_SITES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Site', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('site.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Sites'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Sites_'.$date->format('jS_F_Y'),'Sites exported ('.$date->format('jS F, Y').')','sites'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=sites', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('site.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Sites'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('site_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'sites'); + $session->set('dataType_VDM_IMPORTINTO', 'site'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_SITES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=sites', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/strength.php b/admin/controllers/strength.php new file mode 100644 index 0000000..5ce7462 --- /dev/null +++ b/admin/controllers/strength.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Strength Controller + */ +class Ehealth_portalControllerStrength extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Strengths'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('strength.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.strength.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.strength.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Strength', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=strengths' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/strengths.php b/admin/controllers/strengths.php new file mode 100644 index 0000000..d331f5c --- /dev/null +++ b/admin/controllers/strengths.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Strengths Controller + */ +class Ehealth_portalControllerStrengths extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_STRENGTHS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Strength', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('strength.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Strengths'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Strengths_'.$date->format('jS_F_Y'),'Strengths exported ('.$date->format('jS F, Y').')','strengths'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=strengths', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('strength.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Strengths'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('strength_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'strengths'); + $session->set('dataType_VDM_IMPORTINTO', 'strength'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_STRENGTHS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=strengths', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/test.php b/admin/controllers/test.php new file mode 100644 index 0000000..d14337a --- /dev/null +++ b/admin/controllers/test.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Test Controller + */ +class Ehealth_portalControllerTest extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Tests'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('test.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.test.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.test.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Test', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=tests' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/testing_reason.php b/admin/controllers/testing_reason.php new file mode 100644 index 0000000..f61207a --- /dev/null +++ b/admin/controllers/testing_reason.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Testing_reason Controller + */ +class Ehealth_portalControllerTesting_reason extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Testing_reasons'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('testing_reason.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.testing_reason.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.testing_reason.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Testing_reason', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=testing_reasons' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/testing_reasons.php b/admin/controllers/testing_reasons.php new file mode 100644 index 0000000..470514a --- /dev/null +++ b/admin/controllers/testing_reasons.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Testing_reasons Controller + */ +class Ehealth_portalControllerTesting_reasons extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_TESTING_REASONS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Testing_reason', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('testing_reason.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Testing_reasons'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Testing_reasons_'.$date->format('jS_F_Y'),'Testing reasons exported ('.$date->format('jS F, Y').')','testing reasons'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=testing_reasons', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('testing_reason.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Testing_reasons'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('testing_reason_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'testing_reasons'); + $session->set('dataType_VDM_IMPORTINTO', 'testing_reason'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_TESTING_REASONS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=testing_reasons', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/tests.php b/admin/controllers/tests.php new file mode 100644 index 0000000..1ab4b35 --- /dev/null +++ b/admin/controllers/tests.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Tests Controller + */ +class Ehealth_portalControllerTests extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_TESTS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Test', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('test.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Tests'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Tests_'.$date->format('jS_F_Y'),'Tests exported ('.$date->format('jS F, Y').')','tests'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=tests', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('test.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Tests'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('test_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'tests'); + $session->set('dataType_VDM_IMPORTINTO', 'test'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_TESTS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=tests', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/tuberculoses.php b/admin/controllers/tuberculoses.php new file mode 100644 index 0000000..139fa44 --- /dev/null +++ b/admin/controllers/tuberculoses.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Tuberculoses Controller + */ +class Ehealth_portalControllerTuberculoses extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_TUBERCULOSES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Tuberculosis', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('tuberculosis.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Tuberculoses'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Tuberculoses_'.$date->format('jS_F_Y'),'Tuberculoses exported ('.$date->format('jS F, Y').')','tuberculoses'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=tuberculoses', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('tuberculosis.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Tuberculoses'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('tuberculosis_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'tuberculoses'); + $session->set('dataType_VDM_IMPORTINTO', 'tuberculosis'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_TUBERCULOSES'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=tuberculoses', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/tuberculosis.php b/admin/controllers/tuberculosis.php new file mode 100644 index 0000000..594dcc5 --- /dev/null +++ b/admin/controllers/tuberculosis.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Tuberculosis Controller + */ +class Ehealth_portalControllerTuberculosis extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Tuberculoses'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('tuberculosis.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.tuberculosis.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.tuberculosis.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Tuberculosis', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=tuberculoses' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/unit.php b/admin/controllers/unit.php new file mode 100644 index 0000000..acd12d5 --- /dev/null +++ b/admin/controllers/unit.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Unit Controller + */ +class Ehealth_portalControllerUnit extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Units'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('unit.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.unit.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.unit.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Unit', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=units' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/units.php b/admin/controllers/units.php new file mode 100644 index 0000000..9073428 --- /dev/null +++ b/admin/controllers/units.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Units Controller + */ +class Ehealth_portalControllerUnits extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_UNITS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Unit', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('unit.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Units'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Units_'.$date->format('jS_F_Y'),'Units exported ('.$date->format('jS F, Y').')','units'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=units', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('unit.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Units'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('unit_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'units'); + $session->set('dataType_VDM_IMPORTINTO', 'unit'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_UNITS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=units', false), $message, 'error'); + return; + } +} diff --git a/admin/controllers/vmmc.php b/admin/controllers/vmmc.php new file mode 100644 index 0000000..1bb80ea --- /dev/null +++ b/admin/controllers/vmmc.php @@ -0,0 +1,330 @@ + + @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\Utilities\ArrayHelper; + +/** + * Vmmc Controller + */ +class Ehealth_portalControllerVmmc extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Vmmcs'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) + { + // Get user object. + $user = JFactory::getUser(); + // Access check. + $access = $user->authorise('vmmc.access', 'com_ehealth_portal'); + if (!$access) + { + return false; + } + + // In the absense of better information, revert to the component permissions. + return parent::allowAdd($data); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // get user object. + $user = JFactory::getUser(); + // get record id. + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit', 'com_ehealth_portal.vmmc.' . (int) $recordId); + if (!$permission) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal.vmmc.' . $recordId)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId)) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + $ownerId = $record->created_by; + } + + // If the owner matches 'me' then allow. + if ($ownerId == $user->id) + { + if ($user->authorise('core.edit.own', 'com_ehealth_portal')) + { + return true; + } + } + } + return false; + } + } + // Since there is no permission, revert to the component permissions. + return parent::allowEdit($data, $key); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Vmmc', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=vmmcs' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/vmmcs.php b/admin/controllers/vmmcs.php new file mode 100644 index 0000000..3b446c3 --- /dev/null +++ b/admin/controllers/vmmcs.php @@ -0,0 +1,122 @@ + + @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\Utilities\ArrayHelper; + +/** + * Vmmcs Controller + */ +class Ehealth_portalControllerVmmcs extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL_VMMCS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Vmmc', $prefix = 'Ehealth_portalModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } + + public function exportData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if export is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('vmmc.export', 'com_ehealth_portal') && $user->authorise('core.export', 'com_ehealth_portal')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + $pks = ArrayHelper::toInteger($pks); + // Get the model + $model = $this->getModel('Vmmcs'); + // get the data to export + $data = $model->getExportData($pks); + if (Ehealth_portalHelper::checkArray($data)) + { + // now set the data to the spreadsheet + $date = JFactory::getDate(); + Ehealth_portalHelper::xls($data,'Vmmcs_'.$date->format('jS_F_Y'),'Vmmcs exported ('.$date->format('jS F, Y').')','vmmcs'); + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_EXPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=vmmcs', false), $message, 'error'); + return; + } + + + public function importData() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // check if import is allowed for this user. + $user = JFactory::getUser(); + if ($user->authorise('vmmc.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // Get the import model + $model = $this->getModel('Vmmcs'); + // get the headers to import + $headers = $model->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + // Load headers to session. + $session = JFactory::getSession(); + $headers = json_encode($headers); + $session->set('vmmc_VDM_IMPORTHEADERS', $headers); + $session->set('backto_VDM_IMPORT', 'vmmcs'); + $session->set('dataType_VDM_IMPORTINTO', 'vmmc'); + // Redirect to import view. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_VMMCS'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=import', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_EHEALTH_PORTAL_IMPORT_FAILED'); + $this->setRedirect(JRoute::_('index.php?option=com_ehealth_portal&view=vmmcs', false), $message, 'error'); + return; + } +} diff --git a/admin/ehealth_portal.php b/admin/ehealth_portal.php new file mode 100644 index 0000000..a86deee --- /dev/null +++ b/admin/ehealth_portal.php @@ -0,0 +1,53 @@ + + @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'); + +JHtml::_('behavior.tabstate'); + +// Access check. +if (!JFactory::getUser()->authorise('core.manage', 'com_ehealth_portal')) +{ + throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); +}; + +// Add CSS file for all pages +$document = JFactory::getDocument(); +$document->addStyleSheet('components/com_ehealth_portal/assets/css/admin.css'); +$document->addScript('components/com_ehealth_portal/assets/js/admin.js'); + +// require helper files +JLoader::register('Ehealth_portalHelper', __DIR__ . '/helpers/ehealth_portal.php'); +JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); + +// Get an instance of the controller prefixed by Ehealth_portal +$controller = JControllerLegacy::getInstance('Ehealth_portal'); + +// Perform the Request task +$controller->execute(JFactory::getApplication()->input->get('task')); + +// Redirect if set by the controller +$controller->redirect(); diff --git a/admin/helpers/ehealth_portal.php b/admin/helpers/ehealth_portal.php new file mode 100644 index 0000000..267e234 --- /dev/null +++ b/admin/helpers/ehealth_portal.php @@ -0,0 +1,1664 @@ + + @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\Filesystem\File; +use Joomla\CMS\Language\Language; +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; +use PhpOffice\PhpSpreadsheet\IOFactory; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +/** + * Ehealth_portal component helper. + */ +abstract class Ehealth_portalHelper +{ + /** + * Composer Switch + * + * @var array + */ + protected static $composer = array(); + + /** + * The Main Active Language + * + * @var string + */ + public static $langTag; + + /** + * Load the Composer Vendors + */ + public static function composerAutoload($target) + { + // insure we load the composer vendor only once + if (!isset(self::$composer[$target])) + { + // get the function name + $functionName = self::safeString('compose' . $target); + // check if method exist + if (method_exists(__CLASS__, $functionName)) + { + return self::{$functionName}(); + } + return false; + } + return self::$composer[$target]; + } + + /** + * Load the Component xml manifest. + */ + public static function manifest() + { + $manifestUrl = JPATH_ADMINISTRATOR."/components/com_ehealth_portal/ehealth_portal.xml"; + return simplexml_load_file($manifestUrl); + } + + /** + * Joomla version object + */ + protected static $JVersion; + + /** + * set/get Joomla version + */ + public static function jVersion() + { + // check if set + if (!self::checkObject(self::$JVersion)) + { + self::$JVersion = new JVersion(); + } + return self::$JVersion; + } + + /** + * Load the Contributors details. + */ + public static function getContributors() + { + // get params + $params = JComponentHelper::getParams('com_ehealth_portal'); + // start contributors array + $contributors = array(); + // get all Contributors (max 20) + $searchArray = range('0','20'); + foreach($searchArray as $nr) + { + if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) + { + // set link based of selected option + if($params->get("useContributor".$nr) == 1) + { + $link_front = '
'; + $link_back = ''; + } + elseif($params->get("useContributor".$nr) == 2) + { + $link_front = ''; + $link_back = ''; + } + else + { + $link_front = ''; + $link_back = ''; + } + $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + } + } + return $contributors; + } + + /** + * Can be used to build help urls. + **/ + public static function getHelpUrl($view) + { + return false; + } + + /** + * Configure the Linkbar. + */ + public static function addSubmenu($submenu) + { + // load user for access menus + $user = JFactory::getUser(); + // load the submenus to sidebar + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_DASHBOARD'), 'index.php?option=com_ehealth_portal&view=ehealth_portal', $submenu === 'ehealth_portal'); + if ($user->authorise('payment.access', 'com_ehealth_portal') && $user->authorise('payment.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_PAYMENTS'), 'index.php?option=com_ehealth_portal&view=payments', $submenu === 'payments'); + } + if ($user->authorise('general_medical_check_up.access', 'com_ehealth_portal') && $user->authorise('general_medical_check_up.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_GENERAL_MEDICAL_CHECK_UPS'), 'index.php?option=com_ehealth_portal&view=general_medical_check_ups', $submenu === 'general_medical_check_ups'); + } + if ($user->authorise('antenatal_care.access', 'com_ehealth_portal') && $user->authorise('antenatal_care.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_ANTENATAL_CARES'), 'index.php?option=com_ehealth_portal&view=antenatal_cares', $submenu === 'antenatal_cares'); + } + if ($user->authorise('immunisation.access', 'com_ehealth_portal') && $user->authorise('immunisation.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_IMMUNISATIONS'), 'index.php?option=com_ehealth_portal&view=immunisations', $submenu === 'immunisations'); + } + if ($user->authorise('vmmc.access', 'com_ehealth_portal') && $user->authorise('vmmc.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_VMMCS'), 'index.php?option=com_ehealth_portal&view=vmmcs', $submenu === 'vmmcs'); + } + if ($user->authorise('prostate_and_testicular_cancer.access', 'com_ehealth_portal') && $user->authorise('prostate_and_testicular_cancer.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_PROSTATE_AND_TESTICULAR_CANCERS'), 'index.php?option=com_ehealth_portal&view=prostate_and_testicular_cancers', $submenu === 'prostate_and_testicular_cancers'); + } + if ($user->authorise('tuberculosis.access', 'com_ehealth_portal') && $user->authorise('tuberculosis.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_TUBERCULOSES'), 'index.php?option=com_ehealth_portal&view=tuberculoses', $submenu === 'tuberculoses'); + } + if ($user->authorise('hiv_counseling_and_testing.access', 'com_ehealth_portal') && $user->authorise('hiv_counseling_and_testing.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_HIV_COUNSELINGS_AND_TESTINGS'), 'index.php?option=com_ehealth_portal&view=hiv_counselings_and_testings', $submenu === 'hiv_counselings_and_testings'); + } + if ($user->authorise('family_planning.access', 'com_ehealth_portal') && $user->authorise('family_planning.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_FAMILY_PLANNINGS'), 'index.php?option=com_ehealth_portal&view=family_plannings', $submenu === 'family_plannings'); + } + if ($user->authorise('health_education.access', 'com_ehealth_portal') && $user->authorise('health_education.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_HEALTH_EDUCATIONS'), 'index.php?option=com_ehealth_portal&view=health_educations', $submenu === 'health_educations'); + } + if ($user->authorise('cervical_cancer.access', 'com_ehealth_portal') && $user->authorise('cervical_cancer.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_CERVICAL_CANCERS'), 'index.php?option=com_ehealth_portal&view=cervical_cancers', $submenu === 'cervical_cancers'); + } + if ($user->authorise('breast_cancer.access', 'com_ehealth_portal') && $user->authorise('breast_cancer.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_BREAST_CANCERS'), 'index.php?option=com_ehealth_portal&view=breast_cancers', $submenu === 'breast_cancers'); + } + if ($user->authorise('test.access', 'com_ehealth_portal') && $user->authorise('test.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_TESTS'), 'index.php?option=com_ehealth_portal&view=tests', $submenu === 'tests'); + } + if ($user->authorise('immunisation_vaccine_type.access', 'com_ehealth_portal') && $user->authorise('immunisation_vaccine_type.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_IMMUNISATION_VACCINE_TYPES'), 'index.php?option=com_ehealth_portal&view=immunisation_vaccine_types', $submenu === 'immunisation_vaccine_types'); + } + if ($user->authorise('unit.access', 'com_ehealth_portal') && $user->authorise('unit.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_UNITS'), 'index.php?option=com_ehealth_portal&view=units', $submenu === 'units'); + } + if ($user->authorise('referral.access', 'com_ehealth_portal') && $user->authorise('referral.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_REFERRALS'), 'index.php?option=com_ehealth_portal&view=referrals', $submenu === 'referrals'); + } + if ($user->authorise('medication.access', 'com_ehealth_portal') && $user->authorise('medication.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_MEDICATIONS'), 'index.php?option=com_ehealth_portal&view=medications', $submenu === 'medications'); + } + if ($user->authorise('administration_part.access', 'com_ehealth_portal') && $user->authorise('administration_part.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_ADMINISTRATION_PARTS'), 'index.php?option=com_ehealth_portal&view=administration_parts', $submenu === 'administration_parts'); + } + if ($user->authorise('strength.access', 'com_ehealth_portal') && $user->authorise('strength.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_STRENGTHS'), 'index.php?option=com_ehealth_portal&view=strengths', $submenu === 'strengths'); + } + if ($user->authorise('patient_queue.access', 'com_ehealth_portal') && $user->authorise('patient_queue.submenu', 'com_ehealth_portal')) + { + JHtmlSidebar::addEntry(JText::_('COM_EHEALTH_PORTAL_SUBMENU_PATIENT_QUEUE'), 'index.php?option=com_ehealth_portal&view=patient_queue', $submenu === 'patient_queue'); + } + } + + /** + * Prepares the xml document + */ + public static function xls($rows, $fileName = null, $title = null, $subjectTab = null, $creator = 'Vast Development Method', $description = null, $category = null,$keywords = null, $modified = null) + { + // set the user + $user = JFactory::getUser(); + // set fileName if not set + if (!$fileName) + { + $fileName = 'exported_'.JFactory::getDate()->format('jS_F_Y'); + } + // set modified if not set + if (!$modified) + { + $modified = $user->name; + } + // set title if not set + if (!$title) + { + $title = 'Book1'; + } + // set tab name if not set + if (!$subjectTab) + { + $subjectTab = 'Sheet1'; + } + + // make sure we have the composer classes loaded + self::composerAutoload('phpspreadsheet'); + + // Create new Spreadsheet object + $spreadsheet = new Spreadsheet(); + + // Set document properties + $spreadsheet->getProperties() + ->setCreator($creator) + ->setCompany('Vast Development Method') + ->setLastModifiedBy($modified) + ->setTitle($title) + ->setSubject($subjectTab); + // The file type + $file_type = 'Xls'; + // set description + if ($description) + { + $spreadsheet->getProperties()->setDescription($description); + } + // set keywords + if ($keywords) + { + $spreadsheet->getProperties()->setKeywords($keywords); + } + // set category + if ($category) + { + $spreadsheet->getProperties()->setCategory($category); + } + + // Some styles + $headerStyles = array( + 'font' => array( + 'bold' => true, + 'color' => array('rgb' => '1171A3'), + 'size' => 12, + 'name' => 'Verdana' + )); + $sideStyles = array( + 'font' => array( + 'bold' => true, + 'color' => array('rgb' => '444444'), + 'size' => 11, + 'name' => 'Verdana' + )); + $normalStyles = array( + 'font' => array( + 'color' => array('rgb' => '444444'), + 'size' => 11, + 'name' => 'Verdana' + )); + + // Add some data + if (($size = self::checkArray($rows)) !== false) + { + $i = 1; + + // Based on data size we adapt the behaviour. + $xls_mode = 1; + if ($size > 3000) + { + $xls_mode = 3; + $file_type = 'Csv'; + } + elseif ($size > 2000) + { + $xls_mode = 2; + } + + // Set active sheet and get it. + $active_sheet = $spreadsheet->setActiveSheetIndex(0); + foreach ($rows as $array) + { + $a = 'A'; + foreach ($array as $value) + { + $active_sheet->setCellValue($a.$i, $value); + if ($xls_mode != 3) + { + if ($i == 1) + { + $active_sheet->getColumnDimension($a)->setAutoSize(true); + $active_sheet->getStyle($a.$i)->applyFromArray($headerStyles); + $active_sheet->getStyle($a.$i)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER); + } + elseif ($a === 'A') + { + $active_sheet->getStyle($a.$i)->applyFromArray($sideStyles); + } + elseif ($xls_mode == 1) + { + $active_sheet->getStyle($a.$i)->applyFromArray($normalStyles); + } + } + $a++; + } + $i++; + } + } + else + { + return false; + } + + // Rename worksheet + $spreadsheet->getActiveSheet()->setTitle($subjectTab); + + // Set active sheet index to the first sheet, so Excel opens this as the first sheet + $spreadsheet->setActiveSheetIndex(0); + + // Redirect output to a client's web browser (Excel5) + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment;filename="' . $fileName . '.' . strtolower($file_type) .'"'); + header('Cache-Control: max-age=0'); + // If you're serving to IE 9, then the following may be needed + header('Cache-Control: max-age=1'); + + // If you're serving to IE over SSL, then the following may be needed + header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past + header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified + header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 + header ('Pragma: public'); // HTTP/1.0 + + $writer = IOFactory::createWriter($spreadsheet, $file_type); + $writer->save('php://output'); + jexit(); + } + + /** + * Get CSV Headers + */ + public static function getFileHeaders($dataType) + { + // make sure we have the composer classes loaded + self::composerAutoload('phpspreadsheet'); + // get session object + $session = JFactory::getSession(); + $package = $session->get('package', null); + $package = json_decode($package, true); + // set the headers + if(isset($package['dir'])) + { + // only load first three rows + $chunkFilter = new PhpOffice\PhpSpreadsheet\Reader\chunkReadFilter(2,1); + // identify the file type + $inputFileType = IOFactory::identify($package['dir']); + // create the reader for this file type + $excelReader = IOFactory::createReader($inputFileType); + // load the limiting filter + $excelReader->setReadFilter($chunkFilter); + $excelReader->setReadDataOnly(true); + // load the rows (only first three) + $excelObj = $excelReader->load($package['dir']); + $headers = array(); + foreach ($excelObj->getActiveSheet()->getRowIterator() as $row) + { + if($row->getRowIndex() == 1) + { + $cellIterator = $row->getCellIterator(); + $cellIterator->setIterateOnlyExistingCells(false); + foreach ($cellIterator as $cell) + { + if (!is_null($cell)) + { + $headers[$cell->getColumn()] = $cell->getValue(); + } + } + $excelObj->disconnectWorksheets(); + unset($excelObj); + break; + } + } + return $headers; + } + return false; + } + + /** + * Load the Composer Vendor phpspreadsheet + */ + protected static function composephpspreadsheet() + { + // load the autoloader for phpspreadsheet + require_once JPATH_SITE . '/libraries/phpspreadsheet/vendor/autoload.php'; + // do not load again + self::$composer['phpspreadsheet'] = true; + + return true; + } + + /** + * Get a Variable + * + * @param string $table The table from which to get the variable + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * + * @return mix string/int/float + * + */ + public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'ehealth_portal') + { + if(!$where) + { + $where = JFactory::getUser()->id; + } + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + if (empty($table)) + { + $query->from($db->quoteName('#__'.$main)); + } + else + { + $query->from($db->quoteName('#__'.$main.'_'.$table)); + } + if (is_numeric($where)) + { + $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); + } + elseif (is_string($where)) + { + $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); + } + else + { + return false; + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + return $db->loadResult(); + } + return false; + } + + /** + * Get array of variables + * + * @param string $table The table from which to get the variables + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * @param bool $unique The switch to return a unique array + * + * @return array + * + */ + public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'ehealth_portal', $unique = true) + { + if(!$where) + { + $where = JFactory::getUser()->id; + } + + if (!self::checkArray($where) && $where > 0) + { + $where = array($where); + } + + if (self::checkArray($where)) + { + // prep main <-- why? well if $main='' is empty then $table can be categories or users + if (self::checkString($main)) + { + $main = '_'.ltrim($main, '_'); + } + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + + $query->select($db->quoteName(array($what))); + if (empty($table)) + { + $query->from($db->quoteName('#__'.$main)); + } + else + { + $query->from($db->quoteName('#_'.$main.'_'.$table)); + } + // add strings to array search + if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) + { + $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); + } + else + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + if ($unique) + { + return array_unique($db->loadColumn()); + } + return $db->loadColumn(); + } + } + return false; + } + + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') + { + // do some table foot work + $external = false; + if (strpos($table, '#__') !== false) + { + $external = true; + $table = str_replace('#__', '', $table); + } + // check if string is JSON + $result = json_decode($value, true); + if (json_last_error() === JSON_ERROR_NONE) + { + // is JSON + if (self::checkArray($result)) + { + if (self::checkString($table)) + { + $names = array(); + foreach ($result as $val) + { + if ($external) + { + if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) + { + $names[] = $_name; + } + } + else + { + if ($_name = self::getVar($table, $val, $id, $name)) + { + $names[] = $_name; + } + } + } + if (self::checkArray($names)) + { + return (string) implode($sperator,$names); + } + } + return (string) implode($sperator,$result); + } + return (string) json_decode($value); + } + return $value; + } + + public static function isPublished($id,$type) + { + if ($type == 'raw') + { + $type = 'item'; + } + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select(array('a.published')); + $query->from('#__ehealth_portal_'.$type.' AS a'); + $query->where('a.id = '. (int) $id); + $query->where('a.published = 1'); + $db->setQuery($query); + $db->execute(); + $found = $db->getNumRows(); + if($found) + { + return true; + } + return false; + } + + public static function getGroupName($id) + { + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select(array('a.title')); + $query->from('#__usergroups AS a'); + $query->where('a.id = '. (int) $id); + $db->setQuery($query); + $db->execute(); + $found = $db->getNumRows(); + if($found) + { + return $db->loadResult(); + } + return $id; + } + + /** + * Get the action permissions + * + * @param string $view The related view name + * @param int $record The item to act upon + * @param string $views The related list view name + * @param mixed $target Only get this permission (like edit, create, delete) + * @param string $component The target component + * @param object $user The user whose permissions we are loading + * + * @return object The JObject of permission/authorised actions + * + */ + public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'ehealth_portal', $user = 'null') + { + // load the user if not given + if (!self::checkObject($user)) + { + // get the user object + $user = JFactory::getUser(); + } + // load the JObject + $result = new JObject; + // make view name safe (just incase) + $view = self::safeString($view); + if (self::checkString($views)) + { + $views = self::safeString($views); + } + // get all actions from component + $actions = JAccess::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', + "/access/section[@name='component']/" + ); + // if non found then return empty JObject + if (empty($actions)) + { + return $result; + } + // get created by if not found + if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + { + $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + } + // set actions only set in component settings + $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); + // check if we have a target + $checkTarget = false; + if ($target) + { + // convert to an array + if (self::checkString($target)) + { + $target = array($target); + } + // check if we are good to go + if (self::checkArray($target)) + { + $checkTarget = true; + } + } + // loop the actions and set the permissions + foreach ($actions as $action) + { + // check target action filter + if ($checkTarget && self::filterActions($view, $action->name, $target)) + { + continue; + } + // set to use component default + $fallback = true; + // reset permission per/action + $permission = false; + $catpermission = false; + // set area + $area = 'comp'; + // check if the record has an ID and the action is item related (not a component action) + if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) + { + // we are in item + $area = 'item'; + // The record has been set. Check the record permissions. + $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id); + // if no permission found, check edit own + if (!$permission) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // the correct target + $coreCheck = (array) explode('.', $action->name); + // check that we have both local and global access + if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) && + $user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + { + // we are in item + $area = 'category'; + // set the core check + $coreCheck = explode('.', $action->name); + $core = $coreCheck[0]; + // make sure we use the core. action check for the categories + if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false ) + { + $coreCheck[0] = 'core'; + $categoryCheck = implode('.', $coreCheck); + } + else + { + $categoryCheck = $action->name; + } + // The record has a category. Check the category permissions. + $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid); + if (!$catpermission && !is_null($catpermission)) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // check that we have both local and global access + if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) && + $user->authorise($core . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + } + } + // if allowed then fallback on component global settings + if ($fallback) + { + // if item/category blocks access then don't fall back on global + if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission)) + { + // do not allow + $result->set($action->name, false); + } + // Finally remember the global settings have the final say. (even if item allow) + // The local item permissions can block, but it can't open and override of global permissions. + // Since items are created by users and global permissions is set by system admin. + else + { + $result->set($action->name, $user->authorise($action->name, 'com_' . $component)); + } + } + } + return $result; + } + + /** + * Filter the action permissions + * + * @param string $action The action to check + * @param array $targets The array of target actions + * + * @return boolean true if action should be filtered out + * + */ + protected static function filterActions(&$view, &$action, &$targets) + { + foreach ($targets as $target) + { + if (strpos($action, $view . '.' . $target) !== false || + strpos($action, 'core.' . $target) !== false) + { + return false; + break; + } + } + return true; + } + + /** + * Get any component's model + */ + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Ehealth_portal', $config = array()) + { + // fix the name + $name = self::safeString($name); + // full path to models + $fullPathModels = $path . '/models'; + // load the model file + JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + // make sure the table path is loaded + if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + { + // This is the JCB default path to tables in Joomla 3.x + $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + } + // get instance + $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + // if model not found (strange) + if ($model == false) + { + jimport('joomla.filesystem.file'); + // get file path + $filePath = $path . '/' . $name . '.php'; + $fullPathModel = $fullPathModels . '/' . $name . '.php'; + // check if it exists + if (File::exists($filePath)) + { + // get the file + require_once $filePath; + } + elseif (File::exists($fullPathModel)) + { + // get the file + require_once $fullPathModel; + } + // build class names + $modelClass = $Component . 'Model' . $name; + if (class_exists($modelClass)) + { + // initialize the model + return new $modelClass($config); + } + } + return $model; + } + + /** + * Add to asset Table + */ + public static function setAsset($id, $table, $inherit = true) + { + $parent = JTable::getInstance('Asset'); + $parent->loadByName('com_ehealth_portal'); + + $parentId = $parent->id; + $name = 'com_ehealth_portal.'.$table.'.'.$id; + $title = ''; + + $asset = JTable::getInstance('Asset'); + $asset->loadByName($name); + + // Check for an error. + $error = $asset->getError(); + + if ($error) + { + return false; + } + else + { + // Specify how a new or moved node asset is inserted into the tree. + if ($asset->parent_id != $parentId) + { + $asset->setLocation($parentId, 'last-child'); + } + + // Prepare the asset to be stored. + $asset->parent_id = $parentId; + $asset->name = $name; + $asset->title = $title; + // get the default asset rules + $rules = self::getDefaultAssetRules('com_ehealth_portal', $table, $inherit); + if ($rules instanceof JAccessRules) + { + $asset->rules = (string) $rules; + } + + if (!$asset->check() || !$asset->store()) + { + JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + return false; + } + else + { + // Create an asset_id or heal one that is corrupted. + $object = new stdClass(); + + // Must be a valid primary key value. + $object->id = $id; + $object->asset_id = (int) $asset->id; + + // Update their asset_id to link to the asset table. + return JFactory::getDbo()->updateObject('#__ehealth_portal_'.$table, $object, 'id'); + } + } + return false; + } + + /** + * Gets the default asset Rules for a component/view. + */ + protected static function getDefaultAssetRules($component, $view, $inherit = true) + { + // if new or inherited + $assetId = 0; + // Only get the actual item rules if not inheriting + if (!$inherit) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + // check that there is a value + if ($db->getNumRows()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + } + } + // get asset rules + $result = JAccess::getAssetRules($assetId); + if ($result instanceof JAccessRules) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($view !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + elseif ($inherit) + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count((array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules($_result); + // return filtered rules + return $rules; + } + } + return $result; + } + + /** + * xmlAppend + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement + * + * @return null + * + */ + public static function xmlAppend(&$xml, $node) + { + if (!$node) + { + // element was not returned + return; + } + switch (get_class($node)) + { + case 'stdClass': + if (property_exists($node, 'comment')) + { + self::xmlComment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::xmlAppend($xml, $node->fieldXML); + } + break; + case 'SimpleXMLElement': + $domXML = dom_import_simplexml($xml); + $domNode = dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = simplexml_import_dom($domXML); + break; + } + } + + /** + * xmlComment + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param string $comment The comment to inject + * + * @return null + * + */ + public static function xmlComment(&$xml, $comment) + { + $domXML = dom_import_simplexml($xml); + $domComment = new DOMComment($comment); + $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); + $domXML->appendChild($nodeTarget); + $xml = simplexml_import_dom($domXML); + } + + /** + * xmlAddAttributes + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $attributes The attributes to apply to the XML element + * + * @return null + * + */ + public static function xmlAddAttributes(&$xml, $attributes = array()) + { + foreach ($attributes as $key => $value) + { + $xml->addAttribute($key, $value); + } + } + + /** + * xmlAddOptions + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $options The options to apply to the XML element + * + * @return void + * + */ + public static function xmlAddOptions(&$xml, $options = array()) + { + foreach ($options as $key => $value) + { + $addOption = $xml->addChild('option'); + $addOption->addAttribute('value', $key); + $addOption[] = $value; + } + } + + /** + * get the field object + * + * @param array $attributes The array of attributes + * @param string $default The default of the field + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldObject(&$attributes, $default = '', $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes) && isset($attributes['type'])) + { + // make sure the form helper class is loaded + if (!method_exists('JFormHelper', 'loadFieldType')) + { + jimport('joomla.form.form'); + } + // get field type + $field = JFormHelper::loadFieldType($attributes['type'], true); + // get field xml + $XML = self::getFieldXML($attributes, $options); + // setup the field + $field->setup($XML, $default); + // return the field object + return $field; + } + return false; + } + + /** + * get the field xml + * + * @param array $attributes The array of attributes + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldXML(&$attributes, $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes)) + { + // start field xml + $XML = new SimpleXMLElement(''); + // load the attributes + self::xmlAddAttributes($XML, $attributes); + // check if we have options + if (self::checkArray($options)) + { + // load the options + self::xmlAddOptions($XML, $options); + } + // return the field xml + return $XML; + } + return false; + } + + /** + * Render Bool Button + * + * @param array $args All the args for the button + * 0) name + * 1) additional (options class) // not used at this time + * 2) default + * 3) yes (name) + * 4) no (name) + * + * @return string The input html of the button + * + */ + public static function renderBoolButton() + { + $args = func_get_args(); + // check if there is additional button class + $additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time + // button attributes + $buttonAttributes = array( + 'type' => 'radio', + 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'class' => 'btn-group', + 'filter' => 'INT', + 'default' => isset($args[2]) ? (int) $args[2] : 0); + // set the button options + $buttonOptions = array( + '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', + '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + // return the input + return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + } + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + */ + public static function checkJson($string) + { + if (self::checkString($string)) + { + json_decode($string); + return (json_last_error() === JSON_ERROR_NONE); + } + return false; + } + + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + */ + public static function checkObject($object) + { + if (isset($object) && is_object($object)) + { + return count((array)$object) > 0; + } + return false; + } + + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + */ + public static function checkArray($array, $removeEmptyString = false) + { + if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + foreach ($array as $key => $string) + { + if (empty($string)) + { + unset($array[$key]); + } + } + return self::checkArray($array, false); + } + return $nr; + } + return false; + } + + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + */ + public static function checkString($string) + { + if (isset($string) && is_string($string) && strlen($string) > 0) + { + return true; + } + return false; + } + + /** + * Check if we are connected + * Thanks https://stackoverflow.com/a/4860432/1429677 + * + * @returns bool true on success + */ + public static function isConnected() + { + // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) + if ($connected) + { + //action when connected + $is_conn = true; + fclose($connected); + } + else + { + //action in connection failure + $is_conn = false; + } + return $is_conn; + } + + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + */ + public static function mergeArrays($arrays) + { + if(self::checkArray($arrays)) + { + $arrayBuket = array(); + foreach ($arrays as $array) + { + if (self::checkArray($array)) + { + $arrayBuket = array_merge($arrayBuket, $array); + } + } + return $arrayBuket; + } + return false; + } + + // typo sorry! + public static function sorten($string, $length = 40, $addTip = true) + { + return self::shorten($string, $length, $addTip); + } + + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + */ + public static function shorten($string, $length = 40, $addTip = true) + { + if (self::checkString($string)) + { + $initial = strlen($string); + $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); + $words_count = count((array)$words); + + $word_length = 0; + $last_word = 0; + for (; $last_word < $words_count; ++$last_word) + { + $word_length += strlen($words[$last_word]); + if ($word_length > $length) + { + break; + } + } + + $newString = implode(array_slice($words, 0, $last_word)); + $final = strlen($newString); + if ($initial != $final && $addTip) + { + $title = self::shorten($string, 400 , false); + return ''.trim($newString).'...'; + } + elseif ($initial != $final && !$addTip) + { + return trim($newString).'...'; + } + } + return $string; + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + */ + public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + if ($replaceNumbers === true) + { + // remove all numbers and replace with english text version (works well only up to millions) + $string = self::replaceNumbers($string); + } + // 0nly continue if we have a string + if (self::checkString($string)) + { + // create file name without the extention that is safe + if ($type === 'filename') + { + // make sure VDM is not in the string + $string = str_replace('VDM', 'vDm', $string); + // Remove anything which isn't a word, whitespace, number + // or any of the following caracters -_() + // If you don't need to handle multi-byte characters + // you can use preg_replace rather than mb_ereg_replace + // Thanks @Łukasz Rysiak! + // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); + $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); + // http://stackoverflow.com/a/2021729/1429677 + return preg_replace('/\s+/', ' ', $string); + } + // remove all other characters + $string = trim($string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + // Transliterate string + $string = self::transliterate($string); + // remove all and keep only characters + if ($keepOnlyCharacters) + { + $string = preg_replace("/[^A-Za-z ]/", '', $string); + } + // keep both numbers and characters + else + { + $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); + } + // select final adaptations + if ($type === 'L' || $type === 'strtolower') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // default is to return lower + return strtolower($string); + } + elseif ($type === 'W') + { + // return a string with all first letter of each word uppercase(no undersocre) + return ucwords(strtolower($string)); + } + elseif ($type === 'w' || $type === 'word') + { + // return a string with all lowercase(no undersocre) + return strtolower($string); + } + elseif ($type === 'Ww' || $type === 'Word') + { + // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) + return ucfirst(strtolower($string)); + } + elseif ($type === 'WW' || $type === 'WORD') + { + // return a string with all the uppercase(no undersocre) + return strtoupper($string); + } + elseif ($type === 'U' || $type === 'strtoupper') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // return all upper + return strtoupper($string); + } + elseif ($type === 'F' || $type === 'ucfirst') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // return with first caracter to upper + return ucfirst(strtolower($string)); + } + elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') + { + // convert all words to first letter uppercase + $string = ucwords(strtolower($string)); + // remove white space + $string = preg_replace('/\s+/', '', $string); + // now return first letter lowercase + return lcfirst($string); + } + // return string + return $string; + } + // not a string + return ''; + } + + public static function transliterate($string) + { + // set tag only once + if (!self::checkString(self::$langTag)) + { + // get global value + self::$langTag = JComponentHelper::getParams('com_ehealth_portal')->get('language', 'en-GB'); + } + // Transliterate on the language requested + $lang = Language::getInstance(self::$langTag); + return $lang->transliterate($string); + } + + public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) + { + if (self::checkString($var)) + { + $filter = new JFilterInput(); + $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); + if ($shorten) + { + return self::shorten($string,$length); + } + return $string; + } + else + { + return ''; + } + } + + public static function replaceNumbers($string) + { + // set numbers array + $numbers = array(); + // first get all numbers + preg_match_all('!\d+!', $string, $numbers); + // check if we have any numbers + if (isset($numbers[0]) && self::checkArray($numbers[0])) + { + foreach ($numbers[0] as $number) + { + $searchReplace[$number] = self::numberToString((int)$number); + } + // now replace numbers in string + $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); + // check if we missed any, strange if we did. + return self::replaceNumbers($string); + } + // return the string with no numbers remaining. + return $string; + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + */ + public static function numberToString($x) + { + $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", + "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", + "nineteen", "twenty", 30 => "thirty", 40 => "forty", + 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", + 90 => "ninety" ); + + if(!is_numeric($x)) + { + $w = $x; + } + elseif(fmod($x, 1) != 0) + { + $w = $x; + } + else + { + if($x < 0) + { + $w = 'minus '; + $x = -$x; + } + else + { + $w = ''; + // ... now $x is a non-negative integer. + } + + if($x < 21) // 0 to 20 + { + $w .= $nwords[$x]; + } + elseif($x < 100) // 21 to 99 + { + $w .= $nwords[10 * floor($x/10)]; + $r = fmod($x, 10); + if($r > 0) + { + $w .= ' '. $nwords[$r]; + } + } + elseif($x < 1000) // 100 to 999 + { + $w .= $nwords[floor($x/100)] .' hundred'; + $r = fmod($x, 100); + if($r > 0) + { + $w .= ' and '. self::numberToString($r); + } + } + elseif($x < 1000000) // 1000 to 999999 + { + $w .= self::numberToString(floor($x/1000)) .' thousand'; + $r = fmod($x, 1000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::numberToString($r); + } + } + else // millions + { + $w .= self::numberToString(floor($x/1000000)) .' million'; + $r = fmod($x, 1000000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::numberToString($r); + } + } + } + return $w; + } + + /** + * Random Key + * + * @returns a string + */ + public static function randomkey($size) + { + $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; + $key = array(); + $bagsize = strlen($bag) - 1; + for ($i = 0; $i < $size; $i++) + { + $get = rand(0, $bagsize); + $key[] = $bag[$get]; + } + return implode($key); + } +} diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php new file mode 100644 index 0000000..6051e4d --- /dev/null +++ b/admin/helpers/headercheck.php @@ -0,0 +1,85 @@ + + @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'); + +class ehealth_portalHeaderCheck +{ + function js_loaded($script_name) + { + // UIkit check point + if (strpos($script_name,'uikit') !== false) + { + $app = JFactory::getApplication(); + $getTemplateName = $app->getTemplate('template')->template; + + if (strpos($getTemplateName,'yoo') !== false) + { + return true; + } + } + + $document = JFactory::getDocument(); + $head_data = $document->getHeadData(); + foreach (array_keys($head_data['scripts']) as $script) + { + if (stristr($script, $script_name)) + { + return true; + } + } + + return false; + } + + function css_loaded($script_name) + { + // UIkit check point + if (strpos($script_name,'uikit') !== false) + { + $app = JFactory::getApplication(); + $getTemplateName = $app->getTemplate('template')->template; + + if (strpos($getTemplateName,'yoo') !== false) + { + return true; + } + } + + $document = JFactory::getDocument(); + $head_data = $document->getHeadData(); + + foreach (array_keys($head_data['styleSheets']) as $script) + { + if (stristr($script, $script_name)) + { + return true; + } + } + + return false; + } +} \ No newline at end of file diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php new file mode 100644 index 0000000..3638b95 --- /dev/null +++ b/admin/helpers/html/batch_.php @@ -0,0 +1,92 @@ + + @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('JPATH_PLATFORM') or die; + +/** + * Utility class to render a list view batch selection options + * + * @since 3.0 + */ +abstract class JHtmlBatch_ +{ + /** + * ListSelection + * + * @var array + * @since 3.0 + */ + protected static $ListSelection = array(); + + /** + * Render the batch selection options. + * + * @return string The necessary HTML to display the batch selection options + * + * @since 3.0 + */ + public static function render() + { + // Collect display data + $data = new stdClass; + $data->ListSelection = static::getListSelection(); + + // Create a layout object and ask it to render the batch selection options + $layout = new JLayoutFile('batchselection'); + $batchHtml = $layout->render($data); + + return $batchHtml; + } + + /** + * Method to add a list selection to the batch modal + * + * @param string $label Label for the menu item. + * @param string $name Name for the filter. Also used as id. + * @param string $options Options for the select field. + * @param bool $noDefault Don't the label as the empty option + * + * @return void + * + * @since 3.0 + */ + public static function addListSelection($label, $name, $options, $noDefault = false) + { + array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault)); + } + + /** + * Returns an array of all ListSelection + * + * @return array + * + * @since 3.0 + */ + public static function getListSelection() + { + return static::$ListSelection; + } +} diff --git a/admin/helpers/html/index.html b/admin/helpers/html/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/helpers/html/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/helpers/index.html b/admin/helpers/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/helpers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/index.html b/admin/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/language/en-GB/en-GB.com_ehealth_portal.ini b/admin/language/en-GB/en-GB.com_ehealth_portal.ini new file mode 100644 index 0000000..9d47860 --- /dev/null +++ b/admin/language/en-GB/en-GB.com_ehealth_portal.ini @@ -0,0 +1,2850 @@ +COM_EHEALTH_PORTAL="eHealth Portal" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART="Administration Part" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS="Administration Parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_ACCESS="Administration Parts Access" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_ACCESS_DESC="Allows the users in this group to access access administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_BATCH_OPTIONS="Batch process the selected Administration Parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_BATCH_TIP="All changes will be applied to all selected Administration Parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_BATCH_USE="Administration Parts Batch Use" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_DESCRIPTION="Administration Parts Edit Description" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of administration part" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_NAME="Administration Parts Edit Name" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_NAME_DESC="Allows the users in this group to edit name of administration part" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_VERSION="Administration Parts Edit Version" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EXPORT="Administration Parts Export" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EXPORT_DESC="Allows the users in this group to export export administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_IMPORT="Administration Parts Import" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_IMPORT_DESC="Allows the users in this group to import import administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_ARCHIVED="%s Administration Parts archived." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_ARCHIVED_1="%s Administration Part archived." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_CHECKED_IN_0="No Administration Part successfully checked in." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_CHECKED_IN_1="%d Administration Part successfully checked in." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_CHECKED_IN_MORE="%d Administration Parts successfully checked in." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_DELETED="%s Administration Parts deleted." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_DELETED_1="%s Administration Part deleted." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_FAILED_PUBLISHING="%s Administration Parts failed publishing." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_FAILED_PUBLISHING_1="%s Administration Part failed publishing." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_FEATURED="%s Administration Parts featured." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_FEATURED_1="%s Administration Part featured." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_PUBLISHED="%s Administration Parts published." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_PUBLISHED_1="%s Administration Part published." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_TRASHED="%s Administration Parts trashed." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_TRASHED_1="%s Administration Part trashed." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_UNFEATURED="%s Administration Parts unfeatured." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_UNFEATURED_1="%s Administration Part unfeatured." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_UNPUBLISHED="%s Administration Parts unpublished." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_N_ITEMS_UNPUBLISHED_1="%s Administration Part unpublished." +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_SUBMENU="Administration Parts Submenu" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_SUBMENU_DESC="Allows the users in this group to submenu of administration part" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_CREATED_BY_DESC="The user that created this Administration Part." +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_CREATED_DATE_DESC="The date this Administration Part was created." +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_DETAILS="Details" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_EDIT="Editing the Administration Part" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_ERROR_UNIQUE_ALIAS="Another Administration Part has the same alias." +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_ID="Id" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_MODIFIED_BY_DESC="The last user that modified this Administration Part." +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_MODIFIED_DATE_DESC="The date this Administration Part was modified." +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_NEW="A New Administration Part" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Administration Part to customise the alias." +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_STATUS="Status" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_VACCINES="Vaccine(s)" +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_VERSION_DESC="A count of the number of times this Administration Part has been revised." +COM_EHEALTH_PORTAL_ADMINISTRATION_PART_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_ANTENATAL_CARE="Antenatal Care" +COM_EHEALTH_PORTAL_ANTENATAL_CARES="Antenatal Cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_ACCESS="Antenatal Cares Access" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_ACCESS_DESC="Allows the users in this group to access access antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_BATCH_OPTIONS="Batch process the selected Antenatal Cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_BATCH_TIP="All changes will be applied to all selected Antenatal Cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_BATCH_USE="Antenatal Cares Batch Use" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_DASHBOARD_ADD="Antenatal Cares Dashboard Add" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of antenatal care" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_DASHBOARD_LIST="Antenatal Cares Dashboard List" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of antenatal care" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_EDIT_VERSION="Antenatal Cares Edit Version" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_EXPORT="Antenatal Cares Export" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_EXPORT_DESC="Allows the users in this group to export export antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_IMPORT="Antenatal Cares Import" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_IMPORT_DESC="Allows the users in this group to import import antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_ARCHIVED="%s Antenatal Cares archived." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_ARCHIVED_1="%s Antenatal Care archived." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_CHECKED_IN_0="No Antenatal Care successfully checked in." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_CHECKED_IN_1="%d Antenatal Care successfully checked in." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_CHECKED_IN_MORE="%d Antenatal Cares successfully checked in." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_DELETED="%s Antenatal Cares deleted." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_DELETED_1="%s Antenatal Care deleted." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_FAILED_PUBLISHING="%s Antenatal Cares failed publishing." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_FAILED_PUBLISHING_1="%s Antenatal Care failed publishing." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_FEATURED="%s Antenatal Cares featured." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_FEATURED_1="%s Antenatal Care featured." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_PUBLISHED="%s Antenatal Cares published." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_PUBLISHED_1="%s Antenatal Care published." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_TRASHED="%s Antenatal Cares trashed." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_TRASHED_1="%s Antenatal Care trashed." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_UNFEATURED="%s Antenatal Cares unfeatured." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_UNFEATURED_1="%s Antenatal Care unfeatured." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_UNPUBLISHED="%s Antenatal Cares unpublished." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_N_ITEMS_UNPUBLISHED_1="%s Antenatal Care unpublished." +COM_EHEALTH_PORTAL_ANTENATAL_CARES_SUBMENU="Antenatal Cares Submenu" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_SUBMENU_DESC="Allows the users in this group to submenu of antenatal care" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_ABDOMINAL_EXAMINATION="Abdominal Examination" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_CAESAREAN_SECTIONS_LABEL="Number of caesarean sections?" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_CREATED_BY_DESC="The user that created this Antenatal Care." +COM_EHEALTH_PORTAL_ANTENATAL_CARE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_CREATED_DATE_DESC="The date this Antenatal Care was created." +COM_EHEALTH_PORTAL_ANTENATAL_CARE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_EDIT="Editing the Antenatal Care" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_ERROR_UNIQUE_ALIAS="Another Antenatal Care has the same alias." +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_ENGAGEMENT_DESCRIPTION="Select engagement of presenting part" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_ENGAGEMENT_LABEL="Engagement of presenting part" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_HEART_RATE_DESCRIPTION="Enter foetal heart rate (bpm)" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_HEART_RATE_LABEL="Foetal heart rate (bpm)" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_LIE_DESCRIPTION="Select foetal poles/lie" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_LIE_LABEL="Foetal poles/lie" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_MOVEMENTS_DESCRIPTION="Add Foetal Movements Here" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_MOVEMENTS_HINT="Add Foetal Movements Here" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_MOVEMENTS_LABEL="Foetal Movements" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_PRESENTATION_DESCRIPTION="Select foetal presentation" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_PRESENTATION_LABEL="Foetal presentation" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_ID="Id" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_LAST_MENSTRUAL_PERIOD_DESCRIPTION="Enter last menstrual period" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_LAST_MENSTRUAL_PERIOD_LABEL="Last Menstrual Period (LMP)" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_LIVE_BIRTHS_LABEL="Number of live births?" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_MISCARRIAGES_LABEL="Number of Miscarriages?" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_MODIFIED_BY_DESC="The last user that modified this Antenatal Care." +COM_EHEALTH_PORTAL_ANTENATAL_CARE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_MODIFIED_DATE_DESC="The date this Antenatal Care was modified." +COM_EHEALTH_PORTAL_ANTENATAL_CARE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_NEW="A New Antenatal Care" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_NORMAL_BIRTHS_LABEL="Number of Normal Births?" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_PREGNANCIES_EXCL_LABEL="Number of pregnancies excluding this one?" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_PREGNANCY_HISTORY="Pregnancy History" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Antenatal Care to customise the alias." +COM_EHEALTH_PORTAL_ANTENATAL_CARE_STATUS="Status" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_STILL_BIRTHS_LABEL="Number of still births" +COM_EHEALTH_PORTAL_ANTENATAL_CARE_VERSION_DESC="A count of the number of times this Antenatal Care has been revised." +COM_EHEALTH_PORTAL_ANTENATAL_CARE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_ARCHIVED="Archived" +COM_EHEALTH_PORTAL_AUTHOR="Author" +COM_EHEALTH_PORTAL_BACK="Back" +COM_EHEALTH_PORTAL_BREAST_CANCER="Breast Cancer" +COM_EHEALTH_PORTAL_BREAST_CANCERS="Breast Cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_ACCESS="Breast Cancers Access" +COM_EHEALTH_PORTAL_BREAST_CANCERS_ACCESS_DESC="Allows the users in this group to access access breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_BATCH_OPTIONS="Batch process the selected Breast Cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_BATCH_TIP="All changes will be applied to all selected Breast Cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_BATCH_USE="Breast Cancers Batch Use" +COM_EHEALTH_PORTAL_BREAST_CANCERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_DASHBOARD_ADD="Breast Cancers Dashboard Add" +COM_EHEALTH_PORTAL_BREAST_CANCERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of breast cancer" +COM_EHEALTH_PORTAL_BREAST_CANCERS_DASHBOARD_LIST="Breast Cancers Dashboard List" +COM_EHEALTH_PORTAL_BREAST_CANCERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of breast cancer" +COM_EHEALTH_PORTAL_BREAST_CANCERS_EDIT_VERSION="Breast Cancers Edit Version" +COM_EHEALTH_PORTAL_BREAST_CANCERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_EXPORT="Breast Cancers Export" +COM_EHEALTH_PORTAL_BREAST_CANCERS_EXPORT_DESC="Allows the users in this group to export export breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_IMPORT="Breast Cancers Import" +COM_EHEALTH_PORTAL_BREAST_CANCERS_IMPORT_DESC="Allows the users in this group to import import breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_ARCHIVED="%s Breast Cancers archived." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_ARCHIVED_1="%s Breast Cancer archived." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_CHECKED_IN_0="No Breast Cancer successfully checked in." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_CHECKED_IN_1="%d Breast Cancer successfully checked in." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_CHECKED_IN_MORE="%d Breast Cancers successfully checked in." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_DELETED="%s Breast Cancers deleted." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_DELETED_1="%s Breast Cancer deleted." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_FAILED_PUBLISHING="%s Breast Cancers failed publishing." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_FAILED_PUBLISHING_1="%s Breast Cancer failed publishing." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_FEATURED="%s Breast Cancers featured." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_FEATURED_1="%s Breast Cancer featured." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_PUBLISHED="%s Breast Cancers published." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_PUBLISHED_1="%s Breast Cancer published." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_TRASHED="%s Breast Cancers trashed." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_TRASHED_1="%s Breast Cancer trashed." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_UNFEATURED="%s Breast Cancers unfeatured." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_UNFEATURED_1="%s Breast Cancer unfeatured." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_UNPUBLISHED="%s Breast Cancers unpublished." +COM_EHEALTH_PORTAL_BREAST_CANCERS_N_ITEMS_UNPUBLISHED_1="%s Breast Cancer unpublished." +COM_EHEALTH_PORTAL_BREAST_CANCERS_SUBMENU="Breast Cancers Submenu" +COM_EHEALTH_PORTAL_BREAST_CANCERS_SUBMENU_DESC="Allows the users in this group to submenu of breast cancer" +COM_EHEALTH_PORTAL_BREAST_CANCER_ASIAN="Asian" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_ABNORMAL_SKIN_DESCRIPTION="Scaly, red. or swollen skin on the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_ABNORMAL_SKIN_LABEL="Scaly, red. or swollen skin on the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_AGE_RANGE_DESCRIPTION="Age > 40 years" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_AGE_RANGE_LABEL="Age > 40 years" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_BREASTFEEDING_DESCRIPTION="Are you breastfeeding?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_BREASTFEEDING_LABEL="Are you breastfeeding?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_BREAST_SHAPE_DESCRIPTION="A change in the size or shape of the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_BREAST_SHAPE_LABEL="A change in the size or shape of the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_DIMPLING_DESCRIPTION="Dimpling or puckering (contact into wrinkles or small folds) in the skin of the breast. The skin may have ridges or pitting so that it looks like the skin of an orange" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_DIMPLING_LABEL="Dimpling or puckering (contact into wrinkles or small folds) in the skin of the breast. The skin may have ridges or pitting so that it looks like the skin of an orange" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_FAMILY_HISTORY_DESCRIPTION="Do you have a family history of breast cancer in the family, immediate family (mother / grandmother)?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_FAMILY_HISTORY_LABEL="Do you have a family history of breast cancer in the family, immediate family (mother / grandmother)?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_HISTORY_HRT_DESCRIPTION="Do you have a history of taking HRT (Oestrogen hormone replacement therapy)?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_HISTORY_HRT_LABEL="Do you have a history of taking HRT (Oestrogen hormone replacement therapy)?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_INWARD_NIPPLE_DESCRIPTION="A nipple turned inward into the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_INWARD_NIPPLE_LABEL="A nipple turned inward into the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_LUMP_NEAR_BREAST_DESCRIPTION="A lump or thickening in or near the breast or in the underarm area" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_LUMP_NEAR_BREAST_LABEL="A lump or thickening in or near the breast or in the underarm area" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_NIPPLE_DISCHARGE_DESCRIPTION="Discharge (fluid) from the nipple, especially if it's bloody" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_NIPPLE_DISCHARGE_LABEL="Discharge (fluid) from the nipple, especially if it's bloody" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_OVERWEIGHT_DESCRIPTION="Does the patient appear to be overweight?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_OVERWEIGHT_LABEL="Does the patient appear to be overweight?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_PREG_AGE_LABEL="At what age was your first pregnancy?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_PREG_FREQ_LABEL="How many times were you pregnant?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_RACE_LABEL="Race" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_REG_EXERCISE_DESCRIPTION="Do you do regular exercise?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BC_REG_EXERCISE_LABEL="Do you do regular exercise?" +COM_EHEALTH_PORTAL_BREAST_CANCER_BLACK="Black" +COM_EHEALTH_PORTAL_BREAST_CANCER_BREAST_EXAMINATION="Breast Examination" +COM_EHEALTH_PORTAL_BREAST_CANCER_COLOURED="Coloured" +COM_EHEALTH_PORTAL_BREAST_CANCER_CREATED_BY_DESC="The user that created this Breast Cancer." +COM_EHEALTH_PORTAL_BREAST_CANCER_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_BREAST_CANCER_CREATED_DATE_DESC="The date this Breast Cancer was created." +COM_EHEALTH_PORTAL_BREAST_CANCER_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_BREAST_CANCER_EDIT="Editing the Breast Cancer" +COM_EHEALTH_PORTAL_BREAST_CANCER_ERROR_UNIQUE_ALIAS="Another Breast Cancer has the same alias." +COM_EHEALTH_PORTAL_BREAST_CANCER_ID="Id" +COM_EHEALTH_PORTAL_BREAST_CANCER_MODIFIED_BY_DESC="The last user that modified this Breast Cancer." +COM_EHEALTH_PORTAL_BREAST_CANCER_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_BREAST_CANCER_MODIFIED_DATE_DESC="The date this Breast Cancer was modified." +COM_EHEALTH_PORTAL_BREAST_CANCER_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_BREAST_CANCER_NEW="A New Breast Cancer" +COM_EHEALTH_PORTAL_BREAST_CANCER_NO="No" +COM_EHEALTH_PORTAL_BREAST_CANCER_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_BREAST_CANCER_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_BREAST_CANCER_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_BREAST_CANCER_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_BREAST_CANCER_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_BREAST_CANCER_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_BREAST_CANCER_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_BREAST_CANCER_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_BREAST_CANCER_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_BREAST_CANCER_RISK_ASSESMENT="Risk Assesment" +COM_EHEALTH_PORTAL_BREAST_CANCER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Breast Cancer to customise the alias." +COM_EHEALTH_PORTAL_BREAST_CANCER_STATUS="Status" +COM_EHEALTH_PORTAL_BREAST_CANCER_THIRTY_YEARS="30+ years" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_ABNORMAL_SKIN_DESCRIPTION="Scaly, red. or swollen skin on the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_ABNORMAL_SKIN_HINT="Add text Here" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_ABNORMAL_SKIN_LABEL="Comments:" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_BREAST_SHAPE_DESCRIPTION="A change in the size or shape of the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_BREAST_SHAPE_HINT="Add text here" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_BREAST_SHAPE_LABEL="Comments:" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_DIMPLING_DESCRIPTION="Dimpling or puckering (contact into wrinkles or small folds) in the skin of the breast. The skin may have ridges or pitting so that it looks like the skin of an orange" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_DIMPLING_HINT="Add text Here" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_DIMPLING_LABEL="Comments:" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_INWARD_NIPPLE_DESCRIPTION="A nipple turned inward into the breast" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_INWARD_NIPPLE_HINT="Add text Here" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_INWARD_NIPPLE_LABEL="Comments:" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_LUMP_NEAR_BREAST_DESCRIPTION="A lump or thickening in or near the breast or in the underarm area" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_LUMP_NEAR_BREAST_HINT="Add text here" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_LUMP_NEAR_BREAST_LABEL="Comments:" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_NIPPLE_DISCHARGE_DESCRIPTION="Discharge (fluid) from the nipple, especially if it's bloody" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_NIPPLE_DISCHARGE_HINT="Add text Here" +COM_EHEALTH_PORTAL_BREAST_CANCER_TXT_BC_NIPPLE_DISCHARGE_LABEL="Comments:" +COM_EHEALTH_PORTAL_BREAST_CANCER_VERSION_DESC="A count of the number of times this Breast Cancer has been revised." +COM_EHEALTH_PORTAL_BREAST_CANCER_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_BREAST_CANCER_WHITE="White" +COM_EHEALTH_PORTAL_BREAST_CANCER_YES="Yes" +COM_EHEALTH_PORTAL_CERVICAL_CANCER="Cervical Cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS="Cervical Cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_ACCESS="Cervical Cancers Access" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_ACCESS_DESC="Allows the users in this group to access access cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_BATCH_OPTIONS="Batch process the selected Cervical Cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_BATCH_TIP="All changes will be applied to all selected Cervical Cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_BATCH_USE="Cervical Cancers Batch Use" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_DASHBOARD_ADD="Cervical Cancers Dashboard Add" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of cervical cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_DASHBOARD_LIST="Cervical Cancers Dashboard List" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of cervical cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_EDIT_VERSION="Cervical Cancers Edit Version" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_EXPORT="Cervical Cancers Export" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_EXPORT_DESC="Allows the users in this group to export export cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_IMPORT="Cervical Cancers Import" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_IMPORT_DESC="Allows the users in this group to import import cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_ARCHIVED="%s Cervical Cancers archived." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_ARCHIVED_1="%s Cervical Cancer archived." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_CHECKED_IN_0="No Cervical Cancer successfully checked in." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_CHECKED_IN_1="%d Cervical Cancer successfully checked in." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_CHECKED_IN_MORE="%d Cervical Cancers successfully checked in." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_DELETED="%s Cervical Cancers deleted." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_DELETED_1="%s Cervical Cancer deleted." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_FAILED_PUBLISHING="%s Cervical Cancers failed publishing." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_FAILED_PUBLISHING_1="%s Cervical Cancer failed publishing." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_FEATURED="%s Cervical Cancers featured." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_FEATURED_1="%s Cervical Cancer featured." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_PUBLISHED="%s Cervical Cancers published." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_PUBLISHED_1="%s Cervical Cancer published." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_TRASHED="%s Cervical Cancers trashed." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_TRASHED_1="%s Cervical Cancer trashed." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_UNFEATURED="%s Cervical Cancers unfeatured." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_UNFEATURED_1="%s Cervical Cancer unfeatured." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_UNPUBLISHED="%s Cervical Cancers unpublished." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_N_ITEMS_UNPUBLISHED_1="%s Cervical Cancer unpublished." +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_SUBMENU="Cervical Cancers Submenu" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_SUBMENU_DESC="Allows the users in this group to submenu of cervical cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_PERIODS_DESCRIPTION="Periods that become heavier and last longer than usual" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_PERIODS_LABEL="Periods that become heavier and last longer than usual" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_REASON_DESCRIPTION="Enter Reason" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_REASON_HINT="Your Reason Here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_REASON_MESSAGE="Error! Please add some text here." +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_RESULT_DESCRIPTION="Results" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_RESULT_LABEL="Results" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_SEX_ACTVE_DESCRIPTION="Have you been sexually active from a young age?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_SEX_ACTVE_LABEL="Have you been sexually active from a young age?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_SEX_PARTNER_DESCRIPTION="Have you had multiple sexual partners?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_SEX_PARTNER_LABEL="Have you had multiple sexual partners?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_SMOKING_DESCRIPTION="Do you smoke?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_SMOKING_LABEL="Do you smoke?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_VIGINAL_BLEEDING_DESCRIPTION="Abnormal vaginal bleeding between periods, after intercourse, or after menopause" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_VIGINAL_BLEEDING_LABEL="Abnormal vaginal bleeding between periods, after intercourse, or after menopause" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_V_DISCHARGE_DESCRIPTION="Vaginal discharge that does not stop, and may be pale, watery, pink, brown, bloody, or foul-smelling" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CC_V_DISCHARGE_LABEL="Vaginal discharge that does not stop, and may be pale, watery, pink, brown, bloody, or foul-smelling" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CERVICAL_EXAMINATION="Cervical Examination" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CREATED_BY_DESC="The user that created this Cervical Cancer." +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CREATED_DATE_DESC="The date this Cervical Cancer was created." +COM_EHEALTH_PORTAL_CERVICAL_CANCER_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_EDIT="Editing the Cervical Cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_ERROR_UNIQUE_ALIAS="Another Cervical Cancer has the same alias." +COM_EHEALTH_PORTAL_CERVICAL_CANCER_ID="Id" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_INCONCLUSIVE="Inconclusive" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_MODIFIED_BY_DESC="The last user that modified this Cervical Cancer." +COM_EHEALTH_PORTAL_CERVICAL_CANCER_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_MODIFIED_DATE_DESC="The date this Cervical Cancer was modified." +COM_EHEALTH_PORTAL_CERVICAL_CANCER_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_NEGATIVE="Negative" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_NEW="A New Cervical Cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_NO="No" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_PAP_SMEAR_COLLECTION_DESCRIPTION="Pap smear collected" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_PAP_SMEAR_COLLECTION_LABEL="Pap smear collected" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_POSITIVE="Positive" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_RISK_ASSESMENT="Risk Assesment" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Cervical Cancer to customise the alias." +COM_EHEALTH_PORTAL_CERVICAL_CANCER_STATUS="Status" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_PERIODS_DESCRIPTION="Periods that become heavier and last longer than usual" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_PERIODS_HINT="Add text Here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_PERIODS_LABEL="Comments:" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SEX_ACTVE_DESCRIPTION="Have you been sexually active from a young age?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SEX_ACTVE_HINT="Add text here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SEX_ACTVE_LABEL="Comments:" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SEX_PARTNER_DESCRIPTION="Have you had multiple sexual partners?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SEX_PARTNER_HINT="Add text here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SEX_PARTNER_LABEL="Comments:" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SMOKING_DESCRIPTION="Do you smoke?" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SMOKING_HINT="Add text Here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_SMOKING_LABEL="Comments:" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_VIGINAL_BLEEDING_DESCRIPTION="Abnormal vaginal bleeding between periods, after intercourse, or after menopause" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_VIGINAL_BLEEDING_HINT="Add text Here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_VIGINAL_BLEEDING_LABEL="Comments:" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_V_DISCHARGE_DESCRIPTION="Vaginal discharge that does not stop, and may be pale, watery, pink, brown, bloody, or foul-smelling" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_V_DISCHARGE_HINT="Add text Here" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_TXT_CC_V_DISCHARGE_LABEL="Comments:" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_VERSION_DESC="A count of the number of times this Cervical Cancer has been revised." +COM_EHEALTH_PORTAL_CERVICAL_CANCER_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_CERVICAL_CANCER_YES="Yes" +COM_EHEALTH_PORTAL_CLINIC="Clinic" +COM_EHEALTH_PORTAL_CLINICS="Clinics" +COM_EHEALTH_PORTAL_CLINICS_ACCESS="Clinics Access" +COM_EHEALTH_PORTAL_CLINICS_ACCESS_DESC="Allows the users in this group to access access clinics" +COM_EHEALTH_PORTAL_CLINICS_BATCH_OPTIONS="Batch process the selected Clinics" +COM_EHEALTH_PORTAL_CLINICS_BATCH_TIP="All changes will be applied to all selected Clinics" +COM_EHEALTH_PORTAL_CLINICS_BATCH_USE="Clinics Batch Use" +COM_EHEALTH_PORTAL_CLINICS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch clinics" +COM_EHEALTH_PORTAL_CLINICS_EDIT_CLINIC_NAME="Clinics Edit Clinic Name" +COM_EHEALTH_PORTAL_CLINICS_EDIT_CLINIC_NAME_DESC="Allows the users in this group to edit clinic name of clinic" +COM_EHEALTH_PORTAL_CLINICS_EDIT_DESCRIPTION="Clinics Edit Description" +COM_EHEALTH_PORTAL_CLINICS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of clinic" +COM_EHEALTH_PORTAL_CLINICS_EDIT_VERSION="Clinics Edit Version" +COM_EHEALTH_PORTAL_CLINICS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version clinics" +COM_EHEALTH_PORTAL_CLINICS_EXPORT="Clinics Export" +COM_EHEALTH_PORTAL_CLINICS_EXPORT_DESC="Allows the users in this group to export export clinics" +COM_EHEALTH_PORTAL_CLINICS_IMPORT="Clinics Import" +COM_EHEALTH_PORTAL_CLINICS_IMPORT_DESC="Allows the users in this group to import import clinics" +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_ARCHIVED="%s Clinics archived." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_ARCHIVED_1="%s Clinic archived." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_CHECKED_IN_0="No Clinic successfully checked in." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_CHECKED_IN_1="%d Clinic successfully checked in." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_CHECKED_IN_MORE="%d Clinics successfully checked in." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_DELETED="%s Clinics deleted." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_DELETED_1="%s Clinic deleted." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_FAILED_PUBLISHING="%s Clinics failed publishing." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_FAILED_PUBLISHING_1="%s Clinic failed publishing." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_FEATURED="%s Clinics featured." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_FEATURED_1="%s Clinic featured." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_PUBLISHED="%s Clinics published." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_PUBLISHED_1="%s Clinic published." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_TRASHED="%s Clinics trashed." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_TRASHED_1="%s Clinic trashed." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_UNFEATURED="%s Clinics unfeatured." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_UNFEATURED_1="%s Clinic unfeatured." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_UNPUBLISHED="%s Clinics unpublished." +COM_EHEALTH_PORTAL_CLINICS_N_ITEMS_UNPUBLISHED_1="%s Clinic unpublished." +COM_EHEALTH_PORTAL_CLINIC_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_CLINIC_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_CLINIC_CLINIC_NAME_DESCRIPTION="Enter Clinic Name Here" +COM_EHEALTH_PORTAL_CLINIC_CLINIC_NAME_HINT="Clinic Name Here" +COM_EHEALTH_PORTAL_CLINIC_CLINIC_NAME_LABEL="Clinic Name" +COM_EHEALTH_PORTAL_CLINIC_CLINIC_NAME_MESSAGE="Error! Please add clinic name here." +COM_EHEALTH_PORTAL_CLINIC_CLINIC_TYPE_DESCRIPTION="Clinic Type" +COM_EHEALTH_PORTAL_CLINIC_CLINIC_TYPE_LABEL="Clinic Type" +COM_EHEALTH_PORTAL_CLINIC_CREATED_BY_DESC="The user that created this Clinic." +COM_EHEALTH_PORTAL_CLINIC_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_CLINIC_CREATED_DATE_DESC="The date this Clinic was created." +COM_EHEALTH_PORTAL_CLINIC_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_CLINIC_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_CLINIC_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_CLINIC_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_CLINIC_DETAILS="Details" +COM_EHEALTH_PORTAL_CLINIC_EDIT="Editing the Clinic" +COM_EHEALTH_PORTAL_CLINIC_ERROR_UNIQUE_ALIAS="Another Clinic has the same alias." +COM_EHEALTH_PORTAL_CLINIC_FIXED="Fixed" +COM_EHEALTH_PORTAL_CLINIC_ID="Id" +COM_EHEALTH_PORTAL_CLINIC_MOBILE="Mobile" +COM_EHEALTH_PORTAL_CLINIC_MODIFIED_BY_DESC="The last user that modified this Clinic." +COM_EHEALTH_PORTAL_CLINIC_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_CLINIC_MODIFIED_DATE_DESC="The date this Clinic was modified." +COM_EHEALTH_PORTAL_CLINIC_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_CLINIC_NEW="A New Clinic" +COM_EHEALTH_PORTAL_CLINIC_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_CLINIC_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_CLINIC_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_CLINIC_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Clinic to customise the alias." +COM_EHEALTH_PORTAL_CLINIC_STATUS="Status" +COM_EHEALTH_PORTAL_CLINIC_VERSION_DESC="A count of the number of times this Clinic has been revised." +COM_EHEALTH_PORTAL_CLINIC_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_CLOSE_NEW="Close & New" +COM_EHEALTH_PORTAL_CONFIG_AUTHOR="Author Info" +COM_EHEALTH_PORTAL_CONFIG_AUTHOR_EMAIL_DESC="The email address of the author of this component." +COM_EHEALTH_PORTAL_CONFIG_AUTHOR_EMAIL_LABEL="Author Email" +COM_EHEALTH_PORTAL_CONFIG_AUTHOR_NAME_DESC="The name of the author of this component." +COM_EHEALTH_PORTAL_CONFIG_AUTHOR_NAME_LABEL="Author Name" +COM_EHEALTH_PORTAL_CONFIG_CHECK_TIMER_DESC="Set the intervals for the auto checkin fuction of tables that checks out the items to an user." +COM_EHEALTH_PORTAL_CONFIG_CHECK_TIMER_LABEL="Check in timer" +COM_EHEALTH_PORTAL_CONFIG_CHECK_TIMER_OPTION_FIVE="Once a week" +COM_EHEALTH_PORTAL_CONFIG_CHECK_TIMER_OPTION_FOUR="Every second day" +COM_EHEALTH_PORTAL_CONFIG_CHECK_TIMER_OPTION_ONE="Every five hours" +COM_EHEALTH_PORTAL_CONFIG_CHECK_TIMER_OPTION_SIX="Never" +COM_EHEALTH_PORTAL_CONFIG_CHECK_TIMER_OPTION_THREE="Once a day" +COM_EHEALTH_PORTAL_CONFIG_CHECK_TIMER_OPTION_TWO="Every twelve hours" +COM_EHEALTH_PORTAL_CONFIG_GLOBAL_DESC="The Global Parameters" +COM_EHEALTH_PORTAL_CONFIG_GLOBAL_LABEL="Global" +COM_EHEALTH_PORTAL_CONTRIBUTOR="Contributor" +COM_EHEALTH_PORTAL_CONTRIBUTORS="Contributors" +COM_EHEALTH_PORTAL_COUNSELING_TYPE="Counseling Type" +COM_EHEALTH_PORTAL_COUNSELING_TYPES="Counseling Types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_ACCESS="Counseling Types Access" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_ACCESS_DESC="Allows the users in this group to access access counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_BATCH_OPTIONS="Batch process the selected Counseling Types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_BATCH_TIP="All changes will be applied to all selected Counseling Types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_BATCH_USE="Counseling Types Batch Use" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_DESCRIPTION="Counseling Types Edit Description" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of counseling type" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_NAME="Counseling Types Edit Name" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of counseling type" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_VERSION="Counseling Types Edit Version" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EXPORT="Counseling Types Export" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EXPORT_DESC="Allows the users in this group to export export counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_IMPORT="Counseling Types Import" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_IMPORT_DESC="Allows the users in this group to import import counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_ARCHIVED="%s Counseling Types archived." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_ARCHIVED_1="%s Counseling Type archived." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_CHECKED_IN_0="No Counseling Type successfully checked in." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_CHECKED_IN_1="%d Counseling Type successfully checked in." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_CHECKED_IN_MORE="%d Counseling Types successfully checked in." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_DELETED="%s Counseling Types deleted." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_DELETED_1="%s Counseling Type deleted." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_FAILED_PUBLISHING="%s Counseling Types failed publishing." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_FAILED_PUBLISHING_1="%s Counseling Type failed publishing." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_FEATURED="%s Counseling Types featured." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_FEATURED_1="%s Counseling Type featured." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_PUBLISHED="%s Counseling Types published." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_PUBLISHED_1="%s Counseling Type published." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_TRASHED="%s Counseling Types trashed." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_TRASHED_1="%s Counseling Type trashed." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_UNFEATURED="%s Counseling Types unfeatured." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_UNFEATURED_1="%s Counseling Type unfeatured." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_UNPUBLISHED="%s Counseling Types unpublished." +COM_EHEALTH_PORTAL_COUNSELING_TYPES_N_ITEMS_UNPUBLISHED_1="%s Counseling Type unpublished." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_CREATED_BY_DESC="The user that created this Counseling Type." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_CREATED_DATE_DESC="The date this Counseling Type was created." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_DETAILS="Details" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_EDIT="Editing the Counseling Type" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_ERROR_UNIQUE_ALIAS="Another Counseling Type has the same alias." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_ID="Id" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_MODIFIED_BY_DESC="The last user that modified this Counseling Type." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_MODIFIED_DATE_DESC="The date this Counseling Type was modified." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_NEW="A New Counseling Type" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Counseling Type to customise the alias." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_STATUS="Status" +COM_EHEALTH_PORTAL_COUNSELING_TYPE_VERSION_DESC="A count of the number of times this Counseling Type has been revised." +COM_EHEALTH_PORTAL_COUNSELING_TYPE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_CREATE_NEW_S="Create New %s" +COM_EHEALTH_PORTAL_DASH="Dashboard" +COM_EHEALTH_PORTAL_DASHBOARD="eHealth Portal Dashboard" +COM_EHEALTH_PORTAL_DASHBOARD_ANTENATAL_CARES="Antenatal Cares

" +COM_EHEALTH_PORTAL_DASHBOARD_ANTENATAL_CARE_ADD="Add Antenatal Care

" +COM_EHEALTH_PORTAL_DASHBOARD_BREAST_CANCERS="Breast Cancers

" +COM_EHEALTH_PORTAL_DASHBOARD_BREAST_CANCER_ADD="Add Breast Cancer

" +COM_EHEALTH_PORTAL_DASHBOARD_CERVICAL_CANCERS="Cervical Cancers

" +COM_EHEALTH_PORTAL_DASHBOARD_CERVICAL_CANCER_ADD="Add Cervical Cancer

" +COM_EHEALTH_PORTAL_DASHBOARD_FAMILY_PLANNINGS="Family Plannings

" +COM_EHEALTH_PORTAL_DASHBOARD_FAMILY_PLANNING_ADD="Add Family Planning

" +COM_EHEALTH_PORTAL_DASHBOARD_GENERAL_MEDICAL_CHECK_UPS="General Medical Check Ups

" +COM_EHEALTH_PORTAL_DASHBOARD_GENERAL_MEDICAL_CHECK_UP_ADD="Add General Medical Check Up

" +COM_EHEALTH_PORTAL_DASHBOARD_HEALTH_EDUCATIONS="Health Educations

" +COM_EHEALTH_PORTAL_DASHBOARD_HEALTH_EDUCATION_ADD="Add Health Education

" +COM_EHEALTH_PORTAL_DASHBOARD_HIV_COUNSELINGS_AND_TESTINGS="Hiv Counselings And Testings

" +COM_EHEALTH_PORTAL_DASHBOARD_HIV_COUNSELING_AND_TESTING_ADD="Add Hiv Counseling And Testing

" +COM_EHEALTH_PORTAL_DASHBOARD_IMMUNISATIONS="Immunisations

" +COM_EHEALTH_PORTAL_DASHBOARD_IMMUNISATION_ADD="Add Immunisation

" +COM_EHEALTH_PORTAL_DASHBOARD_PATIENT_QUEUE="Patient Queue

" +COM_EHEALTH_PORTAL_DASHBOARD_PAYMENTS="Payments

" +COM_EHEALTH_PORTAL_DASHBOARD_PAYMENT_ADD="Add Payment

" +COM_EHEALTH_PORTAL_DASHBOARD_PROSTATE_AND_TESTICULAR_CANCERS="Prostate And Testicular Cancers

" +COM_EHEALTH_PORTAL_DASHBOARD_PROSTATE_AND_TESTICULAR_CANCER_ADD="Add Prostate And Testicular Cancer

" +COM_EHEALTH_PORTAL_DASHBOARD_TESTS="Tests

" +COM_EHEALTH_PORTAL_DASHBOARD_TEST_ADD="Add Test

" +COM_EHEALTH_PORTAL_DASHBOARD_TUBERCULOSES="Tuberculoses

" +COM_EHEALTH_PORTAL_DASHBOARD_TUBERCULOSIS_ADD="Add Tuberculosis

" +COM_EHEALTH_PORTAL_DASHBOARD_VMMCS="Vmmcs

" +COM_EHEALTH_PORTAL_DASHBOARD_VMMC_ADD="Add Vmmc

" +COM_EHEALTH_PORTAL_DATE="Date" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE="Diagnosis Type" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES="Diagnosis Types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_ACCESS="Diagnosis Types Access" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_ACCESS_DESC="Allows the users in this group to access access diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_BATCH_OPTIONS="Batch process the selected Diagnosis Types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_BATCH_TIP="All changes will be applied to all selected Diagnosis Types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_BATCH_USE="Diagnosis Types Batch Use" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_DESCRIPTION="Diagnosis Types Edit Description" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of diagnosis type" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_NAME="Diagnosis Types Edit Name" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of diagnosis type" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_VERSION="Diagnosis Types Edit Version" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EXPORT="Diagnosis Types Export" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EXPORT_DESC="Allows the users in this group to export export diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_IMPORT="Diagnosis Types Import" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_IMPORT_DESC="Allows the users in this group to import import diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_ARCHIVED="%s Diagnosis Types archived." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_ARCHIVED_1="%s Diagnosis Type archived." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_CHECKED_IN_0="No Diagnosis Type successfully checked in." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_CHECKED_IN_1="%d Diagnosis Type successfully checked in." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_CHECKED_IN_MORE="%d Diagnosis Types successfully checked in." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_DELETED="%s Diagnosis Types deleted." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_DELETED_1="%s Diagnosis Type deleted." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_FAILED_PUBLISHING="%s Diagnosis Types failed publishing." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_FAILED_PUBLISHING_1="%s Diagnosis Type failed publishing." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_FEATURED="%s Diagnosis Types featured." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_FEATURED_1="%s Diagnosis Type featured." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_PUBLISHED="%s Diagnosis Types published." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_PUBLISHED_1="%s Diagnosis Type published." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_TRASHED="%s Diagnosis Types trashed." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_TRASHED_1="%s Diagnosis Type trashed." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_UNFEATURED="%s Diagnosis Types unfeatured." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_UNFEATURED_1="%s Diagnosis Type unfeatured." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_UNPUBLISHED="%s Diagnosis Types unpublished." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_N_ITEMS_UNPUBLISHED_1="%s Diagnosis Type unpublished." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_CREATED_BY_DESC="The user that created this Diagnosis Type." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_CREATED_DATE_DESC="The date this Diagnosis Type was created." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_DETAILS="Details" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_EDIT="Editing the Diagnosis Type" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_ERROR_UNIQUE_ALIAS="Another Diagnosis Type has the same alias." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_ID="Id" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_MODIFIED_BY_DESC="The last user that modified this Diagnosis Type." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_MODIFIED_DATE_DESC="The date this Diagnosis Type was modified." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_NEW="A New Diagnosis Type" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Diagnosis Type to customise the alias." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_STATUS="Status" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_VERSION_DESC="A count of the number of times this Diagnosis Type has been revised." +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_EDIT_CREATED_BY="Edit Created By" +COM_EHEALTH_PORTAL_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by." +COM_EHEALTH_PORTAL_EDIT_CREATED_DATE="Edit Created Date" +COM_EHEALTH_PORTAL_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date." +COM_EHEALTH_PORTAL_EDIT_S="Edit %s" +COM_EHEALTH_PORTAL_EDIT_VERSIONS="Edit Version" +COM_EHEALTH_PORTAL_EDIT_VERSIONS_DESC="Allows users in this group to edit versions." +COM_EHEALTH_PORTAL_EXPORT_DATA="Export Data" +COM_EHEALTH_PORTAL_EXPORT_DATA_DESC="Allows users in this group to export data." +COM_EHEALTH_PORTAL_EXPORT_FAILED="Export Failed" +COM_EHEALTH_PORTAL_FAMILY_PLANNING="Family Planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS="Family Plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_ACCESS="Family Plannings Access" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_ACCESS_DESC="Allows the users in this group to access access family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_BATCH_OPTIONS="Batch process the selected Family Plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_BATCH_TIP="All changes will be applied to all selected Family Plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_BATCH_USE="Family Plannings Batch Use" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_DASHBOARD_ADD="Family Plannings Dashboard Add" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of family planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_DASHBOARD_LIST="Family Plannings Dashboard List" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of family planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EDIT_DIAGNOSIS="Family Plannings Edit Diagnosis" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EDIT_DIAGNOSIS_DESC="Allows the users in this group to edit diagnosis of family planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EDIT_VERSION="Family Plannings Edit Version" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EXPORT="Family Plannings Export" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EXPORT_DESC="Allows the users in this group to export export family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_IMPORT="Family Plannings Import" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_IMPORT_DESC="Allows the users in this group to import import family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_ARCHIVED="%s Family Plannings archived." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_ARCHIVED_1="%s Family Planning archived." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_CHECKED_IN_0="No Family Planning successfully checked in." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_CHECKED_IN_1="%d Family Planning successfully checked in." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_CHECKED_IN_MORE="%d Family Plannings successfully checked in." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_DELETED="%s Family Plannings deleted." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_DELETED_1="%s Family Planning deleted." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_FAILED_PUBLISHING="%s Family Plannings failed publishing." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_FAILED_PUBLISHING_1="%s Family Planning failed publishing." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_FEATURED="%s Family Plannings featured." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_FEATURED_1="%s Family Planning featured." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_PUBLISHED="%s Family Plannings published." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_PUBLISHED_1="%s Family Planning published." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_TRASHED="%s Family Plannings trashed." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_TRASHED_1="%s Family Planning trashed." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_UNFEATURED="%s Family Plannings unfeatured." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_UNFEATURED_1="%s Family Planning unfeatured." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_UNPUBLISHED="%s Family Plannings unpublished." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_N_ITEMS_UNPUBLISHED_1="%s Family Planning unpublished." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_SUBMENU="Family Plannings Submenu" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_SUBMENU_DESC="Allows the users in this group to submenu of family planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_CREATED_BY_DESC="The user that created this Family Planning." +COM_EHEALTH_PORTAL_FAMILY_PLANNING_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_CREATED_DATE_DESC="The date this Family Planning was created." +COM_EHEALTH_PORTAL_FAMILY_PLANNING_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_DETAILS="Details" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_DIAGNOSIS_DESCRIPTION="Select Planning Type" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_DIAGNOSIS_LABEL="Select Family Planning Type" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_EDIT="Editing the Family Planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_ERROR_UNIQUE_ALIAS="Another Family Planning has the same alias." +COM_EHEALTH_PORTAL_FAMILY_PLANNING_ID="Id" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_MODIFIED_BY_DESC="The last user that modified this Family Planning." +COM_EHEALTH_PORTAL_FAMILY_PLANNING_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_MODIFIED_DATE_DESC="The date this Family Planning was modified." +COM_EHEALTH_PORTAL_FAMILY_PLANNING_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_NEW="A New Family Planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Family Planning to customise the alias." +COM_EHEALTH_PORTAL_FAMILY_PLANNING_STATUS="Status" +COM_EHEALTH_PORTAL_FAMILY_PLANNING_VERSION_DESC="A count of the number of times this Family Planning has been revised." +COM_EHEALTH_PORTAL_FAMILY_PLANNING_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_FILTER_ADMINISTRATION_PART_ASCENDING="Administration Part ascending" +COM_EHEALTH_PORTAL_FILTER_ADMINISTRATION_PART_DESCENDING="Administration Part descending" +COM_EHEALTH_PORTAL_FILTER_BPONEDIASTOLIC_ASCENDING="BP(1)-Diastolic ascending" +COM_EHEALTH_PORTAL_FILTER_BPONEDIASTOLIC_DESCENDING="BP(1)-Diastolic descending" +COM_EHEALTH_PORTAL_FILTER_BPONESYSTOLIC_ASCENDING="BP(1)-Systolic ascending" +COM_EHEALTH_PORTAL_FILTER_BPONESYSTOLIC_DESCENDING="BP(1)-Systolic descending" +COM_EHEALTH_PORTAL_FILTER_BPTWODIASTOLIC_ASCENDING="BP(2)-Diastolic ascending" +COM_EHEALTH_PORTAL_FILTER_BPTWODIASTOLIC_DESCENDING="BP(2)-Diastolic descending" +COM_EHEALTH_PORTAL_FILTER_BPTWOSYSTOLIC_ASCENDING="BP(2)-Systolic ascending" +COM_EHEALTH_PORTAL_FILTER_BPTWOSYSTOLIC_DESCENDING="BP(2)-Systolic descending" +COM_EHEALTH_PORTAL_FILTER_CLINIC_NAME_ASCENDING="Clinic Name ascending" +COM_EHEALTH_PORTAL_FILTER_CLINIC_NAME_DESCENDING="Clinic Name descending" +COM_EHEALTH_PORTAL_FILTER_DESCRIPTION_ASCENDING="Description ascending" +COM_EHEALTH_PORTAL_FILTER_DESCRIPTION_DESCENDING="Description descending" +COM_EHEALTH_PORTAL_FILTER_HEIGHT_M_ASCENDING="Height (m) ascending" +COM_EHEALTH_PORTAL_FILTER_HEIGHT_M_DESCENDING="Height (m) descending" +COM_EHEALTH_PORTAL_FILTER_NAME_ASCENDING="Name ascending" +COM_EHEALTH_PORTAL_FILTER_NAME_DESCENDING="Name descending" +COM_EHEALTH_PORTAL_FILTER_ONEST_TEMP_READING_C_ASCENDING="1st Temp. Reading (*C): ascending" +COM_EHEALTH_PORTAL_FILTER_ONEST_TEMP_READING_C_DESCENDING="1st Temp. Reading (*C): descending" +COM_EHEALTH_PORTAL_FILTER_PATIENT_NAME_ASCENDING="Patient Name ascending" +COM_EHEALTH_PORTAL_FILTER_PATIENT_NAME_DESCENDING="Patient Name descending" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED="Status" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_ADMINISTRATION_PARTS="Status options for administration parts" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_ANTENATAL_CARES="Status options for antenatal cares" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_BREAST_CANCERS="Status options for breast cancers" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_CERVICAL_CANCERS="Status options for cervical cancers" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_CLINICS="Status options for clinics" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_COUNSELING_TYPES="Status options for counseling types" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_DIAGNOSIS_TYPES="Status options for diagnosis types" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_FAMILY_PLANNINGS="Status options for family plannings" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_FOETAL_ENGAGEMENTS="Status options for foetal engagements" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_FOETAL_LIES="Status options for foetal lies" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_FOETAL_PRESENTATIONS="Status options for foetal presentations" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_GENERAL_MEDICAL_CHECK_UPS="Status options for general medical check ups" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_HEALTH_EDUCATIONS="Status options for health educations" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_HEALTH_EDUCATION_TOPICS="Status options for health education topics" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_HIV_COUNSELINGS_AND_TESTINGS="Status options for hiv counselings and testings" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_IMMUNISATIONS="Status options for immunisations" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_IMMUNISATION_TYPES="Status options for immunisation types" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_IMMUNISATION_VACCINE_TYPES="Status options for immunisation vaccine types" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_MEDICATIONS="Status options for medications" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_NONPAY_REASONS="Status options for nonpay reasons" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_PAYMENTS="Status options for payments" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_PAYMENT_AMOUNTS="Status options for payment amounts" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_PAYMENT_TYPES="Status options for payment types" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_PLANNING_TYPES="Status options for planning types" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_PROSTATE_AND_TESTICULAR_CANCERS="Status options for prostate and testicular cancers" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_REFERRALS="Status options for referrals" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_SITES="Status options for sites" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_STRENGTHS="Status options for strengths" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_TESTING_REASONS="Status options for testing reasons" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_TESTS="Status options for tests" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_TUBERCULOSES="Status options for tuberculoses" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_UNITS="Status options for units" +COM_EHEALTH_PORTAL_FILTER_PUBLISHED_VMMCS="Status options for vmmcs" +COM_EHEALTH_PORTAL_FILTER_PULSE_ASCENDING="Pulse ascending" +COM_EHEALTH_PORTAL_FILTER_PULSE_DESCENDING="Pulse descending" +COM_EHEALTH_PORTAL_FILTER_REFERRED_TO_ASCENDING="Referred to ascending" +COM_EHEALTH_PORTAL_FILTER_REFERRED_TO_DESCENDING="Referred to descending" +COM_EHEALTH_PORTAL_FILTER_SEARCH="Searchpayments" +COM_EHEALTH_PORTAL_FILTER_SEARCH_ADMINISTRATION_PARTS="Search the administration part items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_ANTENATAL_CARES="Search the antenatal care items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_BREAST_CANCERS="Search the breast cancer items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_CERVICAL_CANCERS="Search the cervical cancer items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_CLINICS="Search the clinic items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_COUNSELING_TYPES="Search the counseling type items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_DIAGNOSIS_TYPES="Search the diagnosis type items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_FAMILY_PLANNINGS="Search the family planning items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_FOETAL_ENGAGEMENTS="Search the foetal engagement items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_FOETAL_LIES="Search the foetal lie items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_FOETAL_PRESENTATIONS="Search the foetal presentation items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_GENERAL_MEDICAL_CHECK_UPS="Search the general medical check up items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_HEALTH_EDUCATIONS="Search the health education items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_HEALTH_EDUCATION_TOPICS="Search the health education topic items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_HIV_COUNSELINGS_AND_TESTINGS="Search the hiv counseling and testing items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_IMMUNISATIONS="Search the immunisation items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_IMMUNISATION_TYPES="Search the immunisation type items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_IMMUNISATION_VACCINE_TYPES="Search the immunisation vaccine type items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_MEDICATIONS="Search the medication items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_NONPAY_REASONS="Search the nonpay reason items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_PAYMENTS="Search the payment items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_PAYMENT_AMOUNTS="Search the payment amount items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_PAYMENT_TYPES="Search the payment type items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_PLANNING_TYPES="Search the planning type items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_PROSTATE_AND_TESTICULAR_CANCERS="Search the prostate and testicular cancer items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_REFERRALS="Search the referral items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_SITES="Search the site items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_STRENGTHS="Search the strength items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_TESTING_REASONS="Search the testing reason items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_TESTS="Search the test items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_TUBERCULOSES="Search the tuberculosis items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_UNITS="Search the unit items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SEARCH_VMMCS="Search the vmmc items. Prefix with ID: to search for an item by ID." +COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS="Select Access" +COM_EHEALTH_PORTAL_FILTER_SELECT_ADMINISTRATION_PART="Select Administration Part" +COM_EHEALTH_PORTAL_FILTER_SELECT_AMOUNT_N="Select Amount (N$):" +COM_EHEALTH_PORTAL_FILTER_SELECT_FAMILY_PLANNING_TYPE_ASCENDING="Select Family Planning Type ascending" +COM_EHEALTH_PORTAL_FILTER_SELECT_FAMILY_PLANNING_TYPE_DESCENDING="Select Family Planning Type descending" +COM_EHEALTH_PORTAL_FILTER_SELECT_FOETAL_POLESLIE="Select Foetal poles/lie" +COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME="Select Patient Name" +COM_EHEALTH_PORTAL_FILTER_SELECT_PAYMENT_CATEGORY="Select Payment Category" +COM_EHEALTH_PORTAL_FILTER_SELECT_REFERRED_TO="Select Referred to" +COM_EHEALTH_PORTAL_FILTER_SELECT_TOPIC_ASCENDING="Select Topic: ascending" +COM_EHEALTH_PORTAL_FILTER_SELECT_TOPIC_DESCENDING="Select Topic: descending" +COM_EHEALTH_PORTAL_FILTER_SELECT_TYPE="Select Type" +COM_EHEALTH_PORTAL_FILTER_SITE_NAME_ASCENDING="Site Name ascending" +COM_EHEALTH_PORTAL_FILTER_SITE_NAME_DESCENDING="Site Name descending" +COM_EHEALTH_PORTAL_FILTER_SITE_REGION_ASCENDING="Site Region ascending" +COM_EHEALTH_PORTAL_FILTER_SITE_REGION_DESCENDING="Site Region descending" +COM_EHEALTH_PORTAL_FILTER_TWOND_TEMP_READING_C_ASCENDING="2nd Temp. Reading (*C): ascending" +COM_EHEALTH_PORTAL_FILTER_TWOND_TEMP_READING_C_DESCENDING="2nd Temp. Reading (*C): descending" +COM_EHEALTH_PORTAL_FILTER_WEIGHT_KG_ASCENDING="Weight (kg) ascending" +COM_EHEALTH_PORTAL_FILTER_WEIGHT_KG_DESCENDING="Weight (kg) descending" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT="Foetal Engagement" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS="Foetal Engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_ACCESS="Foetal Engagements Access" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_ACCESS_DESC="Allows the users in this group to access access foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_BATCH_OPTIONS="Batch process the selected Foetal Engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_BATCH_TIP="All changes will be applied to all selected Foetal Engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_BATCH_USE="Foetal Engagements Batch Use" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_DESCRIPTION="Foetal Engagements Edit Description" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of foetal engagement" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_NAME="Foetal Engagements Edit Name" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_NAME_DESC="Allows the users in this group to edit name of foetal engagement" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_VERSION="Foetal Engagements Edit Version" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EXPORT="Foetal Engagements Export" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EXPORT_DESC="Allows the users in this group to export export foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_IMPORT="Foetal Engagements Import" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_IMPORT_DESC="Allows the users in this group to import import foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_ARCHIVED="%s Foetal Engagements archived." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_ARCHIVED_1="%s Foetal Engagement archived." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_CHECKED_IN_0="No Foetal Engagement successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_CHECKED_IN_1="%d Foetal Engagement successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_CHECKED_IN_MORE="%d Foetal Engagements successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_DELETED="%s Foetal Engagements deleted." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_DELETED_1="%s Foetal Engagement deleted." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_FAILED_PUBLISHING="%s Foetal Engagements failed publishing." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_FAILED_PUBLISHING_1="%s Foetal Engagement failed publishing." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_FEATURED="%s Foetal Engagements featured." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_FEATURED_1="%s Foetal Engagement featured." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_PUBLISHED="%s Foetal Engagements published." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_PUBLISHED_1="%s Foetal Engagement published." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_TRASHED="%s Foetal Engagements trashed." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_TRASHED_1="%s Foetal Engagement trashed." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_UNFEATURED="%s Foetal Engagements unfeatured." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_UNFEATURED_1="%s Foetal Engagement unfeatured." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_UNPUBLISHED="%s Foetal Engagements unpublished." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_N_ITEMS_UNPUBLISHED_1="%s Foetal Engagement unpublished." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_CREATED_BY_DESC="The user that created this Foetal Engagement." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_CREATED_DATE_DESC="The date this Foetal Engagement was created." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_DETAILS="Details" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_EDIT="Editing the Foetal Engagement" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_ERROR_UNIQUE_ALIAS="Another Foetal Engagement has the same alias." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_ID="Id" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_MODIFIED_BY_DESC="The last user that modified this Foetal Engagement." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_MODIFIED_DATE_DESC="The date this Foetal Engagement was modified." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_NEW="A New Foetal Engagement" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Foetal Engagement to customise the alias." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_STATUS="Status" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_VERSION_DESC="A count of the number of times this Foetal Engagement has been revised." +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_FOETAL_LIE="Foetal Lie" +COM_EHEALTH_PORTAL_FOETAL_LIES="Foetal Lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_ACCESS="Foetal Lies Access" +COM_EHEALTH_PORTAL_FOETAL_LIES_ACCESS_DESC="Allows the users in this group to access access foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_BATCH_OPTIONS="Batch process the selected Foetal Lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_BATCH_TIP="All changes will be applied to all selected Foetal Lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_BATCH_USE="Foetal Lies Batch Use" +COM_EHEALTH_PORTAL_FOETAL_LIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_DESCRIPTION="Foetal Lies Edit Description" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of foetal lie" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_NAME="Foetal Lies Edit Name" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_NAME_DESC="Allows the users in this group to edit name of foetal lie" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_VERSION="Foetal Lies Edit Version" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_EXPORT="Foetal Lies Export" +COM_EHEALTH_PORTAL_FOETAL_LIES_EXPORT_DESC="Allows the users in this group to export export foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_IMPORT="Foetal Lies Import" +COM_EHEALTH_PORTAL_FOETAL_LIES_IMPORT_DESC="Allows the users in this group to import import foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_ARCHIVED="%s Foetal Lies archived." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_ARCHIVED_1="%s Foetal Lie archived." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_CHECKED_IN_0="No Foetal Lie successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_CHECKED_IN_1="%d Foetal Lie successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_CHECKED_IN_MORE="%d Foetal Lies successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_DELETED="%s Foetal Lies deleted." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_DELETED_1="%s Foetal Lie deleted." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_FAILED_PUBLISHING="%s Foetal Lies failed publishing." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_FAILED_PUBLISHING_1="%s Foetal Lie failed publishing." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_FEATURED="%s Foetal Lies featured." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_FEATURED_1="%s Foetal Lie featured." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_PUBLISHED="%s Foetal Lies published." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_PUBLISHED_1="%s Foetal Lie published." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_TRASHED="%s Foetal Lies trashed." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_TRASHED_1="%s Foetal Lie trashed." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_UNFEATURED="%s Foetal Lies unfeatured." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_UNFEATURED_1="%s Foetal Lie unfeatured." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_UNPUBLISHED="%s Foetal Lies unpublished." +COM_EHEALTH_PORTAL_FOETAL_LIES_N_ITEMS_UNPUBLISHED_1="%s Foetal Lie unpublished." +COM_EHEALTH_PORTAL_FOETAL_LIE_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_FOETAL_LIE_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_FOETAL_LIE_CREATED_BY_DESC="The user that created this Foetal Lie." +COM_EHEALTH_PORTAL_FOETAL_LIE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_FOETAL_LIE_CREATED_DATE_DESC="The date this Foetal Lie was created." +COM_EHEALTH_PORTAL_FOETAL_LIE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_FOETAL_LIE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_FOETAL_LIE_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_FOETAL_LIE_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_FOETAL_LIE_DETAILS="Details" +COM_EHEALTH_PORTAL_FOETAL_LIE_EDIT="Editing the Foetal Lie" +COM_EHEALTH_PORTAL_FOETAL_LIE_ERROR_UNIQUE_ALIAS="Another Foetal Lie has the same alias." +COM_EHEALTH_PORTAL_FOETAL_LIE_ID="Id" +COM_EHEALTH_PORTAL_FOETAL_LIE_MODIFIED_BY_DESC="The last user that modified this Foetal Lie." +COM_EHEALTH_PORTAL_FOETAL_LIE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_FOETAL_LIE_MODIFIED_DATE_DESC="The date this Foetal Lie was modified." +COM_EHEALTH_PORTAL_FOETAL_LIE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_FOETAL_LIE_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_FOETAL_LIE_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_FOETAL_LIE_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_FOETAL_LIE_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_FOETAL_LIE_NEW="A New Foetal Lie" +COM_EHEALTH_PORTAL_FOETAL_LIE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_FOETAL_LIE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_FOETAL_LIE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_FOETAL_LIE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Foetal Lie to customise the alias." +COM_EHEALTH_PORTAL_FOETAL_LIE_STATUS="Status" +COM_EHEALTH_PORTAL_FOETAL_LIE_VERSION_DESC="A count of the number of times this Foetal Lie has been revised." +COM_EHEALTH_PORTAL_FOETAL_LIE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION="Foetal Presentation" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS="Foetal Presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_ACCESS="Foetal Presentations Access" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_ACCESS_DESC="Allows the users in this group to access access foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_BATCH_OPTIONS="Batch process the selected Foetal Presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_BATCH_TIP="All changes will be applied to all selected Foetal Presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_BATCH_USE="Foetal Presentations Batch Use" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_DESCRIPTION="Foetal Presentations Edit Description" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of foetal presentation" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_NAME="Foetal Presentations Edit Name" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_NAME_DESC="Allows the users in this group to edit name of foetal presentation" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_VERSION="Foetal Presentations Edit Version" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EXPORT="Foetal Presentations Export" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EXPORT_DESC="Allows the users in this group to export export foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_IMPORT="Foetal Presentations Import" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_IMPORT_DESC="Allows the users in this group to import import foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_ARCHIVED="%s Foetal Presentations archived." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_ARCHIVED_1="%s Foetal Presentation archived." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_CHECKED_IN_0="No Foetal Presentation successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_CHECKED_IN_1="%d Foetal Presentation successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_CHECKED_IN_MORE="%d Foetal Presentations successfully checked in." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_DELETED="%s Foetal Presentations deleted." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_DELETED_1="%s Foetal Presentation deleted." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_FAILED_PUBLISHING="%s Foetal Presentations failed publishing." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_FAILED_PUBLISHING_1="%s Foetal Presentation failed publishing." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_FEATURED="%s Foetal Presentations featured." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_FEATURED_1="%s Foetal Presentation featured." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_PUBLISHED="%s Foetal Presentations published." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_PUBLISHED_1="%s Foetal Presentation published." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_TRASHED="%s Foetal Presentations trashed." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_TRASHED_1="%s Foetal Presentation trashed." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_UNFEATURED="%s Foetal Presentations unfeatured." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_UNFEATURED_1="%s Foetal Presentation unfeatured." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_UNPUBLISHED="%s Foetal Presentations unpublished." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_N_ITEMS_UNPUBLISHED_1="%s Foetal Presentation unpublished." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_CREATED_BY_DESC="The user that created this Foetal Presentation." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_CREATED_DATE_DESC="The date this Foetal Presentation was created." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_DETAILS="Details" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_EDIT="Editing the Foetal Presentation" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_ERROR_UNIQUE_ALIAS="Another Foetal Presentation has the same alias." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_ID="Id" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_MODIFIED_BY_DESC="The last user that modified this Foetal Presentation." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_MODIFIED_DATE_DESC="The date this Foetal Presentation was modified." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_NEW="A New Foetal Presentation" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Foetal Presentation to customise the alias." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_STATUS="Status" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_VERSION_DESC="A count of the number of times this Foetal Presentation has been revised." +COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP="General Medical Check Up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS="General Medical Check Ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_ACCESS="General Medical Check Ups Access" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_ACCESS_DESC="Allows the users in this group to access access general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_BATCH_OPTIONS="Batch process the selected General Medical Check Ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_BATCH_TIP="All changes will be applied to all selected General Medical Check Ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_BATCH_USE="General Medical Check Ups Batch Use" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_DASHBOARD_ADD="General Medical Check Ups Dashboard Add" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of general medical check up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_DASHBOARD_LIST="General Medical Check Ups Dashboard List" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of general medical check up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EDIT_PATIENT="General Medical Check Ups Edit Patient" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EDIT_PATIENT_DESC="Allows the users in this group to edit patient of general medical check up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EDIT_VERSION="General Medical Check Ups Edit Version" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EXPORT="General Medical Check Ups Export" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EXPORT_DESC="Allows the users in this group to export export general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_IMPORT="General Medical Check Ups Import" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_IMPORT_DESC="Allows the users in this group to import import general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_ARCHIVED="%s General Medical Check Ups archived." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_ARCHIVED_1="%s General Medical Check Up archived." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_CHECKED_IN_0="No General Medical Check Up successfully checked in." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_CHECKED_IN_1="%d General Medical Check Up successfully checked in." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_CHECKED_IN_MORE="%d General Medical Check Ups successfully checked in." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_DELETED="%s General Medical Check Ups deleted." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_DELETED_1="%s General Medical Check Up deleted." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_FAILED_PUBLISHING="%s General Medical Check Ups failed publishing." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_FAILED_PUBLISHING_1="%s General Medical Check Up failed publishing." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_FEATURED="%s General Medical Check Ups featured." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_FEATURED_1="%s General Medical Check Up featured." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_PUBLISHED="%s General Medical Check Ups published." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_PUBLISHED_1="%s General Medical Check Up published." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_TRASHED="%s General Medical Check Ups trashed." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_TRASHED_1="%s General Medical Check Up trashed." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_UNFEATURED="%s General Medical Check Ups unfeatured." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_UNFEATURED_1="%s General Medical Check Up unfeatured." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_UNPUBLISHED="%s General Medical Check Ups unpublished." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_N_ITEMS_UNPUBLISHED_1="%s General Medical Check Up unpublished." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_SUBMENU="General Medical Check Ups Submenu" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_SUBMENU_DESC="Allows the users in this group to submenu of general medical check up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BMI_DESCRIPTION="Enter pulse in beats per minute" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BMI_LABEL="BMI" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_DIASTOLIC_ONE_DESCRIPTION="Enter BP(1)-Diastolic" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_DIASTOLIC_ONE_LABEL="BP(1)-Diastolic" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_DIASTOLIC_TWO_DESCRIPTION="Enter BP(2)-Diastolic" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_DIASTOLIC_TWO_LABEL="BP(2)-Diastolic" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_SYSTOLIC_ONE_DESCRIPTION="Enter BP(1)-Systolic" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_SYSTOLIC_ONE_LABEL="BP(1)-Systolic" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_SYSTOLIC_TWO_DESCRIPTION="Enter BP(2)-Systolic" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_SYSTOLIC_TWO_LABEL="BP(2)-Systolic" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_CHRONIC_MEDICATION_DESCRIPTION="Chronic Medication" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_CHRONIC_MEDICATION_LABEL="Chronic Medication?" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_COMPLAINT_DESCRIPTION="Add Complaint Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_COMPLAINT_HINT="Add Complaint Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_COMPLAINT_LABEL="Complaint" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_CREATED_BY_DESC="The user that created this General Medical Check Up." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_CREATED_DATE_DESC="The date this General Medical Check Up was created." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_DIAGNOSIS="Diagnosis" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_DIAGNOSIS_DESCRIPTION="Select Diagnosis" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_DIAGNOSIS_LABEL="Select Diagnosis" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_DISPENSING="Dispensing" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_DISPENSING_LABEL="Dispensing" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_EDIT="Editing the General Medical Check Up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_ERROR_UNIQUE_ALIAS="Another General Medical Check Up has the same alias." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_HEIGHT_LABEL="Height (m)" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_ID="Id" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_INSTRUCTIONS_DESCRIPTION="Add Instructions Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_INSTRUCTIONS_HINT="Add Instructions Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_INSTRUCTIONS_LABEL="Instructions" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_INVESTIGATIONS_DESCRIPTION="Add Investigation Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_INVESTIGATIONS_HINT="Add Investigation Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_INVESTIGATIONS_LABEL="Investigations" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_MEDICATION="Medication" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_MEDICATION_DESCRIPTION="Select Medication" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_MEDICATION_LABEL="Select Medication" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_MODIFIED_BY_DESC="The last user that modified this General Medical Check Up." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_MODIFIED_DATE_DESC="The date this General Medical Check Up was modified." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_NEW="A New General Medical Check Up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_NOTES_DESCRIPTION="Add Notes Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_NOTES_HINT="Add notes here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_NOTES_LABEL="Notes" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_PULSE_DESCRIPTION="Enter pulse in beats per minute" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_PULSE_LABEL="Pulse" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_QUANTITY_DESCRIPTION="Enter quantity" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_QUANTITY_LABEL="Quantity" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the General Medical Check Up to customise the alias." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_STATUS="Status" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_STRENGTH="Strength" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_STRENGTH_DESCRIPTION="Select Strength" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_STRENGTH_LABEL="Select Strength" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_TEMP_ONE_DESCRIPTION="1st temperature reading in degree celsius" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_TEMP_ONE_LABEL="1st Temp. Reading (*C):" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_TEMP_TWO_DESCRIPTION="2nd temperature reading in degree celsius." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_TEMP_TWO_LABEL="2nd Temp. Reading (*C):" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_UNIT="Unit" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_UNIT_DESCRIPTION="Select Units" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_UNIT_LABEL="Select Unit" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_VERSION_DESC="A count of the number of times this General Medical Check Up has been revised." +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_VITAL_SIGNS="Vital Signs" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_WEIGHT_LABEL="Weight (kg)" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION="Health Education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS="Health Educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_ACCESS="Health Educations Access" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_ACCESS_DESC="Allows the users in this group to access access health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_BATCH_OPTIONS="Batch process the selected Health Educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_BATCH_TIP="All changes will be applied to all selected Health Educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_BATCH_USE="Health Educations Batch Use" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_DASHBOARD_ADD="Health Educations Dashboard Add" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of health education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_DASHBOARD_LIST="Health Educations Dashboard List" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of health education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EDIT_HEALTH_EDUCATION_TOPIC="Health Educations Edit Health Education Topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EDIT_HEALTH_EDUCATION_TOPIC_DESC="Allows the users in this group to edit health education topic of health education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EDIT_VERSION="Health Educations Edit Version" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EXPORT="Health Educations Export" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EXPORT_DESC="Allows the users in this group to export export health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_IMPORT="Health Educations Import" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_IMPORT_DESC="Allows the users in this group to import import health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_ARCHIVED="%s Health Educations archived." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_ARCHIVED_1="%s Health Education archived." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_CHECKED_IN_0="No Health Education successfully checked in." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_CHECKED_IN_1="%d Health Education successfully checked in." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_CHECKED_IN_MORE="%d Health Educations successfully checked in." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_DELETED="%s Health Educations deleted." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_DELETED_1="%s Health Education deleted." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_FAILED_PUBLISHING="%s Health Educations failed publishing." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_FAILED_PUBLISHING_1="%s Health Education failed publishing." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_FEATURED="%s Health Educations featured." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_FEATURED_1="%s Health Education featured." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_PUBLISHED="%s Health Educations published." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_PUBLISHED_1="%s Health Education published." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_TRASHED="%s Health Educations trashed." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_TRASHED_1="%s Health Education trashed." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_UNFEATURED="%s Health Educations unfeatured." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_UNFEATURED_1="%s Health Education unfeatured." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_UNPUBLISHED="%s Health Educations unpublished." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_N_ITEMS_UNPUBLISHED_1="%s Health Education unpublished." +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_SUBMENU="Health Educations Submenu" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_SUBMENU_DESC="Allows the users in this group to submenu of health education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_CREATED_BY_DESC="The user that created this Health Education." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_CREATED_DATE_DESC="The date this Health Education was created." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_DETAILS="Details" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_EDIT="Editing the Health Education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_EDUCATION_TYPE_DESCRIPTION="Health education type" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_EDUCATION_TYPE_LABEL="Type" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_ERROR_UNIQUE_ALIAS="Another Health Education has the same alias." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_GROUP="Group" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_HEALTH_EDUCATION_TOPIC_DESCRIPTION="Select Health Education Topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_HEALTH_EDUCATION_TOPIC_LABEL="Select Topic:" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_ID="Id" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_INDIVIDUAL="Individual" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_MODIFIED_BY_DESC="The last user that modified this Health Education." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_MODIFIED_DATE_DESC="The date this Health Education was modified." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_NEW="A New Health Education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Health Education to customise the alias." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_STATUS="Status" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC="Health Education Topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS="Health Education Topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_ACCESS="Health Education Topics Access" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_ACCESS_DESC="Allows the users in this group to access access health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_BATCH_OPTIONS="Batch process the selected Health Education Topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_BATCH_TIP="All changes will be applied to all selected Health Education Topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_BATCH_USE="Health Education Topics Batch Use" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_DESCRIPTION="Health Education Topics Edit Description" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of health education topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_NAME="Health Education Topics Edit Name" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_NAME_DESC="Allows the users in this group to edit name of health education topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_VERSION="Health Education Topics Edit Version" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EXPORT="Health Education Topics Export" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EXPORT_DESC="Allows the users in this group to export export health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_IMPORT="Health Education Topics Import" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_IMPORT_DESC="Allows the users in this group to import import health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_ARCHIVED="%s Health Education Topics archived." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_ARCHIVED_1="%s Health Education Topic archived." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_CHECKED_IN_0="No Health Education Topic successfully checked in." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_CHECKED_IN_1="%d Health Education Topic successfully checked in." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_CHECKED_IN_MORE="%d Health Education Topics successfully checked in." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_DELETED="%s Health Education Topics deleted." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_DELETED_1="%s Health Education Topic deleted." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_FAILED_PUBLISHING="%s Health Education Topics failed publishing." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_FAILED_PUBLISHING_1="%s Health Education Topic failed publishing." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_FEATURED="%s Health Education Topics featured." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_FEATURED_1="%s Health Education Topic featured." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_PUBLISHED="%s Health Education Topics published." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_PUBLISHED_1="%s Health Education Topic published." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_TRASHED="%s Health Education Topics trashed." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_TRASHED_1="%s Health Education Topic trashed." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_UNFEATURED="%s Health Education Topics unfeatured." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_UNFEATURED_1="%s Health Education Topic unfeatured." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_UNPUBLISHED="%s Health Education Topics unpublished." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_N_ITEMS_UNPUBLISHED_1="%s Health Education Topic unpublished." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_CREATED_BY_DESC="The user that created this Health Education Topic." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_CREATED_DATE_DESC="The date this Health Education Topic was created." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_DETAILS="Details" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_EDIT="Editing the Health Education Topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_ERROR_UNIQUE_ALIAS="Another Health Education Topic has the same alias." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_ID="Id" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_MODIFIED_BY_DESC="The last user that modified this Health Education Topic." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_MODIFIED_DATE_DESC="The date this Health Education Topic was modified." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_NEW="A New Health Education Topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Health Education Topic to customise the alias." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_STATUS="Status" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_VERSION_DESC="A count of the number of times this Health Education Topic has been revised." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_VERSION_DESC="A count of the number of times this Health Education has been revised." +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_HELP_MANAGER="Help" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS="HIV Counselings and Testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_ACCESS="Hiv Counselings And Testings Access" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_ACCESS_DESC="Allows the users in this group to access access hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_BATCH_OPTIONS="Batch process the selected HIV Counselings and Testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_BATCH_TIP="All changes will be applied to all selected HIV Counselings and Testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_BATCH_USE="Hiv Counselings And Testings Batch Use" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_DASHBOARD_ADD="Hiv Counselings And Testings Dashboard Add" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of hiv counseling and testing" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_DASHBOARD_LIST="Hiv Counselings And Testings Dashboard List" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of hiv counseling and testing" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_EDIT_VERSION="Hiv Counselings And Testings Edit Version" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_EXPORT="Hiv Counselings And Testings Export" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_EXPORT_DESC="Allows the users in this group to export export hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_IMPORT="Hiv Counselings And Testings Import" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_IMPORT_DESC="Allows the users in this group to import import hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_ARCHIVED="%s HIV Counselings and Testings archived." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_ARCHIVED_1="%s HIV Counseling and Testing archived." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_CHECKED_IN_0="No HIV Counseling and Testing successfully checked in." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_CHECKED_IN_1="%d HIV Counseling and Testing successfully checked in." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_CHECKED_IN_MORE="%d HIV Counselings and Testings successfully checked in." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_DELETED="%s HIV Counselings and Testings deleted." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_DELETED_1="%s HIV Counseling and Testing deleted." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_FAILED_PUBLISHING="%s HIV Counselings and Testings failed publishing." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_FAILED_PUBLISHING_1="%s HIV Counseling and Testing failed publishing." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_FEATURED="%s HIV Counselings and Testings featured." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_FEATURED_1="%s HIV Counseling and Testing featured." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_PUBLISHED="%s HIV Counselings and Testings published." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_PUBLISHED_1="%s HIV Counseling and Testing published." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_TRASHED="%s HIV Counselings and Testings trashed." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_TRASHED_1="%s HIV Counseling and Testing trashed." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_UNFEATURED="%s HIV Counselings and Testings unfeatured." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_UNFEATURED_1="%s HIV Counseling and Testing unfeatured." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_UNPUBLISHED="%s HIV Counselings and Testings unpublished." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_N_ITEMS_UNPUBLISHED_1="%s HIV Counseling and Testing unpublished." +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_SUBMENU="Hiv Counselings And Testings Submenu" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_SUBMENU_DESC="Allows the users in this group to submenu of hiv counseling and testing" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING="HIV Counseling and Testing" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_COUNSELING_TYPE_LABEL="Type of counseling?" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_COUPLE="Couple" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_CREATED_BY_DESC="The user that created this HIV Counseling and Testing." +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_CREATED_DATE_DESC="The date this HIV Counseling and Testing was created." +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_DETAILS="Details" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_EDIT="Editing the HIV Counseling and Testing" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_EQA_LABEL="EQA" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_ERROR_UNIQUE_ALIAS="Another HIV Counseling and Testing has the same alias." +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_FINAL_TEST_RESULT_DESCRIPTION="Final test result" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_FINAL_TEST_RESULT_LABEL="Final test result" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_ID="Id" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_INCONCLUSIVE="Inconclusive" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_INDIVIDUAL="Individual" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_LAST_TEST_DATE_DESCRIPTION="When last did you test" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_LAST_TEST_DATE_LABEL="When last did you test" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_MINOR="Minor" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_MODIFIED_BY_DESC="The last user that modified this HIV Counseling and Testing." +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_MODIFIED_DATE_DESC="The date this HIV Counseling and Testing was modified." +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NA="N/A" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEGATIVE="Negative" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEVER="Never" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEW="A New HIV Counseling and Testing" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NO="No" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_ONESIX_MONTHS="1-6 Months" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_POSITIVE="Positive" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_PREV_TEST_RESULT_DESCRIPTION="Previous test results" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_PREV_TEST_RESULT_LABEL="Previous test results" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the HIV Counseling and Testing to customise the alias." +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_SEVENTWELVE_MONTHS="7-12 Months" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_STATUS="Status" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_TESTING_REASON_DESCRIPTION="Select reason for testing" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_TESTING_REASON_LABEL="Reason for testing" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_TEST_RESULT_ONE_DESCRIPTION="Test result #1" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_TEST_RESULT_ONE_LABEL="Test result #1" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_TEST_RESULT_TWO_DESCRIPTION="Test result #2" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_TEST_RESULT_TWO_LABEL="Test result #2" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_UNKNOWN="Unknown" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_VERSION_DESC="A count of the number of times this HIV Counseling and Testing has been revised." +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_YES="Yes" +COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING__YEAR="> Year" +COM_EHEALTH_PORTAL_IMMUNISATION="Immunisation" +COM_EHEALTH_PORTAL_IMMUNISATIONS="Immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_ACCESS="Immunisations Access" +COM_EHEALTH_PORTAL_IMMUNISATIONS_ACCESS_DESC="Allows the users in this group to access access immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_BATCH_OPTIONS="Batch process the selected Immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_BATCH_TIP="All changes will be applied to all selected Immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_BATCH_USE="Immunisations Batch Use" +COM_EHEALTH_PORTAL_IMMUNISATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_DASHBOARD_ADD="Immunisations Dashboard Add" +COM_EHEALTH_PORTAL_IMMUNISATIONS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of immunisation" +COM_EHEALTH_PORTAL_IMMUNISATIONS_DASHBOARD_LIST="Immunisations Dashboard List" +COM_EHEALTH_PORTAL_IMMUNISATIONS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of immunisation" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EDIT_PATIENT="Immunisations Edit Patient" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EDIT_PATIENT_DESC="Allows the users in this group to edit patient of immunisation" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EDIT_VERSION="Immunisations Edit Version" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EXPORT="Immunisations Export" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EXPORT_DESC="Allows the users in this group to export export immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_IMPORT="Immunisations Import" +COM_EHEALTH_PORTAL_IMMUNISATIONS_IMPORT_DESC="Allows the users in this group to import import immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_ARCHIVED="%s Immunisations archived." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_ARCHIVED_1="%s Immunisation archived." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_CHECKED_IN_0="No Immunisation successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_CHECKED_IN_1="%d Immunisation successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_CHECKED_IN_MORE="%d Immunisations successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_DELETED="%s Immunisations deleted." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_DELETED_1="%s Immunisation deleted." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_FAILED_PUBLISHING="%s Immunisations failed publishing." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_FAILED_PUBLISHING_1="%s Immunisation failed publishing." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_FEATURED="%s Immunisations featured." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_FEATURED_1="%s Immunisation featured." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_PUBLISHED="%s Immunisations published." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_PUBLISHED_1="%s Immunisation published." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_TRASHED="%s Immunisations trashed." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_TRASHED_1="%s Immunisation trashed." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_UNFEATURED="%s Immunisations unfeatured." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_UNFEATURED_1="%s Immunisation unfeatured." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_UNPUBLISHED="%s Immunisations unpublished." +COM_EHEALTH_PORTAL_IMMUNISATIONS_N_ITEMS_UNPUBLISHED_1="%s Immunisation unpublished." +COM_EHEALTH_PORTAL_IMMUNISATIONS_SUBMENU="Immunisations Submenu" +COM_EHEALTH_PORTAL_IMMUNISATIONS_SUBMENU_DESC="Allows the users in this group to submenu of immunisation" +COM_EHEALTH_PORTAL_IMMUNISATION_ADMINISTRATION_PART="Administration Part" +COM_EHEALTH_PORTAL_IMMUNISATION_ADMINISTRATION_PART_DESCRIPTION="Select Administration Body Part" +COM_EHEALTH_PORTAL_IMMUNISATION_ADMINISTRATION_PART_LABEL="Administration Part" +COM_EHEALTH_PORTAL_IMMUNISATION_CREATED_BY_DESC="The user that created this Immunisation." +COM_EHEALTH_PORTAL_IMMUNISATION_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_IMMUNISATION_CREATED_DATE_DESC="The date this Immunisation was created." +COM_EHEALTH_PORTAL_IMMUNISATION_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_IMMUNISATION_DETAILS="Details" +COM_EHEALTH_PORTAL_IMMUNISATION_EDIT="Editing the Immunisation" +COM_EHEALTH_PORTAL_IMMUNISATION_ERROR_UNIQUE_ALIAS="Another Immunisation has the same alias." +COM_EHEALTH_PORTAL_IMMUNISATION_ID="Id" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_LABEL="Immunisation" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_TYPE="Immunisation Type" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_TYPE_DESCRIPTION="Select immunisation type" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_TYPE_LABEL="Type" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_UP_TO_DATE_DESCRIPTION="Immunisation up-to-date" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_UP_TO_DATE_LABEL="Immunisation up-to-date" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_VACCINE_TYPE="Immunisation Vaccine Type" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_VACCINE_TYPE_DESCRIPTION="Select Immunisation Vaccine Type" +COM_EHEALTH_PORTAL_IMMUNISATION_IMMUNISATION_VACCINE_TYPE_LABEL="Vaccine" +COM_EHEALTH_PORTAL_IMMUNISATION_MODIFIED_BY_DESC="The last user that modified this Immunisation." +COM_EHEALTH_PORTAL_IMMUNISATION_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_IMMUNISATION_MODIFIED_DATE_DESC="The date this Immunisation was modified." +COM_EHEALTH_PORTAL_IMMUNISATION_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_IMMUNISATION_NEW="A New Immunisation" +COM_EHEALTH_PORTAL_IMMUNISATION_NO="No" +COM_EHEALTH_PORTAL_IMMUNISATION_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_IMMUNISATION_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_IMMUNISATION_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_IMMUNISATION_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_IMMUNISATION_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_IMMUNISATION_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_IMMUNISATION_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_IMMUNISATION_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_IMMUNISATION_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_IMMUNISATION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Immunisation to customise the alias." +COM_EHEALTH_PORTAL_IMMUNISATION_STATUS="Status" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE="Immunisation Type" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES="Immunisation Types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_ACCESS="Immunisation Types Access" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_ACCESS_DESC="Allows the users in this group to access access immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_BATCH_OPTIONS="Batch process the selected Immunisation Types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_BATCH_TIP="All changes will be applied to all selected Immunisation Types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_BATCH_USE="Immunisation Types Batch Use" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_DESCRIPTION="Immunisation Types Edit Description" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of immunisation type" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_NAME="Immunisation Types Edit Name" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of immunisation type" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_VERSION="Immunisation Types Edit Version" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EXPORT="Immunisation Types Export" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EXPORT_DESC="Allows the users in this group to export export immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_IMPORT="Immunisation Types Import" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_IMPORT_DESC="Allows the users in this group to import import immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_ARCHIVED="%s Immunisation Types archived." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_ARCHIVED_1="%s Immunisation Type archived." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_CHECKED_IN_0="No Immunisation Type successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_CHECKED_IN_1="%d Immunisation Type successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_CHECKED_IN_MORE="%d Immunisation Types successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_DELETED="%s Immunisation Types deleted." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_DELETED_1="%s Immunisation Type deleted." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_FAILED_PUBLISHING="%s Immunisation Types failed publishing." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_FAILED_PUBLISHING_1="%s Immunisation Type failed publishing." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_FEATURED="%s Immunisation Types featured." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_FEATURED_1="%s Immunisation Type featured." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_PUBLISHED="%s Immunisation Types published." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_PUBLISHED_1="%s Immunisation Type published." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_TRASHED="%s Immunisation Types trashed." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_TRASHED_1="%s Immunisation Type trashed." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_UNFEATURED="%s Immunisation Types unfeatured." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_UNFEATURED_1="%s Immunisation Type unfeatured." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_UNPUBLISHED="%s Immunisation Types unpublished." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_N_ITEMS_UNPUBLISHED_1="%s Immunisation Type unpublished." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_CREATED_BY_DESC="The user that created this Immunisation Type." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_CREATED_DATE_DESC="The date this Immunisation Type was created." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_DETAILS="Details" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_EDIT="Editing the Immunisation Type" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_ERROR_UNIQUE_ALIAS="Another Immunisation Type has the same alias." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_ID="Id" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_MODIFIED_BY_DESC="The last user that modified this Immunisation Type." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_MODIFIED_DATE_DESC="The date this Immunisation Type was modified." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_NEW="A New Immunisation Type" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Immunisation Type to customise the alias." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_STATUS="Status" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_VERSION_DESC="A count of the number of times this Immunisation Type has been revised." +COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE="Immunisation Vaccine Type" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES="Immunisation Vaccine Types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_ACCESS="Immunisation Vaccine Types Access" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_ACCESS_DESC="Allows the users in this group to access access immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_BATCH_OPTIONS="Batch process the selected Immunisation Vaccine Types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_BATCH_TIP="All changes will be applied to all selected Immunisation Vaccine Types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_BATCH_USE="Immunisation Vaccine Types Batch Use" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_DESCRIPTION="Immunisation Vaccine Types Edit Description" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of immunisation vaccine type" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_NAME="Immunisation Vaccine Types Edit Name" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of immunisation vaccine type" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_VERSION="Immunisation Vaccine Types Edit Version" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EXPORT="Immunisation Vaccine Types Export" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EXPORT_DESC="Allows the users in this group to export export immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_IMPORT="Immunisation Vaccine Types Import" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_IMPORT_DESC="Allows the users in this group to import import immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_ARCHIVED="%s Immunisation Vaccine Types archived." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_ARCHIVED_1="%s Immunisation Vaccine Type archived." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_CHECKED_IN_0="No Immunisation Vaccine Type successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_CHECKED_IN_1="%d Immunisation Vaccine Type successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_CHECKED_IN_MORE="%d Immunisation Vaccine Types successfully checked in." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_DELETED="%s Immunisation Vaccine Types deleted." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_DELETED_1="%s Immunisation Vaccine Type deleted." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_FAILED_PUBLISHING="%s Immunisation Vaccine Types failed publishing." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_FAILED_PUBLISHING_1="%s Immunisation Vaccine Type failed publishing." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_FEATURED="%s Immunisation Vaccine Types featured." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_FEATURED_1="%s Immunisation Vaccine Type featured." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_PUBLISHED="%s Immunisation Vaccine Types published." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_PUBLISHED_1="%s Immunisation Vaccine Type published." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_TRASHED="%s Immunisation Vaccine Types trashed." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_TRASHED_1="%s Immunisation Vaccine Type trashed." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_UNFEATURED="%s Immunisation Vaccine Types unfeatured." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_UNFEATURED_1="%s Immunisation Vaccine Type unfeatured." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_UNPUBLISHED="%s Immunisation Vaccine Types unpublished." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_N_ITEMS_UNPUBLISHED_1="%s Immunisation Vaccine Type unpublished." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_SUBMENU="Immunisation Vaccine Types Submenu" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_SUBMENU_DESC="Allows the users in this group to submenu of immunisation vaccine type" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ADMINISTRATION_PART_DESCRIPTION="Select Administration Body Part" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ADMINISTRATION_PART_LABEL="Administration Part" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_CREATED_BY_DESC="The user that created this Immunisation Vaccine Type." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_CREATED_DATE_DESC="The date this Immunisation Vaccine Type was created." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_DETAILS="Details" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_EDIT="Editing the Immunisation Vaccine Type" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ERROR_UNIQUE_ALIAS="Another Immunisation Vaccine Type has the same alias." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ID="Id" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_MODIFIED_BY_DESC="The last user that modified this Immunisation Vaccine Type." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_MODIFIED_DATE_DESC="The date this Immunisation Vaccine Type was modified." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_NEW="A New Immunisation Vaccine Type" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Immunisation Vaccine Type to customise the alias." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_STATUS="Status" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_VERSION_DESC="A count of the number of times this Immunisation Vaccine Type has been revised." +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_IMMUNISATION_VERSION_DESC="A count of the number of times this Immunisation has been revised." +COM_EHEALTH_PORTAL_IMMUNISATION_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_IMMUNISATION_YES="Yes" +COM_EHEALTH_PORTAL_IMPORT_CONTINUE="Continue" +COM_EHEALTH_PORTAL_IMPORT_DATA="Import Data" +COM_EHEALTH_PORTAL_IMPORT_DATA_DESC="Allows users in this group to import data." +COM_EHEALTH_PORTAL_IMPORT_ERROR="Import error." +COM_EHEALTH_PORTAL_IMPORT_FAILED="Import Failed" +COM_EHEALTH_PORTAL_IMPORT_FILE_COLUMNS="File Columns" +COM_EHEALTH_PORTAL_IMPORT_FORMATS_ACCEPTED="formats accepted" +COM_EHEALTH_PORTAL_IMPORT_FROM_DIRECTORY="Directory" +COM_EHEALTH_PORTAL_IMPORT_FROM_UPLOAD="Upload" +COM_EHEALTH_PORTAL_IMPORT_FROM_URL="URL" +COM_EHEALTH_PORTAL_IMPORT_GET_BOTTON="Get File" +COM_EHEALTH_PORTAL_IMPORT_IGNORE_COLUMN="-- Ignore This Column --" +COM_EHEALTH_PORTAL_IMPORT_LINK_FILE_TO_TABLE_COLUMNS="Link File to Table Columns" +COM_EHEALTH_PORTAL_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE="Does not have a valid file type." +COM_EHEALTH_PORTAL_IMPORT_MSG_ENTER_A_URL="Please enter a url." +COM_EHEALTH_PORTAL_IMPORT_MSG_INVALID_URL="Invalid url." +COM_EHEALTH_PORTAL_IMPORT_MSG_NO_FILE_SELECTED="No import file selected." +COM_EHEALTH_PORTAL_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE="Path does not have a valid file." +COM_EHEALTH_PORTAL_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY="Please enter the file directory." +COM_EHEALTH_PORTAL_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS="Please link all columns." +COM_EHEALTH_PORTAL_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY="Please enter the file directory." +COM_EHEALTH_PORTAL_IMPORT_MSG_PLEASE_SELECT_A_FILE="Please select a file to import." +COM_EHEALTH_PORTAL_IMPORT_MSG_WARNIMPORTFILE="Warning, import file error." +COM_EHEALTH_PORTAL_IMPORT_MSG_WARNIMPORTUPLOADERROR="Warning, import upload error." +COM_EHEALTH_PORTAL_IMPORT_NO_IMPORT_TYPE_FOUND="Import type not found." +COM_EHEALTH_PORTAL_IMPORT_PLEASE_SELECT_COLUMN="-- Please Select Column --" +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE="Select File" +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_DIRECTORY="Set the path to file" +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_ADMINISTRATION_PARTS="Select the file to import data to administration_parts." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_ANTENATAL_CARES="Select the file to import data to antenatal_cares." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_BREAST_CANCERS="Select the file to import data to breast_cancers." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_CERVICAL_CANCERS="Select the file to import data to cervical_cancers." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_CLINICS="Select the file to import data to clinics." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_COUNSELING_TYPES="Select the file to import data to counseling_types." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_DIAGNOSIS_TYPES="Select the file to import data to diagnosis_types." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_FAMILY_PLANNINGS="Select the file to import data to family_plannings." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_FOETAL_ENGAGEMENTS="Select the file to import data to foetal_engagements." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_FOETAL_LIES="Select the file to import data to foetal_lies." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_FOETAL_PRESENTATIONS="Select the file to import data to foetal_presentations." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_GENERAL_MEDICAL_CHECK_UPS="Select the file to import data to general_medical_check_ups." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_HEALTH_EDUCATIONS="Select the file to import data to health_educations." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_HEALTH_EDUCATION_TOPICS="Select the file to import data to health_education_topics." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_HIV_COUNSELINGS_AND_TESTINGS="Select the file to import data to hiv_counselings_and_testings." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_IMMUNISATIONS="Select the file to import data to immunisations." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_IMMUNISATION_TYPES="Select the file to import data to immunisation_types." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_IMMUNISATION_VACCINE_TYPES="Select the file to import data to immunisation_vaccine_types." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_MEDICATIONS="Select the file to import data to medications." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_NONPAY_REASONS="Select the file to import data to nonpay_reasons." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PAYMENTS="Select the file to import data to payments." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PAYMENT_AMOUNTS="Select the file to import data to payment_amounts." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PAYMENT_TYPES="Select the file to import data to payment_types." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PLANNING_TYPES="Select the file to import data to planning_types." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_PROSTATE_AND_TESTICULAR_CANCERS="Select the file to import data to prostate_and_testicular_cancers." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_REFERRALS="Select the file to import data to referrals." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_SITES="Select the file to import data to sites." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_STRENGTHS="Select the file to import data to strengths." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_TESTING_REASONS="Select the file to import data to testing_reasons." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_TESTS="Select the file to import data to tests." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_TUBERCULOSES="Select the file to import data to tuberculoses." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_UNITS="Select the file to import data to units." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_FOR_VMMCS="Select the file to import data to vmmcs." +COM_EHEALTH_PORTAL_IMPORT_SELECT_FILE_URL="Enter file URL" +COM_EHEALTH_PORTAL_IMPORT_SUCCESS="Great! Import successful." +COM_EHEALTH_PORTAL_IMPORT_TABLE_COLUMNS="Table Columns" +COM_EHEALTH_PORTAL_IMPORT_TITLE="Data Importer" +COM_EHEALTH_PORTAL_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE="Package to import not found." +COM_EHEALTH_PORTAL_IMPORT_UPDATE_DATA="Import Data" +COM_EHEALTH_PORTAL_IMPORT_UPLOAD_BOTTON="Upload File" +COM_EHEALTH_PORTAL_INACTIVE="Inactive" +COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS="- Keep Original Access -" +COM_EHEALTH_PORTAL_KEEP_ORIGINAL_CATEGORY="- Keep Original Category -" +COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE="- Keep Original State -" +COM_EHEALTH_PORTAL_LICENSE="License" +COM_EHEALTH_PORTAL_MEDICATION="Medication" +COM_EHEALTH_PORTAL_MEDICATIONS="Medications" +COM_EHEALTH_PORTAL_MEDICATIONS_ACCESS="Medications Access" +COM_EHEALTH_PORTAL_MEDICATIONS_ACCESS_DESC="Allows the users in this group to access access medications" +COM_EHEALTH_PORTAL_MEDICATIONS_BATCH_OPTIONS="Batch process the selected Medications" +COM_EHEALTH_PORTAL_MEDICATIONS_BATCH_TIP="All changes will be applied to all selected Medications" +COM_EHEALTH_PORTAL_MEDICATIONS_BATCH_USE="Medications Batch Use" +COM_EHEALTH_PORTAL_MEDICATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch medications" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_DESCRIPTION="Medications Edit Description" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of medication" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_NAME="Medications Edit Name" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_NAME_DESC="Allows the users in this group to edit name of medication" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_VERSION="Medications Edit Version" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version medications" +COM_EHEALTH_PORTAL_MEDICATIONS_EXPORT="Medications Export" +COM_EHEALTH_PORTAL_MEDICATIONS_EXPORT_DESC="Allows the users in this group to export export medications" +COM_EHEALTH_PORTAL_MEDICATIONS_IMPORT="Medications Import" +COM_EHEALTH_PORTAL_MEDICATIONS_IMPORT_DESC="Allows the users in this group to import import medications" +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_ARCHIVED="%s Medications archived." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_ARCHIVED_1="%s Medication archived." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_CHECKED_IN_0="No Medication successfully checked in." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_CHECKED_IN_1="%d Medication successfully checked in." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_CHECKED_IN_MORE="%d Medications successfully checked in." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_DELETED="%s Medications deleted." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_DELETED_1="%s Medication deleted." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_FAILED_PUBLISHING="%s Medications failed publishing." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_FAILED_PUBLISHING_1="%s Medication failed publishing." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_FEATURED="%s Medications featured." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_FEATURED_1="%s Medication featured." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_PUBLISHED="%s Medications published." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_PUBLISHED_1="%s Medication published." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_TRASHED="%s Medications trashed." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_TRASHED_1="%s Medication trashed." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_UNFEATURED="%s Medications unfeatured." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_UNFEATURED_1="%s Medication unfeatured." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_UNPUBLISHED="%s Medications unpublished." +COM_EHEALTH_PORTAL_MEDICATIONS_N_ITEMS_UNPUBLISHED_1="%s Medication unpublished." +COM_EHEALTH_PORTAL_MEDICATIONS_SUBMENU="Medications Submenu" +COM_EHEALTH_PORTAL_MEDICATIONS_SUBMENU_DESC="Allows the users in this group to submenu of medication" +COM_EHEALTH_PORTAL_MEDICATION_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_MEDICATION_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_MEDICATION_CREATED_BY_DESC="The user that created this Medication." +COM_EHEALTH_PORTAL_MEDICATION_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_MEDICATION_CREATED_DATE_DESC="The date this Medication was created." +COM_EHEALTH_PORTAL_MEDICATION_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_MEDICATION_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_MEDICATION_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_MEDICATION_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_MEDICATION_DETAILS="Details" +COM_EHEALTH_PORTAL_MEDICATION_EDIT="Editing the Medication" +COM_EHEALTH_PORTAL_MEDICATION_ERROR_UNIQUE_ALIAS="Another Medication has the same alias." +COM_EHEALTH_PORTAL_MEDICATION_ID="Id" +COM_EHEALTH_PORTAL_MEDICATION_MODIFIED_BY_DESC="The last user that modified this Medication." +COM_EHEALTH_PORTAL_MEDICATION_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_MEDICATION_MODIFIED_DATE_DESC="The date this Medication was modified." +COM_EHEALTH_PORTAL_MEDICATION_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_MEDICATION_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_MEDICATION_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_MEDICATION_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_MEDICATION_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_MEDICATION_NEW="A New Medication" +COM_EHEALTH_PORTAL_MEDICATION_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_MEDICATION_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_MEDICATION_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_MEDICATION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Medication to customise the alias." +COM_EHEALTH_PORTAL_MEDICATION_STATUS="Status" +COM_EHEALTH_PORTAL_MEDICATION_VERSION_DESC="A count of the number of times this Medication has been revised." +COM_EHEALTH_PORTAL_MEDICATION_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_NEW="New" +COM_EHEALTH_PORTAL_NONPAY_REASON="NonPay Reason" +COM_EHEALTH_PORTAL_NONPAY_REASONS="NonPay Reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_ACCESS="Nonpay Reasons Access" +COM_EHEALTH_PORTAL_NONPAY_REASONS_ACCESS_DESC="Allows the users in this group to access access nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_BATCH_OPTIONS="Batch process the selected NonPay Reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_BATCH_TIP="All changes will be applied to all selected NonPay Reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_BATCH_USE="Nonpay Reasons Batch Use" +COM_EHEALTH_PORTAL_NONPAY_REASONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_DESCRIPTION="Nonpay Reasons Edit Description" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of nonpay reason" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_NAME="Nonpay Reasons Edit Name" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_NAME_DESC="Allows the users in this group to edit name of nonpay reason" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_VERSION="Nonpay Reasons Edit Version" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EXPORT="Nonpay Reasons Export" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EXPORT_DESC="Allows the users in this group to export export nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_IMPORT="Nonpay Reasons Import" +COM_EHEALTH_PORTAL_NONPAY_REASONS_IMPORT_DESC="Allows the users in this group to import import nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_ARCHIVED="%s NonPay Reasons archived." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_ARCHIVED_1="%s NonPay Reason archived." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_CHECKED_IN_0="No NonPay Reason successfully checked in." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_CHECKED_IN_1="%d NonPay Reason successfully checked in." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_CHECKED_IN_MORE="%d NonPay Reasons successfully checked in." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_DELETED="%s NonPay Reasons deleted." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_DELETED_1="%s NonPay Reason deleted." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_FAILED_PUBLISHING="%s NonPay Reasons failed publishing." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_FAILED_PUBLISHING_1="%s NonPay Reason failed publishing." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_FEATURED="%s NonPay Reasons featured." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_FEATURED_1="%s NonPay Reason featured." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_PUBLISHED="%s NonPay Reasons published." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_PUBLISHED_1="%s NonPay Reason published." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_TRASHED="%s NonPay Reasons trashed." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_TRASHED_1="%s NonPay Reason trashed." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_UNFEATURED="%s NonPay Reasons unfeatured." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_UNFEATURED_1="%s NonPay Reason unfeatured." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_UNPUBLISHED="%s NonPay Reasons unpublished." +COM_EHEALTH_PORTAL_NONPAY_REASONS_N_ITEMS_UNPUBLISHED_1="%s NonPay Reason unpublished." +COM_EHEALTH_PORTAL_NONPAY_REASON_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_NONPAY_REASON_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_NONPAY_REASON_CREATED_BY_DESC="The user that created this NonPay Reason." +COM_EHEALTH_PORTAL_NONPAY_REASON_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_NONPAY_REASON_CREATED_DATE_DESC="The date this NonPay Reason was created." +COM_EHEALTH_PORTAL_NONPAY_REASON_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_NONPAY_REASON_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_NONPAY_REASON_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_NONPAY_REASON_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_NONPAY_REASON_DETAILS="Details" +COM_EHEALTH_PORTAL_NONPAY_REASON_EDIT="Editing the NonPay Reason" +COM_EHEALTH_PORTAL_NONPAY_REASON_ERROR_UNIQUE_ALIAS="Another NonPay Reason has the same alias." +COM_EHEALTH_PORTAL_NONPAY_REASON_ID="Id" +COM_EHEALTH_PORTAL_NONPAY_REASON_MODIFIED_BY_DESC="The last user that modified this NonPay Reason." +COM_EHEALTH_PORTAL_NONPAY_REASON_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_NONPAY_REASON_MODIFIED_DATE_DESC="The date this NonPay Reason was modified." +COM_EHEALTH_PORTAL_NONPAY_REASON_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_NONPAY_REASON_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_NONPAY_REASON_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_NONPAY_REASON_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_NONPAY_REASON_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_NONPAY_REASON_NEW="A New NonPay Reason" +COM_EHEALTH_PORTAL_NONPAY_REASON_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_NONPAY_REASON_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_NONPAY_REASON_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_NONPAY_REASON_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the NonPay Reason to customise the alias." +COM_EHEALTH_PORTAL_NONPAY_REASON_STATUS="Status" +COM_EHEALTH_PORTAL_NONPAY_REASON_VERSION_DESC="A count of the number of times this NonPay Reason has been revised." +COM_EHEALTH_PORTAL_NONPAY_REASON_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_NOT_FOUND_OR_ACCESS_DENIED="Not found, or access denied." +COM_EHEALTH_PORTAL_NO_ACCESS_GRANTED="No Access Granted!" +COM_EHEALTH_PORTAL_PATIENT_QUEUE="Patient Queue" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_ACCESS="Patient Queue Access" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_ACCESS_DESC="Allows the users in this group to access patient queue." +COM_EHEALTH_PORTAL_PATIENT_QUEUE_DASHBOARD_LIST="Patient Queue Dashboard List" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of Patient Queue" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_DESC="A patient queue" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_SUBMENU="Patient Queue Submenu" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_SUBMENU_DESC="Allows the users in this group to submenu of Patient Queue" +COM_EHEALTH_PORTAL_PAYMENT="Payment" +COM_EHEALTH_PORTAL_PAYMENTS="Payments" +COM_EHEALTH_PORTAL_PAYMENTS_ACCESS="Payments Access" +COM_EHEALTH_PORTAL_PAYMENTS_ACCESS_DESC="Allows the users in this group to access access payments" +COM_EHEALTH_PORTAL_PAYMENTS_BATCH_OPTIONS="Batch process the selected Payments" +COM_EHEALTH_PORTAL_PAYMENTS_BATCH_TIP="All changes will be applied to all selected Payments" +COM_EHEALTH_PORTAL_PAYMENTS_BATCH_USE="Payments Batch Use" +COM_EHEALTH_PORTAL_PAYMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch payments" +COM_EHEALTH_PORTAL_PAYMENTS_DASHBOARD_ADD="Payments Dashboard Add" +COM_EHEALTH_PORTAL_PAYMENTS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of payment" +COM_EHEALTH_PORTAL_PAYMENTS_DASHBOARD_LIST="Payments Dashboard List" +COM_EHEALTH_PORTAL_PAYMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of payment" +COM_EHEALTH_PORTAL_PAYMENTS_EDIT_PATIENT="Payments Edit Patient" +COM_EHEALTH_PORTAL_PAYMENTS_EDIT_PATIENT_DESC="Allows the users in this group to edit patient of payment" +COM_EHEALTH_PORTAL_PAYMENTS_EDIT_VERSION="Payments Edit Version" +COM_EHEALTH_PORTAL_PAYMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version payments" +COM_EHEALTH_PORTAL_PAYMENTS_EXPORT="Payments Export" +COM_EHEALTH_PORTAL_PAYMENTS_EXPORT_DESC="Allows the users in this group to export export payments" +COM_EHEALTH_PORTAL_PAYMENTS_IMPORT="Payments Import" +COM_EHEALTH_PORTAL_PAYMENTS_IMPORT_DESC="Allows the users in this group to import import payments" +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_ARCHIVED="%s Payments archived." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_ARCHIVED_1="%s Payment archived." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_CHECKED_IN_0="No Payment successfully checked in." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_CHECKED_IN_1="%d Payment successfully checked in." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_CHECKED_IN_MORE="%d Payments successfully checked in." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_DELETED="%s Payments deleted." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_DELETED_1="%s Payment deleted." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_FAILED_PUBLISHING="%s Payments failed publishing." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_FAILED_PUBLISHING_1="%s Payment failed publishing." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_FEATURED="%s Payments featured." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_FEATURED_1="%s Payment featured." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_PUBLISHED="%s Payments published." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_PUBLISHED_1="%s Payment published." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_TRASHED="%s Payments trashed." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_TRASHED_1="%s Payment trashed." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_UNFEATURED="%s Payments unfeatured." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_UNFEATURED_1="%s Payment unfeatured." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_UNPUBLISHED="%s Payments unpublished." +COM_EHEALTH_PORTAL_PAYMENTS_N_ITEMS_UNPUBLISHED_1="%s Payment unpublished." +COM_EHEALTH_PORTAL_PAYMENTS_SUBMENU="Payments Submenu" +COM_EHEALTH_PORTAL_PAYMENTS_SUBMENU_DESC="Allows the users in this group to submenu of payment" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT="Payment Amount" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS="Payment Amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_ACCESS="Payment Amounts Access" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_ACCESS_DESC="Allows the users in this group to access access payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_BATCH_OPTIONS="Batch process the selected Payment Amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_BATCH_TIP="All changes will be applied to all selected Payment Amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_BATCH_USE="Payment Amounts Batch Use" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_DESCRIPTION="Payment Amounts Edit Description" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of payment amount" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_NAME="Payment Amounts Edit Name" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_NAME_DESC="Allows the users in this group to edit name of payment amount" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_VERSION="Payment Amounts Edit Version" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EXPORT="Payment Amounts Export" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EXPORT_DESC="Allows the users in this group to export export payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_IMPORT="Payment Amounts Import" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_IMPORT_DESC="Allows the users in this group to import import payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_ARCHIVED="%s Payment Amounts archived." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_ARCHIVED_1="%s Payment Amount archived." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_CHECKED_IN_0="No Payment Amount successfully checked in." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_CHECKED_IN_1="%d Payment Amount successfully checked in." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_CHECKED_IN_MORE="%d Payment Amounts successfully checked in." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_DELETED="%s Payment Amounts deleted." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_DELETED_1="%s Payment Amount deleted." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_FAILED_PUBLISHING="%s Payment Amounts failed publishing." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_FAILED_PUBLISHING_1="%s Payment Amount failed publishing." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_FEATURED="%s Payment Amounts featured." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_FEATURED_1="%s Payment Amount featured." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_PUBLISHED="%s Payment Amounts published." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_PUBLISHED_1="%s Payment Amount published." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_TRASHED="%s Payment Amounts trashed." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_TRASHED_1="%s Payment Amount trashed." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_UNFEATURED="%s Payment Amounts unfeatured." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_UNFEATURED_1="%s Payment Amount unfeatured." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_UNPUBLISHED="%s Payment Amounts unpublished." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_N_ITEMS_UNPUBLISHED_1="%s Payment Amount unpublished." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_CREATED_BY_DESC="The user that created this Payment Amount." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_CREATED_DATE_DESC="The date this Payment Amount was created." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_DETAILS="Details" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_EDIT="Editing the Payment Amount" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_ERROR_UNIQUE_ALIAS="Another Payment Amount has the same alias." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_ID="Id" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_MODIFIED_BY_DESC="The last user that modified this Payment Amount." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_MODIFIED_DATE_DESC="The date this Payment Amount was modified." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_NEW="A New Payment Amount" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Payment Amount to customise the alias." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_STATUS="Status" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_VERSION_DESC="A count of the number of times this Payment Amount has been revised." +COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_PAYMENT_CREATED_BY_DESC="The user that created this Payment." +COM_EHEALTH_PORTAL_PAYMENT_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_PAYMENT_CREATED_DATE_DESC="The date this Payment was created." +COM_EHEALTH_PORTAL_PAYMENT_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_PAYMENT_DEBT_PAYMENT="Debt Payment" +COM_EHEALTH_PORTAL_PAYMENT_DETAILS="Details" +COM_EHEALTH_PORTAL_PAYMENT_EDIT="Editing the Payment" +COM_EHEALTH_PORTAL_PAYMENT_ERROR_UNIQUE_ALIAS="Another Payment has the same alias." +COM_EHEALTH_PORTAL_PAYMENT_ID="Id" +COM_EHEALTH_PORTAL_PAYMENT_MODIFIED_BY_DESC="The last user that modified this Payment." +COM_EHEALTH_PORTAL_PAYMENT_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_PAYMENT_MODIFIED_DATE_DESC="The date this Payment was modified." +COM_EHEALTH_PORTAL_PAYMENT_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_PAYMENT_NEW="A New Payment" +COM_EHEALTH_PORTAL_PAYMENT_NONPAY_REASON_DESCRIPTION="Select Non-Payment Reason" +COM_EHEALTH_PORTAL_PAYMENT_NONPAY_REASON_LABEL="Non-Payment Reason" +COM_EHEALTH_PORTAL_PAYMENT_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_PAYMENT_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_PAYMENT_PAYMENT_AMOUNT_DESCRIPTION="Select Amount (N$)" +COM_EHEALTH_PORTAL_PAYMENT_PAYMENT_AMOUNT_LABEL="Amount (N$):" +COM_EHEALTH_PORTAL_PAYMENT_PAYMENT_CATEGORY_DESCRIPTION="Category under which payment falls under" +COM_EHEALTH_PORTAL_PAYMENT_PAYMENT_CATEGORY_LABEL="Payment Category" +COM_EHEALTH_PORTAL_PAYMENT_PAYMENT_TYPE_DESCRIPTION="Type of Payment" +COM_EHEALTH_PORTAL_PAYMENT_PAYMENT_TYPE_LABEL="Type of Payment" +COM_EHEALTH_PORTAL_PAYMENT_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_PAYMENT_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_PAYMENT_RECEIPT_NO_DESCRIPTION="Enter Receipt Number Here" +COM_EHEALTH_PORTAL_PAYMENT_RECEIPT_NO_HINT="Receipt Number Here" +COM_EHEALTH_PORTAL_PAYMENT_RECEIPT_NO_LABEL="Receipt Number" +COM_EHEALTH_PORTAL_PAYMENT_RECEIPT_NO_MESSAGE="Error! Please add Receipt Number here." +COM_EHEALTH_PORTAL_PAYMENT_RECEIVE_PAYMENT="Receive Payment" +COM_EHEALTH_PORTAL_PAYMENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Payment to customise the alias." +COM_EHEALTH_PORTAL_PAYMENT_SELECT_AMOUNT_N="Select Amount (N$)" +COM_EHEALTH_PORTAL_PAYMENT_SEVENTY_FIVE="75" +COM_EHEALTH_PORTAL_PAYMENT_STATUS="Status" +COM_EHEALTH_PORTAL_PAYMENT_TEN="10" +COM_EHEALTH_PORTAL_PAYMENT_TYPE="Payment Type" +COM_EHEALTH_PORTAL_PAYMENT_TYPES="Payment Types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_ACCESS="Payment Types Access" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_ACCESS_DESC="Allows the users in this group to access access payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_BATCH_OPTIONS="Batch process the selected Payment Types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_BATCH_TIP="All changes will be applied to all selected Payment Types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_BATCH_USE="Payment Types Batch Use" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_DESCRIPTION="Payment Types Edit Description" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of payment type" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_NAME="Payment Types Edit Name" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of payment type" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_VERSION="Payment Types Edit Version" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EXPORT="Payment Types Export" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EXPORT_DESC="Allows the users in this group to export export payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_IMPORT="Payment Types Import" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_IMPORT_DESC="Allows the users in this group to import import payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_ARCHIVED="%s Payment Types archived." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_ARCHIVED_1="%s Payment Type archived." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_CHECKED_IN_0="No Payment Type successfully checked in." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_CHECKED_IN_1="%d Payment Type successfully checked in." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_CHECKED_IN_MORE="%d Payment Types successfully checked in." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_DELETED="%s Payment Types deleted." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_DELETED_1="%s Payment Type deleted." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_FAILED_PUBLISHING="%s Payment Types failed publishing." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_FAILED_PUBLISHING_1="%s Payment Type failed publishing." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_FEATURED="%s Payment Types featured." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_FEATURED_1="%s Payment Type featured." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_PUBLISHED="%s Payment Types published." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_PUBLISHED_1="%s Payment Type published." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_TRASHED="%s Payment Types trashed." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_TRASHED_1="%s Payment Type trashed." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_UNFEATURED="%s Payment Types unfeatured." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_UNFEATURED_1="%s Payment Type unfeatured." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_UNPUBLISHED="%s Payment Types unpublished." +COM_EHEALTH_PORTAL_PAYMENT_TYPES_N_ITEMS_UNPUBLISHED_1="%s Payment Type unpublished." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_CREATED_BY_DESC="The user that created this Payment Type." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_CREATED_DATE_DESC="The date this Payment Type was created." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_DETAILS="Details" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_EDIT="Editing the Payment Type" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_ERROR_UNIQUE_ALIAS="Another Payment Type has the same alias." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_ID="Id" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_MODIFIED_BY_DESC="The last user that modified this Payment Type." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_MODIFIED_DATE_DESC="The date this Payment Type was modified." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_NEW="A New Payment Type" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Payment Type to customise the alias." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_STATUS="Status" +COM_EHEALTH_PORTAL_PAYMENT_TYPE_VERSION_DESC="A count of the number of times this Payment Type has been revised." +COM_EHEALTH_PORTAL_PAYMENT_TYPE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_PAYMENT_VERSION_DESC="A count of the number of times this Payment has been revised." +COM_EHEALTH_PORTAL_PAYMENT_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_PAYMENT_ZERO="0" +COM_EHEALTH_PORTAL_PLANNING_TYPE="Planning Type" +COM_EHEALTH_PORTAL_PLANNING_TYPES="Planning Types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_ACCESS="Planning Types Access" +COM_EHEALTH_PORTAL_PLANNING_TYPES_ACCESS_DESC="Allows the users in this group to access access planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_BATCH_OPTIONS="Batch process the selected Planning Types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_BATCH_TIP="All changes will be applied to all selected Planning Types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_BATCH_USE="Planning Types Batch Use" +COM_EHEALTH_PORTAL_PLANNING_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_DESCRIPTION="Planning Types Edit Description" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of planning type" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_NAME="Planning Types Edit Name" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of planning type" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_VERSION="Planning Types Edit Version" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EXPORT="Planning Types Export" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EXPORT_DESC="Allows the users in this group to export export planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_IMPORT="Planning Types Import" +COM_EHEALTH_PORTAL_PLANNING_TYPES_IMPORT_DESC="Allows the users in this group to import import planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_ARCHIVED="%s Planning Types archived." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_ARCHIVED_1="%s Planning Type archived." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_CHECKED_IN_0="No Planning Type successfully checked in." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_CHECKED_IN_1="%d Planning Type successfully checked in." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_CHECKED_IN_MORE="%d Planning Types successfully checked in." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_DELETED="%s Planning Types deleted." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_DELETED_1="%s Planning Type deleted." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_FAILED_PUBLISHING="%s Planning Types failed publishing." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_FAILED_PUBLISHING_1="%s Planning Type failed publishing." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_FEATURED="%s Planning Types featured." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_FEATURED_1="%s Planning Type featured." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_PUBLISHED="%s Planning Types published." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_PUBLISHED_1="%s Planning Type published." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_TRASHED="%s Planning Types trashed." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_TRASHED_1="%s Planning Type trashed." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_UNFEATURED="%s Planning Types unfeatured." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_UNFEATURED_1="%s Planning Type unfeatured." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_UNPUBLISHED="%s Planning Types unpublished." +COM_EHEALTH_PORTAL_PLANNING_TYPES_N_ITEMS_UNPUBLISHED_1="%s Planning Type unpublished." +COM_EHEALTH_PORTAL_PLANNING_TYPE_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_PLANNING_TYPE_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_PLANNING_TYPE_CREATED_BY_DESC="The user that created this Planning Type." +COM_EHEALTH_PORTAL_PLANNING_TYPE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_PLANNING_TYPE_CREATED_DATE_DESC="The date this Planning Type was created." +COM_EHEALTH_PORTAL_PLANNING_TYPE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_PLANNING_TYPE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_PLANNING_TYPE_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_PLANNING_TYPE_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_PLANNING_TYPE_DETAILS="Details" +COM_EHEALTH_PORTAL_PLANNING_TYPE_EDIT="Editing the Planning Type" +COM_EHEALTH_PORTAL_PLANNING_TYPE_ERROR_UNIQUE_ALIAS="Another Planning Type has the same alias." +COM_EHEALTH_PORTAL_PLANNING_TYPE_ID="Id" +COM_EHEALTH_PORTAL_PLANNING_TYPE_MODIFIED_BY_DESC="The last user that modified this Planning Type." +COM_EHEALTH_PORTAL_PLANNING_TYPE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_PLANNING_TYPE_MODIFIED_DATE_DESC="The date this Planning Type was modified." +COM_EHEALTH_PORTAL_PLANNING_TYPE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_PLANNING_TYPE_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_PLANNING_TYPE_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_PLANNING_TYPE_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_PLANNING_TYPE_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_PLANNING_TYPE_NEW="A New Planning Type" +COM_EHEALTH_PORTAL_PLANNING_TYPE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_PLANNING_TYPE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_PLANNING_TYPE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_PLANNING_TYPE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Planning Type to customise the alias." +COM_EHEALTH_PORTAL_PLANNING_TYPE_STATUS="Status" +COM_EHEALTH_PORTAL_PLANNING_TYPE_VERSION_DESC="A count of the number of times this Planning Type has been revised." +COM_EHEALTH_PORTAL_PLANNING_TYPE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER="Prostate and Testicular Cancer" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS="Prostate and Testicular Cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_ACCESS="Prostate And Testicular Cancers Access" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_ACCESS_DESC="Allows the users in this group to access access prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_BATCH_OPTIONS="Batch process the selected Prostate and Testicular Cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_BATCH_TIP="All changes will be applied to all selected Prostate and Testicular Cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_BATCH_USE="Prostate And Testicular Cancers Batch Use" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_DASHBOARD_ADD="Prostate And Testicular Cancers Dashboard Add" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of prostate and testicular cancer" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_DASHBOARD_LIST="Prostate And Testicular Cancers Dashboard List" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of prostate and testicular cancer" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_EDIT_VERSION="Prostate And Testicular Cancers Edit Version" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_EXPORT="Prostate And Testicular Cancers Export" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_EXPORT_DESC="Allows the users in this group to export export prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_IMPORT="Prostate And Testicular Cancers Import" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_IMPORT_DESC="Allows the users in this group to import import prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_ARCHIVED="%s Prostate and Testicular Cancers archived." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_ARCHIVED_1="%s Prostate and Testicular Cancer archived." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_CHECKED_IN_0="No Prostate and Testicular Cancer successfully checked in." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_CHECKED_IN_1="%d Prostate and Testicular Cancer successfully checked in." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_CHECKED_IN_MORE="%d Prostate and Testicular Cancers successfully checked in." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_DELETED="%s Prostate and Testicular Cancers deleted." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_DELETED_1="%s Prostate and Testicular Cancer deleted." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_FAILED_PUBLISHING="%s Prostate and Testicular Cancers failed publishing." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_FAILED_PUBLISHING_1="%s Prostate and Testicular Cancer failed publishing." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_FEATURED="%s Prostate and Testicular Cancers featured." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_FEATURED_1="%s Prostate and Testicular Cancer featured." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_PUBLISHED="%s Prostate and Testicular Cancers published." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_PUBLISHED_1="%s Prostate and Testicular Cancer published." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_TRASHED="%s Prostate and Testicular Cancers trashed." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_TRASHED_1="%s Prostate and Testicular Cancer trashed." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_UNFEATURED="%s Prostate and Testicular Cancers unfeatured." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_UNFEATURED_1="%s Prostate and Testicular Cancer unfeatured." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_UNPUBLISHED="%s Prostate and Testicular Cancers unpublished." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_N_ITEMS_UNPUBLISHED_1="%s Prostate and Testicular Cancer unpublished." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_SUBMENU="Prostate And Testicular Cancers Submenu" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_SUBMENU_DESC="Allows the users in this group to submenu of prostate and testicular cancer" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_CREATED_BY_DESC="The user that created this Prostate and Testicular Cancer." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_CREATED_DATE_DESC="The date this Prostate and Testicular Cancer was created." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_DETAILS="Details" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_EDIT="Editing the Prostate and Testicular Cancer" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_ERROR_UNIQUE_ALIAS="Another Prostate and Testicular Cancer has the same alias." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_ID="Id" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_MODIFIED_BY_DESC="The last user that modified this Prostate and Testicular Cancer." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_MODIFIED_DATE_DESC="The date this Prostate and Testicular Cancer was modified." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NEW="A New Prostate and Testicular Cancer" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NO="No" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_AGE_DESCRIPTION="Age > 40 years?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_AGE_LABEL="Age > 40 years?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_DIET_DESCRIPTION="Do you eat a high fat diet low in fruit and vegetables?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_DIET_LABEL="Do you eat a high fat diet low in fruit and vegetables?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_FAM_HISTORY_DESCRIPTION="Do you have a family history of a father, brother or grandfather with prostate or testicular cancer?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_FAM_HISTORY_LABEL="Do you have a family history of a father, brother or grandfather with prostate or testicular cancer?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_OVERWEIGHT_DESCRIPTION="Does the patient appear to be overweight?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_OVERWEIGHT_LABEL="Does the patient appear to be overweight?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_PHY_ACTIVITY_DESCRIPTION="Do you do regular physical activity?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_PHY_ACTIVITY_LABEL="Do you do regular physical activity?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_URINATE_DESCRIPTION="Do you experience difficulty passing urine?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_URINATE_LABEL="Do you experience difficulty passing urine?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_URINE_FREQ_DESCRIPTION="Do you pass urine more frequently than usual, especially at night?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PTC_URINE_FREQ_LABEL="Do you pass urine more frequently than usual, especially at night?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Prostate and Testicular Cancer to customise the alias." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_STATUS="Status" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_AGE_DESCRIPTION="Age > 40 years?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_AGE_HINT="Add text here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_AGE_LABEL="Comments:" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_DIET_DESCRIPTION="Do you eat a high fat diet low in fruit and vegetables?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_DIET_HINT="Add text Here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_DIET_LABEL="Comments:" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_FAM_HISTORY_DESCRIPTION="Do you have a family history of a father, brother or grandfather with prostate or testicular cancer?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_FAM_HISTORY_HINT="Add text here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_FAM_HISTORY_LABEL="Comments:" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_OVERWEIGHT_DESCRIPTION="Does the patient appear to be overweight?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_OVERWEIGHT_HINT="Add text Here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_OVERWEIGHT_LABEL="Comments:" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_PHY_ACTIVITY_DESCRIPTION="Do you do regular physical activity?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_PHY_ACTIVITY_HINT="Add text Here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_PHY_ACTIVITY_LABEL="Comments:" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_URINATE_DESCRIPTION="Do you experience difficulty passing urine?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_URINATE_HINT="Add text Here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_URINATE_LABEL="Comments:" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_URINE_FREQ_DESCRIPTION="Do you pass urine more frequently than usual, especially at night?" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_URINE_FREQ_HINT="Add text Here" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_TXT_PTC_URINE_FREQ_LABEL="Comments:" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_VERSION_DESC="A count of the number of times this Prostate and Testicular Cancer has been revised." +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_YES="Yes" +COM_EHEALTH_PORTAL_PUBLISHED="Published" +COM_EHEALTH_PORTAL_REFERRAL="Referral" +COM_EHEALTH_PORTAL_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_REFERRALS_ACCESS="Referrals Access" +COM_EHEALTH_PORTAL_REFERRALS_ACCESS_DESC="Allows the users in this group to access access referrals" +COM_EHEALTH_PORTAL_REFERRALS_BATCH_OPTIONS="Batch process the selected Referrals" +COM_EHEALTH_PORTAL_REFERRALS_BATCH_TIP="All changes will be applied to all selected Referrals" +COM_EHEALTH_PORTAL_REFERRALS_BATCH_USE="Referrals Batch Use" +COM_EHEALTH_PORTAL_REFERRALS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch referrals" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_DESCRIPTION="Referrals Edit Description" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of referral" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_NAME="Referrals Edit Name" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_NAME_DESC="Allows the users in this group to edit name of referral" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_VERSION="Referrals Edit Version" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version referrals" +COM_EHEALTH_PORTAL_REFERRALS_EXPORT="Referrals Export" +COM_EHEALTH_PORTAL_REFERRALS_EXPORT_DESC="Allows the users in this group to export export referrals" +COM_EHEALTH_PORTAL_REFERRALS_IMPORT="Referrals Import" +COM_EHEALTH_PORTAL_REFERRALS_IMPORT_DESC="Allows the users in this group to import import referrals" +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_ARCHIVED="%s Referrals archived." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_ARCHIVED_1="%s Referral archived." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_CHECKED_IN_0="No Referral successfully checked in." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_CHECKED_IN_1="%d Referral successfully checked in." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_CHECKED_IN_MORE="%d Referrals successfully checked in." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_DELETED="%s Referrals deleted." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_DELETED_1="%s Referral deleted." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_FAILED_PUBLISHING="%s Referrals failed publishing." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_FAILED_PUBLISHING_1="%s Referral failed publishing." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_FEATURED="%s Referrals featured." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_FEATURED_1="%s Referral featured." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_PUBLISHED="%s Referrals published." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_PUBLISHED_1="%s Referral published." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_TRASHED="%s Referrals trashed." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_TRASHED_1="%s Referral trashed." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_UNFEATURED="%s Referrals unfeatured." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_UNFEATURED_1="%s Referral unfeatured." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_UNPUBLISHED="%s Referrals unpublished." +COM_EHEALTH_PORTAL_REFERRALS_N_ITEMS_UNPUBLISHED_1="%s Referral unpublished." +COM_EHEALTH_PORTAL_REFERRALS_SUBMENU="Referrals Submenu" +COM_EHEALTH_PORTAL_REFERRALS_SUBMENU_DESC="Allows the users in this group to submenu of referral" +COM_EHEALTH_PORTAL_REFERRAL_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_REFERRAL_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_REFERRAL_CREATED_BY_DESC="The user that created this Referral." +COM_EHEALTH_PORTAL_REFERRAL_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_REFERRAL_CREATED_DATE_DESC="The date this Referral was created." +COM_EHEALTH_PORTAL_REFERRAL_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_REFERRAL_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_REFERRAL_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_REFERRAL_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_REFERRAL_DETAILS="Details" +COM_EHEALTH_PORTAL_REFERRAL_EDIT="Editing the Referral" +COM_EHEALTH_PORTAL_REFERRAL_ERROR_UNIQUE_ALIAS="Another Referral has the same alias." +COM_EHEALTH_PORTAL_REFERRAL_ID="Id" +COM_EHEALTH_PORTAL_REFERRAL_MODIFIED_BY_DESC="The last user that modified this Referral." +COM_EHEALTH_PORTAL_REFERRAL_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_REFERRAL_MODIFIED_DATE_DESC="The date this Referral was modified." +COM_EHEALTH_PORTAL_REFERRAL_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_REFERRAL_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_REFERRAL_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_REFERRAL_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_REFERRAL_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_REFERRAL_NEW="A New Referral" +COM_EHEALTH_PORTAL_REFERRAL_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_REFERRAL_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_REFERRAL_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_REFERRAL_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Referral to customise the alias." +COM_EHEALTH_PORTAL_REFERRAL_STATUS="Status" +COM_EHEALTH_PORTAL_REFERRAL_VERSION_DESC="A count of the number of times this Referral has been revised." +COM_EHEALTH_PORTAL_REFERRAL_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_SAVE_SUCCESS="Great! Item successfully saved." +COM_EHEALTH_PORTAL_SAVE_WARNING="The value already existed so please select another." +COM_EHEALTH_PORTAL_SITE="Site" +COM_EHEALTH_PORTAL_SITES="Sites" +COM_EHEALTH_PORTAL_SITES_ACCESS="Sites Access" +COM_EHEALTH_PORTAL_SITES_ACCESS_DESC="Allows the users in this group to access access sites" +COM_EHEALTH_PORTAL_SITES_BATCH_OPTIONS="Batch process the selected Sites" +COM_EHEALTH_PORTAL_SITES_BATCH_TIP="All changes will be applied to all selected Sites" +COM_EHEALTH_PORTAL_SITES_BATCH_USE="Sites Batch Use" +COM_EHEALTH_PORTAL_SITES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch sites" +COM_EHEALTH_PORTAL_SITES_EDIT_DESCRIPTION="Sites Edit Description" +COM_EHEALTH_PORTAL_SITES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of site" +COM_EHEALTH_PORTAL_SITES_EDIT_SITE_NAME="Sites Edit Site Name" +COM_EHEALTH_PORTAL_SITES_EDIT_SITE_NAME_DESC="Allows the users in this group to edit site name of site" +COM_EHEALTH_PORTAL_SITES_EDIT_SITE_REGION="Sites Edit Site Region" +COM_EHEALTH_PORTAL_SITES_EDIT_SITE_REGION_DESC="Allows the users in this group to edit site region of site" +COM_EHEALTH_PORTAL_SITES_EDIT_VERSION="Sites Edit Version" +COM_EHEALTH_PORTAL_SITES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version sites" +COM_EHEALTH_PORTAL_SITES_EXPORT="Sites Export" +COM_EHEALTH_PORTAL_SITES_EXPORT_DESC="Allows the users in this group to export export sites" +COM_EHEALTH_PORTAL_SITES_IMPORT="Sites Import" +COM_EHEALTH_PORTAL_SITES_IMPORT_DESC="Allows the users in this group to import import sites" +COM_EHEALTH_PORTAL_SITES_N_ITEMS_ARCHIVED="%s Sites archived." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_ARCHIVED_1="%s Site archived." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_CHECKED_IN_0="No Site successfully checked in." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_CHECKED_IN_1="%d Site successfully checked in." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_CHECKED_IN_MORE="%d Sites successfully checked in." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_DELETED="%s Sites deleted." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_DELETED_1="%s Site deleted." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_FAILED_PUBLISHING="%s Sites failed publishing." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_FAILED_PUBLISHING_1="%s Site failed publishing." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_FEATURED="%s Sites featured." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_FEATURED_1="%s Site featured." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_PUBLISHED="%s Sites published." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_PUBLISHED_1="%s Site published." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_TRASHED="%s Sites trashed." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_TRASHED_1="%s Site trashed." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_UNFEATURED="%s Sites unfeatured." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_UNFEATURED_1="%s Site unfeatured." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_UNPUBLISHED="%s Sites unpublished." +COM_EHEALTH_PORTAL_SITES_N_ITEMS_UNPUBLISHED_1="%s Site unpublished." +COM_EHEALTH_PORTAL_SITE_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_SITE_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_SITE_CREATED_BY_DESC="The user that created this Site." +COM_EHEALTH_PORTAL_SITE_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_SITE_CREATED_DATE_DESC="The date this Site was created." +COM_EHEALTH_PORTAL_SITE_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_SITE_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_SITE_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_SITE_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_SITE_DETAILS="Details" +COM_EHEALTH_PORTAL_SITE_EDIT="Editing the Site" +COM_EHEALTH_PORTAL_SITE_ERROR_UNIQUE_ALIAS="Another Site has the same alias." +COM_EHEALTH_PORTAL_SITE_ID="Id" +COM_EHEALTH_PORTAL_SITE_MODIFIED_BY_DESC="The last user that modified this Site." +COM_EHEALTH_PORTAL_SITE_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_SITE_MODIFIED_DATE_DESC="The date this Site was modified." +COM_EHEALTH_PORTAL_SITE_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_SITE_NEW="A New Site" +COM_EHEALTH_PORTAL_SITE_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_SITE_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_SITE_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_SITE_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Site to customise the alias." +COM_EHEALTH_PORTAL_SITE_SITE_NAME_DESCRIPTION="Enter Site Name Here" +COM_EHEALTH_PORTAL_SITE_SITE_NAME_HINT="Site Name Here" +COM_EHEALTH_PORTAL_SITE_SITE_NAME_LABEL="Site Name" +COM_EHEALTH_PORTAL_SITE_SITE_NAME_MESSAGE="Error! Please add Site Name here." +COM_EHEALTH_PORTAL_SITE_SITE_REGION_DESCRIPTION="Enter Site Region Here" +COM_EHEALTH_PORTAL_SITE_SITE_REGION_HINT="Site Region Here" +COM_EHEALTH_PORTAL_SITE_SITE_REGION_LABEL="Site Region" +COM_EHEALTH_PORTAL_SITE_SITE_REGION_MESSAGE="Error! Please add Site Region here." +COM_EHEALTH_PORTAL_SITE_STATUS="Status" +COM_EHEALTH_PORTAL_SITE_VERSION_DESC="A count of the number of times this Site has been revised." +COM_EHEALTH_PORTAL_SITE_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_STRENGTH="Strength" +COM_EHEALTH_PORTAL_STRENGTHS="Strengths" +COM_EHEALTH_PORTAL_STRENGTHS_ACCESS="Strengths Access" +COM_EHEALTH_PORTAL_STRENGTHS_ACCESS_DESC="Allows the users in this group to access access strengths" +COM_EHEALTH_PORTAL_STRENGTHS_BATCH_OPTIONS="Batch process the selected Strengths" +COM_EHEALTH_PORTAL_STRENGTHS_BATCH_TIP="All changes will be applied to all selected Strengths" +COM_EHEALTH_PORTAL_STRENGTHS_BATCH_USE="Strengths Batch Use" +COM_EHEALTH_PORTAL_STRENGTHS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch strengths" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_DESCRIPTION="Strengths Edit Description" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of strength" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_NAME="Strengths Edit Name" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_NAME_DESC="Allows the users in this group to edit name of strength" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_VERSION="Strengths Edit Version" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version strengths" +COM_EHEALTH_PORTAL_STRENGTHS_EXPORT="Strengths Export" +COM_EHEALTH_PORTAL_STRENGTHS_EXPORT_DESC="Allows the users in this group to export export strengths" +COM_EHEALTH_PORTAL_STRENGTHS_IMPORT="Strengths Import" +COM_EHEALTH_PORTAL_STRENGTHS_IMPORT_DESC="Allows the users in this group to import import strengths" +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_ARCHIVED="%s Strengths archived." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_ARCHIVED_1="%s Strength archived." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_CHECKED_IN_0="No Strength successfully checked in." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_CHECKED_IN_1="%d Strength successfully checked in." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_CHECKED_IN_MORE="%d Strengths successfully checked in." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_DELETED="%s Strengths deleted." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_DELETED_1="%s Strength deleted." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_FAILED_PUBLISHING="%s Strengths failed publishing." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_FAILED_PUBLISHING_1="%s Strength failed publishing." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_FEATURED="%s Strengths featured." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_FEATURED_1="%s Strength featured." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_PUBLISHED="%s Strengths published." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_PUBLISHED_1="%s Strength published." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_TRASHED="%s Strengths trashed." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_TRASHED_1="%s Strength trashed." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_UNFEATURED="%s Strengths unfeatured." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_UNFEATURED_1="%s Strength unfeatured." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_UNPUBLISHED="%s Strengths unpublished." +COM_EHEALTH_PORTAL_STRENGTHS_N_ITEMS_UNPUBLISHED_1="%s Strength unpublished." +COM_EHEALTH_PORTAL_STRENGTHS_SUBMENU="Strengths Submenu" +COM_EHEALTH_PORTAL_STRENGTHS_SUBMENU_DESC="Allows the users in this group to submenu of strength" +COM_EHEALTH_PORTAL_STRENGTH_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_STRENGTH_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_STRENGTH_CREATED_BY_DESC="The user that created this Strength." +COM_EHEALTH_PORTAL_STRENGTH_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_STRENGTH_CREATED_DATE_DESC="The date this Strength was created." +COM_EHEALTH_PORTAL_STRENGTH_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_STRENGTH_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_STRENGTH_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_STRENGTH_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_STRENGTH_DETAILS="Details" +COM_EHEALTH_PORTAL_STRENGTH_EDIT="Editing the Strength" +COM_EHEALTH_PORTAL_STRENGTH_ERROR_UNIQUE_ALIAS="Another Strength has the same alias." +COM_EHEALTH_PORTAL_STRENGTH_ID="Id" +COM_EHEALTH_PORTAL_STRENGTH_MODIFIED_BY_DESC="The last user that modified this Strength." +COM_EHEALTH_PORTAL_STRENGTH_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_STRENGTH_MODIFIED_DATE_DESC="The date this Strength was modified." +COM_EHEALTH_PORTAL_STRENGTH_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_STRENGTH_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_STRENGTH_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_STRENGTH_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_STRENGTH_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_STRENGTH_NEW="A New Strength" +COM_EHEALTH_PORTAL_STRENGTH_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_STRENGTH_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_STRENGTH_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_STRENGTH_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Strength to customise the alias." +COM_EHEALTH_PORTAL_STRENGTH_STATUS="Status" +COM_EHEALTH_PORTAL_STRENGTH_VERSION_DESC="A count of the number of times this Strength has been revised." +COM_EHEALTH_PORTAL_STRENGTH_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_SUBMENU_ADMINISTRATION_PARTS="Administration Parts" +COM_EHEALTH_PORTAL_SUBMENU_ANTENATAL_CARES="Antenatal Cares" +COM_EHEALTH_PORTAL_SUBMENU_BREAST_CANCERS="Breast Cancers" +COM_EHEALTH_PORTAL_SUBMENU_CERVICAL_CANCERS="Cervical Cancers" +COM_EHEALTH_PORTAL_SUBMENU_DASHBOARD="Dashboard" +COM_EHEALTH_PORTAL_SUBMENU_FAMILY_PLANNINGS="Family Plannings" +COM_EHEALTH_PORTAL_SUBMENU_GENERAL_MEDICAL_CHECK_UPS="General Medical Check Ups" +COM_EHEALTH_PORTAL_SUBMENU_HEALTH_EDUCATIONS="Health Educations" +COM_EHEALTH_PORTAL_SUBMENU_HIV_COUNSELINGS_AND_TESTINGS="HIV Counselings and Testings" +COM_EHEALTH_PORTAL_SUBMENU_IMMUNISATIONS="Immunisations" +COM_EHEALTH_PORTAL_SUBMENU_IMMUNISATION_VACCINE_TYPES="Immunisation Vaccine Types" +COM_EHEALTH_PORTAL_SUBMENU_MEDICATIONS="Medications" +COM_EHEALTH_PORTAL_SUBMENU_PATIENT_QUEUE="Patient Queue" +COM_EHEALTH_PORTAL_SUBMENU_PAYMENTS="Payments" +COM_EHEALTH_PORTAL_SUBMENU_PROSTATE_AND_TESTICULAR_CANCERS="Prostate and Testicular Cancers" +COM_EHEALTH_PORTAL_SUBMENU_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_SUBMENU_STRENGTHS="Strengths" +COM_EHEALTH_PORTAL_SUBMENU_TESTS="Tests" +COM_EHEALTH_PORTAL_SUBMENU_TUBERCULOSES="Tuberculoses" +COM_EHEALTH_PORTAL_SUBMENU_UNITS="Units" +COM_EHEALTH_PORTAL_SUBMENU_VMMCS="VMMCs" +COM_EHEALTH_PORTAL_TEST="Test" +COM_EHEALTH_PORTAL_TESTING_REASON="Testing Reason" +COM_EHEALTH_PORTAL_TESTING_REASONS="Testing Reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_ACCESS="Testing Reasons Access" +COM_EHEALTH_PORTAL_TESTING_REASONS_ACCESS_DESC="Allows the users in this group to access access testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_BATCH_OPTIONS="Batch process the selected Testing Reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_BATCH_TIP="All changes will be applied to all selected Testing Reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_BATCH_USE="Testing Reasons Batch Use" +COM_EHEALTH_PORTAL_TESTING_REASONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_DESCRIPTION="Testing Reasons Edit Description" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of testing reason" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_NAME="Testing Reasons Edit Name" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_NAME_DESC="Allows the users in this group to edit name of testing reason" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_VERSION="Testing Reasons Edit Version" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_EXPORT="Testing Reasons Export" +COM_EHEALTH_PORTAL_TESTING_REASONS_EXPORT_DESC="Allows the users in this group to export export testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_IMPORT="Testing Reasons Import" +COM_EHEALTH_PORTAL_TESTING_REASONS_IMPORT_DESC="Allows the users in this group to import import testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_ARCHIVED="%s Testing Reasons archived." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_ARCHIVED_1="%s Testing Reason archived." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_CHECKED_IN_0="No Testing Reason successfully checked in." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_CHECKED_IN_1="%d Testing Reason successfully checked in." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_CHECKED_IN_MORE="%d Testing Reasons successfully checked in." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_DELETED="%s Testing Reasons deleted." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_DELETED_1="%s Testing Reason deleted." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_FAILED_PUBLISHING="%s Testing Reasons failed publishing." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_FAILED_PUBLISHING_1="%s Testing Reason failed publishing." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_FEATURED="%s Testing Reasons featured." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_FEATURED_1="%s Testing Reason featured." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_PUBLISHED="%s Testing Reasons published." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_PUBLISHED_1="%s Testing Reason published." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_TRASHED="%s Testing Reasons trashed." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_TRASHED_1="%s Testing Reason trashed." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_UNFEATURED="%s Testing Reasons unfeatured." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_UNFEATURED_1="%s Testing Reason unfeatured." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_UNPUBLISHED="%s Testing Reasons unpublished." +COM_EHEALTH_PORTAL_TESTING_REASONS_N_ITEMS_UNPUBLISHED_1="%s Testing Reason unpublished." +COM_EHEALTH_PORTAL_TESTING_REASON_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_TESTING_REASON_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_TESTING_REASON_CREATED_BY_DESC="The user that created this Testing Reason." +COM_EHEALTH_PORTAL_TESTING_REASON_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_TESTING_REASON_CREATED_DATE_DESC="The date this Testing Reason was created." +COM_EHEALTH_PORTAL_TESTING_REASON_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_TESTING_REASON_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_TESTING_REASON_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_TESTING_REASON_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_TESTING_REASON_DETAILS="Details" +COM_EHEALTH_PORTAL_TESTING_REASON_EDIT="Editing the Testing Reason" +COM_EHEALTH_PORTAL_TESTING_REASON_ERROR_UNIQUE_ALIAS="Another Testing Reason has the same alias." +COM_EHEALTH_PORTAL_TESTING_REASON_ID="Id" +COM_EHEALTH_PORTAL_TESTING_REASON_MODIFIED_BY_DESC="The last user that modified this Testing Reason." +COM_EHEALTH_PORTAL_TESTING_REASON_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_TESTING_REASON_MODIFIED_DATE_DESC="The date this Testing Reason was modified." +COM_EHEALTH_PORTAL_TESTING_REASON_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_TESTING_REASON_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_TESTING_REASON_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_TESTING_REASON_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_TESTING_REASON_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_TESTING_REASON_NEW="A New Testing Reason" +COM_EHEALTH_PORTAL_TESTING_REASON_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_TESTING_REASON_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_TESTING_REASON_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_TESTING_REASON_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Testing Reason to customise the alias." +COM_EHEALTH_PORTAL_TESTING_REASON_STATUS="Status" +COM_EHEALTH_PORTAL_TESTING_REASON_VERSION_DESC="A count of the number of times this Testing Reason has been revised." +COM_EHEALTH_PORTAL_TESTING_REASON_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_TESTS="Tests" +COM_EHEALTH_PORTAL_TESTS_ACCESS="Tests Access" +COM_EHEALTH_PORTAL_TESTS_ACCESS_DESC="Allows the users in this group to access access tests" +COM_EHEALTH_PORTAL_TESTS_BATCH_OPTIONS="Batch process the selected Tests" +COM_EHEALTH_PORTAL_TESTS_BATCH_TIP="All changes will be applied to all selected Tests" +COM_EHEALTH_PORTAL_TESTS_BATCH_USE="Tests Batch Use" +COM_EHEALTH_PORTAL_TESTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch tests" +COM_EHEALTH_PORTAL_TESTS_DASHBOARD_ADD="Tests Dashboard Add" +COM_EHEALTH_PORTAL_TESTS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of test" +COM_EHEALTH_PORTAL_TESTS_DASHBOARD_LIST="Tests Dashboard List" +COM_EHEALTH_PORTAL_TESTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of test" +COM_EHEALTH_PORTAL_TESTS_EDIT_VERSION="Tests Edit Version" +COM_EHEALTH_PORTAL_TESTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version tests" +COM_EHEALTH_PORTAL_TESTS_EXPORT="Tests Export" +COM_EHEALTH_PORTAL_TESTS_EXPORT_DESC="Allows the users in this group to export export tests" +COM_EHEALTH_PORTAL_TESTS_IMPORT="Tests Import" +COM_EHEALTH_PORTAL_TESTS_IMPORT_DESC="Allows the users in this group to import import tests" +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_ARCHIVED="%s Tests archived." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_ARCHIVED_1="%s Test archived." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_CHECKED_IN_0="No Test successfully checked in." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_CHECKED_IN_1="%d Test successfully checked in." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_CHECKED_IN_MORE="%d Tests successfully checked in." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_DELETED="%s Tests deleted." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_DELETED_1="%s Test deleted." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_FAILED_PUBLISHING="%s Tests failed publishing." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_FAILED_PUBLISHING_1="%s Test failed publishing." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_FEATURED="%s Tests featured." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_FEATURED_1="%s Test featured." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_PUBLISHED="%s Tests published." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_PUBLISHED_1="%s Test published." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_TRASHED="%s Tests trashed." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_TRASHED_1="%s Test trashed." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_UNFEATURED="%s Tests unfeatured." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_UNFEATURED_1="%s Test unfeatured." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_UNPUBLISHED="%s Tests unpublished." +COM_EHEALTH_PORTAL_TESTS_N_ITEMS_UNPUBLISHED_1="%s Test unpublished." +COM_EHEALTH_PORTAL_TESTS_SUBMENU="Tests Submenu" +COM_EHEALTH_PORTAL_TESTS_SUBMENU_DESC="Allows the users in this group to submenu of test" +COM_EHEALTH_PORTAL_TEST_ABNORMAL="Abnormal" +COM_EHEALTH_PORTAL_TEST_CHOLESTEROL="Cholesterol" +COM_EHEALTH_PORTAL_TEST_CHOLESTEROL_READING_DESCRIPTION="Enter Cholesterol reading (g/dL)" +COM_EHEALTH_PORTAL_TEST_CHOLESTEROL_READING_HINT="Your Cholesterol reading (g/dL) Here" +COM_EHEALTH_PORTAL_TEST_CHOLESTEROL_READING_LABEL="Cholesterol reading (g/dL):" +COM_EHEALTH_PORTAL_TEST_CREATED_BY_DESC="The user that created this Test." +COM_EHEALTH_PORTAL_TEST_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_TEST_CREATED_DATE_DESC="The date this Test was created." +COM_EHEALTH_PORTAL_TEST_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_TEST_EDIT="Editing the Test" +COM_EHEALTH_PORTAL_TEST_ERROR_UNIQUE_ALIAS="Another Test has the same alias." +COM_EHEALTH_PORTAL_TEST_GLUCOSE="Glucose" +COM_EHEALTH_PORTAL_TEST_GLUCOSE_FIRST_READING_DESCRIPTION="Enter Glucose 1st reading (mmol/L)" +COM_EHEALTH_PORTAL_TEST_GLUCOSE_FIRST_READING_HINT="Your Glucose 1st reading (mmol/L) Here" +COM_EHEALTH_PORTAL_TEST_GLUCOSE_FIRST_READING_LABEL="1st reading (mmol/L)" +COM_EHEALTH_PORTAL_TEST_GLUCOSE_SECOND_READING_DESCRIPTION="Enter Glucose 2nd reading (mmol/L)" +COM_EHEALTH_PORTAL_TEST_GLUCOSE_SECOND_READING_HINT="Your Glucose 2nd reading (mmol/L) Here" +COM_EHEALTH_PORTAL_TEST_GLUCOSE_SECOND_READING_LABEL="2nd reading (mmol/L):" +COM_EHEALTH_PORTAL_TEST_HAEMOGLOBIN="Haemoglobin" +COM_EHEALTH_PORTAL_TEST_HAEMOGLOBIN_READING_DESCRIPTION="Enter Haemoglobin reading (g/dL)" +COM_EHEALTH_PORTAL_TEST_HAEMOGLOBIN_READING_HINT="Your Haemoglobin reading (g/dL) Here" +COM_EHEALTH_PORTAL_TEST_HAEMOGLOBIN_READING_LABEL="Haemoglobin reading (g/dL):" +COM_EHEALTH_PORTAL_TEST_HEPATITIS_B="Hepatitis B" +COM_EHEALTH_PORTAL_TEST_HEPATITIS_FIRST_READING_DESCRIPTION="1st reading" +COM_EHEALTH_PORTAL_TEST_HEPATITIS_FIRST_READING_LABEL="1st reading:" +COM_EHEALTH_PORTAL_TEST_HEPATITIS_SECOND_READING_DESCRIPTION="2nd reading" +COM_EHEALTH_PORTAL_TEST_HEPATITIS_SECOND_READING_LABEL="2nd reading:" +COM_EHEALTH_PORTAL_TEST_ID="Id" +COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE="Inconclusive" +COM_EHEALTH_PORTAL_TEST_MALARIA="Malaria" +COM_EHEALTH_PORTAL_TEST_MALARIA_FIRST_READING_DESCRIPTION="1st reading" +COM_EHEALTH_PORTAL_TEST_MALARIA_FIRST_READING_LABEL="1st reading:" +COM_EHEALTH_PORTAL_TEST_MALARIA_SECOND_READING_DESCRIPTION="2nd reading" +COM_EHEALTH_PORTAL_TEST_MALARIA_SECOND_READING_LABEL="2nd reading:" +COM_EHEALTH_PORTAL_TEST_MODIFIED_BY_DESC="The last user that modified this Test." +COM_EHEALTH_PORTAL_TEST_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_TEST_MODIFIED_DATE_DESC="The date this Test was modified." +COM_EHEALTH_PORTAL_TEST_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_TEST_NEGATIVE="Negative" +COM_EHEALTH_PORTAL_TEST_NEW="A New Test" +COM_EHEALTH_PORTAL_TEST_NORMAL="Normal" +COM_EHEALTH_PORTAL_TEST_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_TEST_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_TEST_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_TEST_POSITIVE="Positive" +COM_EHEALTH_PORTAL_TEST_PREGNANCY="Pregnancy" +COM_EHEALTH_PORTAL_TEST_PREGNANCY_FIRST_READING_DESCRIPTION="1st reading" +COM_EHEALTH_PORTAL_TEST_PREGNANCY_FIRST_READING_LABEL="1st reading:" +COM_EHEALTH_PORTAL_TEST_PREGNANCY_SECOND_READING_DESCRIPTION="2nd reading" +COM_EHEALTH_PORTAL_TEST_PREGNANCY_SECOND_READING_LABEL="2nd reading:" +COM_EHEALTH_PORTAL_TEST_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_TEST_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_TEST_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_TEST_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_TEST_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_TEST_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_TEST_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Test to customise the alias." +COM_EHEALTH_PORTAL_TEST_STATUS="Status" +COM_EHEALTH_PORTAL_TEST_SYPHILIS_FIRST_READING_DESCRIPTION="1st reading" +COM_EHEALTH_PORTAL_TEST_SYPHILIS_FIRST_READING_LABEL="1st reading:" +COM_EHEALTH_PORTAL_TEST_SYPHILIS_SECOND_READING_DESCRIPTION="2nd reading" +COM_EHEALTH_PORTAL_TEST_SYPHILIS_SECOND_READING_LABEL="2nd reading:" +COM_EHEALTH_PORTAL_TEST_SYPHILLIS="Syphillis" +COM_EHEALTH_PORTAL_TEST_URINE="Urine" +COM_EHEALTH_PORTAL_TEST_URINE_TEST_RESULT_DESCRIPTION="Urine test result" +COM_EHEALTH_PORTAL_TEST_URINE_TEST_RESULT_LABEL="Urine test result" +COM_EHEALTH_PORTAL_TEST_VERSION_DESC="A count of the number of times this Test has been revised." +COM_EHEALTH_PORTAL_TEST_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_TRASHED="Trashed" +COM_EHEALTH_PORTAL_TUBERCULOSES="Tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_ACCESS="Tuberculoses Access" +COM_EHEALTH_PORTAL_TUBERCULOSES_ACCESS_DESC="Allows the users in this group to access access tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_BATCH_OPTIONS="Batch process the selected Tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_BATCH_TIP="All changes will be applied to all selected Tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_BATCH_USE="Tuberculoses Batch Use" +COM_EHEALTH_PORTAL_TUBERCULOSES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_DASHBOARD_ADD="Tuberculoses Dashboard Add" +COM_EHEALTH_PORTAL_TUBERCULOSES_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSES_DASHBOARD_LIST="Tuberculoses Dashboard List" +COM_EHEALTH_PORTAL_TUBERCULOSES_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSES_EDIT_PATIENT="Tuberculoses Edit Patient" +COM_EHEALTH_PORTAL_TUBERCULOSES_EDIT_PATIENT_DESC="Allows the users in this group to edit patient of tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSES_EDIT_VERSION="Tuberculoses Edit Version" +COM_EHEALTH_PORTAL_TUBERCULOSES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_EXPORT="Tuberculoses Export" +COM_EHEALTH_PORTAL_TUBERCULOSES_EXPORT_DESC="Allows the users in this group to export export tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_IMPORT="Tuberculoses Import" +COM_EHEALTH_PORTAL_TUBERCULOSES_IMPORT_DESC="Allows the users in this group to import import tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_ARCHIVED="%s Tuberculoses archived." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_ARCHIVED_1="%s Tuberculosis archived." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_CHECKED_IN_0="No Tuberculosis successfully checked in." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_CHECKED_IN_1="%d Tuberculosis successfully checked in." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_CHECKED_IN_MORE="%d Tuberculoses successfully checked in." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_DELETED="%s Tuberculoses deleted." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_DELETED_1="%s Tuberculosis deleted." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_FAILED_PUBLISHING="%s Tuberculoses failed publishing." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_FAILED_PUBLISHING_1="%s Tuberculosis failed publishing." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_FEATURED="%s Tuberculoses featured." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_FEATURED_1="%s Tuberculosis featured." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_PUBLISHED="%s Tuberculoses published." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_PUBLISHED_1="%s Tuberculosis published." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_TRASHED="%s Tuberculoses trashed." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_TRASHED_1="%s Tuberculosis trashed." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_UNFEATURED="%s Tuberculoses unfeatured." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_UNFEATURED_1="%s Tuberculosis unfeatured." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_UNPUBLISHED="%s Tuberculoses unpublished." +COM_EHEALTH_PORTAL_TUBERCULOSES_N_ITEMS_UNPUBLISHED_1="%s Tuberculosis unpublished." +COM_EHEALTH_PORTAL_TUBERCULOSES_SUBMENU="Tuberculoses Submenu" +COM_EHEALTH_PORTAL_TUBERCULOSES_SUBMENU_DESC="Allows the users in this group to submenu of tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSIS="Tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSIS_BLOOD_STREAKED_SPUTUM_DESCRIPTION="Coughing blood-streaked sputum" +COM_EHEALTH_PORTAL_TUBERCULOSIS_BLOOD_STREAKED_SPUTUM_LABEL="Coughing blood-streaked sputum" +COM_EHEALTH_PORTAL_TUBERCULOSIS_CREATED_BY_DESC="The user that created this Tuberculosis." +COM_EHEALTH_PORTAL_TUBERCULOSIS_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_TUBERCULOSIS_CREATED_DATE_DESC="The date this Tuberculosis was created." +COM_EHEALTH_PORTAL_TUBERCULOSIS_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_TUBERCULOSIS_DATE_OF_TREATMENT_DESCRIPTION="Enter date/year of treatment" +COM_EHEALTH_PORTAL_TUBERCULOSIS_DATE_OF_TREATMENT_LABEL="Date/year of treatment" +COM_EHEALTH_PORTAL_TUBERCULOSIS_DIAGNOSED_WITH_DISEASE_DESCRIPTION="Have you been recently diagnosed with diabetes, halitosis, HIV, renal/liver disease?" +COM_EHEALTH_PORTAL_TUBERCULOSIS_DIAGNOSED_WITH_DISEASE_LABEL="Have you been recently diagnosed with diabetes, halitosis, HIV, renal/liver disease?" +COM_EHEALTH_PORTAL_TUBERCULOSIS_EDIT="Editing the Tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSIS_ERROR_UNIQUE_ALIAS="Another Tuberculosis has the same alias." +COM_EHEALTH_PORTAL_TUBERCULOSIS_ID="Id" +COM_EHEALTH_PORTAL_TUBERCULOSIS_INCONCLUSIVE="Inconclusive" +COM_EHEALTH_PORTAL_TUBERCULOSIS_MODIFIED_BY_DESC="The last user that modified this Tuberculosis." +COM_EHEALTH_PORTAL_TUBERCULOSIS_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_TUBERCULOSIS_MODIFIED_DATE_DESC="The date this Tuberculosis was modified." +COM_EHEALTH_PORTAL_TUBERCULOSIS_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_TUBERCULOSIS_NEGATIVE="Negative" +COM_EHEALTH_PORTAL_TUBERCULOSIS_NEW="A New Tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSIS_NO="No" +COM_EHEALTH_PORTAL_TUBERCULOSIS_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_TUBERCULOSIS_PAIN_IN_CHEST_DESCRIPTION="Pain in chest when breathing or coughing" +COM_EHEALTH_PORTAL_TUBERCULOSIS_PAIN_IN_CHEST_LABEL="Pain in chest when breathing or coughing" +COM_EHEALTH_PORTAL_TUBERCULOSIS_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_TUBERCULOSIS_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_TUBERCULOSIS_PERSISTENT_COUGH_DESCRIPTION="Persistent cough of > 1 month duration" +COM_EHEALTH_PORTAL_TUBERCULOSIS_PERSISTENT_COUGH_LABEL="Persistent cough of > 1 month duration" +COM_EHEALTH_PORTAL_TUBERCULOSIS_POSITIVE="Positive" +COM_EHEALTH_PORTAL_TUBERCULOSIS_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_TUBERCULOSIS_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_TUBERCULOSIS_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_TUBERCULOSIS_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_TUBERCULOSIS_RECURRING_NIGHT_SWEATS_DESCRIPTION="Recurring night sweats during previous month" +COM_EHEALTH_PORTAL_TUBERCULOSIS_RECURRING_NIGHT_SWEATS_LABEL="Recurring night sweats during previous month" +COM_EHEALTH_PORTAL_TUBERCULOSIS_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_TUBERCULOSIS_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_TUBERCULOSIS_REFERRED_SECOND_SPUTUM_DESCRIPTION="Referred for 2nd sputum" +COM_EHEALTH_PORTAL_TUBERCULOSIS_REFERRED_SECOND_SPUTUM_LABEL="Referred for 2nd sputum" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Tuberculosis to customise the alias." +COM_EHEALTH_PORTAL_TUBERCULOSIS_SCREENING="Screening" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SHORTNESS_OF_BREATH_DESCRIPTION="Shortness of breath (SOB) with increasing severity and frequency" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SHORTNESS_OF_BREATH_LABEL="Shortness of breath (SOB) with increasing severity and frequency" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SPUTUM_COLLECTION="Sputum Collection" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SPUTUM_COLLECTION_ONE_DESCRIPTION="1st Sputum collected" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SPUTUM_COLLECTION_ONE_LABEL="1st Sputum collected" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SPUTUM_RESULT_ONE_DESCRIPTION="1st Sputum result" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SPUTUM_RESULT_ONE_LABEL="1st Sputum result" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SPUTUM_RESULT_TWO_DESCRIPTION="2nd Sputum result" +COM_EHEALTH_PORTAL_TUBERCULOSIS_SPUTUM_RESULT_TWO_LABEL="2nd Sputum result" +COM_EHEALTH_PORTAL_TUBERCULOSIS_STATUS="Status" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_EXPOSED_DESCRIPTION="Have you recently been exposed to: a patient(s), colleague, close relative with suspected or confirmed active TB?" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_EXPOSED_LABEL="Have you recently been exposed to: a patient(s), colleague, close relative with suspected or confirmed active TB?" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_FEVER_DESCRIPTION="Fever lasting > 1 month" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_FEVER_LABEL="Fever lasting > 1 month" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_REASON_ONE_DESCRIPTION="Enter Reason" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_REASON_ONE_HINT="Your Reason Here" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_REASON_ONE_LABEL="Reason" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_REASON_ONE_MESSAGE="Error! Please add some text here." +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_REASON_TWO_DESCRIPTION="Enter Reason" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_REASON_TWO_HINT="Your Reason Here" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_REASON_TWO_LABEL="Reason" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_REASON_TWO_MESSAGE="Error! Please add some text here." +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_TREATMENT_DESCRIPTION="Have you ever been treated for TB before?" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TB_TREATMENT_LABEL="Have you ever been treated for TB before?" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TREATING_DHC_DESCRIPTION="Enter Treating doctor/hospital/clinic" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TREATING_DHC_HINT="Your Treating doctor/hospital/clinic Here" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TREATING_DHC_LABEL="Treating doctor/hospital/clinic" +COM_EHEALTH_PORTAL_TUBERCULOSIS_TREATING_DHC_MESSAGE="Error! Please add some text here." +COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN="Uncertain" +COM_EHEALTH_PORTAL_TUBERCULOSIS_UNUSUAL_TIREDNESS_DESCRIPTION="Unusual tiredness or weakness lasting weeks" +COM_EHEALTH_PORTAL_TUBERCULOSIS_UNUSUAL_TIREDNESS_LABEL="Unusual tiredness or weakness lasting weeks" +COM_EHEALTH_PORTAL_TUBERCULOSIS_VERSION_DESC="A count of the number of times this Tuberculosis has been revised." +COM_EHEALTH_PORTAL_TUBERCULOSIS_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_TUBERCULOSIS_WEIGHT_LOSS_WDIETING_DESCRIPTION="Weight loss without dieting in the previous 2-3 months" +COM_EHEALTH_PORTAL_TUBERCULOSIS_WEIGHT_LOSS_WDIETING_LABEL="Weight loss without dieting in the previous 2-3 months" +COM_EHEALTH_PORTAL_TUBERCULOSIS_YES="Yes" +COM_EHEALTH_PORTAL_UNIT="Unit" +COM_EHEALTH_PORTAL_UNITS="Units" +COM_EHEALTH_PORTAL_UNITS_ACCESS="Units Access" +COM_EHEALTH_PORTAL_UNITS_ACCESS_DESC="Allows the users in this group to access access units" +COM_EHEALTH_PORTAL_UNITS_BATCH_OPTIONS="Batch process the selected Units" +COM_EHEALTH_PORTAL_UNITS_BATCH_TIP="All changes will be applied to all selected Units" +COM_EHEALTH_PORTAL_UNITS_BATCH_USE="Units Batch Use" +COM_EHEALTH_PORTAL_UNITS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch units" +COM_EHEALTH_PORTAL_UNITS_EDIT_DESCRIPTION="Units Edit Description" +COM_EHEALTH_PORTAL_UNITS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of unit" +COM_EHEALTH_PORTAL_UNITS_EDIT_NAME="Units Edit Name" +COM_EHEALTH_PORTAL_UNITS_EDIT_NAME_DESC="Allows the users in this group to edit name of unit" +COM_EHEALTH_PORTAL_UNITS_EDIT_VERSION="Units Edit Version" +COM_EHEALTH_PORTAL_UNITS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version units" +COM_EHEALTH_PORTAL_UNITS_EXPORT="Units Export" +COM_EHEALTH_PORTAL_UNITS_EXPORT_DESC="Allows the users in this group to export export units" +COM_EHEALTH_PORTAL_UNITS_IMPORT="Units Import" +COM_EHEALTH_PORTAL_UNITS_IMPORT_DESC="Allows the users in this group to import import units" +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_ARCHIVED="%s Units archived." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_ARCHIVED_1="%s Unit archived." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_CHECKED_IN_0="No Unit successfully checked in." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_CHECKED_IN_1="%d Unit successfully checked in." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_CHECKED_IN_MORE="%d Units successfully checked in." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_DELETED="%s Units deleted." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_DELETED_1="%s Unit deleted." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_FAILED_PUBLISHING="%s Units failed publishing." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_FAILED_PUBLISHING_1="%s Unit failed publishing." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_FEATURED="%s Units featured." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_FEATURED_1="%s Unit featured." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_PUBLISHED="%s Units published." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_PUBLISHED_1="%s Unit published." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_TRASHED="%s Units trashed." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_TRASHED_1="%s Unit trashed." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_UNFEATURED="%s Units unfeatured." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_UNFEATURED_1="%s Unit unfeatured." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_UNPUBLISHED="%s Units unpublished." +COM_EHEALTH_PORTAL_UNITS_N_ITEMS_UNPUBLISHED_1="%s Unit unpublished." +COM_EHEALTH_PORTAL_UNITS_SUBMENU="Units Submenu" +COM_EHEALTH_PORTAL_UNITS_SUBMENU_DESC="Allows the users in this group to submenu of unit" +COM_EHEALTH_PORTAL_UNIT_ALIAS_HINT="Auto-generated from name" +COM_EHEALTH_PORTAL_UNIT_ALIAS_LABEL="Alias" +COM_EHEALTH_PORTAL_UNIT_CREATED_BY_DESC="The user that created this Unit." +COM_EHEALTH_PORTAL_UNIT_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_UNIT_CREATED_DATE_DESC="The date this Unit was created." +COM_EHEALTH_PORTAL_UNIT_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_UNIT_DESCRIPTION_DESCRIPTION="Add Description Here" +COM_EHEALTH_PORTAL_UNIT_DESCRIPTION_HINT="Add Description Here" +COM_EHEALTH_PORTAL_UNIT_DESCRIPTION_LABEL="Description" +COM_EHEALTH_PORTAL_UNIT_DETAILS="Details" +COM_EHEALTH_PORTAL_UNIT_EDIT="Editing the Unit" +COM_EHEALTH_PORTAL_UNIT_ERROR_UNIQUE_ALIAS="Another Unit has the same alias." +COM_EHEALTH_PORTAL_UNIT_ID="Id" +COM_EHEALTH_PORTAL_UNIT_MODIFIED_BY_DESC="The last user that modified this Unit." +COM_EHEALTH_PORTAL_UNIT_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_UNIT_MODIFIED_DATE_DESC="The date this Unit was modified." +COM_EHEALTH_PORTAL_UNIT_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_UNIT_NAME_DESCRIPTION="Enter Name Here" +COM_EHEALTH_PORTAL_UNIT_NAME_HINT="Name here" +COM_EHEALTH_PORTAL_UNIT_NAME_LABEL="Name" +COM_EHEALTH_PORTAL_UNIT_NAME_MESSAGE="Error! Please add name here." +COM_EHEALTH_PORTAL_UNIT_NEW="A New Unit" +COM_EHEALTH_PORTAL_UNIT_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_UNIT_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_UNIT_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_UNIT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Unit to customise the alias." +COM_EHEALTH_PORTAL_UNIT_STATUS="Status" +COM_EHEALTH_PORTAL_UNIT_VERSION_DESC="A count of the number of times this Unit has been revised." +COM_EHEALTH_PORTAL_UNIT_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_USE_BATCH="Use Batch" +COM_EHEALTH_PORTAL_USE_BATCH_DESC="Allows users in this group to use batch copy/update method." +COM_EHEALTH_PORTAL_VERSION="Version" +COM_EHEALTH_PORTAL_VMMC="VMMC" +COM_EHEALTH_PORTAL_VMMCS="VMMCs" +COM_EHEALTH_PORTAL_VMMCS_ACCESS="Vmmcs Access" +COM_EHEALTH_PORTAL_VMMCS_ACCESS_DESC="Allows the users in this group to access access vmmcs" +COM_EHEALTH_PORTAL_VMMCS_BATCH_OPTIONS="Batch process the selected VMMCs" +COM_EHEALTH_PORTAL_VMMCS_BATCH_TIP="All changes will be applied to all selected VMMCs" +COM_EHEALTH_PORTAL_VMMCS_BATCH_USE="Vmmcs Batch Use" +COM_EHEALTH_PORTAL_VMMCS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch vmmcs" +COM_EHEALTH_PORTAL_VMMCS_DASHBOARD_ADD="Vmmcs Dashboard Add" +COM_EHEALTH_PORTAL_VMMCS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of vmmc" +COM_EHEALTH_PORTAL_VMMCS_DASHBOARD_LIST="Vmmcs Dashboard List" +COM_EHEALTH_PORTAL_VMMCS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of vmmc" +COM_EHEALTH_PORTAL_VMMCS_EDIT_VERSION="Vmmcs Edit Version" +COM_EHEALTH_PORTAL_VMMCS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version vmmcs" +COM_EHEALTH_PORTAL_VMMCS_EXPORT="Vmmcs Export" +COM_EHEALTH_PORTAL_VMMCS_EXPORT_DESC="Allows the users in this group to export export vmmcs" +COM_EHEALTH_PORTAL_VMMCS_IMPORT="Vmmcs Import" +COM_EHEALTH_PORTAL_VMMCS_IMPORT_DESC="Allows the users in this group to import import vmmcs" +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_ARCHIVED="%s VMMCs archived." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_ARCHIVED_1="%s VMMC archived." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_CHECKED_IN_0="No VMMC successfully checked in." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_CHECKED_IN_1="%d VMMC successfully checked in." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_CHECKED_IN_MORE="%d VMMCs successfully checked in." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_DELETED="%s VMMCs deleted." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_DELETED_1="%s VMMC deleted." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_FAILED_PUBLISHING="%s VMMCs failed publishing." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_FAILED_PUBLISHING_1="%s VMMC failed publishing." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_FEATURED="%s VMMCs featured." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_FEATURED_1="%s VMMC featured." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_PUBLISHED="%s VMMCs published." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_PUBLISHED_1="%s VMMC published." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_TRASHED="%s VMMCs trashed." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_TRASHED_1="%s VMMC trashed." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_UNFEATURED="%s VMMCs unfeatured." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_UNFEATURED_1="%s VMMC unfeatured." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_UNPUBLISHED="%s VMMCs unpublished." +COM_EHEALTH_PORTAL_VMMCS_N_ITEMS_UNPUBLISHED_1="%s VMMC unpublished." +COM_EHEALTH_PORTAL_VMMCS_SUBMENU="Vmmcs Submenu" +COM_EHEALTH_PORTAL_VMMCS_SUBMENU_DESC="Allows the users in this group to submenu of vmmc" +COM_EHEALTH_PORTAL_VMMC_ARE_YOU_CIRCUMCISED_DESCRIPTION="Are you circumcised?" +COM_EHEALTH_PORTAL_VMMC_ARE_YOU_CIRCUMCISED_LABEL="Are you circumcised?" +COM_EHEALTH_PORTAL_VMMC_CREATED_BY_DESC="The user that created this VMMC." +COM_EHEALTH_PORTAL_VMMC_CREATED_BY_LABEL="Created By" +COM_EHEALTH_PORTAL_VMMC_CREATED_DATE_DESC="The date this VMMC was created." +COM_EHEALTH_PORTAL_VMMC_CREATED_DATE_LABEL="Created Date" +COM_EHEALTH_PORTAL_VMMC_DETAILS="Details" +COM_EHEALTH_PORTAL_VMMC_EDIT="Editing the VMMC" +COM_EHEALTH_PORTAL_VMMC_ERROR_UNIQUE_ALIAS="Another VMMC has the same alias." +COM_EHEALTH_PORTAL_VMMC_FEMALE="Female" +COM_EHEALTH_PORTAL_VMMC_ID="Id" +COM_EHEALTH_PORTAL_VMMC_INFO_BEN_VMCC_DESCRIPTION="Provided with information on benefits of VMMC?" +COM_EHEALTH_PORTAL_VMMC_INFO_BEN_VMCC_LABEL="Provided with information on benefits of VMMC?" +COM_EHEALTH_PORTAL_VMMC_INTERESTED_IN_VMMC_DESCRIPTION="Are you interested in VMMC?" +COM_EHEALTH_PORTAL_VMMC_INTERESTED_IN_VMMC_LABEL="Are you interested in VMMC?" +COM_EHEALTH_PORTAL_VMMC_MALE="Male" +COM_EHEALTH_PORTAL_VMMC_MODIFIED_BY_DESC="The last user that modified this VMMC." +COM_EHEALTH_PORTAL_VMMC_MODIFIED_BY_LABEL="Modified By" +COM_EHEALTH_PORTAL_VMMC_MODIFIED_DATE_DESC="The date this VMMC was modified." +COM_EHEALTH_PORTAL_VMMC_MODIFIED_DATE_LABEL="Modified Date" +COM_EHEALTH_PORTAL_VMMC_NEW="A New VMMC" +COM_EHEALTH_PORTAL_VMMC_NO="No" +COM_EHEALTH_PORTAL_VMMC_ORDERING_LABEL="Ordering" +COM_EHEALTH_PORTAL_VMMC_PARTNER_CIRCUMCISED_DESCRIPTION="Is your partner circumcised?" +COM_EHEALTH_PORTAL_VMMC_PARTNER_CIRCUMCISED_LABEL="Is your partner circumcised?" +COM_EHEALTH_PORTAL_VMMC_PATIENT_LABEL="Patient Name" +COM_EHEALTH_PORTAL_VMMC_PERMISSION="Permissions" +COM_EHEALTH_PORTAL_VMMC_PUBLISHING="Publishing" +COM_EHEALTH_PORTAL_VMMC_REASON_DESCRIPTION="Add Reason Here" +COM_EHEALTH_PORTAL_VMMC_REASON_HINT="Add Reason Here" +COM_EHEALTH_PORTAL_VMMC_REASON_LABEL="Reason" +COM_EHEALTH_PORTAL_VMMC_REFERRALS="Referrals" +COM_EHEALTH_PORTAL_VMMC_REFERRAL_LABEL="Referred to" +COM_EHEALTH_PORTAL_VMMC_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the VMMC to customise the alias." +COM_EHEALTH_PORTAL_VMMC_STATUS="Status" +COM_EHEALTH_PORTAL_VMMC_VERSION_DESC="A count of the number of times this VMMC has been revised." +COM_EHEALTH_PORTAL_VMMC_VERSION_LABEL="Version" +COM_EHEALTH_PORTAL_VMMC_VMMC_GENDER_DESCRIPTION="Gender" +COM_EHEALTH_PORTAL_VMMC_VMMC_GENDER_LABEL="Gender" +COM_EHEALTH_PORTAL_VMMC_YES="Yes" +COM_EHEALTH_PORTAL_WEBSITE="Website" \ No newline at end of file diff --git a/admin/language/en-GB/en-GB.com_ehealth_portal.sys.ini b/admin/language/en-GB/en-GB.com_ehealth_portal.sys.ini new file mode 100644 index 0000000..6f59fb6 --- /dev/null +++ b/admin/language/en-GB/en-GB.com_ehealth_portal.sys.ini @@ -0,0 +1,549 @@ +COM_EHEALTH_PORTAL="eHealth Portal" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_ACCESS="Administration Parts Access" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_ACCESS_DESC="Allows the users in this group to access access administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_BATCH_USE="Administration Parts Batch Use" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_DESCRIPTION="Administration Parts Edit Description" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of administration part" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_NAME="Administration Parts Edit Name" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_NAME_DESC="Allows the users in this group to edit name of administration part" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_VERSION="Administration Parts Edit Version" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EXPORT="Administration Parts Export" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_EXPORT_DESC="Allows the users in this group to export export administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_IMPORT="Administration Parts Import" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_IMPORT_DESC="Allows the users in this group to import import administration parts" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_SUBMENU="Administration Parts Submenu" +COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_SUBMENU_DESC="Allows the users in this group to submenu of administration part" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_ACCESS="Antenatal Cares Access" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_ACCESS_DESC="Allows the users in this group to access access antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_BATCH_USE="Antenatal Cares Batch Use" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_DASHBOARD_ADD="Antenatal Cares Dashboard Add" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of antenatal care" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_DASHBOARD_LIST="Antenatal Cares Dashboard List" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of antenatal care" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_EDIT_VERSION="Antenatal Cares Edit Version" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_EXPORT="Antenatal Cares Export" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_EXPORT_DESC="Allows the users in this group to export export antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_IMPORT="Antenatal Cares Import" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_IMPORT_DESC="Allows the users in this group to import import antenatal cares" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_SUBMENU="Antenatal Cares Submenu" +COM_EHEALTH_PORTAL_ANTENATAL_CARES_SUBMENU_DESC="Allows the users in this group to submenu of antenatal care" +COM_EHEALTH_PORTAL_BREAST_CANCERS_ACCESS="Breast Cancers Access" +COM_EHEALTH_PORTAL_BREAST_CANCERS_ACCESS_DESC="Allows the users in this group to access access breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_BATCH_USE="Breast Cancers Batch Use" +COM_EHEALTH_PORTAL_BREAST_CANCERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_DASHBOARD_ADD="Breast Cancers Dashboard Add" +COM_EHEALTH_PORTAL_BREAST_CANCERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of breast cancer" +COM_EHEALTH_PORTAL_BREAST_CANCERS_DASHBOARD_LIST="Breast Cancers Dashboard List" +COM_EHEALTH_PORTAL_BREAST_CANCERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of breast cancer" +COM_EHEALTH_PORTAL_BREAST_CANCERS_EDIT_VERSION="Breast Cancers Edit Version" +COM_EHEALTH_PORTAL_BREAST_CANCERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_EXPORT="Breast Cancers Export" +COM_EHEALTH_PORTAL_BREAST_CANCERS_EXPORT_DESC="Allows the users in this group to export export breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_IMPORT="Breast Cancers Import" +COM_EHEALTH_PORTAL_BREAST_CANCERS_IMPORT_DESC="Allows the users in this group to import import breast cancers" +COM_EHEALTH_PORTAL_BREAST_CANCERS_SUBMENU="Breast Cancers Submenu" +COM_EHEALTH_PORTAL_BREAST_CANCERS_SUBMENU_DESC="Allows the users in this group to submenu of breast cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_ACCESS="Cervical Cancers Access" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_ACCESS_DESC="Allows the users in this group to access access cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_BATCH_USE="Cervical Cancers Batch Use" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_DASHBOARD_ADD="Cervical Cancers Dashboard Add" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of cervical cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_DASHBOARD_LIST="Cervical Cancers Dashboard List" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of cervical cancer" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_EDIT_VERSION="Cervical Cancers Edit Version" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_EXPORT="Cervical Cancers Export" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_EXPORT_DESC="Allows the users in this group to export export cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_IMPORT="Cervical Cancers Import" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_IMPORT_DESC="Allows the users in this group to import import cervical cancers" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_SUBMENU="Cervical Cancers Submenu" +COM_EHEALTH_PORTAL_CERVICAL_CANCERS_SUBMENU_DESC="Allows the users in this group to submenu of cervical cancer" +COM_EHEALTH_PORTAL_CLINICS_ACCESS="Clinics Access" +COM_EHEALTH_PORTAL_CLINICS_ACCESS_DESC="Allows the users in this group to access access clinics" +COM_EHEALTH_PORTAL_CLINICS_BATCH_USE="Clinics Batch Use" +COM_EHEALTH_PORTAL_CLINICS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch clinics" +COM_EHEALTH_PORTAL_CLINICS_EDIT_CLINIC_NAME="Clinics Edit Clinic Name" +COM_EHEALTH_PORTAL_CLINICS_EDIT_CLINIC_NAME_DESC="Allows the users in this group to edit clinic name of clinic" +COM_EHEALTH_PORTAL_CLINICS_EDIT_DESCRIPTION="Clinics Edit Description" +COM_EHEALTH_PORTAL_CLINICS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of clinic" +COM_EHEALTH_PORTAL_CLINICS_EDIT_VERSION="Clinics Edit Version" +COM_EHEALTH_PORTAL_CLINICS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version clinics" +COM_EHEALTH_PORTAL_CLINICS_EXPORT="Clinics Export" +COM_EHEALTH_PORTAL_CLINICS_EXPORT_DESC="Allows the users in this group to export export clinics" +COM_EHEALTH_PORTAL_CLINICS_IMPORT="Clinics Import" +COM_EHEALTH_PORTAL_CLINICS_IMPORT_DESC="Allows the users in this group to import import clinics" +COM_EHEALTH_PORTAL_CONFIGURATION="eHealth Portal Configuration" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_ACCESS="Counseling Types Access" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_ACCESS_DESC="Allows the users in this group to access access counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_BATCH_USE="Counseling Types Batch Use" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_DESCRIPTION="Counseling Types Edit Description" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of counseling type" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_NAME="Counseling Types Edit Name" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of counseling type" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_VERSION="Counseling Types Edit Version" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EXPORT="Counseling Types Export" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_EXPORT_DESC="Allows the users in this group to export export counseling types" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_IMPORT="Counseling Types Import" +COM_EHEALTH_PORTAL_COUNSELING_TYPES_IMPORT_DESC="Allows the users in this group to import import counseling types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_ACCESS="Diagnosis Types Access" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_ACCESS_DESC="Allows the users in this group to access access diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_BATCH_USE="Diagnosis Types Batch Use" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_DESCRIPTION="Diagnosis Types Edit Description" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of diagnosis type" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_NAME="Diagnosis Types Edit Name" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of diagnosis type" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_VERSION="Diagnosis Types Edit Version" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EXPORT="Diagnosis Types Export" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_EXPORT_DESC="Allows the users in this group to export export diagnosis types" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_IMPORT="Diagnosis Types Import" +COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_IMPORT_DESC="Allows the users in this group to import import diagnosis types" +COM_EHEALTH_PORTAL_EDIT_CREATED_BY="Edit Created By" +COM_EHEALTH_PORTAL_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by." +COM_EHEALTH_PORTAL_EDIT_CREATED_DATE="Edit Created Date" +COM_EHEALTH_PORTAL_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date." +COM_EHEALTH_PORTAL_EDIT_VERSIONS="Edit Version" +COM_EHEALTH_PORTAL_EDIT_VERSIONS_DESC="Allows users in this group to edit versions." +COM_EHEALTH_PORTAL_EXPORT_DATA="Export Data" +COM_EHEALTH_PORTAL_EXPORT_DATA_DESC="Allows users in this group to export data." +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_ACCESS="Family Plannings Access" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_ACCESS_DESC="Allows the users in this group to access access family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_BATCH_USE="Family Plannings Batch Use" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_DASHBOARD_ADD="Family Plannings Dashboard Add" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of family planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_DASHBOARD_LIST="Family Plannings Dashboard List" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of family planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EDIT_DIAGNOSIS="Family Plannings Edit Diagnosis" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EDIT_DIAGNOSIS_DESC="Allows the users in this group to edit diagnosis of family planning" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EDIT_VERSION="Family Plannings Edit Version" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EXPORT="Family Plannings Export" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_EXPORT_DESC="Allows the users in this group to export export family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_IMPORT="Family Plannings Import" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_IMPORT_DESC="Allows the users in this group to import import family plannings" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_SUBMENU="Family Plannings Submenu" +COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_SUBMENU_DESC="Allows the users in this group to submenu of family planning" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_ACCESS="Foetal Engagements Access" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_ACCESS_DESC="Allows the users in this group to access access foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_BATCH_USE="Foetal Engagements Batch Use" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_DESCRIPTION="Foetal Engagements Edit Description" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of foetal engagement" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_NAME="Foetal Engagements Edit Name" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_NAME_DESC="Allows the users in this group to edit name of foetal engagement" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_VERSION="Foetal Engagements Edit Version" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EXPORT="Foetal Engagements Export" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_EXPORT_DESC="Allows the users in this group to export export foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_IMPORT="Foetal Engagements Import" +COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_IMPORT_DESC="Allows the users in this group to import import foetal engagements" +COM_EHEALTH_PORTAL_FOETAL_LIES_ACCESS="Foetal Lies Access" +COM_EHEALTH_PORTAL_FOETAL_LIES_ACCESS_DESC="Allows the users in this group to access access foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_BATCH_USE="Foetal Lies Batch Use" +COM_EHEALTH_PORTAL_FOETAL_LIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_DESCRIPTION="Foetal Lies Edit Description" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of foetal lie" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_NAME="Foetal Lies Edit Name" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_NAME_DESC="Allows the users in this group to edit name of foetal lie" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_VERSION="Foetal Lies Edit Version" +COM_EHEALTH_PORTAL_FOETAL_LIES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_EXPORT="Foetal Lies Export" +COM_EHEALTH_PORTAL_FOETAL_LIES_EXPORT_DESC="Allows the users in this group to export export foetal lies" +COM_EHEALTH_PORTAL_FOETAL_LIES_IMPORT="Foetal Lies Import" +COM_EHEALTH_PORTAL_FOETAL_LIES_IMPORT_DESC="Allows the users in this group to import import foetal lies" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_ACCESS="Foetal Presentations Access" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_ACCESS_DESC="Allows the users in this group to access access foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_BATCH_USE="Foetal Presentations Batch Use" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_DESCRIPTION="Foetal Presentations Edit Description" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of foetal presentation" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_NAME="Foetal Presentations Edit Name" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_NAME_DESC="Allows the users in this group to edit name of foetal presentation" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_VERSION="Foetal Presentations Edit Version" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EXPORT="Foetal Presentations Export" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_EXPORT_DESC="Allows the users in this group to export export foetal presentations" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_IMPORT="Foetal Presentations Import" +COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_IMPORT_DESC="Allows the users in this group to import import foetal presentations" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_ACCESS="General Medical Check Ups Access" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_ACCESS_DESC="Allows the users in this group to access access general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_BATCH_USE="General Medical Check Ups Batch Use" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_DASHBOARD_ADD="General Medical Check Ups Dashboard Add" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of general medical check up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_DASHBOARD_LIST="General Medical Check Ups Dashboard List" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of general medical check up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EDIT_PATIENT="General Medical Check Ups Edit Patient" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EDIT_PATIENT_DESC="Allows the users in this group to edit patient of general medical check up" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EDIT_VERSION="General Medical Check Ups Edit Version" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EXPORT="General Medical Check Ups Export" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_EXPORT_DESC="Allows the users in this group to export export general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_IMPORT="General Medical Check Ups Import" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_IMPORT_DESC="Allows the users in this group to import import general medical check ups" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_SUBMENU="General Medical Check Ups Submenu" +COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_SUBMENU_DESC="Allows the users in this group to submenu of general medical check up" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_ACCESS="Health Educations Access" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_ACCESS_DESC="Allows the users in this group to access access health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_BATCH_USE="Health Educations Batch Use" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_DASHBOARD_ADD="Health Educations Dashboard Add" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of health education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_DASHBOARD_LIST="Health Educations Dashboard List" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of health education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EDIT_HEALTH_EDUCATION_TOPIC="Health Educations Edit Health Education Topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EDIT_HEALTH_EDUCATION_TOPIC_DESC="Allows the users in this group to edit health education topic of health education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EDIT_VERSION="Health Educations Edit Version" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EXPORT="Health Educations Export" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_EXPORT_DESC="Allows the users in this group to export export health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_IMPORT="Health Educations Import" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_IMPORT_DESC="Allows the users in this group to import import health educations" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_SUBMENU="Health Educations Submenu" +COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_SUBMENU_DESC="Allows the users in this group to submenu of health education" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_ACCESS="Health Education Topics Access" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_ACCESS_DESC="Allows the users in this group to access access health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_BATCH_USE="Health Education Topics Batch Use" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_DESCRIPTION="Health Education Topics Edit Description" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of health education topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_NAME="Health Education Topics Edit Name" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_NAME_DESC="Allows the users in this group to edit name of health education topic" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_VERSION="Health Education Topics Edit Version" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EXPORT="Health Education Topics Export" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_EXPORT_DESC="Allows the users in this group to export export health education topics" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_IMPORT="Health Education Topics Import" +COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_IMPORT_DESC="Allows the users in this group to import import health education topics" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_ACCESS="Hiv Counselings And Testings Access" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_ACCESS_DESC="Allows the users in this group to access access hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_BATCH_USE="Hiv Counselings And Testings Batch Use" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_DASHBOARD_ADD="Hiv Counselings And Testings Dashboard Add" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of hiv counseling and testing" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_DASHBOARD_LIST="Hiv Counselings And Testings Dashboard List" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of hiv counseling and testing" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_EDIT_VERSION="Hiv Counselings And Testings Edit Version" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_EXPORT="Hiv Counselings And Testings Export" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_EXPORT_DESC="Allows the users in this group to export export hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_IMPORT="Hiv Counselings And Testings Import" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_IMPORT_DESC="Allows the users in this group to import import hiv counselings and testings" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_SUBMENU="Hiv Counselings And Testings Submenu" +COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_SUBMENU_DESC="Allows the users in this group to submenu of hiv counseling and testing" +COM_EHEALTH_PORTAL_IMMUNISATIONS_ACCESS="Immunisations Access" +COM_EHEALTH_PORTAL_IMMUNISATIONS_ACCESS_DESC="Allows the users in this group to access access immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_BATCH_USE="Immunisations Batch Use" +COM_EHEALTH_PORTAL_IMMUNISATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_DASHBOARD_ADD="Immunisations Dashboard Add" +COM_EHEALTH_PORTAL_IMMUNISATIONS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of immunisation" +COM_EHEALTH_PORTAL_IMMUNISATIONS_DASHBOARD_LIST="Immunisations Dashboard List" +COM_EHEALTH_PORTAL_IMMUNISATIONS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of immunisation" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EDIT_PATIENT="Immunisations Edit Patient" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EDIT_PATIENT_DESC="Allows the users in this group to edit patient of immunisation" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EDIT_VERSION="Immunisations Edit Version" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EXPORT="Immunisations Export" +COM_EHEALTH_PORTAL_IMMUNISATIONS_EXPORT_DESC="Allows the users in this group to export export immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_IMPORT="Immunisations Import" +COM_EHEALTH_PORTAL_IMMUNISATIONS_IMPORT_DESC="Allows the users in this group to import import immunisations" +COM_EHEALTH_PORTAL_IMMUNISATIONS_SUBMENU="Immunisations Submenu" +COM_EHEALTH_PORTAL_IMMUNISATIONS_SUBMENU_DESC="Allows the users in this group to submenu of immunisation" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_ACCESS="Immunisation Types Access" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_ACCESS_DESC="Allows the users in this group to access access immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_BATCH_USE="Immunisation Types Batch Use" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_DESCRIPTION="Immunisation Types Edit Description" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of immunisation type" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_NAME="Immunisation Types Edit Name" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of immunisation type" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_VERSION="Immunisation Types Edit Version" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EXPORT="Immunisation Types Export" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_EXPORT_DESC="Allows the users in this group to export export immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_IMPORT="Immunisation Types Import" +COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_IMPORT_DESC="Allows the users in this group to import import immunisation types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_ACCESS="Immunisation Vaccine Types Access" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_ACCESS_DESC="Allows the users in this group to access access immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_BATCH_USE="Immunisation Vaccine Types Batch Use" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_DESCRIPTION="Immunisation Vaccine Types Edit Description" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of immunisation vaccine type" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_NAME="Immunisation Vaccine Types Edit Name" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of immunisation vaccine type" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_VERSION="Immunisation Vaccine Types Edit Version" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EXPORT="Immunisation Vaccine Types Export" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_EXPORT_DESC="Allows the users in this group to export export immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_IMPORT="Immunisation Vaccine Types Import" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_IMPORT_DESC="Allows the users in this group to import import immunisation vaccine types" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_SUBMENU="Immunisation Vaccine Types Submenu" +COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_SUBMENU_DESC="Allows the users in this group to submenu of immunisation vaccine type" +COM_EHEALTH_PORTAL_IMPORT_DATA="Import Data" +COM_EHEALTH_PORTAL_IMPORT_DATA_DESC="Allows users in this group to import data." +COM_EHEALTH_PORTAL_MEDICATIONS_ACCESS="Medications Access" +COM_EHEALTH_PORTAL_MEDICATIONS_ACCESS_DESC="Allows the users in this group to access access medications" +COM_EHEALTH_PORTAL_MEDICATIONS_BATCH_USE="Medications Batch Use" +COM_EHEALTH_PORTAL_MEDICATIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch medications" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_DESCRIPTION="Medications Edit Description" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of medication" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_NAME="Medications Edit Name" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_NAME_DESC="Allows the users in this group to edit name of medication" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_VERSION="Medications Edit Version" +COM_EHEALTH_PORTAL_MEDICATIONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version medications" +COM_EHEALTH_PORTAL_MEDICATIONS_EXPORT="Medications Export" +COM_EHEALTH_PORTAL_MEDICATIONS_EXPORT_DESC="Allows the users in this group to export export medications" +COM_EHEALTH_PORTAL_MEDICATIONS_IMPORT="Medications Import" +COM_EHEALTH_PORTAL_MEDICATIONS_IMPORT_DESC="Allows the users in this group to import import medications" +COM_EHEALTH_PORTAL_MEDICATIONS_SUBMENU="Medications Submenu" +COM_EHEALTH_PORTAL_MEDICATIONS_SUBMENU_DESC="Allows the users in this group to submenu of medication" +COM_EHEALTH_PORTAL_MENU="» eHealth Portal" +COM_EHEALTH_PORTAL_MENU_ANTENATAL_CARES="Antenatal Cares" +COM_EHEALTH_PORTAL_MENU_BREAST_CANCERS="Breast Cancers" +COM_EHEALTH_PORTAL_MENU_CERVICAL_CANCERS="Cervical Cancers" +COM_EHEALTH_PORTAL_MENU_FAMILY_PLANNINGS="Family Plannings" +COM_EHEALTH_PORTAL_MENU_GENERAL_MEDICAL_CHECK_UPS="General Medical Check Ups" +COM_EHEALTH_PORTAL_MENU_HEALTH_EDUCATIONS="Health Educations" +COM_EHEALTH_PORTAL_MENU_HIV_COUNSELINGS_AND_TESTINGS="HIV Counselings and Testings" +COM_EHEALTH_PORTAL_MENU_IMMUNISATIONS="Immunisations" +COM_EHEALTH_PORTAL_MENU_PATIENT_QUEUE="Patient Queue" +COM_EHEALTH_PORTAL_MENU_PAYMENTS="Payments" +COM_EHEALTH_PORTAL_MENU_PROSTATE_AND_TESTICULAR_CANCERS="Prostate and Testicular Cancers" +COM_EHEALTH_PORTAL_MENU_TESTS="Tests" +COM_EHEALTH_PORTAL_MENU_TUBERCULOSES="Tuberculoses" +COM_EHEALTH_PORTAL_MENU_VMMCS="VMMCs" +COM_EHEALTH_PORTAL_NONPAY_REASONS_ACCESS="Nonpay Reasons Access" +COM_EHEALTH_PORTAL_NONPAY_REASONS_ACCESS_DESC="Allows the users in this group to access access nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_BATCH_USE="Nonpay Reasons Batch Use" +COM_EHEALTH_PORTAL_NONPAY_REASONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_DESCRIPTION="Nonpay Reasons Edit Description" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of nonpay reason" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_NAME="Nonpay Reasons Edit Name" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_NAME_DESC="Allows the users in this group to edit name of nonpay reason" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_VERSION="Nonpay Reasons Edit Version" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EXPORT="Nonpay Reasons Export" +COM_EHEALTH_PORTAL_NONPAY_REASONS_EXPORT_DESC="Allows the users in this group to export export nonpay reasons" +COM_EHEALTH_PORTAL_NONPAY_REASONS_IMPORT="Nonpay Reasons Import" +COM_EHEALTH_PORTAL_NONPAY_REASONS_IMPORT_DESC="Allows the users in this group to import import nonpay reasons" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_ACCESS="Patient Queue Access" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_ACCESS_DESC="Allows the users in this group to access patient queue." +COM_EHEALTH_PORTAL_PATIENT_QUEUE_DASHBOARD_LIST="Patient Queue Dashboard List" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of Patient Queue" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_SUBMENU="Patient Queue Submenu" +COM_EHEALTH_PORTAL_PATIENT_QUEUE_SUBMENU_DESC="Allows the users in this group to submenu of Patient Queue" +COM_EHEALTH_PORTAL_PAYMENTS_ACCESS="Payments Access" +COM_EHEALTH_PORTAL_PAYMENTS_ACCESS_DESC="Allows the users in this group to access access payments" +COM_EHEALTH_PORTAL_PAYMENTS_BATCH_USE="Payments Batch Use" +COM_EHEALTH_PORTAL_PAYMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch payments" +COM_EHEALTH_PORTAL_PAYMENTS_DASHBOARD_ADD="Payments Dashboard Add" +COM_EHEALTH_PORTAL_PAYMENTS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of payment" +COM_EHEALTH_PORTAL_PAYMENTS_DASHBOARD_LIST="Payments Dashboard List" +COM_EHEALTH_PORTAL_PAYMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of payment" +COM_EHEALTH_PORTAL_PAYMENTS_EDIT_PATIENT="Payments Edit Patient" +COM_EHEALTH_PORTAL_PAYMENTS_EDIT_PATIENT_DESC="Allows the users in this group to edit patient of payment" +COM_EHEALTH_PORTAL_PAYMENTS_EDIT_VERSION="Payments Edit Version" +COM_EHEALTH_PORTAL_PAYMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version payments" +COM_EHEALTH_PORTAL_PAYMENTS_EXPORT="Payments Export" +COM_EHEALTH_PORTAL_PAYMENTS_EXPORT_DESC="Allows the users in this group to export export payments" +COM_EHEALTH_PORTAL_PAYMENTS_IMPORT="Payments Import" +COM_EHEALTH_PORTAL_PAYMENTS_IMPORT_DESC="Allows the users in this group to import import payments" +COM_EHEALTH_PORTAL_PAYMENTS_SUBMENU="Payments Submenu" +COM_EHEALTH_PORTAL_PAYMENTS_SUBMENU_DESC="Allows the users in this group to submenu of payment" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_ACCESS="Payment Amounts Access" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_ACCESS_DESC="Allows the users in this group to access access payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_BATCH_USE="Payment Amounts Batch Use" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_DESCRIPTION="Payment Amounts Edit Description" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of payment amount" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_NAME="Payment Amounts Edit Name" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_NAME_DESC="Allows the users in this group to edit name of payment amount" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_VERSION="Payment Amounts Edit Version" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EXPORT="Payment Amounts Export" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_EXPORT_DESC="Allows the users in this group to export export payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_IMPORT="Payment Amounts Import" +COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_IMPORT_DESC="Allows the users in this group to import import payment amounts" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_ACCESS="Payment Types Access" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_ACCESS_DESC="Allows the users in this group to access access payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_BATCH_USE="Payment Types Batch Use" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_DESCRIPTION="Payment Types Edit Description" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of payment type" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_NAME="Payment Types Edit Name" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of payment type" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_VERSION="Payment Types Edit Version" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EXPORT="Payment Types Export" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_EXPORT_DESC="Allows the users in this group to export export payment types" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_IMPORT="Payment Types Import" +COM_EHEALTH_PORTAL_PAYMENT_TYPES_IMPORT_DESC="Allows the users in this group to import import payment types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_ACCESS="Planning Types Access" +COM_EHEALTH_PORTAL_PLANNING_TYPES_ACCESS_DESC="Allows the users in this group to access access planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_BATCH_USE="Planning Types Batch Use" +COM_EHEALTH_PORTAL_PLANNING_TYPES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_DESCRIPTION="Planning Types Edit Description" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of planning type" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_NAME="Planning Types Edit Name" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of planning type" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_VERSION="Planning Types Edit Version" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EXPORT="Planning Types Export" +COM_EHEALTH_PORTAL_PLANNING_TYPES_EXPORT_DESC="Allows the users in this group to export export planning types" +COM_EHEALTH_PORTAL_PLANNING_TYPES_IMPORT="Planning Types Import" +COM_EHEALTH_PORTAL_PLANNING_TYPES_IMPORT_DESC="Allows the users in this group to import import planning types" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_ACCESS="Prostate And Testicular Cancers Access" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_ACCESS_DESC="Allows the users in this group to access access prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_BATCH_USE="Prostate And Testicular Cancers Batch Use" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_DASHBOARD_ADD="Prostate And Testicular Cancers Dashboard Add" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of prostate and testicular cancer" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_DASHBOARD_LIST="Prostate And Testicular Cancers Dashboard List" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of prostate and testicular cancer" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_EDIT_VERSION="Prostate And Testicular Cancers Edit Version" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_EXPORT="Prostate And Testicular Cancers Export" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_EXPORT_DESC="Allows the users in this group to export export prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_IMPORT="Prostate And Testicular Cancers Import" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_IMPORT_DESC="Allows the users in this group to import import prostate and testicular cancers" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_SUBMENU="Prostate And Testicular Cancers Submenu" +COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_SUBMENU_DESC="Allows the users in this group to submenu of prostate and testicular cancer" +COM_EHEALTH_PORTAL_REFERRALS_ACCESS="Referrals Access" +COM_EHEALTH_PORTAL_REFERRALS_ACCESS_DESC="Allows the users in this group to access access referrals" +COM_EHEALTH_PORTAL_REFERRALS_BATCH_USE="Referrals Batch Use" +COM_EHEALTH_PORTAL_REFERRALS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch referrals" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_DESCRIPTION="Referrals Edit Description" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of referral" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_NAME="Referrals Edit Name" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_NAME_DESC="Allows the users in this group to edit name of referral" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_VERSION="Referrals Edit Version" +COM_EHEALTH_PORTAL_REFERRALS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version referrals" +COM_EHEALTH_PORTAL_REFERRALS_EXPORT="Referrals Export" +COM_EHEALTH_PORTAL_REFERRALS_EXPORT_DESC="Allows the users in this group to export export referrals" +COM_EHEALTH_PORTAL_REFERRALS_IMPORT="Referrals Import" +COM_EHEALTH_PORTAL_REFERRALS_IMPORT_DESC="Allows the users in this group to import import referrals" +COM_EHEALTH_PORTAL_REFERRALS_SUBMENU="Referrals Submenu" +COM_EHEALTH_PORTAL_REFERRALS_SUBMENU_DESC="Allows the users in this group to submenu of referral" +COM_EHEALTH_PORTAL_SITES_ACCESS="Sites Access" +COM_EHEALTH_PORTAL_SITES_ACCESS_DESC="Allows the users in this group to access access sites" +COM_EHEALTH_PORTAL_SITES_BATCH_USE="Sites Batch Use" +COM_EHEALTH_PORTAL_SITES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch sites" +COM_EHEALTH_PORTAL_SITES_EDIT_DESCRIPTION="Sites Edit Description" +COM_EHEALTH_PORTAL_SITES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of site" +COM_EHEALTH_PORTAL_SITES_EDIT_SITE_NAME="Sites Edit Site Name" +COM_EHEALTH_PORTAL_SITES_EDIT_SITE_NAME_DESC="Allows the users in this group to edit site name of site" +COM_EHEALTH_PORTAL_SITES_EDIT_SITE_REGION="Sites Edit Site Region" +COM_EHEALTH_PORTAL_SITES_EDIT_SITE_REGION_DESC="Allows the users in this group to edit site region of site" +COM_EHEALTH_PORTAL_SITES_EDIT_VERSION="Sites Edit Version" +COM_EHEALTH_PORTAL_SITES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version sites" +COM_EHEALTH_PORTAL_SITES_EXPORT="Sites Export" +COM_EHEALTH_PORTAL_SITES_EXPORT_DESC="Allows the users in this group to export export sites" +COM_EHEALTH_PORTAL_SITES_IMPORT="Sites Import" +COM_EHEALTH_PORTAL_SITES_IMPORT_DESC="Allows the users in this group to import import sites" +COM_EHEALTH_PORTAL_STRENGTHS_ACCESS="Strengths Access" +COM_EHEALTH_PORTAL_STRENGTHS_ACCESS_DESC="Allows the users in this group to access access strengths" +COM_EHEALTH_PORTAL_STRENGTHS_BATCH_USE="Strengths Batch Use" +COM_EHEALTH_PORTAL_STRENGTHS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch strengths" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_DESCRIPTION="Strengths Edit Description" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of strength" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_NAME="Strengths Edit Name" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_NAME_DESC="Allows the users in this group to edit name of strength" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_VERSION="Strengths Edit Version" +COM_EHEALTH_PORTAL_STRENGTHS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version strengths" +COM_EHEALTH_PORTAL_STRENGTHS_EXPORT="Strengths Export" +COM_EHEALTH_PORTAL_STRENGTHS_EXPORT_DESC="Allows the users in this group to export export strengths" +COM_EHEALTH_PORTAL_STRENGTHS_IMPORT="Strengths Import" +COM_EHEALTH_PORTAL_STRENGTHS_IMPORT_DESC="Allows the users in this group to import import strengths" +COM_EHEALTH_PORTAL_STRENGTHS_SUBMENU="Strengths Submenu" +COM_EHEALTH_PORTAL_STRENGTHS_SUBMENU_DESC="Allows the users in this group to submenu of strength" +COM_EHEALTH_PORTAL_TESTING_REASONS_ACCESS="Testing Reasons Access" +COM_EHEALTH_PORTAL_TESTING_REASONS_ACCESS_DESC="Allows the users in this group to access access testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_BATCH_USE="Testing Reasons Batch Use" +COM_EHEALTH_PORTAL_TESTING_REASONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_DESCRIPTION="Testing Reasons Edit Description" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of testing reason" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_NAME="Testing Reasons Edit Name" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_NAME_DESC="Allows the users in this group to edit name of testing reason" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_VERSION="Testing Reasons Edit Version" +COM_EHEALTH_PORTAL_TESTING_REASONS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_EXPORT="Testing Reasons Export" +COM_EHEALTH_PORTAL_TESTING_REASONS_EXPORT_DESC="Allows the users in this group to export export testing reasons" +COM_EHEALTH_PORTAL_TESTING_REASONS_IMPORT="Testing Reasons Import" +COM_EHEALTH_PORTAL_TESTING_REASONS_IMPORT_DESC="Allows the users in this group to import import testing reasons" +COM_EHEALTH_PORTAL_TESTS_ACCESS="Tests Access" +COM_EHEALTH_PORTAL_TESTS_ACCESS_DESC="Allows the users in this group to access access tests" +COM_EHEALTH_PORTAL_TESTS_BATCH_USE="Tests Batch Use" +COM_EHEALTH_PORTAL_TESTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch tests" +COM_EHEALTH_PORTAL_TESTS_DASHBOARD_ADD="Tests Dashboard Add" +COM_EHEALTH_PORTAL_TESTS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of test" +COM_EHEALTH_PORTAL_TESTS_DASHBOARD_LIST="Tests Dashboard List" +COM_EHEALTH_PORTAL_TESTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of test" +COM_EHEALTH_PORTAL_TESTS_EDIT_VERSION="Tests Edit Version" +COM_EHEALTH_PORTAL_TESTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version tests" +COM_EHEALTH_PORTAL_TESTS_EXPORT="Tests Export" +COM_EHEALTH_PORTAL_TESTS_EXPORT_DESC="Allows the users in this group to export export tests" +COM_EHEALTH_PORTAL_TESTS_IMPORT="Tests Import" +COM_EHEALTH_PORTAL_TESTS_IMPORT_DESC="Allows the users in this group to import import tests" +COM_EHEALTH_PORTAL_TESTS_SUBMENU="Tests Submenu" +COM_EHEALTH_PORTAL_TESTS_SUBMENU_DESC="Allows the users in this group to submenu of test" +COM_EHEALTH_PORTAL_TUBERCULOSES_ACCESS="Tuberculoses Access" +COM_EHEALTH_PORTAL_TUBERCULOSES_ACCESS_DESC="Allows the users in this group to access access tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_BATCH_USE="Tuberculoses Batch Use" +COM_EHEALTH_PORTAL_TUBERCULOSES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_DASHBOARD_ADD="Tuberculoses Dashboard Add" +COM_EHEALTH_PORTAL_TUBERCULOSES_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSES_DASHBOARD_LIST="Tuberculoses Dashboard List" +COM_EHEALTH_PORTAL_TUBERCULOSES_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSES_EDIT_PATIENT="Tuberculoses Edit Patient" +COM_EHEALTH_PORTAL_TUBERCULOSES_EDIT_PATIENT_DESC="Allows the users in this group to edit patient of tuberculosis" +COM_EHEALTH_PORTAL_TUBERCULOSES_EDIT_VERSION="Tuberculoses Edit Version" +COM_EHEALTH_PORTAL_TUBERCULOSES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_EXPORT="Tuberculoses Export" +COM_EHEALTH_PORTAL_TUBERCULOSES_EXPORT_DESC="Allows the users in this group to export export tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_IMPORT="Tuberculoses Import" +COM_EHEALTH_PORTAL_TUBERCULOSES_IMPORT_DESC="Allows the users in this group to import import tuberculoses" +COM_EHEALTH_PORTAL_TUBERCULOSES_SUBMENU="Tuberculoses Submenu" +COM_EHEALTH_PORTAL_TUBERCULOSES_SUBMENU_DESC="Allows the users in this group to submenu of tuberculosis" +COM_EHEALTH_PORTAL_UNITS_ACCESS="Units Access" +COM_EHEALTH_PORTAL_UNITS_ACCESS_DESC="Allows the users in this group to access access units" +COM_EHEALTH_PORTAL_UNITS_BATCH_USE="Units Batch Use" +COM_EHEALTH_PORTAL_UNITS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch units" +COM_EHEALTH_PORTAL_UNITS_EDIT_DESCRIPTION="Units Edit Description" +COM_EHEALTH_PORTAL_UNITS_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of unit" +COM_EHEALTH_PORTAL_UNITS_EDIT_NAME="Units Edit Name" +COM_EHEALTH_PORTAL_UNITS_EDIT_NAME_DESC="Allows the users in this group to edit name of unit" +COM_EHEALTH_PORTAL_UNITS_EDIT_VERSION="Units Edit Version" +COM_EHEALTH_PORTAL_UNITS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version units" +COM_EHEALTH_PORTAL_UNITS_EXPORT="Units Export" +COM_EHEALTH_PORTAL_UNITS_EXPORT_DESC="Allows the users in this group to export export units" +COM_EHEALTH_PORTAL_UNITS_IMPORT="Units Import" +COM_EHEALTH_PORTAL_UNITS_IMPORT_DESC="Allows the users in this group to import import units" +COM_EHEALTH_PORTAL_UNITS_SUBMENU="Units Submenu" +COM_EHEALTH_PORTAL_UNITS_SUBMENU_DESC="Allows the users in this group to submenu of unit" +COM_EHEALTH_PORTAL_USE_BATCH="Use Batch" +COM_EHEALTH_PORTAL_USE_BATCH_DESC="Allows users in this group to use batch copy/update method." +COM_EHEALTH_PORTAL_VMMCS_ACCESS="Vmmcs Access" +COM_EHEALTH_PORTAL_VMMCS_ACCESS_DESC="Allows the users in this group to access access vmmcs" +COM_EHEALTH_PORTAL_VMMCS_BATCH_USE="Vmmcs Batch Use" +COM_EHEALTH_PORTAL_VMMCS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch vmmcs" +COM_EHEALTH_PORTAL_VMMCS_DASHBOARD_ADD="Vmmcs Dashboard Add" +COM_EHEALTH_PORTAL_VMMCS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of vmmc" +COM_EHEALTH_PORTAL_VMMCS_DASHBOARD_LIST="Vmmcs Dashboard List" +COM_EHEALTH_PORTAL_VMMCS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of vmmc" +COM_EHEALTH_PORTAL_VMMCS_EDIT_VERSION="Vmmcs Edit Version" +COM_EHEALTH_PORTAL_VMMCS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version vmmcs" +COM_EHEALTH_PORTAL_VMMCS_EXPORT="Vmmcs Export" +COM_EHEALTH_PORTAL_VMMCS_EXPORT_DESC="Allows the users in this group to export export vmmcs" +COM_EHEALTH_PORTAL_VMMCS_IMPORT="Vmmcs Import" +COM_EHEALTH_PORTAL_VMMCS_IMPORT_DESC="Allows the users in this group to import import vmmcs" +COM_EHEALTH_PORTAL_VMMCS_SUBMENU="Vmmcs Submenu" +COM_EHEALTH_PORTAL_VMMCS_SUBMENU_DESC="Allows the users in this group to submenu of vmmc" \ No newline at end of file diff --git a/admin/language/en-GB/index.html b/admin/language/en-GB/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/language/en-GB/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/language/index.html b/admin/language/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/language/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/administration_part/details_above.php b/admin/layouts/administration_part/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/administration_part/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/administration_part/details_fullwidth.php b/admin/layouts/administration_part/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/administration_part/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/administration_part/index.html b/admin/layouts/administration_part/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/administration_part/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/administration_part/publishing.php b/admin/layouts/administration_part/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/administration_part/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/administration_part/publlshing.php b/admin/layouts/administration_part/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/administration_part/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/administration_part/vaccines_fullwidth.php b/admin/layouts/administration_part/vaccines_fullwidth.php new file mode 100644 index 0000000..c0c14da --- /dev/null +++ b/admin/layouts/administration_part/vaccines_fullwidth.php @@ -0,0 +1,150 @@ + + @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'); + +// set the defaults +$items = $displayData->vvyvaccines; +$user = JFactory::getUser(); +$id = $displayData->item->id; +// set the edit URL +$edit = "index.php?option=com_ehealth_portal&view=immunisation_vaccine_types&task=immunisation_vaccine_type.edit"; +// set a return value +$return = ($id) ? "index.php?option=com_ehealth_portal&view=administration_part&layout=edit&id=" . $id : ""; +// check for a return value +$jinput = JFactory::getApplication()->input; +if ($_return = $jinput->get('return', null, 'base64')) +{ + $return .= "&return=" . $_return; +} +// check if return value was set +if (Ehealth_portalHelper::checkString($return)) +{ + // set the referral values + $ref = ($id) ? "&ref=administration_part&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return)); +} +else +{ + $ref = ($id) ? "&ref=administration_part&refid=" . $id : ""; +} +// set the create new URL +$new = "index.php?option=com_ehealth_portal&view=immunisation_vaccine_types&task=immunisation_vaccine_type.edit" . $ref; +// set the create new and close URL +$close_new = "index.php?option=com_ehealth_portal&view=immunisation_vaccine_types&task=immunisation_vaccine_type.edit"; +// load the action object +$can = Ehealth_portalHelper::getActions('immunisation_vaccine_type'); + +?> +
+get('core.create')): ?> +
+ + +


+ + + + + + + + + + + + + + $item): ?> + authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('immunisation_vaccine_type',$item,'immunisation_vaccine_types'); + ?> + + + + + published == 1): ?> + + published == 0): ?> + + published == 2): ?> + + published == -2): ?> + + + + + + +
+ + + + + + + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'immunisation_vaccine_types.', $canCheckin); ?> + + + escape($item->name); ?> + + + escape($item->administration_part_name); ?> + + escape($item->description); ?> + + + + + + + + + + + + + + + + + + id; ?> +
+ +
+ +
+ +
diff --git a/admin/layouts/antenatal_care/abdominal_examination_left.php b/admin/layouts/antenatal_care/abdominal_examination_left.php new file mode 100644 index 0000000..b5c6ba7 --- /dev/null +++ b/admin/layouts/antenatal_care/abdominal_examination_left.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'foetal_lie', + 'foetal_presentation', + 'foetal_engagement', + 'foetal_heart_rate' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/antenatal_care/index.html b/admin/layouts/antenatal_care/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/antenatal_care/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/antenatal_care/pregnancy_history_above.php b/admin/layouts/antenatal_care/pregnancy_history_above.php new file mode 100644 index 0000000..88c640b --- /dev/null +++ b/admin/layouts/antenatal_care/pregnancy_history_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/antenatal_care/pregnancy_history_fullwidth.php b/admin/layouts/antenatal_care/pregnancy_history_fullwidth.php new file mode 100644 index 0000000..b0e442f --- /dev/null +++ b/admin/layouts/antenatal_care/pregnancy_history_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'foetal_movements' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/antenatal_care/pregnancy_history_left.php b/admin/layouts/antenatal_care/pregnancy_history_left.php new file mode 100644 index 0000000..1437b3d --- /dev/null +++ b/admin/layouts/antenatal_care/pregnancy_history_left.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'pregnancies_excl', + 'live_births', + 'miscarriages', + 'still_births' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/antenatal_care/pregnancy_history_right.php b/admin/layouts/antenatal_care/pregnancy_history_right.php new file mode 100644 index 0000000..baedd79 --- /dev/null +++ b/admin/layouts/antenatal_care/pregnancy_history_right.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'normal_births', + 'caesarean_sections', + 'last_menstrual_period' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/antenatal_care/publishing.php b/admin/layouts/antenatal_care/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/antenatal_care/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/antenatal_care/publlshing.php b/admin/layouts/antenatal_care/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/antenatal_care/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php new file mode 100644 index 0000000..ef144cb --- /dev/null +++ b/admin/layouts/batchselection.php @@ -0,0 +1,62 @@ + + @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('JPATH_BASE') or die; + +JHtmlBehavior::core(); +$divWrapper = range(1,120,2); +$counter = 0; +?> +ListSelection) : ?> +
+ ListSelection as $ListSelection) : ?> +
+
+ + +
+
+ +
+
+ + + +
+
+
+ + +
+
+ \ No newline at end of file diff --git a/admin/layouts/breast_cancer/breast_examination_left.php b/admin/layouts/breast_cancer/breast_examination_left.php new file mode 100644 index 0000000..4d4fc43 --- /dev/null +++ b/admin/layouts/breast_cancer/breast_examination_left.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'bc_lump_near_breast', + 'txt_bc_lump_near_breast', + 'bc_inward_nipple', + 'txt_bc_inward_nipple', + 'bc_dimpling', + 'txt_bc_dimpling' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/breast_cancer/breast_examination_right.php b/admin/layouts/breast_cancer/breast_examination_right.php new file mode 100644 index 0000000..f5d9680 --- /dev/null +++ b/admin/layouts/breast_cancer/breast_examination_right.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'bc_nipple_discharge', + 'txt_bc_nipple_discharge', + 'bc_abnormal_skin', + 'txt_bc_abnormal_skin', + 'bc_breast_shape', + 'txt_bc_breast_shape' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/breast_cancer/index.html b/admin/layouts/breast_cancer/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/breast_cancer/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/breast_cancer/publishing.php b/admin/layouts/breast_cancer/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/breast_cancer/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/breast_cancer/publlshing.php b/admin/layouts/breast_cancer/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/breast_cancer/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/breast_cancer/referrals_left.php b/admin/layouts/breast_cancer/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/breast_cancer/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/breast_cancer/referrals_right.php b/admin/layouts/breast_cancer/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/breast_cancer/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/breast_cancer/risk_assesment_above.php b/admin/layouts/breast_cancer/risk_assesment_above.php new file mode 100644 index 0000000..0f2a95f --- /dev/null +++ b/admin/layouts/breast_cancer/risk_assesment_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/breast_cancer/risk_assesment_left.php b/admin/layouts/breast_cancer/risk_assesment_left.php new file mode 100644 index 0000000..c8d29c7 --- /dev/null +++ b/admin/layouts/breast_cancer/risk_assesment_left.php @@ -0,0 +1,64 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'bc_age_range', + 'bc_family_history', + 'bc_race', + 'bc_breastfeeding', + 'bc_preg_freq', + 'bc_preg_age', + 'bc_history_hrt', + 'bc_reg_exercise', + 'bc_overweight' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/cervical_cancer/cervical_examination_left.php b/admin/layouts/cervical_cancer/cervical_examination_left.php new file mode 100644 index 0000000..c89696c --- /dev/null +++ b/admin/layouts/cervical_cancer/cervical_examination_left.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'pap_smear_collection', + 'cc_reason', + 'cc_result' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/cervical_cancer/index.html b/admin/layouts/cervical_cancer/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/cervical_cancer/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/cervical_cancer/publishing.php b/admin/layouts/cervical_cancer/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/cervical_cancer/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/cervical_cancer/publlshing.php b/admin/layouts/cervical_cancer/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/cervical_cancer/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/cervical_cancer/referrals_left.php b/admin/layouts/cervical_cancer/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/cervical_cancer/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/cervical_cancer/referrals_right.php b/admin/layouts/cervical_cancer/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/cervical_cancer/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/cervical_cancer/risk_assesment_above.php b/admin/layouts/cervical_cancer/risk_assesment_above.php new file mode 100644 index 0000000..0f2a95f --- /dev/null +++ b/admin/layouts/cervical_cancer/risk_assesment_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/cervical_cancer/risk_assesment_left.php b/admin/layouts/cervical_cancer/risk_assesment_left.php new file mode 100644 index 0000000..7c906ce --- /dev/null +++ b/admin/layouts/cervical_cancer/risk_assesment_left.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'cc_viginal_bleeding', + 'txt_cc_viginal_bleeding', + 'cc_v_discharge', + 'txt_cc_v_discharge', + 'cc_periods', + 'txt_cc_periods' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/cervical_cancer/risk_assesment_right.php b/admin/layouts/cervical_cancer/risk_assesment_right.php new file mode 100644 index 0000000..b0581f4 --- /dev/null +++ b/admin/layouts/cervical_cancer/risk_assesment_right.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'cc_smoking', + 'txt_cc_smoking', + 'cc_sex_actve', + 'txt_cc_sex_actve', + 'cc_sex_partner', + 'txt_cc_sex_partner' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/clinic/details_above.php b/admin/layouts/clinic/details_above.php new file mode 100644 index 0000000..9230e4c --- /dev/null +++ b/admin/layouts/clinic/details_above.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'clinic_name', + 'alias', + 'clinic_type' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/clinic/details_fullwidth.php b/admin/layouts/clinic/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/clinic/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/clinic/index.html b/admin/layouts/clinic/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/clinic/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/clinic/publishing.php b/admin/layouts/clinic/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/clinic/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/clinic/publlshing.php b/admin/layouts/clinic/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/clinic/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/counseling_type/details_above.php b/admin/layouts/counseling_type/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/counseling_type/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/counseling_type/details_fullwidth.php b/admin/layouts/counseling_type/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/counseling_type/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/counseling_type/index.html b/admin/layouts/counseling_type/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/counseling_type/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/counseling_type/publishing.php b/admin/layouts/counseling_type/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/counseling_type/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/counseling_type/publlshing.php b/admin/layouts/counseling_type/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/counseling_type/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/diagnosis_type/details_above.php b/admin/layouts/diagnosis_type/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/diagnosis_type/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/diagnosis_type/details_fullwidth.php b/admin/layouts/diagnosis_type/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/diagnosis_type/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/diagnosis_type/index.html b/admin/layouts/diagnosis_type/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/diagnosis_type/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/diagnosis_type/publishing.php b/admin/layouts/diagnosis_type/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/diagnosis_type/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/diagnosis_type/publlshing.php b/admin/layouts/diagnosis_type/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/diagnosis_type/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/family_planning/details_above.php b/admin/layouts/family_planning/details_above.php new file mode 100644 index 0000000..5b2dd4f --- /dev/null +++ b/admin/layouts/family_planning/details_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/family_planning/details_left.php b/admin/layouts/family_planning/details_left.php new file mode 100644 index 0000000..c5ada16 --- /dev/null +++ b/admin/layouts/family_planning/details_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'diagnosis' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/family_planning/index.html b/admin/layouts/family_planning/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/family_planning/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/family_planning/publishing.php b/admin/layouts/family_planning/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/family_planning/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/family_planning/publlshing.php b/admin/layouts/family_planning/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/family_planning/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/foetal_engagement/details_above.php b/admin/layouts/foetal_engagement/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/foetal_engagement/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/foetal_engagement/details_fullwidth.php b/admin/layouts/foetal_engagement/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/foetal_engagement/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/foetal_engagement/index.html b/admin/layouts/foetal_engagement/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/foetal_engagement/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/foetal_engagement/publishing.php b/admin/layouts/foetal_engagement/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/foetal_engagement/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/foetal_engagement/publlshing.php b/admin/layouts/foetal_engagement/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/foetal_engagement/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/foetal_lie/details_above.php b/admin/layouts/foetal_lie/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/foetal_lie/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/foetal_lie/details_fullwidth.php b/admin/layouts/foetal_lie/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/foetal_lie/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/foetal_lie/index.html b/admin/layouts/foetal_lie/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/foetal_lie/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/foetal_lie/publishing.php b/admin/layouts/foetal_lie/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/foetal_lie/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/foetal_lie/publlshing.php b/admin/layouts/foetal_lie/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/foetal_lie/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/foetal_presentation/details_above.php b/admin/layouts/foetal_presentation/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/foetal_presentation/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/foetal_presentation/details_fullwidth.php b/admin/layouts/foetal_presentation/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/foetal_presentation/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/foetal_presentation/index.html b/admin/layouts/foetal_presentation/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/foetal_presentation/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/foetal_presentation/publishing.php b/admin/layouts/foetal_presentation/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/foetal_presentation/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/foetal_presentation/publlshing.php b/admin/layouts/foetal_presentation/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/foetal_presentation/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/general_medical_check_up/diagnosis_fullwidth.php b/admin/layouts/general_medical_check_up/diagnosis_fullwidth.php new file mode 100644 index 0000000..fbe6ac8 --- /dev/null +++ b/admin/layouts/general_medical_check_up/diagnosis_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'diagnosis' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/general_medical_check_up/dispensing_fullwidth.php b/admin/layouts/general_medical_check_up/dispensing_fullwidth.php new file mode 100644 index 0000000..9ea417e --- /dev/null +++ b/admin/layouts/general_medical_check_up/dispensing_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'dispensing' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/general_medical_check_up/index.html b/admin/layouts/general_medical_check_up/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/general_medical_check_up/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/general_medical_check_up/publishing.php b/admin/layouts/general_medical_check_up/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/general_medical_check_up/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/general_medical_check_up/publlshing.php b/admin/layouts/general_medical_check_up/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/general_medical_check_up/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/general_medical_check_up/referrals_left.php b/admin/layouts/general_medical_check_up/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/general_medical_check_up/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/general_medical_check_up/referrals_right.php b/admin/layouts/general_medical_check_up/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/general_medical_check_up/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/general_medical_check_up/vital_signs_above.php b/admin/layouts/general_medical_check_up/vital_signs_above.php new file mode 100644 index 0000000..295a8fe --- /dev/null +++ b/admin/layouts/general_medical_check_up/vital_signs_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/general_medical_check_up/vital_signs_fullwidth.php b/admin/layouts/general_medical_check_up/vital_signs_fullwidth.php new file mode 100644 index 0000000..d30ebfc --- /dev/null +++ b/admin/layouts/general_medical_check_up/vital_signs_fullwidth.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'complaint', + 'investigations', + 'notes' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/general_medical_check_up/vital_signs_left.php b/admin/layouts/general_medical_check_up/vital_signs_left.php new file mode 100644 index 0000000..87a959a --- /dev/null +++ b/admin/layouts/general_medical_check_up/vital_signs_left.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'bp_diastolic_one', + 'bp_systolic_one', + 'temp_one', + 'weight', + 'pulse', + 'chronic_medication' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/general_medical_check_up/vital_signs_right.php b/admin/layouts/general_medical_check_up/vital_signs_right.php new file mode 100644 index 0000000..11a74ec --- /dev/null +++ b/admin/layouts/general_medical_check_up/vital_signs_right.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'bp_diastolic_two', + 'bp_systolic_two', + 'temp_two', + 'height', + 'bmi' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/health_education/details_above.php b/admin/layouts/health_education/details_above.php new file mode 100644 index 0000000..2e3aac4 --- /dev/null +++ b/admin/layouts/health_education/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient', + 'education_type' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/health_education/details_left.php b/admin/layouts/health_education/details_left.php new file mode 100644 index 0000000..dc5d16f --- /dev/null +++ b/admin/layouts/health_education/details_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'health_education_topic' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/health_education/index.html b/admin/layouts/health_education/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/health_education/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/health_education/publishing.php b/admin/layouts/health_education/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/health_education/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/health_education/publlshing.php b/admin/layouts/health_education/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/health_education/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/health_education_topic/details_above.php b/admin/layouts/health_education_topic/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/health_education_topic/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/health_education_topic/details_fullwidth.php b/admin/layouts/health_education_topic/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/health_education_topic/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/health_education_topic/index.html b/admin/layouts/health_education_topic/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/health_education_topic/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/health_education_topic/publishing.php b/admin/layouts/health_education_topic/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/health_education_topic/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/health_education_topic/publlshing.php b/admin/layouts/health_education_topic/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/health_education_topic/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/hiv_counseling_and_testing/details_above.php b/admin/layouts/hiv_counseling_and_testing/details_above.php new file mode 100644 index 0000000..5b2dd4f --- /dev/null +++ b/admin/layouts/hiv_counseling_and_testing/details_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/hiv_counseling_and_testing/details_left.php b/admin/layouts/hiv_counseling_and_testing/details_left.php new file mode 100644 index 0000000..265d1c9 --- /dev/null +++ b/admin/layouts/hiv_counseling_and_testing/details_left.php @@ -0,0 +1,63 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'counseling_type', + 'testing_reason', + 'last_test_date', + 'prev_test_result', + 'test_result_one', + 'test_result_two', + 'final_test_result', + 'eqa' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/hiv_counseling_and_testing/index.html b/admin/layouts/hiv_counseling_and_testing/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/hiv_counseling_and_testing/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/hiv_counseling_and_testing/publishing.php b/admin/layouts/hiv_counseling_and_testing/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/hiv_counseling_and_testing/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/hiv_counseling_and_testing/publlshing.php b/admin/layouts/hiv_counseling_and_testing/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/hiv_counseling_and_testing/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/hiv_counseling_and_testing/referrals_left.php b/admin/layouts/hiv_counseling_and_testing/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/hiv_counseling_and_testing/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/hiv_counseling_and_testing/referrals_right.php b/admin/layouts/hiv_counseling_and_testing/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/hiv_counseling_and_testing/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation/details_above.php b/admin/layouts/immunisation/details_above.php new file mode 100644 index 0000000..5b2dd4f --- /dev/null +++ b/admin/layouts/immunisation/details_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/immunisation/details_fullwidth.php b/admin/layouts/immunisation/details_fullwidth.php new file mode 100644 index 0000000..9c8aa24 --- /dev/null +++ b/admin/layouts/immunisation/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'immunisation' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/immunisation/details_left.php b/admin/layouts/immunisation/details_left.php new file mode 100644 index 0000000..8322696 --- /dev/null +++ b/admin/layouts/immunisation/details_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'immunisation_up_to_date' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation/details_under.php b/admin/layouts/immunisation/details_under.php new file mode 100644 index 0000000..09a8231 --- /dev/null +++ b/admin/layouts/immunisation/details_under.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'immunisation_vaccine_type', + 'administration_part' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/immunisation/index.html b/admin/layouts/immunisation/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/immunisation/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/immunisation/publishing.php b/admin/layouts/immunisation/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/immunisation/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation/publlshing.php b/admin/layouts/immunisation/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/immunisation/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation/referrals_left.php b/admin/layouts/immunisation/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/immunisation/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation/referrals_right.php b/admin/layouts/immunisation/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/immunisation/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation_type/details_above.php b/admin/layouts/immunisation_type/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/immunisation_type/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/immunisation_type/details_fullwidth.php b/admin/layouts/immunisation_type/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/immunisation_type/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/immunisation_type/index.html b/admin/layouts/immunisation_type/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/immunisation_type/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/immunisation_type/publishing.php b/admin/layouts/immunisation_type/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/immunisation_type/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation_type/publlshing.php b/admin/layouts/immunisation_type/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/immunisation_type/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation_vaccine_type/details_above.php b/admin/layouts/immunisation_vaccine_type/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/immunisation_vaccine_type/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/immunisation_vaccine_type/details_fullwidth.php b/admin/layouts/immunisation_vaccine_type/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/immunisation_vaccine_type/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/immunisation_vaccine_type/details_left.php b/admin/layouts/immunisation_vaccine_type/details_left.php new file mode 100644 index 0000000..e0d1efc --- /dev/null +++ b/admin/layouts/immunisation_vaccine_type/details_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'administration_part' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation_vaccine_type/index.html b/admin/layouts/immunisation_vaccine_type/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/immunisation_vaccine_type/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/immunisation_vaccine_type/publishing.php b/admin/layouts/immunisation_vaccine_type/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/immunisation_vaccine_type/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/immunisation_vaccine_type/publlshing.php b/admin/layouts/immunisation_vaccine_type/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/immunisation_vaccine_type/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/index.html b/admin/layouts/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/medication/details_above.php b/admin/layouts/medication/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/medication/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/medication/details_fullwidth.php b/admin/layouts/medication/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/medication/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/medication/index.html b/admin/layouts/medication/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/medication/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/medication/publishing.php b/admin/layouts/medication/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/medication/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/medication/publlshing.php b/admin/layouts/medication/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/medication/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/nonpay_reason/details_above.php b/admin/layouts/nonpay_reason/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/nonpay_reason/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/nonpay_reason/details_fullwidth.php b/admin/layouts/nonpay_reason/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/nonpay_reason/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/nonpay_reason/index.html b/admin/layouts/nonpay_reason/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/nonpay_reason/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/nonpay_reason/publishing.php b/admin/layouts/nonpay_reason/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/nonpay_reason/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/nonpay_reason/publlshing.php b/admin/layouts/nonpay_reason/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/nonpay_reason/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/payment/details_above.php b/admin/layouts/payment/details_above.php new file mode 100644 index 0000000..55dc45f --- /dev/null +++ b/admin/layouts/payment/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient', + 'payment_category' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/payment/details_left.php b/admin/layouts/payment/details_left.php new file mode 100644 index 0000000..4b3976c --- /dev/null +++ b/admin/layouts/payment/details_left.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'payment_type', + 'payment_amount', + 'nonpay_reason', + 'receipt_no' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/payment/index.html b/admin/layouts/payment/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/payment/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/payment/publishing.php b/admin/layouts/payment/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/payment/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/payment/publlshing.php b/admin/layouts/payment/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/payment/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/payment_amount/details_above.php b/admin/layouts/payment_amount/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/payment_amount/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/payment_amount/details_fullwidth.php b/admin/layouts/payment_amount/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/payment_amount/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/payment_amount/index.html b/admin/layouts/payment_amount/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/payment_amount/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/payment_amount/publishing.php b/admin/layouts/payment_amount/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/payment_amount/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/payment_amount/publlshing.php b/admin/layouts/payment_amount/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/payment_amount/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/payment_type/details_above.php b/admin/layouts/payment_type/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/payment_type/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/payment_type/details_fullwidth.php b/admin/layouts/payment_type/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/payment_type/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/payment_type/index.html b/admin/layouts/payment_type/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/payment_type/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/payment_type/publishing.php b/admin/layouts/payment_type/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/payment_type/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/payment_type/publlshing.php b/admin/layouts/payment_type/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/payment_type/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/planning_type/details_above.php b/admin/layouts/planning_type/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/planning_type/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/planning_type/details_fullwidth.php b/admin/layouts/planning_type/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/planning_type/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/planning_type/index.html b/admin/layouts/planning_type/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/planning_type/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/planning_type/publishing.php b/admin/layouts/planning_type/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/planning_type/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/planning_type/publlshing.php b/admin/layouts/planning_type/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/planning_type/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/prostate_and_testicular_cancer/details_above.php b/admin/layouts/prostate_and_testicular_cancer/details_above.php new file mode 100644 index 0000000..5b2dd4f --- /dev/null +++ b/admin/layouts/prostate_and_testicular_cancer/details_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/prostate_and_testicular_cancer/details_left.php b/admin/layouts/prostate_and_testicular_cancer/details_left.php new file mode 100644 index 0000000..a8212c3 --- /dev/null +++ b/admin/layouts/prostate_and_testicular_cancer/details_left.php @@ -0,0 +1,63 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'ptc_age', + 'txt_ptc_age', + 'ptc_fam_history', + 'txt_ptc_fam_history', + 'ptc_diet', + 'txt_ptc_diet', + 'ptc_phy_activity', + 'txt_ptc_phy_activity' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/prostate_and_testicular_cancer/details_right.php b/admin/layouts/prostate_and_testicular_cancer/details_right.php new file mode 100644 index 0000000..3895b3a --- /dev/null +++ b/admin/layouts/prostate_and_testicular_cancer/details_right.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'ptc_overweight', + 'txt_ptc_overweight', + 'ptc_urinate', + 'txt_ptc_urinate', + 'ptc_urine_freq', + 'txt_ptc_urine_freq' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/prostate_and_testicular_cancer/index.html b/admin/layouts/prostate_and_testicular_cancer/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/prostate_and_testicular_cancer/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/prostate_and_testicular_cancer/publishing.php b/admin/layouts/prostate_and_testicular_cancer/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/prostate_and_testicular_cancer/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/prostate_and_testicular_cancer/publlshing.php b/admin/layouts/prostate_and_testicular_cancer/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/prostate_and_testicular_cancer/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/prostate_and_testicular_cancer/referrals_left.php b/admin/layouts/prostate_and_testicular_cancer/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/prostate_and_testicular_cancer/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/prostate_and_testicular_cancer/referrals_right.php b/admin/layouts/prostate_and_testicular_cancer/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/prostate_and_testicular_cancer/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/referral/details_above.php b/admin/layouts/referral/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/referral/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/referral/details_fullwidth.php b/admin/layouts/referral/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/referral/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/referral/index.html b/admin/layouts/referral/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/referral/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/referral/publishing.php b/admin/layouts/referral/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/referral/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/referral/publlshing.php b/admin/layouts/referral/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/referral/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/site/details_above.php b/admin/layouts/site/details_above.php new file mode 100644 index 0000000..2c9ad21 --- /dev/null +++ b/admin/layouts/site/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'site_name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/site/details_fullwidth.php b/admin/layouts/site/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/site/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/site/details_left.php b/admin/layouts/site/details_left.php new file mode 100644 index 0000000..f7f76a3 --- /dev/null +++ b/admin/layouts/site/details_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'site_region' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/site/index.html b/admin/layouts/site/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/site/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/site/publishing.php b/admin/layouts/site/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/site/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/site/publlshing.php b/admin/layouts/site/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/site/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/strength/details_above.php b/admin/layouts/strength/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/strength/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/strength/details_fullwidth.php b/admin/layouts/strength/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/strength/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/strength/index.html b/admin/layouts/strength/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/strength/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/strength/publishing.php b/admin/layouts/strength/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/strength/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/strength/publlshing.php b/admin/layouts/strength/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/strength/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/cholesterol_left.php b/admin/layouts/test/cholesterol_left.php new file mode 100644 index 0000000..15ebaab --- /dev/null +++ b/admin/layouts/test/cholesterol_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'cholesterol_reading' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/glucose_left.php b/admin/layouts/test/glucose_left.php new file mode 100644 index 0000000..64da32d --- /dev/null +++ b/admin/layouts/test/glucose_left.php @@ -0,0 +1,57 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'glucose_first_reading', + 'glucose_second_reading' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/haemoglobin_left.php b/admin/layouts/test/haemoglobin_left.php new file mode 100644 index 0000000..9ef02a6 --- /dev/null +++ b/admin/layouts/test/haemoglobin_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'haemoglobin_reading' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/hepatitis_b_left.php b/admin/layouts/test/hepatitis_b_left.php new file mode 100644 index 0000000..9fc98ea --- /dev/null +++ b/admin/layouts/test/hepatitis_b_left.php @@ -0,0 +1,57 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'hepatitis_first_reading', + 'hepatitis_second_reading' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/index.html b/admin/layouts/test/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/test/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/test/malaria_left.php b/admin/layouts/test/malaria_left.php new file mode 100644 index 0000000..2195bb0 --- /dev/null +++ b/admin/layouts/test/malaria_left.php @@ -0,0 +1,57 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'malaria_first_reading', + 'malaria_second_reading' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/pregnancy_left.php b/admin/layouts/test/pregnancy_left.php new file mode 100644 index 0000000..c2055f1 --- /dev/null +++ b/admin/layouts/test/pregnancy_left.php @@ -0,0 +1,57 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'pregnancy_first_reading', + 'pregnancy_second_reading' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/publishing.php b/admin/layouts/test/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/test/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/publlshing.php b/admin/layouts/test/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/test/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/referrals_left.php b/admin/layouts/test/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/test/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/referrals_right.php b/admin/layouts/test/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/test/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/syphillis_left.php b/admin/layouts/test/syphillis_left.php new file mode 100644 index 0000000..04c11f8 --- /dev/null +++ b/admin/layouts/test/syphillis_left.php @@ -0,0 +1,57 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'syphilis_first_reading', + 'syphilis_second_reading' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/test/urine_above.php b/admin/layouts/test/urine_above.php new file mode 100644 index 0000000..d360d6f --- /dev/null +++ b/admin/layouts/test/urine_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/test/urine_left.php b/admin/layouts/test/urine_left.php new file mode 100644 index 0000000..fa0bacc --- /dev/null +++ b/admin/layouts/test/urine_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'urine_test_result' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/testing_reason/details_above.php b/admin/layouts/testing_reason/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/testing_reason/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/testing_reason/details_fullwidth.php b/admin/layouts/testing_reason/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/testing_reason/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/testing_reason/index.html b/admin/layouts/testing_reason/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/testing_reason/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/testing_reason/publishing.php b/admin/layouts/testing_reason/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/testing_reason/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/testing_reason/publlshing.php b/admin/layouts/testing_reason/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/testing_reason/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/tuberculosis/index.html b/admin/layouts/tuberculosis/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/tuberculosis/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/tuberculosis/publishing.php b/admin/layouts/tuberculosis/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/tuberculosis/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/tuberculosis/publlshing.php b/admin/layouts/tuberculosis/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/tuberculosis/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/tuberculosis/referrals_left.php b/admin/layouts/tuberculosis/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/tuberculosis/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/tuberculosis/referrals_right.php b/admin/layouts/tuberculosis/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/tuberculosis/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/tuberculosis/screening_above.php b/admin/layouts/tuberculosis/screening_above.php new file mode 100644 index 0000000..2856398 --- /dev/null +++ b/admin/layouts/tuberculosis/screening_above.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/tuberculosis/screening_left.php b/admin/layouts/tuberculosis/screening_left.php new file mode 100644 index 0000000..2e050d7 --- /dev/null +++ b/admin/layouts/tuberculosis/screening_left.php @@ -0,0 +1,63 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'weight_loss_wdieting', + 'recurring_night_sweats', + 'tb_fever', + 'persistent_cough', + 'blood_streaked_sputum', + 'unusual_tiredness', + 'pain_in_chest', + 'shortness_of_breath' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/tuberculosis/screening_right.php b/admin/layouts/tuberculosis/screening_right.php new file mode 100644 index 0000000..7043177 --- /dev/null +++ b/admin/layouts/tuberculosis/screening_right.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'diagnosed_with_disease', + 'tb_exposed', + 'tb_treatment', + 'date_of_treatment', + 'treating_dhc' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/tuberculosis/sputum_collection_left.php b/admin/layouts/tuberculosis/sputum_collection_left.php new file mode 100644 index 0000000..49941da --- /dev/null +++ b/admin/layouts/tuberculosis/sputum_collection_left.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'sputum_collection_one', + 'tb_reason_one', + 'sputum_result_one', + 'referred_second_sputum', + 'tb_reason_two', + 'sputum_result_two' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/unit/details_above.php b/admin/layouts/unit/details_above.php new file mode 100644 index 0000000..10065f8 --- /dev/null +++ b/admin/layouts/unit/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'name', + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/unit/details_fullwidth.php b/admin/layouts/unit/details_fullwidth.php new file mode 100644 index 0000000..38dbb66 --- /dev/null +++ b/admin/layouts/unit/details_fullwidth.php @@ -0,0 +1,58 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/unit/index.html b/admin/layouts/unit/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/unit/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/unit/publishing.php b/admin/layouts/unit/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/unit/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/unit/publlshing.php b/admin/layouts/unit/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/unit/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/vmmc/details_above.php b/admin/layouts/vmmc/details_above.php new file mode 100644 index 0000000..07b6e96 --- /dev/null +++ b/admin/layouts/vmmc/details_above.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'patient', + 'vmmc_gender' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/vmmc/details_left.php b/admin/layouts/vmmc/details_left.php new file mode 100644 index 0000000..4df5777 --- /dev/null +++ b/admin/layouts/vmmc/details_left.php @@ -0,0 +1,59 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'partner_circumcised', + 'are_you_circumcised', + 'interested_in_vmmc', + 'info_ben_vmcc' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/vmmc/index.html b/admin/layouts/vmmc/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/layouts/vmmc/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/layouts/vmmc/publishing.php b/admin/layouts/vmmc/publishing.php new file mode 100644 index 0000000..409229e --- /dev/null +++ b/admin/layouts/vmmc/publishing.php @@ -0,0 +1,60 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'title', + 'created', + 'created_by', + 'modified', + 'modified_by' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/vmmc/publlshing.php b/admin/layouts/vmmc/publlshing.php new file mode 100644 index 0000000..3d84e5e --- /dev/null +++ b/admin/layouts/vmmc/publlshing.php @@ -0,0 +1,61 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'published', + 'ordering', + 'access', + 'version', + 'hits', + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/vmmc/referrals_left.php b/admin/layouts/vmmc/referrals_left.php new file mode 100644 index 0000000..f0c0337 --- /dev/null +++ b/admin/layouts/vmmc/referrals_left.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'referral' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/vmmc/referrals_right.php b/admin/layouts/vmmc/referrals_right.php new file mode 100644 index 0000000..710b162 --- /dev/null +++ b/admin/layouts/vmmc/referrals_right.php @@ -0,0 +1,56 @@ + + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'reason' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/models/administration_part.php b/admin/models/administration_part.php new file mode 100644 index 0000000..be786b7 --- /dev/null +++ b/admin/models/administration_part.php @@ -0,0 +1,1074 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Administration_part Model + */ +class Ehealth_portalModelAdministration_part extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.administration_part'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'administration_part', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.administration_part'); + } + } + $this->administration_partvvvv = $item->id; + + return $item; + } + + /** + * Method to get list data. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getVvyvaccines() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_immunisation_vaccine_type table + $query->from($db->quoteName('#__ehealth_portal_immunisation_vaccine_type', 'a')); + + // From the ehealth_portal_administration_part table. + $query->select($db->quoteName('g.name','administration_part_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_administration_part', 'g') . ' ON (' . $db->quoteName('a.administration_part') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by administration_partvvvv global. + $administration_partvvvv = $this->administration_partvvvv; + if (is_numeric($administration_partvvvv )) + { + $query->where('a.administration_part = ' . (int) $administration_partvvvv ); + } + elseif (is_string($administration_partvvvv)) + { + $query->where('a.administration_part = ' . $db->quote($administration_partvvvv)); + } + else + { + $query->where('a.administration_part = -5'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.published ASC'); + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + return $items; + } + return false; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.administration_part', 'administration_part', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.administration_part.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('administration_part.edit.name', 'com_ehealth_portal.administration_part.' . (int) $id)) + || ($id == 0 && !$user->authorise('administration_part.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('administration_part.edit.description', 'com_ehealth_portal.administration_part.' . (int) $id)) + || ($id == 0 && !$user->authorise('administration_part.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/administration_part.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.administration_part.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.administration_part.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.administration_part.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_administration_part')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.administration_part.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.administration_part', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('administration_part'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('administration_part'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('administration_part'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('administration_part', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_ADMINISTRATION_PART_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/administration_parts.php b/admin/models/administration_parts.php new file mode 100644 index 0000000..55d8cc9 --- /dev/null +++ b/admin/models/administration_parts.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Administration_parts Model + */ +class Ehealth_portalModelAdministration_parts extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_administration_part', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_administration_part table + $query->from($db->quoteName('#__ehealth_portal_administration_part', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_administration_part"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_administration_part')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_administration_part'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/ajax.php b/admin/models/ajax.php new file mode 100644 index 0000000..abcfbb2 --- /dev/null +++ b/admin/models/ajax.php @@ -0,0 +1,66 @@ + + @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\Utilities\ArrayHelper; + +/** + * Ehealth_portal Ajax Model + */ +class Ehealth_portalModelAjax extends JModelList +{ + protected $app_params; + + public function __construct() + { + parent::__construct(); + // get params + $this->app_params = JComponentHelper::getParams('com_ehealth_portal'); + + } + + // Used in immunisation + public function getImmunisationVaccineType($administration_part) + { + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName( array('a.id') )); + $query->from($db->quoteName('#__ehealth_portal_immunisation_vaccine_type', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + // check for administration part and immunisation vaccine type + $query->where($db->quoteName('a.administration_part') . ' = '. (int) $administration_part); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + return $db->loadColumn(); + } + return false; + } +} diff --git a/admin/models/antenatal_care.php b/admin/models/antenatal_care.php new file mode 100644 index 0000000..cd1a624 --- /dev/null +++ b/admin/models/antenatal_care.php @@ -0,0 +1,880 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Antenatal_care Model + */ +class Ehealth_portalModelAntenatal_care extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'pregnancy_history' => array( + 'left' => array( + 'pregnancies_excl', + 'live_births', + 'miscarriages', + 'still_births' + ), + 'right' => array( + 'normal_births', + 'caesarean_sections', + 'last_menstrual_period' + ), + 'fullwidth' => array( + 'foetal_movements' + ), + 'above' => array( + 'patient' + ) + ), + 'abdominal_examination' => array( + 'left' => array( + 'foetal_lie', + 'foetal_presentation', + 'foetal_engagement', + 'foetal_heart_rate' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.antenatal_care'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'antenatal_care', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.antenatal_care'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.antenatal_care', 'antenatal_care', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.antenatal_care.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/antenatal_care.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.antenatal_care.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.antenatal_care.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.antenatal_care.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_antenatal_care')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.antenatal_care.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.antenatal_care', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('antenatal_care'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('antenatal_care'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('antenatal_care'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/antenatal_cares.php b/admin/models/antenatal_cares.php new file mode 100644 index 0000000..6dd5f19 --- /dev/null +++ b/admin/models/antenatal_cares.php @@ -0,0 +1,460 @@ + + @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\Utilities\ArrayHelper; + +/** + * Antenatal_cares Model + */ +class Ehealth_portalModelAntenatal_cares extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient', + 'g.name','foetal_lie' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + $foetal_lie = $this->getUserStateFromRequest($this->context . '.filter.foetal_lie', 'filter_foetal_lie'); + if ($formSubmited) + { + $foetal_lie = $app->input->post->get('foetal_lie'); + $this->setState('filter.foetal_lie', $foetal_lie); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_antenatal_care', 'a')); + + // From the ehealth_portal_foetal_lie table. + $query->select($db->quoteName('g.name','foetal_lie_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_foetal_lie', 'g') . ' ON (' . $db->quoteName('a.foetal_lie') . ' = ' . $db->quoteName('g.id') . ')'); + + // From the ehealth_portal_foetal_presentation table. + $query->select($db->quoteName('h.name','foetal_presentation_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_foetal_presentation', 'h') . ' ON (' . $db->quoteName('a.foetal_presentation') . ' = ' . $db->quoteName('h.id') . ')'); + + // From the ehealth_portal_foetal_engagement table. + $query->select($db->quoteName('i.name','foetal_engagement_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_foetal_engagement', 'i') . ' ON (' . $db->quoteName('a.foetal_engagement') . ' = ' . $db->quoteName('i.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + // Filter by Foetal_lie. + $_foetal_lie = $this->getState('filter.foetal_lie'); + if (is_numeric($_foetal_lie)) + { + if (is_float($_foetal_lie)) + { + $query->where('a.foetal_lie = ' . (float) $_foetal_lie); + } + else + { + $query->where('a.foetal_lie = ' . (int) $_foetal_lie); + } + } + elseif (Ehealth_portalHelper::checkString($_foetal_lie)) + { + $query->where('a.foetal_lie = ' . $db->quote($db->escape($_foetal_lie))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_antenatal_care table + $query->from($db->quoteName('#__ehealth_portal_antenatal_care', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_antenatal_care"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + $id .= ':' . $this->getState('filter.foetal_lie'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_antenatal_care')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_antenatal_care'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/breast_cancer.php b/admin/models/breast_cancer.php new file mode 100644 index 0000000..b302072 --- /dev/null +++ b/admin/models/breast_cancer.php @@ -0,0 +1,895 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Breast_cancer Model + */ +class Ehealth_portalModelBreast_cancer extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'risk_assesment' => array( + 'left' => array( + 'bc_age_range', + 'bc_family_history', + 'bc_race', + 'bc_breastfeeding', + 'bc_preg_freq', + 'bc_preg_age', + 'bc_history_hrt', + 'bc_reg_exercise', + 'bc_overweight' + ), + 'above' => array( + 'patient' + ) + ), + 'breast_examination' => array( + 'left' => array( + 'bc_lump_near_breast', + 'txt_bc_lump_near_breast', + 'bc_inward_nipple', + 'txt_bc_inward_nipple', + 'bc_dimpling', + 'txt_bc_dimpling' + ), + 'right' => array( + 'bc_nipple_discharge', + 'txt_bc_nipple_discharge', + 'bc_abnormal_skin', + 'txt_bc_abnormal_skin', + 'bc_breast_shape', + 'txt_bc_breast_shape' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.breast_cancer'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'breast_cancer', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.breast_cancer'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.breast_cancer', 'breast_cancer', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.breast_cancer.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/breast_cancer.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.breast_cancer.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.breast_cancer.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.breast_cancer.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_breast_cancer')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.breast_cancer.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.breast_cancer', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('breast_cancer'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('breast_cancer'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('breast_cancer'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/breast_cancers.php b/admin/models/breast_cancers.php new file mode 100644 index 0000000..3904336 --- /dev/null +++ b/admin/models/breast_cancers.php @@ -0,0 +1,657 @@ + + @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\Utilities\ArrayHelper; + +/** + * Breast_cancers Model + */ +class Ehealth_portalModelBreast_cancers extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert bc_age_range + $item->bc_age_range = $this->selectionTranslation($item->bc_age_range, 'bc_age_range'); + // convert bc_family_history + $item->bc_family_history = $this->selectionTranslation($item->bc_family_history, 'bc_family_history'); + // convert bc_race + $item->bc_race = $this->selectionTranslation($item->bc_race, 'bc_race'); + // convert bc_breastfeeding + $item->bc_breastfeeding = $this->selectionTranslation($item->bc_breastfeeding, 'bc_breastfeeding'); + // convert bc_preg_age + $item->bc_preg_age = $this->selectionTranslation($item->bc_preg_age, 'bc_preg_age'); + // convert bc_history_hrt + $item->bc_history_hrt = $this->selectionTranslation($item->bc_history_hrt, 'bc_history_hrt'); + // convert bc_reg_exercise + $item->bc_reg_exercise = $this->selectionTranslation($item->bc_reg_exercise, 'bc_reg_exercise'); + // convert bc_overweight + $item->bc_overweight = $this->selectionTranslation($item->bc_overweight, 'bc_overweight'); + // convert bc_lump_near_breast + $item->bc_lump_near_breast = $this->selectionTranslation($item->bc_lump_near_breast, 'bc_lump_near_breast'); + // convert bc_dimpling + $item->bc_dimpling = $this->selectionTranslation($item->bc_dimpling, 'bc_dimpling'); + // convert bc_inward_nipple + $item->bc_inward_nipple = $this->selectionTranslation($item->bc_inward_nipple, 'bc_inward_nipple'); + // convert bc_nipple_discharge + $item->bc_nipple_discharge = $this->selectionTranslation($item->bc_nipple_discharge, 'bc_nipple_discharge'); + // convert bc_abnormal_skin + $item->bc_abnormal_skin = $this->selectionTranslation($item->bc_abnormal_skin, 'bc_abnormal_skin'); + // convert bc_breast_shape + $item->bc_breast_shape = $this->selectionTranslation($item->bc_breast_shape, 'bc_breast_shape'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of bc_age_range language strings + if ($name === 'bc_age_range') + { + $bc_age_rangeArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_age_rangeArray[$value]) && Ehealth_portalHelper::checkString($bc_age_rangeArray[$value])) + { + return $bc_age_rangeArray[$value]; + } + } + // Array of bc_family_history language strings + if ($name === 'bc_family_history') + { + $bc_family_historyArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_family_historyArray[$value]) && Ehealth_portalHelper::checkString($bc_family_historyArray[$value])) + { + return $bc_family_historyArray[$value]; + } + } + // Array of bc_race language strings + if ($name === 'bc_race') + { + $bc_raceArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_WHITE', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_COLOURED', + 2 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_BLACK', + 3 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_ASIAN' + ); + // Now check if value is found in this array + if (isset($bc_raceArray[$value]) && Ehealth_portalHelper::checkString($bc_raceArray[$value])) + { + return $bc_raceArray[$value]; + } + } + // Array of bc_breastfeeding language strings + if ($name === 'bc_breastfeeding') + { + $bc_breastfeedingArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_breastfeedingArray[$value]) && Ehealth_portalHelper::checkString($bc_breastfeedingArray[$value])) + { + return $bc_breastfeedingArray[$value]; + } + } + // Array of bc_preg_age language strings + if ($name === 'bc_preg_age') + { + $bc_preg_ageArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_THIRTY_YEARS', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_THIRTY_YEARS' + ); + // Now check if value is found in this array + if (isset($bc_preg_ageArray[$value]) && Ehealth_portalHelper::checkString($bc_preg_ageArray[$value])) + { + return $bc_preg_ageArray[$value]; + } + } + // Array of bc_history_hrt language strings + if ($name === 'bc_history_hrt') + { + $bc_history_hrtArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_history_hrtArray[$value]) && Ehealth_portalHelper::checkString($bc_history_hrtArray[$value])) + { + return $bc_history_hrtArray[$value]; + } + } + // Array of bc_reg_exercise language strings + if ($name === 'bc_reg_exercise') + { + $bc_reg_exerciseArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_reg_exerciseArray[$value]) && Ehealth_portalHelper::checkString($bc_reg_exerciseArray[$value])) + { + return $bc_reg_exerciseArray[$value]; + } + } + // Array of bc_overweight language strings + if ($name === 'bc_overweight') + { + $bc_overweightArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_overweightArray[$value]) && Ehealth_portalHelper::checkString($bc_overweightArray[$value])) + { + return $bc_overweightArray[$value]; + } + } + // Array of bc_lump_near_breast language strings + if ($name === 'bc_lump_near_breast') + { + $bc_lump_near_breastArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_lump_near_breastArray[$value]) && Ehealth_portalHelper::checkString($bc_lump_near_breastArray[$value])) + { + return $bc_lump_near_breastArray[$value]; + } + } + // Array of bc_dimpling language strings + if ($name === 'bc_dimpling') + { + $bc_dimplingArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_dimplingArray[$value]) && Ehealth_portalHelper::checkString($bc_dimplingArray[$value])) + { + return $bc_dimplingArray[$value]; + } + } + // Array of bc_inward_nipple language strings + if ($name === 'bc_inward_nipple') + { + $bc_inward_nippleArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_inward_nippleArray[$value]) && Ehealth_portalHelper::checkString($bc_inward_nippleArray[$value])) + { + return $bc_inward_nippleArray[$value]; + } + } + // Array of bc_nipple_discharge language strings + if ($name === 'bc_nipple_discharge') + { + $bc_nipple_dischargeArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_nipple_dischargeArray[$value]) && Ehealth_portalHelper::checkString($bc_nipple_dischargeArray[$value])) + { + return $bc_nipple_dischargeArray[$value]; + } + } + // Array of bc_abnormal_skin language strings + if ($name === 'bc_abnormal_skin') + { + $bc_abnormal_skinArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_abnormal_skinArray[$value]) && Ehealth_portalHelper::checkString($bc_abnormal_skinArray[$value])) + { + return $bc_abnormal_skinArray[$value]; + } + } + // Array of bc_breast_shape language strings + if ($name === 'bc_breast_shape') + { + $bc_breast_shapeArray = array( + 0 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_BREAST_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($bc_breast_shapeArray[$value]) && Ehealth_portalHelper::checkString($bc_breast_shapeArray[$value])) + { + return $bc_breast_shapeArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_breast_cancer', 'a')); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('g.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'g') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_breast_cancer table + $query->from($db->quoteName('#__ehealth_portal_breast_cancer', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_breast_cancer"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_breast_cancer')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_breast_cancer'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/cervical_cancer.php b/admin/models/cervical_cancer.php new file mode 100644 index 0000000..ed914cf --- /dev/null +++ b/admin/models/cervical_cancer.php @@ -0,0 +1,889 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Cervical_cancer Model + */ +class Ehealth_portalModelCervical_cancer extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'risk_assesment' => array( + 'left' => array( + 'cc_viginal_bleeding', + 'txt_cc_viginal_bleeding', + 'cc_v_discharge', + 'txt_cc_v_discharge', + 'cc_periods', + 'txt_cc_periods' + ), + 'right' => array( + 'cc_smoking', + 'txt_cc_smoking', + 'cc_sex_actve', + 'txt_cc_sex_actve', + 'cc_sex_partner', + 'txt_cc_sex_partner' + ), + 'above' => array( + 'patient' + ) + ), + 'cervical_examination' => array( + 'left' => array( + 'pap_smear_collection', + 'cc_reason', + 'cc_result' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.cervical_cancer'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'cervical_cancer', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.cervical_cancer'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.cervical_cancer', 'cervical_cancer', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.cervical_cancer.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/cervical_cancer.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.cervical_cancer.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.cervical_cancer.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.cervical_cancer.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_cervical_cancer')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.cervical_cancer.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.cervical_cancer', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('cervical_cancer'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('cervical_cancer'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('cervical_cancer'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/cervical_cancers.php b/admin/models/cervical_cancers.php new file mode 100644 index 0000000..298482d --- /dev/null +++ b/admin/models/cervical_cancers.php @@ -0,0 +1,566 @@ + + @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\Utilities\ArrayHelper; + +/** + * Cervical_cancers Model + */ +class Ehealth_portalModelCervical_cancers extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert cc_viginal_bleeding + $item->cc_viginal_bleeding = $this->selectionTranslation($item->cc_viginal_bleeding, 'cc_viginal_bleeding'); + // convert cc_v_discharge + $item->cc_v_discharge = $this->selectionTranslation($item->cc_v_discharge, 'cc_v_discharge'); + // convert cc_periods + $item->cc_periods = $this->selectionTranslation($item->cc_periods, 'cc_periods'); + // convert cc_smoking + $item->cc_smoking = $this->selectionTranslation($item->cc_smoking, 'cc_smoking'); + // convert cc_sex_actve + $item->cc_sex_actve = $this->selectionTranslation($item->cc_sex_actve, 'cc_sex_actve'); + // convert cc_sex_partner + $item->cc_sex_partner = $this->selectionTranslation($item->cc_sex_partner, 'cc_sex_partner'); + // convert pap_smear_collection + $item->pap_smear_collection = $this->selectionTranslation($item->pap_smear_collection, 'pap_smear_collection'); + // convert cc_result + $item->cc_result = $this->selectionTranslation($item->cc_result, 'cc_result'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of cc_viginal_bleeding language strings + if ($name === 'cc_viginal_bleeding') + { + $cc_viginal_bleedingArray = array( + 0 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($cc_viginal_bleedingArray[$value]) && Ehealth_portalHelper::checkString($cc_viginal_bleedingArray[$value])) + { + return $cc_viginal_bleedingArray[$value]; + } + } + // Array of cc_v_discharge language strings + if ($name === 'cc_v_discharge') + { + $cc_v_dischargeArray = array( + 0 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($cc_v_dischargeArray[$value]) && Ehealth_portalHelper::checkString($cc_v_dischargeArray[$value])) + { + return $cc_v_dischargeArray[$value]; + } + } + // Array of cc_periods language strings + if ($name === 'cc_periods') + { + $cc_periodsArray = array( + 0 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($cc_periodsArray[$value]) && Ehealth_portalHelper::checkString($cc_periodsArray[$value])) + { + return $cc_periodsArray[$value]; + } + } + // Array of cc_smoking language strings + if ($name === 'cc_smoking') + { + $cc_smokingArray = array( + 0 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($cc_smokingArray[$value]) && Ehealth_portalHelper::checkString($cc_smokingArray[$value])) + { + return $cc_smokingArray[$value]; + } + } + // Array of cc_sex_actve language strings + if ($name === 'cc_sex_actve') + { + $cc_sex_actveArray = array( + 0 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($cc_sex_actveArray[$value]) && Ehealth_portalHelper::checkString($cc_sex_actveArray[$value])) + { + return $cc_sex_actveArray[$value]; + } + } + // Array of cc_sex_partner language strings + if ($name === 'cc_sex_partner') + { + $cc_sex_partnerArray = array( + 0 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($cc_sex_partnerArray[$value]) && Ehealth_portalHelper::checkString($cc_sex_partnerArray[$value])) + { + return $cc_sex_partnerArray[$value]; + } + } + // Array of pap_smear_collection language strings + if ($name === 'pap_smear_collection') + { + $pap_smear_collectionArray = array( + 0 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($pap_smear_collectionArray[$value]) && Ehealth_portalHelper::checkString($pap_smear_collectionArray[$value])) + { + return $pap_smear_collectionArray[$value]; + } + } + // Array of cc_result language strings + if ($name === 'cc_result') + { + $cc_resultArray = array( + 0 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($cc_resultArray[$value]) && Ehealth_portalHelper::checkString($cc_resultArray[$value])) + { + return $cc_resultArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_cervical_cancer', 'a')); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('g.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'g') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_cervical_cancer table + $query->from($db->quoteName('#__ehealth_portal_cervical_cancer', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_cervical_cancer"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_cervical_cancer')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_cervical_cancer'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/clinic.php b/admin/models/clinic.php new file mode 100644 index 0000000..446781a --- /dev/null +++ b/admin/models/clinic.php @@ -0,0 +1,998 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Clinic Model + */ +class Ehealth_portalModelClinic extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'clinic_name', + 'alias', + 'clinic_type' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.clinic'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'clinic', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.clinic'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.clinic', 'clinic', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Clinic Name access controls. + if ($id != 0 && (!$user->authorise('clinic.edit.clinic_name', 'com_ehealth_portal.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('clinic.edit.clinic_name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('clinic_name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('clinic_name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('clinic_name')) + { + // Disable fields while saving. + $form->setFieldAttribute('clinic_name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('clinic_name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('clinic.edit.description', 'com_ehealth_portal.clinic.' . (int) $id)) + || ($id == 0 && !$user->authorise('clinic.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/clinic.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.clinic.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.clinic.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.clinic.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_clinic')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.clinic.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.clinic', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('clinic'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('clinic'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->clinic_name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->clinic_name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('clinic'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the clinic_name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['clinic_name'] == $origTable->clinic_name) + { + list($clinic_name, $alias) = $this->_generateNewTitle($data['alias'], $data['clinic_name']); + $data['clinic_name'] = $clinic_name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['clinic_name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['clinic_name']); + } + + $table = JTable::getInstance('clinic', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_CLINIC_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/clinics.php b/admin/models/clinics.php new file mode 100644 index 0000000..5b4cee4 --- /dev/null +++ b/admin/models/clinics.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Clinics Model + */ +class Ehealth_portalModelClinics extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.clinic_name','clinic_name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $clinic_name = $this->getUserStateFromRequest($this->context . '.filter.clinic_name', 'filter_clinic_name'); + if ($formSubmited) + { + $clinic_name = $app->input->post->get('clinic_name'); + $this->setState('filter.clinic_name', $clinic_name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_clinic', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.clinic_name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_clinic table + $query->from($db->quoteName('#__ehealth_portal_clinic', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_clinic"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.clinic_name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_clinic')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_clinic'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/counseling_type.php b/admin/models/counseling_type.php new file mode 100644 index 0000000..c40d6ea --- /dev/null +++ b/admin/models/counseling_type.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Counseling_type Model + */ +class Ehealth_portalModelCounseling_type extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.counseling_type'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'counseling_type', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.counseling_type'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.counseling_type', 'counseling_type', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.counseling_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('counseling_type.edit.name', 'com_ehealth_portal.counseling_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('counseling_type.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('counseling_type.edit.description', 'com_ehealth_portal.counseling_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('counseling_type.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/counseling_type.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.counseling_type.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.counseling_type.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.counseling_type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_counseling_type')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.counseling_type.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.counseling_type', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('counseling_type'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('counseling_type'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('counseling_type'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('counseling_type', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_COUNSELING_TYPE_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/counseling_types.php b/admin/models/counseling_types.php new file mode 100644 index 0000000..e9ddc35 --- /dev/null +++ b/admin/models/counseling_types.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Counseling_types Model + */ +class Ehealth_portalModelCounseling_types extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_counseling_type', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_counseling_type table + $query->from($db->quoteName('#__ehealth_portal_counseling_type', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_counseling_type"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_counseling_type')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_counseling_type'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/diagnosis_type.php b/admin/models/diagnosis_type.php new file mode 100644 index 0000000..c8cb681 --- /dev/null +++ b/admin/models/diagnosis_type.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Diagnosis_type Model + */ +class Ehealth_portalModelDiagnosis_type extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.diagnosis_type'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'diagnosis_type', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.diagnosis_type'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.diagnosis_type', 'diagnosis_type', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.diagnosis_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('diagnosis_type.edit.name', 'com_ehealth_portal.diagnosis_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('diagnosis_type.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('diagnosis_type.edit.description', 'com_ehealth_portal.diagnosis_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('diagnosis_type.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/diagnosis_type.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.diagnosis_type.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.diagnosis_type.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.diagnosis_type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_diagnosis_type')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.diagnosis_type.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.diagnosis_type', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('diagnosis_type'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('diagnosis_type'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('diagnosis_type'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('diagnosis_type', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/diagnosis_types.php b/admin/models/diagnosis_types.php new file mode 100644 index 0000000..5c4519f --- /dev/null +++ b/admin/models/diagnosis_types.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Diagnosis_types Model + */ +class Ehealth_portalModelDiagnosis_types extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_diagnosis_type', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_diagnosis_type table + $query->from($db->quoteName('#__ehealth_portal_diagnosis_type', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_diagnosis_type"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_diagnosis_type')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_diagnosis_type'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/ehealth_portal.php b/admin/models/ehealth_portal.php new file mode 100644 index 0000000..0860906 --- /dev/null +++ b/admin/models/ehealth_portal.php @@ -0,0 +1,345 @@ + + @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'); + +/** + * Ehealth_portal Model + */ +class Ehealth_portalModelEhealth_portal extends JModelList +{ + public function getIcons() + { + // load user for access menus + $user = JFactory::getUser(); + // reset icon array + $icons = array(); + // view groups array + $viewGroups = array( + 'main' => array('png.payment.add', 'png.payments', 'png.general_medical_check_up.add', 'png.general_medical_check_ups', 'png.antenatal_care.add', 'png.antenatal_cares', 'png.immunisation.add', 'png.immunisations', 'png.vmmc.add', 'png.vmmcs', 'png.prostate_and_testicular_cancer.add', 'png.prostate_and_testicular_cancers', 'png.tuberculosis.add', 'png.tuberculoses', 'png.hiv_counseling_and_testing.add', 'png.hiv_counselings_and_testings', 'png.family_planning.add', 'png.family_plannings', 'png.health_education.add', 'png.health_educations', 'png.cervical_cancer.add', 'png.cervical_cancers', 'png.breast_cancer.add', 'png.breast_cancers', 'png.test.add', 'png.tests', 'png.patient_queue') + ); + // view access array + $viewAccess = array( + 'patient_queue.access' => 'patient_queue.access', + 'patient_queue.submenu' => 'patient_queue.submenu', + 'patient_queue.dashboard_list' => 'patient_queue.dashboard_list', + 'payments.access' => 'payment.access', + 'payment.access' => 'payment.access', + 'payments.submenu' => 'payment.submenu', + 'payments.dashboard_list' => 'payment.dashboard_list', + 'payment.dashboard_add' => 'payment.dashboard_add', + 'general_medical_check_ups.access' => 'general_medical_check_up.access', + 'general_medical_check_up.access' => 'general_medical_check_up.access', + 'general_medical_check_ups.submenu' => 'general_medical_check_up.submenu', + 'general_medical_check_ups.dashboard_list' => 'general_medical_check_up.dashboard_list', + 'general_medical_check_up.dashboard_add' => 'general_medical_check_up.dashboard_add', + 'antenatal_cares.access' => 'antenatal_care.access', + 'antenatal_care.access' => 'antenatal_care.access', + 'antenatal_cares.submenu' => 'antenatal_care.submenu', + 'antenatal_cares.dashboard_list' => 'antenatal_care.dashboard_list', + 'antenatal_care.dashboard_add' => 'antenatal_care.dashboard_add', + 'immunisations.access' => 'immunisation.access', + 'immunisation.access' => 'immunisation.access', + 'immunisations.submenu' => 'immunisation.submenu', + 'immunisations.dashboard_list' => 'immunisation.dashboard_list', + 'immunisation.dashboard_add' => 'immunisation.dashboard_add', + 'vmmcs.access' => 'vmmc.access', + 'vmmc.access' => 'vmmc.access', + 'vmmcs.submenu' => 'vmmc.submenu', + 'vmmcs.dashboard_list' => 'vmmc.dashboard_list', + 'vmmc.dashboard_add' => 'vmmc.dashboard_add', + 'prostate_and_testicular_cancers.access' => 'prostate_and_testicular_cancer.access', + 'prostate_and_testicular_cancer.access' => 'prostate_and_testicular_cancer.access', + 'prostate_and_testicular_cancers.submenu' => 'prostate_and_testicular_cancer.submenu', + 'prostate_and_testicular_cancers.dashboard_list' => 'prostate_and_testicular_cancer.dashboard_list', + 'prostate_and_testicular_cancer.dashboard_add' => 'prostate_and_testicular_cancer.dashboard_add', + 'tuberculoses.access' => 'tuberculosis.access', + 'tuberculosis.access' => 'tuberculosis.access', + 'tuberculoses.submenu' => 'tuberculosis.submenu', + 'tuberculoses.dashboard_list' => 'tuberculosis.dashboard_list', + 'tuberculosis.dashboard_add' => 'tuberculosis.dashboard_add', + 'hiv_counselings_and_testings.access' => 'hiv_counseling_and_testing.access', + 'hiv_counseling_and_testing.access' => 'hiv_counseling_and_testing.access', + 'hiv_counselings_and_testings.submenu' => 'hiv_counseling_and_testing.submenu', + 'hiv_counselings_and_testings.dashboard_list' => 'hiv_counseling_and_testing.dashboard_list', + 'hiv_counseling_and_testing.dashboard_add' => 'hiv_counseling_and_testing.dashboard_add', + 'family_plannings.access' => 'family_planning.access', + 'family_planning.access' => 'family_planning.access', + 'family_plannings.submenu' => 'family_planning.submenu', + 'family_plannings.dashboard_list' => 'family_planning.dashboard_list', + 'family_planning.dashboard_add' => 'family_planning.dashboard_add', + 'health_educations.access' => 'health_education.access', + 'health_education.access' => 'health_education.access', + 'health_educations.submenu' => 'health_education.submenu', + 'health_educations.dashboard_list' => 'health_education.dashboard_list', + 'health_education.dashboard_add' => 'health_education.dashboard_add', + 'cervical_cancers.access' => 'cervical_cancer.access', + 'cervical_cancer.access' => 'cervical_cancer.access', + 'cervical_cancers.submenu' => 'cervical_cancer.submenu', + 'cervical_cancers.dashboard_list' => 'cervical_cancer.dashboard_list', + 'cervical_cancer.dashboard_add' => 'cervical_cancer.dashboard_add', + 'breast_cancers.access' => 'breast_cancer.access', + 'breast_cancer.access' => 'breast_cancer.access', + 'breast_cancers.submenu' => 'breast_cancer.submenu', + 'breast_cancers.dashboard_list' => 'breast_cancer.dashboard_list', + 'breast_cancer.dashboard_add' => 'breast_cancer.dashboard_add', + 'tests.access' => 'test.access', + 'test.access' => 'test.access', + 'tests.submenu' => 'test.submenu', + 'tests.dashboard_list' => 'test.dashboard_list', + 'test.dashboard_add' => 'test.dashboard_add', + 'immunisation_vaccine_types.access' => 'immunisation_vaccine_type.access', + 'immunisation_vaccine_type.access' => 'immunisation_vaccine_type.access', + 'immunisation_vaccine_types.submenu' => 'immunisation_vaccine_type.submenu', + 'foetal_presentations.access' => 'foetal_presentation.access', + 'foetal_presentation.access' => 'foetal_presentation.access', + 'foetal_lies.access' => 'foetal_lie.access', + 'foetal_lie.access' => 'foetal_lie.access', + 'counseling_types.access' => 'counseling_type.access', + 'counseling_type.access' => 'counseling_type.access', + 'foetal_engagements.access' => 'foetal_engagement.access', + 'foetal_engagement.access' => 'foetal_engagement.access', + 'health_education_topics.access' => 'health_education_topic.access', + 'health_education_topic.access' => 'health_education_topic.access', + 'testing_reasons.access' => 'testing_reason.access', + 'testing_reason.access' => 'testing_reason.access', + 'clinics.access' => 'clinic.access', + 'clinic.access' => 'clinic.access', + 'immunisation_types.access' => 'immunisation_type.access', + 'immunisation_type.access' => 'immunisation_type.access', + 'units.access' => 'unit.access', + 'unit.access' => 'unit.access', + 'units.submenu' => 'unit.submenu', + 'referrals.access' => 'referral.access', + 'referral.access' => 'referral.access', + 'referrals.submenu' => 'referral.submenu', + 'planning_types.access' => 'planning_type.access', + 'planning_type.access' => 'planning_type.access', + 'diagnosis_types.access' => 'diagnosis_type.access', + 'diagnosis_type.access' => 'diagnosis_type.access', + 'nonpay_reasons.access' => 'nonpay_reason.access', + 'nonpay_reason.access' => 'nonpay_reason.access', + 'medications.access' => 'medication.access', + 'medication.access' => 'medication.access', + 'medications.submenu' => 'medication.submenu', + 'payment_amounts.access' => 'payment_amount.access', + 'payment_amount.access' => 'payment_amount.access', + 'administration_parts.access' => 'administration_part.access', + 'administration_part.access' => 'administration_part.access', + 'administration_parts.submenu' => 'administration_part.submenu', + 'payment_types.access' => 'payment_type.access', + 'payment_type.access' => 'payment_type.access', + 'strengths.access' => 'strength.access', + 'strength.access' => 'strength.access', + 'strengths.submenu' => 'strength.submenu', + 'sites.access' => 'site.access', + 'site.access' => 'site.access'); + // loop over the $views + foreach($viewGroups as $group => $views) + { + $i = 0; + if (Ehealth_portalHelper::checkArray($views)) + { + foreach($views as $view) + { + $add = false; + // external views (links) + if (strpos($view,'||') !== false) + { + $dwd = explode('||', $view); + if (count($dwd) == 3) + { + list($type, $name, $url) = $dwd; + $viewName = $name; + $alt = $name; + $url = $url; + $image = $name . '.' . $type; + $name = 'COM_EHEALTH_PORTAL_DASHBOARD_' . Ehealth_portalHelper::safeString($name,'U'); + } + } + // internal views + elseif (strpos($view,'.') !== false) + { + $dwd = explode('.', $view); + if (count($dwd) == 3) + { + list($type, $name, $action) = $dwd; + } + elseif (count($dwd) == 2) + { + list($type, $name) = $dwd; + $action = false; + } + if ($action) + { + $viewName = $name; + switch($action) + { + case 'add': + $url = 'index.php?option=com_ehealth_portal&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; + $name = 'COM_EHEALTH_PORTAL_DASHBOARD_'.Ehealth_portalHelper::safeString($name,'U').'_ADD'; + $add = true; + break; + default: + // check for new convention (more stable) + if (strpos($action, '_qpo0O0oqp_') !== false) + { + list($action, $extension) = (array) explode('_qpo0O0oqp_', $action); + $extension = str_replace('_po0O0oq_', '.', $extension); + } + else + { + $extension = 'com_ehealth_portal.' . $name; + } + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_EHEALTH_PORTAL_DASHBOARD_' . Ehealth_portalHelper::safeString($name,'U') . '_' . Ehealth_portalHelper::safeString($action,'U'); + break; + } + } + else + { + $viewName = $name; + $alt = $name; + $url = 'index.php?option=com_ehealth_portal&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_EHEALTH_PORTAL_DASHBOARD_' . Ehealth_portalHelper::safeString($name,'U'); + $hover = false; + } + } + else + { + $viewName = $view; + $alt = $view; + $url = 'index.php?option=com_ehealth_portal&view=' . $view; + $image = $view . '.png'; + $name = ucwords($view).'

'; + $hover = false; + } + // first make sure the view access is set + if (Ehealth_portalHelper::checkArray($viewAccess)) + { + // setup some defaults + $dashboard_add = false; + $dashboard_list = false; + $accessTo = ''; + $accessAdd = ''; + // access checking start + $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? Ehealth_portalHelper::checkString($viewAccess[$viewName.'.create']):false; + $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? Ehealth_portalHelper::checkString($viewAccess[$viewName.'.access']):false; + // set main controllers + $accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? Ehealth_portalHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false; + $accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? Ehealth_portalHelper::checkString($viewAccess[$viewName.'.dashboard_list']):false; + // check for adding access + if ($add && $accessCreate) + { + $accessAdd = $viewAccess[$viewName.'.create']; + } + elseif ($add) + { + $accessAdd = 'core.create'; + } + // check if access to view is set + if ($accessAccess) + { + $accessTo = $viewAccess[$viewName.'.access']; + } + // set main access controllers + if ($accessDashboard_add) + { + $dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_ehealth_portal'); + } + if ($accessDashboard_list) + { + $dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_ehealth_portal'); + } + if (Ehealth_portalHelper::checkString($accessAdd) && Ehealth_portalHelper::checkString($accessTo)) + { + // check access + if($user->authorise($accessAdd, 'com_ehealth_portal') && $user->authorise($accessTo, 'com_ehealth_portal') && $dashboard_add) + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + elseif (Ehealth_portalHelper::checkString($accessTo)) + { + // check access + if($user->authorise($accessTo, 'com_ehealth_portal') && $dashboard_list) + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + elseif (Ehealth_portalHelper::checkString($accessAdd)) + { + // check access + if($user->authorise($accessAdd, 'com_ehealth_portal') && $dashboard_add) + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + else + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + } + else + { + $icons[$group][$i] = new StdClass; + $icons[$group][$i]->url = $url; + $icons[$group][$i]->name = $name; + $icons[$group][$i]->image = $image; + $icons[$group][$i]->alt = $alt; + } + $i++; + } + } + else + { + $icons[$group][$i] = false; + } + } + return $icons; + } +} diff --git a/admin/models/family_planning.php b/admin/models/family_planning.php new file mode 100644 index 0000000..4a92468 --- /dev/null +++ b/admin/models/family_planning.php @@ -0,0 +1,878 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Family_planning Model + */ +class Ehealth_portalModelFamily_planning extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'diagnosis' + ), + 'above' => array( + 'patient' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.family_planning'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'family_planning', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.family_planning'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.family_planning', 'family_planning', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.family_planning.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Diagnosis access controls. + if ($id != 0 && (!$user->authorise('family_planning.edit.diagnosis', 'com_ehealth_portal.family_planning.' . (int) $id)) + || ($id == 0 && !$user->authorise('family_planning.edit.diagnosis', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('diagnosis', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('diagnosis', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('diagnosis')) + { + // Disable fields while saving. + $form->setFieldAttribute('diagnosis', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('diagnosis', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/family_planning.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.family_planning.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.family_planning.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.family_planning.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_family_planning')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.family_planning.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.family_planning', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('family_planning'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('family_planning'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('family_planning'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/family_plannings.php b/admin/models/family_plannings.php new file mode 100644 index 0000000..b1e6155 --- /dev/null +++ b/admin/models/family_plannings.php @@ -0,0 +1,435 @@ + + @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\Utilities\ArrayHelper; + +/** + * Family_plannings Model + */ +class Ehealth_portalModelFamily_plannings extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient', + 'g.name','diagnosis' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + $diagnosis = $this->getUserStateFromRequest($this->context . '.filter.diagnosis', 'filter_diagnosis'); + if ($formSubmited) + { + $diagnosis = $app->input->post->get('diagnosis'); + $this->setState('filter.diagnosis', $diagnosis); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_family_planning', 'a')); + + // From the ehealth_portal_planning_type table. + $query->select($db->quoteName('g.name','diagnosis_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_planning_type', 'g') . ' ON (' . $db->quoteName('a.diagnosis') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.' OR a.diagnosis LIKE '.$search.' OR g.name LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_family_planning table + $query->from($db->quoteName('#__ehealth_portal_family_planning', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_family_planning"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + $id .= ':' . $this->getState('filter.diagnosis'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_family_planning')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_family_planning'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/fields/administrationparts.php b/admin/models/fields/administrationparts.php new file mode 100644 index 0000000..772d934 --- /dev/null +++ b/admin/models/fields/administrationparts.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Administrationparts Form Field class for the Ehealth_portal component + */ +class JFormFieldAdministrationparts extends JFormFieldList +{ + /** + * The administrationparts field type. + * + * @var string + */ + public $type = 'administrationparts'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create administration_part + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit administration_part + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=administration_parts&task=administration_part.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for administration_part field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','administration_part_name'))); + $query->from($db->quoteName('#__ehealth_portal_administration_part', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_administration_part'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->administration_part_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/antenatalcaresfilterpatient.php b/admin/models/fields/antenatalcaresfilterpatient.php new file mode 100644 index 0000000..ebe797b --- /dev/null +++ b/admin/models/fields/antenatalcaresfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Antenatalcaresfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldAntenatalcaresfilterpatient extends JFormFieldList +{ + /** + * The antenatalcaresfilterpatient field type. + * + * @var string + */ + public $type = 'antenatalcaresfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_antenatal_care')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/breastcancersfilterpatient.php b/admin/models/fields/breastcancersfilterpatient.php new file mode 100644 index 0000000..b5424c1 --- /dev/null +++ b/admin/models/fields/breastcancersfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Breastcancersfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldBreastcancersfilterpatient extends JFormFieldList +{ + /** + * The breastcancersfilterpatient field type. + * + * @var string + */ + public $type = 'breastcancersfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_breast_cancer')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/cervicalcancersfilterpatient.php b/admin/models/fields/cervicalcancersfilterpatient.php new file mode 100644 index 0000000..4d89548 --- /dev/null +++ b/admin/models/fields/cervicalcancersfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Cervicalcancersfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldCervicalcancersfilterpatient extends JFormFieldList +{ + /** + * The cervicalcancersfilterpatient field type. + * + * @var string + */ + public $type = 'cervicalcancersfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_cervical_cancer')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/diagnosis.php b/admin/models/fields/diagnosis.php new file mode 100644 index 0000000..a7f00c4 --- /dev/null +++ b/admin/models/fields/diagnosis.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Diagnosis Form Field class for the Ehealth_portal component + */ +class JFormFieldDiagnosis extends JFormFieldList +{ + /** + * The diagnosis field type. + * + * @var string + */ + public $type = 'diagnosis'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create diagnosis_type + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit diagnosis_type + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=diagnosis_types&task=diagnosis_type.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for diagnosis_type field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','diagnosis_name'))); + $query->from($db->quoteName('#__ehealth_portal_diagnosis_type', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_diagnosis_type'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->diagnosis_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/familyplanning.php b/admin/models/fields/familyplanning.php new file mode 100644 index 0000000..df04405 --- /dev/null +++ b/admin/models/fields/familyplanning.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Familyplanning Form Field class for the Ehealth_portal component + */ +class JFormFieldFamilyplanning extends JFormFieldList +{ + /** + * The familyplanning field type. + * + * @var string + */ + public $type = 'familyplanning'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create planning_type + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit planning_type + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=planning_types&task=planning_type.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for planning_type field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','diagnosis_name'))); + $query->from($db->quoteName('#__ehealth_portal_planning_type', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_planning_type'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->diagnosis_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/familyplanningsfilterpatient.php b/admin/models/fields/familyplanningsfilterpatient.php new file mode 100644 index 0000000..e24ee57 --- /dev/null +++ b/admin/models/fields/familyplanningsfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Familyplanningsfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldFamilyplanningsfilterpatient extends JFormFieldList +{ + /** + * The familyplanningsfilterpatient field type. + * + * @var string + */ + public $type = 'familyplanningsfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_family_planning')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/foetalengagement.php b/admin/models/fields/foetalengagement.php new file mode 100644 index 0000000..7e50935 --- /dev/null +++ b/admin/models/fields/foetalengagement.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Foetalengagement Form Field class for the Ehealth_portal component + */ +class JFormFieldFoetalengagement extends JFormFieldList +{ + /** + * The foetalengagement field type. + * + * @var string + */ + public $type = 'foetalengagement'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create foetal_engagement + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit foetal_engagement + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=foetal_engagements&task=foetal_engagement.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for foetal_engagement field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','foetal_engagement_name'))); + $query->from($db->quoteName('#__ehealth_portal_foetal_engagement', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_foetal_engagement'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->foetal_engagement_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/foetallie.php b/admin/models/fields/foetallie.php new file mode 100644 index 0000000..857868f --- /dev/null +++ b/admin/models/fields/foetallie.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Foetallie Form Field class for the Ehealth_portal component + */ +class JFormFieldFoetallie extends JFormFieldList +{ + /** + * The foetallie field type. + * + * @var string + */ + public $type = 'foetallie'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create foetal_lie + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit foetal_lie + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=foetal_lies&task=foetal_lie.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for foetal_lie field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','foetal_lie_name'))); + $query->from($db->quoteName('#__ehealth_portal_foetal_lie', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_foetal_lie'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->foetal_lie_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/foetalpresentation.php b/admin/models/fields/foetalpresentation.php new file mode 100644 index 0000000..d66afd4 --- /dev/null +++ b/admin/models/fields/foetalpresentation.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Foetalpresentation Form Field class for the Ehealth_portal component + */ +class JFormFieldFoetalpresentation extends JFormFieldList +{ + /** + * The foetalpresentation field type. + * + * @var string + */ + public $type = 'foetalpresentation'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create foetal_presentation + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit foetal_presentation + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=foetal_presentations&task=foetal_presentation.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for foetal_presentation field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','foetal_presentation_name'))); + $query->from($db->quoteName('#__ehealth_portal_foetal_presentation', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_foetal_presentation'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->foetal_presentation_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/generalmedicalcheckupsfilterpatient.php b/admin/models/fields/generalmedicalcheckupsfilterpatient.php new file mode 100644 index 0000000..9714d89 --- /dev/null +++ b/admin/models/fields/generalmedicalcheckupsfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Generalmedicalcheckupsfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldGeneralmedicalcheckupsfilterpatient extends JFormFieldList +{ + /** + * The generalmedicalcheckupsfilterpatient field type. + * + * @var string + */ + public $type = 'generalmedicalcheckupsfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_general_medical_check_up')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/healtheducationsfiltereducationtype.php b/admin/models/fields/healtheducationsfiltereducationtype.php new file mode 100644 index 0000000..3921b00 --- /dev/null +++ b/admin/models/fields/healtheducationsfiltereducationtype.php @@ -0,0 +1,85 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Healtheducationsfiltereducationtype Form Field class for the Ehealth_portal component + */ +class JFormFieldHealtheducationsfiltereducationtype extends JFormFieldList +{ + /** + * The healtheducationsfiltereducationtype field type. + * + * @var string + */ + public $type = 'healtheducationsfiltereducationtype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('education_type')); + $query->from($db->quoteName('#__ehealth_portal_health_education')); + $query->order($db->quoteName('education_type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_TYPE') . ' -'); + + if ($results) + { + // get health_educationsmodel + $model = Ehealth_portalHelper::getModel('health_educations'); + $results = array_unique($results); + foreach ($results as $education_type) + { + // Translate the education_type selection + $text = $model->selectionTranslation($education_type,'education_type'); + // Now add the education_type and its text to the options array + $_filter[] = JHtml::_('select.option', $education_type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/healtheducationsfilterpatient.php b/admin/models/fields/healtheducationsfilterpatient.php new file mode 100644 index 0000000..0174342 --- /dev/null +++ b/admin/models/fields/healtheducationsfilterpatient.php @@ -0,0 +1,80 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Healtheducationsfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldHealtheducationsfilterpatient extends JFormFieldList +{ + /** + * The healtheducationsfilterpatient field type. + * + * @var string + */ + public $type = 'healtheducationsfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_health_education')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/healtheducationtopics.php b/admin/models/fields/healtheducationtopics.php new file mode 100644 index 0000000..de28c21 --- /dev/null +++ b/admin/models/fields/healtheducationtopics.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Healtheducationtopics Form Field class for the Ehealth_portal component + */ +class JFormFieldHealtheducationtopics extends JFormFieldList +{ + /** + * The healtheducationtopics field type. + * + * @var string + */ + public $type = 'healtheducationtopics'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create health_education_topic + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit health_education_topic + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=health_education_topics&task=health_education_topic.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for health_education_topic field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','health_education_topic_name'))); + $query->from($db->quoteName('#__ehealth_portal_health_education_topic', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_health_education_topic'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->health_education_topic_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/hivcounselingsandtestingsfilterpatient.php b/admin/models/fields/hivcounselingsandtestingsfilterpatient.php new file mode 100644 index 0000000..af571d0 --- /dev/null +++ b/admin/models/fields/hivcounselingsandtestingsfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Hivcounselingsandtestingsfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldHivcounselingsandtestingsfilterpatient extends JFormFieldList +{ + /** + * The hivcounselingsandtestingsfilterpatient field type. + * + * @var string + */ + public $type = 'hivcounselingsandtestingsfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_hiv_counseling_and_testing')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/immunisationsfilterpatient.php b/admin/models/fields/immunisationsfilterpatient.php new file mode 100644 index 0000000..ca4aabd --- /dev/null +++ b/admin/models/fields/immunisationsfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Immunisationsfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldImmunisationsfilterpatient extends JFormFieldList +{ + /** + * The immunisationsfilterpatient field type. + * + * @var string + */ + public $type = 'immunisationsfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_immunisation')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/immunisationtype.php b/admin/models/fields/immunisationtype.php new file mode 100644 index 0000000..ae71a45 --- /dev/null +++ b/admin/models/fields/immunisationtype.php @@ -0,0 +1,84 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Immunisationtype Form Field class for the Ehealth_portal component + */ +class JFormFieldImmunisationtype extends JFormFieldList +{ + /** + * The immunisationtype field type. + * + * @var string + */ + public $type = 'immunisationtype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','immunisation_type_name'))); + $query->from($db->quoteName('#__ehealth_portal_immunisation_type', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_immunisation_type'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->immunisation_type_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/immunisationvaccinetypes.php b/admin/models/fields/immunisationvaccinetypes.php new file mode 100644 index 0000000..5ede20c --- /dev/null +++ b/admin/models/fields/immunisationvaccinetypes.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Immunisationvaccinetypes Form Field class for the Ehealth_portal component + */ +class JFormFieldImmunisationvaccinetypes extends JFormFieldList +{ + /** + * The immunisationvaccinetypes field type. + * + * @var string + */ + public $type = 'immunisationvaccinetypes'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create immunisation_vaccine_type + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit immunisation_vaccine_type + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=immunisation_vaccine_types&task=immunisation_vaccine_type.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for immunisation_vaccine_type field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','immunisation_vaccine_type_name'))); + $query->from($db->quoteName('#__ehealth_portal_immunisation_vaccine_type', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_immunisation_vaccine_type'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->immunisation_vaccine_type_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/index.html b/admin/models/fields/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/models/fields/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/models/fields/medication.php b/admin/models/fields/medication.php new file mode 100644 index 0000000..86afee5 --- /dev/null +++ b/admin/models/fields/medication.php @@ -0,0 +1,84 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Medication Form Field class for the Ehealth_portal component + */ +class JFormFieldMedication extends JFormFieldList +{ + /** + * The medication field type. + * + * @var string + */ + public $type = 'medication'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','medication_name'))); + $query->from($db->quoteName('#__ehealth_portal_medication', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_medication'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->medication_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/nonpayreason.php b/admin/models/fields/nonpayreason.php new file mode 100644 index 0000000..b7a3953 --- /dev/null +++ b/admin/models/fields/nonpayreason.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Nonpayreason Form Field class for the Ehealth_portal component + */ +class JFormFieldNonpayreason extends JFormFieldList +{ + /** + * The nonpayreason field type. + * + * @var string + */ + public $type = 'nonpayreason'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create nonpay_reason + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit nonpay_reason + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=nonpay_reasons&task=nonpay_reason.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for nonpay_reason field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','nonpay_reason_name'))); + $query->from($db->quoteName('#__ehealth_portal_nonpay_reason', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_nonpay_reason'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->nonpay_reason_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/paymentsfilterpatient.php b/admin/models/fields/paymentsfilterpatient.php new file mode 100644 index 0000000..bec82ab --- /dev/null +++ b/admin/models/fields/paymentsfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Paymentsfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldPaymentsfilterpatient extends JFormFieldList +{ + /** + * The paymentsfilterpatient field type. + * + * @var string + */ + public $type = 'paymentsfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_payment')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/paymentsfilterpaymentamount.php b/admin/models/fields/paymentsfilterpaymentamount.php new file mode 100644 index 0000000..ee139c1 --- /dev/null +++ b/admin/models/fields/paymentsfilterpaymentamount.php @@ -0,0 +1,84 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Paymentsfilterpaymentamount Form Field class for the Ehealth_portal component + */ +class JFormFieldPaymentsfilterpaymentamount extends JFormFieldList +{ + /** + * The paymentsfilterpaymentamount field type. + * + * @var string + */ + public $type = 'paymentsfilterpaymentamount'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('payment_amount')); + $query->from($db->quoteName('#__ehealth_portal_payment')); + $query->order($db->quoteName('payment_amount') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + + if ($results) + { + // get paymentsmodel + $model = Ehealth_portalHelper::getModel('payments'); + $results = array_unique($results); + foreach ($results as $payment_amount) + { + // Translate the payment_amount selection + $text = $model->selectionTranslation($payment_amount,'payment_amount'); + // Now add the payment_amount and its text to the options array + $_filter[] = JHtml::_('select.option', $payment_amount, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/paymentsfilterpaymentcategory.php b/admin/models/fields/paymentsfilterpaymentcategory.php new file mode 100644 index 0000000..b2d7986 --- /dev/null +++ b/admin/models/fields/paymentsfilterpaymentcategory.php @@ -0,0 +1,85 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Paymentsfilterpaymentcategory Form Field class for the Ehealth_portal component + */ +class JFormFieldPaymentsfilterpaymentcategory extends JFormFieldList +{ + /** + * The paymentsfilterpaymentcategory field type. + * + * @var string + */ + public $type = 'paymentsfilterpaymentcategory'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('payment_category')); + $query->from($db->quoteName('#__ehealth_portal_payment')); + $query->order($db->quoteName('payment_category') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PAYMENT_CATEGORY') . ' -'); + + if ($results) + { + // get paymentsmodel + $model = Ehealth_portalHelper::getModel('payments'); + $results = array_unique($results); + foreach ($results as $payment_category) + { + // Translate the payment_category selection + $text = $model->selectionTranslation($payment_category,'payment_category'); + // Now add the payment_category and its text to the options array + $_filter[] = JHtml::_('select.option', $payment_category, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/paymenttype.php b/admin/models/fields/paymenttype.php new file mode 100644 index 0000000..44024ce --- /dev/null +++ b/admin/models/fields/paymenttype.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Paymenttype Form Field class for the Ehealth_portal component + */ +class JFormFieldPaymenttype extends JFormFieldList +{ + /** + * The paymenttype field type. + * + * @var string + */ + public $type = 'paymenttype'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create payment_type + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit payment_type + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=payment_types&task=payment_type.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for payment_type field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','payment_type_name'))); + $query->from($db->quoteName('#__ehealth_portal_payment_type', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_payment_type'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->payment_type_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/prostateandtesticularcancersfilterpatient.php b/admin/models/fields/prostateandtesticularcancersfilterpatient.php new file mode 100644 index 0000000..2ffa7d3 --- /dev/null +++ b/admin/models/fields/prostateandtesticularcancersfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Prostateandtesticularcancersfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldProstateandtesticularcancersfilterpatient extends JFormFieldList +{ + /** + * The prostateandtesticularcancersfilterpatient field type. + * + * @var string + */ + public $type = 'prostateandtesticularcancersfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_prostate_and_testicular_cancer')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/referrals.php b/admin/models/fields/referrals.php new file mode 100644 index 0000000..d7b5278 --- /dev/null +++ b/admin/models/fields/referrals.php @@ -0,0 +1,192 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Referrals Form Field class for the Ehealth_portal component + */ +class JFormFieldReferrals extends JFormFieldList +{ + /** + * The referrals field type. + * + * @var string + */ + public $type = 'referrals'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create referral + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit referral + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=referrals&task=referral.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for referral field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','referral_name'))); + $query->from($db->quoteName('#__ehealth_portal_referral', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_referral'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + if ($this->multiple === false) { + $options[] = JHtml::_('select.option', '', 'Select Referral'); + } + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->referral_name); + } + } + return $options; + + } +} diff --git a/admin/models/fields/stengths.php b/admin/models/fields/stengths.php new file mode 100644 index 0000000..f1ae0ab --- /dev/null +++ b/admin/models/fields/stengths.php @@ -0,0 +1,84 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Stengths Form Field class for the Ehealth_portal component + */ +class JFormFieldStengths extends JFormFieldList +{ + /** + * The stengths field type. + * + * @var string + */ + public $type = 'stengths'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','strength_name'))); + $query->from($db->quoteName('#__ehealth_portal_strength', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_strength'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->strength_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/testingreason.php b/admin/models/fields/testingreason.php new file mode 100644 index 0000000..a5f7a3a --- /dev/null +++ b/admin/models/fields/testingreason.php @@ -0,0 +1,188 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Testingreason Form Field class for the Ehealth_portal component + */ +class JFormFieldTestingreason extends JFormFieldList +{ + /** + * The testingreason field type. + * + * @var string + */ + public $type = 'testingreason'; + + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $set_button = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($set_button === 'true') + { + $button = array(); + $script = array(); + $button_code_name = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referral if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; + } + // get button label + $button_label = trim($button_code_name); + $button_label = preg_replace('/_+/', ' ', $button_label); + $button_label = preg_replace('/\s+/', ' ', $button_label); + $button_label = preg_replace("/[^A-Za-z ]/", '', $button_label); + $button_label = ucfirst(strtolower($button_label)); + // get user object + $user = JFactory::getUser(); + // only add if user allowed to create testing_reason + if ($user->authorise('core.create', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $button[] = ' + '; + } + // only add if user allowed to edit testing_reason + if ($user->authorise('core.edit', 'com_ehealth_portal') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) { + e.preventDefault(); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val(); + ".$button_code_name."Button(".$button_code_name."Value); + }); + function ".$button_code_name."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$button_code_name."Create').hide(); + // show edit button + jQuery('#".$button_code_name."Edit').show(); + var url = 'index.php?option=com_ehealth_portal&view=testing_reasons&task=testing_reason.edit&id='+value+'".$refJ."'; + jQuery('#".$button_code_name."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$button_code_name."Create').show(); + // hide edit button + jQuery('#".$button_code_name."Edit').hide(); + } + }"; + } + // check if button was created for testing_reason field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','testing_reason_name'))); + $query->from($db->quoteName('#__ehealth_portal_testing_reason', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_testing_reason'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->testing_reason_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/testsfilterpatient.php b/admin/models/fields/testsfilterpatient.php new file mode 100644 index 0000000..87ebc23 --- /dev/null +++ b/admin/models/fields/testsfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Testsfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldTestsfilterpatient extends JFormFieldList +{ + /** + * The testsfilterpatient field type. + * + * @var string + */ + public $type = 'testsfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_test')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/tuberculosesfilterpatient.php b/admin/models/fields/tuberculosesfilterpatient.php new file mode 100644 index 0000000..85095c3 --- /dev/null +++ b/admin/models/fields/tuberculosesfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Tuberculosesfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldTuberculosesfilterpatient extends JFormFieldList +{ + /** + * The tuberculosesfilterpatient field type. + * + * @var string + */ + public $type = 'tuberculosesfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_tuberculosis')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/units.php b/admin/models/fields/units.php new file mode 100644 index 0000000..158e407 --- /dev/null +++ b/admin/models/fields/units.php @@ -0,0 +1,84 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Units Form Field class for the Ehealth_portal component + */ +class JFormFieldUnits extends JFormFieldList +{ + /** + * The units field type. + * + * @var string + */ + public $type = 'units'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get the user object. + $user = JFactory::getUser(); + // Get the databse object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','unit_name'))); + $query->from($db->quoteName('#__ehealth_portal_unit', 'a')); + $query->where($db->quoteName('a.published') . ' = 1'); + $query->order('a.name ASC'); + // Implement View Level Access (if set in table) + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $columns = $db->getTableColumns('#__ehealth_portal_unit'); + if(isset($columns['access'])) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + } + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->unit_name); + } + } + return $options; + } +} diff --git a/admin/models/fields/vmmcsfilterpatient.php b/admin/models/fields/vmmcsfilterpatient.php new file mode 100644 index 0000000..ca6cf67 --- /dev/null +++ b/admin/models/fields/vmmcsfilterpatient.php @@ -0,0 +1,81 @@ + + @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'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Vmmcsfilterpatient Form Field class for the Ehealth_portal component + */ +class JFormFieldVmmcsfilterpatient extends JFormFieldList +{ + /** + * The vmmcsfilterpatient field type. + * + * @var string + */ + public $type = 'vmmcsfilterpatient'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('patient')); + $query->from($db->quoteName('#__ehealth_portal_vmmc')); + $query->order($db->quoteName('patient') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $patient) + { + // Now add the patient and its text to the options array + $_filter[] = JHtml::_('select.option', $patient, JFactory::getUser($patient)->name); + } + } + return $_filter; + } +} diff --git a/admin/models/foetal_engagement.php b/admin/models/foetal_engagement.php new file mode 100644 index 0000000..4a0325a --- /dev/null +++ b/admin/models/foetal_engagement.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Foetal_engagement Model + */ +class Ehealth_portalModelFoetal_engagement extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.foetal_engagement'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'foetal_engagement', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.foetal_engagement'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.foetal_engagement', 'foetal_engagement', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.foetal_engagement.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('foetal_engagement.edit.name', 'com_ehealth_portal.foetal_engagement.' . (int) $id)) + || ($id == 0 && !$user->authorise('foetal_engagement.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('foetal_engagement.edit.description', 'com_ehealth_portal.foetal_engagement.' . (int) $id)) + || ($id == 0 && !$user->authorise('foetal_engagement.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/foetal_engagement.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.foetal_engagement.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.foetal_engagement.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.foetal_engagement.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_foetal_engagement')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.foetal_engagement.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.foetal_engagement', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('foetal_engagement'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('foetal_engagement'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('foetal_engagement'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('foetal_engagement', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/foetal_engagements.php b/admin/models/foetal_engagements.php new file mode 100644 index 0000000..3c0055e --- /dev/null +++ b/admin/models/foetal_engagements.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_engagements Model + */ +class Ehealth_portalModelFoetal_engagements extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_foetal_engagement', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_foetal_engagement table + $query->from($db->quoteName('#__ehealth_portal_foetal_engagement', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_foetal_engagement"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_foetal_engagement')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_foetal_engagement'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/foetal_lie.php b/admin/models/foetal_lie.php new file mode 100644 index 0000000..30206e8 --- /dev/null +++ b/admin/models/foetal_lie.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Foetal_lie Model + */ +class Ehealth_portalModelFoetal_lie extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.foetal_lie'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'foetal_lie', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.foetal_lie'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.foetal_lie', 'foetal_lie', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.foetal_lie.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('foetal_lie.edit.name', 'com_ehealth_portal.foetal_lie.' . (int) $id)) + || ($id == 0 && !$user->authorise('foetal_lie.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('foetal_lie.edit.description', 'com_ehealth_portal.foetal_lie.' . (int) $id)) + || ($id == 0 && !$user->authorise('foetal_lie.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/foetal_lie.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.foetal_lie.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.foetal_lie.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.foetal_lie.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_foetal_lie')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.foetal_lie.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.foetal_lie', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('foetal_lie'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('foetal_lie'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('foetal_lie'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('foetal_lie', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_FOETAL_LIE_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/foetal_lies.php b/admin/models/foetal_lies.php new file mode 100644 index 0000000..9b76b9b --- /dev/null +++ b/admin/models/foetal_lies.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_lies Model + */ +class Ehealth_portalModelFoetal_lies extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_foetal_lie', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_foetal_lie table + $query->from($db->quoteName('#__ehealth_portal_foetal_lie', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_foetal_lie"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_foetal_lie')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_foetal_lie'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/foetal_presentation.php b/admin/models/foetal_presentation.php new file mode 100644 index 0000000..f0dabe5 --- /dev/null +++ b/admin/models/foetal_presentation.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Foetal_presentation Model + */ +class Ehealth_portalModelFoetal_presentation extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.foetal_presentation'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'foetal_presentation', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.foetal_presentation'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.foetal_presentation', 'foetal_presentation', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.foetal_presentation.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('foetal_presentation.edit.name', 'com_ehealth_portal.foetal_presentation.' . (int) $id)) + || ($id == 0 && !$user->authorise('foetal_presentation.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('foetal_presentation.edit.description', 'com_ehealth_portal.foetal_presentation.' . (int) $id)) + || ($id == 0 && !$user->authorise('foetal_presentation.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/foetal_presentation.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.foetal_presentation.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.foetal_presentation.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.foetal_presentation.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_foetal_presentation')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.foetal_presentation.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.foetal_presentation', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('foetal_presentation'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('foetal_presentation'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('foetal_presentation'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('foetal_presentation', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/foetal_presentations.php b/admin/models/foetal_presentations.php new file mode 100644 index 0000000..7f43ed4 --- /dev/null +++ b/admin/models/foetal_presentations.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Foetal_presentations Model + */ +class Ehealth_portalModelFoetal_presentations extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_foetal_presentation', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_foetal_presentation table + $query->from($db->quoteName('#__ehealth_portal_foetal_presentation', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_foetal_presentation"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_foetal_presentation')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_foetal_presentation'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/forms/administration_part.xml b/admin/models/forms/administration_part.xml new file mode 100644 index 0000000..7ca6943 --- /dev/null +++ b/admin/models/forms/administration_part.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/antenatal_care.xml b/admin/models/forms/antenatal_care.xml new file mode 100644 index 0000000..c6d5df1 --- /dev/null +++ b/admin/models/forms/antenatal_care.xml @@ -0,0 +1,250 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/breast_cancer.xml b/admin/models/forms/breast_cancer.xml new file mode 100644 index 0000000..a33864e --- /dev/null +++ b/admin/models/forms/breast_cancer.xml @@ -0,0 +1,453 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/cervical_cancer.xml b/admin/models/forms/cervical_cancer.xml new file mode 100644 index 0000000..3622502 --- /dev/null +++ b/admin/models/forms/cervical_cancer.xml @@ -0,0 +1,366 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/clinic.xml b/admin/models/forms/clinic.xml new file mode 100644 index 0000000..4656fbb --- /dev/null +++ b/admin/models/forms/clinic.xml @@ -0,0 +1,173 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/counseling_type.xml b/admin/models/forms/counseling_type.xml new file mode 100644 index 0000000..5eefde6 --- /dev/null +++ b/admin/models/forms/counseling_type.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/diagnosis_type.xml b/admin/models/forms/diagnosis_type.xml new file mode 100644 index 0000000..a7f99d8 --- /dev/null +++ b/admin/models/forms/diagnosis_type.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/family_planning.xml b/admin/models/forms/family_planning.xml new file mode 100644 index 0000000..9d73d28 --- /dev/null +++ b/admin/models/forms/family_planning.xml @@ -0,0 +1,136 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/filter_administration_parts.xml b/admin/models/forms/filter_administration_parts.xml new file mode 100644 index 0000000..904d95b --- /dev/null +++ b/admin/models/forms/filter_administration_parts.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_antenatal_cares.xml b/admin/models/forms/filter_antenatal_cares.xml new file mode 100644 index 0000000..5c97fa9 --- /dev/null +++ b/admin/models/forms/filter_antenatal_cares.xml @@ -0,0 +1,81 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_breast_cancers.xml b/admin/models/forms/filter_breast_cancers.xml new file mode 100644 index 0000000..23a1d5c --- /dev/null +++ b/admin/models/forms/filter_breast_cancers.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_cervical_cancers.xml b/admin/models/forms/filter_cervical_cancers.xml new file mode 100644 index 0000000..756779f --- /dev/null +++ b/admin/models/forms/filter_cervical_cancers.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_clinics.xml b/admin/models/forms/filter_clinics.xml new file mode 100644 index 0000000..e9cd438 --- /dev/null +++ b/admin/models/forms/filter_clinics.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_counseling_types.xml b/admin/models/forms/filter_counseling_types.xml new file mode 100644 index 0000000..e087cff --- /dev/null +++ b/admin/models/forms/filter_counseling_types.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_diagnosis_types.xml b/admin/models/forms/filter_diagnosis_types.xml new file mode 100644 index 0000000..270b70d --- /dev/null +++ b/admin/models/forms/filter_diagnosis_types.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_family_plannings.xml b/admin/models/forms/filter_family_plannings.xml new file mode 100644 index 0000000..fda08e4 --- /dev/null +++ b/admin/models/forms/filter_family_plannings.xml @@ -0,0 +1,76 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_foetal_engagements.xml b/admin/models/forms/filter_foetal_engagements.xml new file mode 100644 index 0000000..3dead1b --- /dev/null +++ b/admin/models/forms/filter_foetal_engagements.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_foetal_lies.xml b/admin/models/forms/filter_foetal_lies.xml new file mode 100644 index 0000000..69da086 --- /dev/null +++ b/admin/models/forms/filter_foetal_lies.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_foetal_presentations.xml b/admin/models/forms/filter_foetal_presentations.xml new file mode 100644 index 0000000..973e66b --- /dev/null +++ b/admin/models/forms/filter_foetal_presentations.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_general_medical_check_ups.xml b/admin/models/forms/filter_general_medical_check_ups.xml new file mode 100644 index 0000000..5a2e08e --- /dev/null +++ b/admin/models/forms/filter_general_medical_check_ups.xml @@ -0,0 +1,94 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_health_education_topics.xml b/admin/models/forms/filter_health_education_topics.xml new file mode 100644 index 0000000..3aef82d --- /dev/null +++ b/admin/models/forms/filter_health_education_topics.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_health_educations.xml b/admin/models/forms/filter_health_educations.xml new file mode 100644 index 0000000..e0545a8 --- /dev/null +++ b/admin/models/forms/filter_health_educations.xml @@ -0,0 +1,84 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_hiv_counselings_and_testings.xml b/admin/models/forms/filter_hiv_counselings_and_testings.xml new file mode 100644 index 0000000..54a49bf --- /dev/null +++ b/admin/models/forms/filter_hiv_counselings_and_testings.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_immunisation_types.xml b/admin/models/forms/filter_immunisation_types.xml new file mode 100644 index 0000000..893ce7c --- /dev/null +++ b/admin/models/forms/filter_immunisation_types.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_immunisation_vaccine_types.xml b/admin/models/forms/filter_immunisation_vaccine_types.xml new file mode 100644 index 0000000..b80e423 --- /dev/null +++ b/admin/models/forms/filter_immunisation_vaccine_types.xml @@ -0,0 +1,78 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_immunisations.xml b/admin/models/forms/filter_immunisations.xml new file mode 100644 index 0000000..b537658 --- /dev/null +++ b/admin/models/forms/filter_immunisations.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_medications.xml b/admin/models/forms/filter_medications.xml new file mode 100644 index 0000000..d2ae6e1 --- /dev/null +++ b/admin/models/forms/filter_medications.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_nonpay_reasons.xml b/admin/models/forms/filter_nonpay_reasons.xml new file mode 100644 index 0000000..854804a --- /dev/null +++ b/admin/models/forms/filter_nonpay_reasons.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_payment_amounts.xml b/admin/models/forms/filter_payment_amounts.xml new file mode 100644 index 0000000..98ff2e5 --- /dev/null +++ b/admin/models/forms/filter_payment_amounts.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_payment_types.xml b/admin/models/forms/filter_payment_types.xml new file mode 100644 index 0000000..3b8995a --- /dev/null +++ b/admin/models/forms/filter_payment_types.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_payments.xml b/admin/models/forms/filter_payments.xml new file mode 100644 index 0000000..383ae1d --- /dev/null +++ b/admin/models/forms/filter_payments.xml @@ -0,0 +1,87 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_planning_types.xml b/admin/models/forms/filter_planning_types.xml new file mode 100644 index 0000000..05943aa --- /dev/null +++ b/admin/models/forms/filter_planning_types.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_prostate_and_testicular_cancers.xml b/admin/models/forms/filter_prostate_and_testicular_cancers.xml new file mode 100644 index 0000000..f157d1b --- /dev/null +++ b/admin/models/forms/filter_prostate_and_testicular_cancers.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_referrals.xml b/admin/models/forms/filter_referrals.xml new file mode 100644 index 0000000..15a9a26 --- /dev/null +++ b/admin/models/forms/filter_referrals.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_sites.xml b/admin/models/forms/filter_sites.xml new file mode 100644 index 0000000..cc76c00 --- /dev/null +++ b/admin/models/forms/filter_sites.xml @@ -0,0 +1,71 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_strengths.xml b/admin/models/forms/filter_strengths.xml new file mode 100644 index 0000000..404976a --- /dev/null +++ b/admin/models/forms/filter_strengths.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_testing_reasons.xml b/admin/models/forms/filter_testing_reasons.xml new file mode 100644 index 0000000..f4a3c3c --- /dev/null +++ b/admin/models/forms/filter_testing_reasons.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_tests.xml b/admin/models/forms/filter_tests.xml new file mode 100644 index 0000000..443d8c5 --- /dev/null +++ b/admin/models/forms/filter_tests.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_tuberculoses.xml b/admin/models/forms/filter_tuberculoses.xml new file mode 100644 index 0000000..18e53c7 --- /dev/null +++ b/admin/models/forms/filter_tuberculoses.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_units.xml b/admin/models/forms/filter_units.xml new file mode 100644 index 0000000..8cb259f --- /dev/null +++ b/admin/models/forms/filter_units.xml @@ -0,0 +1,69 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_vmmcs.xml b/admin/models/forms/filter_vmmcs.xml new file mode 100644 index 0000000..703784f --- /dev/null +++ b/admin/models/forms/filter_vmmcs.xml @@ -0,0 +1,82 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/foetal_engagement.xml b/admin/models/forms/foetal_engagement.xml new file mode 100644 index 0000000..9e04985 --- /dev/null +++ b/admin/models/forms/foetal_engagement.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/foetal_lie.xml b/admin/models/forms/foetal_lie.xml new file mode 100644 index 0000000..8d5d1e2 --- /dev/null +++ b/admin/models/forms/foetal_lie.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/foetal_presentation.xml b/admin/models/forms/foetal_presentation.xml new file mode 100644 index 0000000..4c00145 --- /dev/null +++ b/admin/models/forms/foetal_presentation.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/general_medical_check_up.xml b/admin/models/forms/general_medical_check_up.xml new file mode 100644 index 0000000..1c10f5e --- /dev/null +++ b/admin/models/forms/general_medical_check_up.xml @@ -0,0 +1,388 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+ \ No newline at end of file diff --git a/admin/models/forms/health_education.xml b/admin/models/forms/health_education.xml new file mode 100644 index 0000000..8d2e907 --- /dev/null +++ b/admin/models/forms/health_education.xml @@ -0,0 +1,152 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/health_education_topic.xml b/admin/models/forms/health_education_topic.xml new file mode 100644 index 0000000..bfa266a --- /dev/null +++ b/admin/models/forms/health_education_topic.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/hiv_counseling_and_testing.xml b/admin/models/forms/hiv_counseling_and_testing.xml new file mode 100644 index 0000000..54b0845 --- /dev/null +++ b/admin/models/forms/hiv_counseling_and_testing.xml @@ -0,0 +1,285 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/immunisation.xml b/admin/models/forms/immunisation.xml new file mode 100644 index 0000000..8357690 --- /dev/null +++ b/admin/models/forms/immunisation.xml @@ -0,0 +1,231 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+ \ No newline at end of file diff --git a/admin/models/forms/immunisation_type.xml b/admin/models/forms/immunisation_type.xml new file mode 100644 index 0000000..cda7be3 --- /dev/null +++ b/admin/models/forms/immunisation_type.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/immunisation_vaccine_type.xml b/admin/models/forms/immunisation_vaccine_type.xml new file mode 100644 index 0000000..0a013d3 --- /dev/null +++ b/admin/models/forms/immunisation_vaccine_type.xml @@ -0,0 +1,167 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/index.html b/admin/models/forms/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/models/forms/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/models/forms/medication.xml b/admin/models/forms/medication.xml new file mode 100644 index 0000000..407c17e --- /dev/null +++ b/admin/models/forms/medication.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/nonpay_reason.xml b/admin/models/forms/nonpay_reason.xml new file mode 100644 index 0000000..5333f57 --- /dev/null +++ b/admin/models/forms/nonpay_reason.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/payment.xml b/admin/models/forms/payment.xml new file mode 100644 index 0000000..3b3b5d3 --- /dev/null +++ b/admin/models/forms/payment.xml @@ -0,0 +1,200 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/payment_amount.xml b/admin/models/forms/payment_amount.xml new file mode 100644 index 0000000..ad879f3 --- /dev/null +++ b/admin/models/forms/payment_amount.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/payment_type.xml b/admin/models/forms/payment_type.xml new file mode 100644 index 0000000..262c16a --- /dev/null +++ b/admin/models/forms/payment_type.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/planning_type.xml b/admin/models/forms/planning_type.xml new file mode 100644 index 0000000..b0efc9d --- /dev/null +++ b/admin/models/forms/planning_type.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/prostate_and_testicular_cancer.xml b/admin/models/forms/prostate_and_testicular_cancer.xml new file mode 100644 index 0000000..db9a6f9 --- /dev/null +++ b/admin/models/forms/prostate_and_testicular_cancer.xml @@ -0,0 +1,343 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/referral.xml b/admin/models/forms/referral.xml new file mode 100644 index 0000000..dde9f4b --- /dev/null +++ b/admin/models/forms/referral.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/site.xml b/admin/models/forms/site.xml new file mode 100644 index 0000000..4bed40c --- /dev/null +++ b/admin/models/forms/site.xml @@ -0,0 +1,172 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/strength.xml b/admin/models/forms/strength.xml new file mode 100644 index 0000000..4a8a8f9 --- /dev/null +++ b/admin/models/forms/strength.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/test.xml b/admin/models/forms/test.xml new file mode 100644 index 0000000..85aec64 --- /dev/null +++ b/admin/models/forms/test.xml @@ -0,0 +1,369 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/testing_reason.xml b/admin/models/forms/testing_reason.xml new file mode 100644 index 0000000..d3c9791 --- /dev/null +++ b/admin/models/forms/testing_reason.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/tuberculosis.xml b/admin/models/forms/tuberculosis.xml new file mode 100644 index 0000000..6a15b82 --- /dev/null +++ b/admin/models/forms/tuberculosis.xml @@ -0,0 +1,469 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/unit.xml b/admin/models/forms/unit.xml new file mode 100644 index 0000000..8540afe --- /dev/null +++ b/admin/models/forms/unit.xml @@ -0,0 +1,156 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/forms/vmmc.xml b/admin/models/forms/vmmc.xml new file mode 100644 index 0000000..21f7995 --- /dev/null +++ b/admin/models/forms/vmmc.xml @@ -0,0 +1,227 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + +
+
\ No newline at end of file diff --git a/admin/models/general_medical_check_up.php b/admin/models/general_medical_check_up.php new file mode 100644 index 0000000..aaea0c6 --- /dev/null +++ b/admin/models/general_medical_check_up.php @@ -0,0 +1,940 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal General_medical_check_up Model + */ +class Ehealth_portalModelGeneral_medical_check_up extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'vital_signs' => array( + 'left' => array( + 'bp_diastolic_one', + 'bp_systolic_one', + 'temp_one', + 'weight', + 'pulse', + 'chronic_medication' + ), + 'right' => array( + 'bp_diastolic_two', + 'bp_systolic_two', + 'temp_two', + 'height', + 'bmi' + ), + 'fullwidth' => array( + 'complaint', + 'investigations', + 'notes' + ), + 'above' => array( + 'patient' + ) + ), + 'diagnosis' => array( + 'fullwidth' => array( + 'diagnosis' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ), + 'dispensing' => array( + 'fullwidth' => array( + 'dispensing' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.general_medical_check_up'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'general_medical_check_up', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->dispensing)) + { + // Convert the dispensing field to an array. + $dispensing = new Registry; + $dispensing->loadString($item->dispensing); + $item->dispensing = $dispensing->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.general_medical_check_up'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.general_medical_check_up', 'general_medical_check_up', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.general_medical_check_up.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Patient access controls. + if ($id != 0 && (!$user->authorise('general_medical_check_up.edit.patient', 'com_ehealth_portal.general_medical_check_up.' . (int) $id)) + || ($id == 0 && !$user->authorise('general_medical_check_up.edit.patient', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('patient', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('patient', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('patient')) + { + // Disable fields while saving. + $form->setFieldAttribute('patient', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('patient', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/general_medical_check_up.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.general_medical_check_up.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.general_medical_check_up.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.general_medical_check_up.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_general_medical_check_up')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.general_medical_check_up.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.general_medical_check_up', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('general_medical_check_up'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('general_medical_check_up'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('general_medical_check_up'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the empty chronic_medication item to data + if (!isset($data['chronic_medication'])) + { + $data['chronic_medication'] = ''; + } + + // Set the dispensing items to data. + if (isset($data['dispensing']) && is_array($data['dispensing'])) + { + $dispensing = new JRegistry; + $dispensing->loadArray($data['dispensing']); + $data['dispensing'] = (string) $dispensing; + } + elseif (!isset($data['dispensing'])) + { + // Set the empty dispensing to data + $data['dispensing'] = ''; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/general_medical_check_ups.php b/admin/models/general_medical_check_ups.php new file mode 100644 index 0000000..81c3973 --- /dev/null +++ b/admin/models/general_medical_check_ups.php @@ -0,0 +1,520 @@ + + @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\Utilities\ArrayHelper; + +/** + * General_medical_check_ups Model + */ +class Ehealth_portalModelGeneral_medical_check_ups extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient', + 'a.bp_diastolic_one','bp_diastolic_one', + 'a.bp_systolic_one','bp_systolic_one', + 'a.temp_one','temp_one', + 'a.weight','weight', + 'a.pulse','pulse', + 'a.bp_diastolic_two','bp_diastolic_two', + 'a.bp_systolic_two','bp_systolic_two', + 'a.temp_two','temp_two', + 'a.height','height', + 'h.name','referral' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + $bp_diastolic_one = $this->getUserStateFromRequest($this->context . '.filter.bp_diastolic_one', 'filter_bp_diastolic_one'); + if ($formSubmited) + { + $bp_diastolic_one = $app->input->post->get('bp_diastolic_one'); + $this->setState('filter.bp_diastolic_one', $bp_diastolic_one); + } + + $bp_systolic_one = $this->getUserStateFromRequest($this->context . '.filter.bp_systolic_one', 'filter_bp_systolic_one'); + if ($formSubmited) + { + $bp_systolic_one = $app->input->post->get('bp_systolic_one'); + $this->setState('filter.bp_systolic_one', $bp_systolic_one); + } + + $temp_one = $this->getUserStateFromRequest($this->context . '.filter.temp_one', 'filter_temp_one'); + if ($formSubmited) + { + $temp_one = $app->input->post->get('temp_one'); + $this->setState('filter.temp_one', $temp_one); + } + + $weight = $this->getUserStateFromRequest($this->context . '.filter.weight', 'filter_weight'); + if ($formSubmited) + { + $weight = $app->input->post->get('weight'); + $this->setState('filter.weight', $weight); + } + + $pulse = $this->getUserStateFromRequest($this->context . '.filter.pulse', 'filter_pulse'); + if ($formSubmited) + { + $pulse = $app->input->post->get('pulse'); + $this->setState('filter.pulse', $pulse); + } + + $bp_diastolic_two = $this->getUserStateFromRequest($this->context . '.filter.bp_diastolic_two', 'filter_bp_diastolic_two'); + if ($formSubmited) + { + $bp_diastolic_two = $app->input->post->get('bp_diastolic_two'); + $this->setState('filter.bp_diastolic_two', $bp_diastolic_two); + } + + $bp_systolic_two = $this->getUserStateFromRequest($this->context . '.filter.bp_systolic_two', 'filter_bp_systolic_two'); + if ($formSubmited) + { + $bp_systolic_two = $app->input->post->get('bp_systolic_two'); + $this->setState('filter.bp_systolic_two', $bp_systolic_two); + } + + $temp_two = $this->getUserStateFromRequest($this->context . '.filter.temp_two', 'filter_temp_two'); + if ($formSubmited) + { + $temp_two = $app->input->post->get('temp_two'); + $this->setState('filter.temp_two', $temp_two); + } + + $height = $this->getUserStateFromRequest($this->context . '.filter.height', 'filter_height'); + if ($formSubmited) + { + $height = $app->input->post->get('height'); + $this->setState('filter.height', $height); + } + + $referral = $this->getUserStateFromRequest($this->context . '.filter.referral', 'filter_referral'); + if ($formSubmited) + { + $referral = $app->input->post->get('referral'); + $this->setState('filter.referral', $referral); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_general_medical_check_up', 'a')); + + // From the ehealth_portal_diagnosis_type table. + $query->select($db->quoteName('g.name','diagnosis_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_diagnosis_type', 'g') . ' ON (' . $db->quoteName('a.diagnosis') . ' = ' . $db->quoteName('g.id') . ')'); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('h.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'h') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('h.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.' OR a.bp_diastolic_one LIKE '.$search.' OR a.bp_systolic_one LIKE '.$search.' OR a.temp_one LIKE '.$search.' OR a.weight LIKE '.$search.' OR a.pulse LIKE '.$search.' OR a.bp_diastolic_two LIKE '.$search.' OR a.bp_systolic_two LIKE '.$search.' OR a.temp_two LIKE '.$search.' OR a.height LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_general_medical_check_up table + $query->from($db->quoteName('#__ehealth_portal_general_medical_check_up', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_general_medical_check_up"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + $id .= ':' . $this->getState('filter.bp_diastolic_one'); + $id .= ':' . $this->getState('filter.bp_systolic_one'); + $id .= ':' . $this->getState('filter.temp_one'); + $id .= ':' . $this->getState('filter.weight'); + $id .= ':' . $this->getState('filter.pulse'); + $id .= ':' . $this->getState('filter.bp_diastolic_two'); + $id .= ':' . $this->getState('filter.bp_systolic_two'); + $id .= ':' . $this->getState('filter.temp_two'); + $id .= ':' . $this->getState('filter.height'); + $id .= ':' . $this->getState('filter.referral'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_general_medical_check_up')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_general_medical_check_up'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/health_education.php b/admin/models/health_education.php new file mode 100644 index 0000000..b013030 --- /dev/null +++ b/admin/models/health_education.php @@ -0,0 +1,879 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Health_education Model + */ +class Ehealth_portalModelHealth_education extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'health_education_topic' + ), + 'above' => array( + 'patient', + 'education_type' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.health_education'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'health_education', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.health_education'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.health_education', 'health_education', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.health_education.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Health Education Topic access controls. + if ($id != 0 && (!$user->authorise('health_education.edit.health_education_topic', 'com_ehealth_portal.health_education.' . (int) $id)) + || ($id == 0 && !$user->authorise('health_education.edit.health_education_topic', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('health_education_topic', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('health_education_topic', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('health_education_topic')) + { + // Disable fields while saving. + $form->setFieldAttribute('health_education_topic', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('health_education_topic', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/health_education.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.health_education.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.health_education.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.health_education.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_health_education')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.health_education.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.health_education', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('health_education'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('health_education'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('health_education'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/health_education_topic.php b/admin/models/health_education_topic.php new file mode 100644 index 0000000..3f99f5b --- /dev/null +++ b/admin/models/health_education_topic.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Health_education_topic Model + */ +class Ehealth_portalModelHealth_education_topic extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.health_education_topic'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'health_education_topic', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.health_education_topic'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.health_education_topic', 'health_education_topic', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.health_education_topic.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('health_education_topic.edit.name', 'com_ehealth_portal.health_education_topic.' . (int) $id)) + || ($id == 0 && !$user->authorise('health_education_topic.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('health_education_topic.edit.description', 'com_ehealth_portal.health_education_topic.' . (int) $id)) + || ($id == 0 && !$user->authorise('health_education_topic.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/health_education_topic.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.health_education_topic.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.health_education_topic.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.health_education_topic.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_health_education_topic')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.health_education_topic.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.health_education_topic', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('health_education_topic'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('health_education_topic'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('health_education_topic'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('health_education_topic', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/health_education_topics.php b/admin/models/health_education_topics.php new file mode 100644 index 0000000..ea17b5f --- /dev/null +++ b/admin/models/health_education_topics.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Health_education_topics Model + */ +class Ehealth_portalModelHealth_education_topics extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_health_education_topic', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_health_education_topic table + $query->from($db->quoteName('#__ehealth_portal_health_education_topic', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_health_education_topic"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_health_education_topic')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_health_education_topic'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/health_educations.php b/admin/models/health_educations.php new file mode 100644 index 0000000..c96cf1e --- /dev/null +++ b/admin/models/health_educations.php @@ -0,0 +1,529 @@ + + @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\Utilities\ArrayHelper; + +/** + * Health_educations Model + */ +class Ehealth_portalModelHealth_educations extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.education_type','education_type', + 'a.patient','patient', + 'g.name','health_education_topic' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $education_type = $this->getUserStateFromRequest($this->context . '.filter.education_type', 'filter_education_type'); + if ($formSubmited) + { + $education_type = $app->input->post->get('education_type'); + $this->setState('filter.education_type', $education_type); + } + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + $health_education_topic = $this->getUserStateFromRequest($this->context . '.filter.health_education_topic', 'filter_health_education_topic'); + if ($formSubmited) + { + $health_education_topic = $app->input->post->get('health_education_topic'); + $this->setState('filter.health_education_topic', $health_education_topic); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert education_type + $item->education_type = $this->selectionTranslation($item->education_type, 'education_type'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of education_type language strings + if ($name === 'education_type') + { + $education_typeArray = array( + 0 => 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_INDIVIDUAL', + 1 => 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_GROUP' + ); + // Now check if value is found in this array + if (isset($education_typeArray[$value]) && Ehealth_portalHelper::checkString($education_typeArray[$value])) + { + return $education_typeArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_health_education', 'a')); + + // From the ehealth_portal_health_education_topic table. + $query->select($db->quoteName('g.name','health_education_topic_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_health_education_topic', 'g') . ' ON (' . $db->quoteName('a.health_education_topic') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.health_education_topic LIKE '.$search.' OR g.name LIKE '.$search.' OR a.patient LIKE '.$search.')'); + } + } + + // Filter by Education_type. + $_education_type = $this->getState('filter.education_type'); + if (is_numeric($_education_type)) + { + if (is_float($_education_type)) + { + $query->where('a.education_type = ' . (float) $_education_type); + } + else + { + $query->where('a.education_type = ' . (int) $_education_type); + } + } + elseif (Ehealth_portalHelper::checkString($_education_type)) + { + $query->where('a.education_type = ' . $db->quote($db->escape($_education_type))); + } + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + elseif (Ehealth_portalHelper::checkArray($_patient)) + { + // Secure the array for the query + $_patient = array_map( function ($val) use(&$db) { + if (is_numeric($val)) + { + if (is_float($val)) + { + return (float) $val; + } + else + { + return (int) $val; + } + } + elseif (Ehealth_portalHelper::checkString($val)) + { + return $db->quote($db->escape($val)); + } + }, $_patient); + // Filter by the Patient Array. + $query->where('a.patient IN (' . implode(',', $_patient) . ')'); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_health_education table + $query->from($db->quoteName('#__ehealth_portal_health_education', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_health_education"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.education_type'); + // Check if the value is an array + $_patient = $this->getState('filter.patient'); + if (Ehealth_portalHelper::checkArray($_patient)) + { + $id .= ':' . implode(':', $_patient); + } + // Check if this is only an number or string + elseif (is_numeric($_patient) + || Ehealth_portalHelper::checkString($_patient)) + { + $id .= ':' . $_patient; + } + $id .= ':' . $this->getState('filter.health_education_topic'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_health_education')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_health_education'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/hiv_counseling_and_testing.php b/admin/models/hiv_counseling_and_testing.php new file mode 100644 index 0000000..138cd85 --- /dev/null +++ b/admin/models/hiv_counseling_and_testing.php @@ -0,0 +1,876 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Hiv_counseling_and_testing Model + */ +class Ehealth_portalModelHiv_counseling_and_testing extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'counseling_type', + 'testing_reason', + 'last_test_date', + 'prev_test_result', + 'test_result_one', + 'test_result_two', + 'final_test_result', + 'eqa' + ), + 'above' => array( + 'patient' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.hiv_counseling_and_testing'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'hiv_counseling_and_testing', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.hiv_counseling_and_testing'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.hiv_counseling_and_testing', 'hiv_counseling_and_testing', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.hiv_counseling_and_testing.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/hiv_counseling_and_testing.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.hiv_counseling_and_testing.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.hiv_counseling_and_testing.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.hiv_counseling_and_testing.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_hiv_counseling_and_testing')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.hiv_counseling_and_testing.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.hiv_counseling_and_testing', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('hiv_counseling_and_testing'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('hiv_counseling_and_testing'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('hiv_counseling_and_testing'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/hiv_counselings_and_testings.php b/admin/models/hiv_counselings_and_testings.php new file mode 100644 index 0000000..38b3aa1 --- /dev/null +++ b/admin/models/hiv_counselings_and_testings.php @@ -0,0 +1,563 @@ + + @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\Utilities\ArrayHelper; + +/** + * Hiv_counselings_and_testings Model + */ +class Ehealth_portalModelHiv_counselings_and_testings extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert counseling_type + $item->counseling_type = $this->selectionTranslation($item->counseling_type, 'counseling_type'); + // convert last_test_date + $item->last_test_date = $this->selectionTranslation($item->last_test_date, 'last_test_date'); + // convert prev_test_result + $item->prev_test_result = $this->selectionTranslation($item->prev_test_result, 'prev_test_result'); + // convert test_result_one + $item->test_result_one = $this->selectionTranslation($item->test_result_one, 'test_result_one'); + // convert test_result_two + $item->test_result_two = $this->selectionTranslation($item->test_result_two, 'test_result_two'); + // convert final_test_result + $item->final_test_result = $this->selectionTranslation($item->final_test_result, 'final_test_result'); + // convert eqa + $item->eqa = $this->selectionTranslation($item->eqa, 'eqa'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of counseling_type language strings + if ($name === 'counseling_type') + { + $counseling_typeArray = array( + 0 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_INDIVIDUAL', + 1 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_COUPLE', + 2 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_MINOR' + ); + // Now check if value is found in this array + if (isset($counseling_typeArray[$value]) && Ehealth_portalHelper::checkString($counseling_typeArray[$value])) + { + return $counseling_typeArray[$value]; + } + } + // Array of last_test_date language strings + if ($name === 'last_test_date') + { + $last_test_dateArray = array( + 0 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_ONESIX_MONTHS', + 1 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_SEVENTWELVE_MONTHS', + 2 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING__YEAR', + 3 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEVER' + ); + // Now check if value is found in this array + if (isset($last_test_dateArray[$value]) && Ehealth_portalHelper::checkString($last_test_dateArray[$value])) + { + return $last_test_dateArray[$value]; + } + } + // Array of prev_test_result language strings + if ($name === 'prev_test_result') + { + $prev_test_resultArray = array( + 0 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEGATIVE', + 1 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_POSITIVE', + 2 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_UNKNOWN', + 3 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NA' + ); + // Now check if value is found in this array + if (isset($prev_test_resultArray[$value]) && Ehealth_portalHelper::checkString($prev_test_resultArray[$value])) + { + return $prev_test_resultArray[$value]; + } + } + // Array of test_result_one language strings + if ($name === 'test_result_one') + { + $test_result_oneArray = array( + 0 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($test_result_oneArray[$value]) && Ehealth_portalHelper::checkString($test_result_oneArray[$value])) + { + return $test_result_oneArray[$value]; + } + } + // Array of test_result_two language strings + if ($name === 'test_result_two') + { + $test_result_twoArray = array( + 0 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($test_result_twoArray[$value]) && Ehealth_portalHelper::checkString($test_result_twoArray[$value])) + { + return $test_result_twoArray[$value]; + } + } + // Array of final_test_result language strings + if ($name === 'final_test_result') + { + $final_test_resultArray = array( + 0 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEGATIVE', + 1 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_POSITIVE', + 2 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_UNKNOWN', + 3 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NA' + ); + // Now check if value is found in this array + if (isset($final_test_resultArray[$value]) && Ehealth_portalHelper::checkString($final_test_resultArray[$value])) + { + return $final_test_resultArray[$value]; + } + } + // Array of eqa language strings + if ($name === 'eqa') + { + $eqaArray = array( + 0 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_YES', + 1 => 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NO' + ); + // Now check if value is found in this array + if (isset($eqaArray[$value]) && Ehealth_portalHelper::checkString($eqaArray[$value])) + { + return $eqaArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_hiv_counseling_and_testing', 'a')); + + // From the ehealth_portal_testing_reason table. + $query->select($db->quoteName('g.name','testing_reason_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_testing_reason', 'g') . ' ON (' . $db->quoteName('a.testing_reason') . ' = ' . $db->quoteName('g.id') . ')'); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('h.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'h') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('h.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_hiv_counseling_and_testing table + $query->from($db->quoteName('#__ehealth_portal_hiv_counseling_and_testing', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_hiv_counseling_and_testing"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_hiv_counseling_and_testing')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_hiv_counseling_and_testing'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/immunisation.php b/admin/models/immunisation.php new file mode 100644 index 0000000..4539142 --- /dev/null +++ b/admin/models/immunisation.php @@ -0,0 +1,914 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Immunisation Model + */ +class Ehealth_portalModelImmunisation extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'immunisation_up_to_date' + ), + 'fullwidth' => array( + 'immunisation' + ), + 'above' => array( + 'patient' + ), + 'under' => array( + 'immunisation_vaccine_type', + 'administration_part' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.immunisation'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'immunisation', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->immunisation)) + { + // Convert the immunisation field to an array. + $immunisation = new Registry; + $immunisation->loadString($item->immunisation); + $item->immunisation = $immunisation->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.immunisation'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.immunisation', 'immunisation', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.immunisation.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Patient access controls. + if ($id != 0 && (!$user->authorise('immunisation.edit.patient', 'com_ehealth_portal.immunisation.' . (int) $id)) + || ($id == 0 && !$user->authorise('immunisation.edit.patient', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('patient', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('patient', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('patient')) + { + // Disable fields while saving. + $form->setFieldAttribute('patient', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('patient', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/immunisation.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.immunisation.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.immunisation.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.immunisation.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_immunisation')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.immunisation.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.immunisation', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('immunisation'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('immunisation'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('immunisation'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the immunisation items to data. + if (isset($data['immunisation']) && is_array($data['immunisation'])) + { + $immunisation = new JRegistry; + $immunisation->loadArray($data['immunisation']); + $data['immunisation'] = (string) $immunisation; + } + elseif (!isset($data['immunisation'])) + { + // Set the empty immunisation to data + $data['immunisation'] = ''; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/immunisation_type.php b/admin/models/immunisation_type.php new file mode 100644 index 0000000..56fb934 --- /dev/null +++ b/admin/models/immunisation_type.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Immunisation_type Model + */ +class Ehealth_portalModelImmunisation_type extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.immunisation_type'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'immunisation_type', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.immunisation_type'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.immunisation_type', 'immunisation_type', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.immunisation_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('immunisation_type.edit.name', 'com_ehealth_portal.immunisation_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('immunisation_type.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('immunisation_type.edit.description', 'com_ehealth_portal.immunisation_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('immunisation_type.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/immunisation_type.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.immunisation_type.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.immunisation_type.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.immunisation_type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_immunisation_type')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.immunisation_type.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.immunisation_type', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('immunisation_type'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('immunisation_type'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('immunisation_type'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('immunisation_type', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/immunisation_types.php b/admin/models/immunisation_types.php new file mode 100644 index 0000000..2d31480 --- /dev/null +++ b/admin/models/immunisation_types.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisation_types Model + */ +class Ehealth_portalModelImmunisation_types extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_immunisation_type', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_immunisation_type table + $query->from($db->quoteName('#__ehealth_portal_immunisation_type', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_immunisation_type"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_immunisation_type')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_immunisation_type'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/immunisation_vaccine_type.php b/admin/models/immunisation_vaccine_type.php new file mode 100644 index 0000000..b515a72 --- /dev/null +++ b/admin/models/immunisation_vaccine_type.php @@ -0,0 +1,1000 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Immunisation_vaccine_type Model + */ +class Ehealth_portalModelImmunisation_vaccine_type extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'administration_part' + ), + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.immunisation_vaccine_type'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'immunisation_vaccine_type', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.immunisation_vaccine_type'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.immunisation_vaccine_type', 'immunisation_vaccine_type', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.immunisation_vaccine_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('immunisation_vaccine_type.edit.name', 'com_ehealth_portal.immunisation_vaccine_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('immunisation_vaccine_type.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('immunisation_vaccine_type.edit.description', 'com_ehealth_portal.immunisation_vaccine_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('immunisation_vaccine_type.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/immunisation_vaccine_type.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.immunisation_vaccine_type.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.immunisation_vaccine_type.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.immunisation_vaccine_type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_immunisation_vaccine_type')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.immunisation_vaccine_type.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.immunisation_vaccine_type', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('immunisation_vaccine_type'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('immunisation_vaccine_type'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('immunisation_vaccine_type'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('immunisation_vaccine_type', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/immunisation_vaccine_types.php b/admin/models/immunisation_vaccine_types.php new file mode 100644 index 0000000..57be898 --- /dev/null +++ b/admin/models/immunisation_vaccine_types.php @@ -0,0 +1,444 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisation_vaccine_types Model + */ +class Ehealth_portalModelImmunisation_vaccine_types extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'g.name','administration_part', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $administration_part = $this->getUserStateFromRequest($this->context . '.filter.administration_part', 'filter_administration_part'); + if ($formSubmited) + { + $administration_part = $app->input->post->get('administration_part'); + $this->setState('filter.administration_part', $administration_part); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_immunisation_vaccine_type', 'a')); + + // From the ehealth_portal_administration_part table. + $query->select($db->quoteName('g.name','administration_part_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_administration_part', 'g') . ' ON (' . $db->quoteName('a.administration_part') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.administration_part LIKE '.$search.' OR g.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + // Filter by Administration_part. + $_administration_part = $this->getState('filter.administration_part'); + if (is_numeric($_administration_part)) + { + if (is_float($_administration_part)) + { + $query->where('a.administration_part = ' . (float) $_administration_part); + } + else + { + $query->where('a.administration_part = ' . (int) $_administration_part); + } + } + elseif (Ehealth_portalHelper::checkString($_administration_part)) + { + $query->where('a.administration_part = ' . $db->quote($db->escape($_administration_part))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_immunisation_vaccine_type table + $query->from($db->quoteName('#__ehealth_portal_immunisation_vaccine_type', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_immunisation_vaccine_type"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.administration_part'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_immunisation_vaccine_type')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_immunisation_vaccine_type'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/immunisations.php b/admin/models/immunisations.php new file mode 100644 index 0000000..be835e7 --- /dev/null +++ b/admin/models/immunisations.php @@ -0,0 +1,468 @@ + + @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\Utilities\ArrayHelper; + +/** + * Immunisations Model + */ +class Ehealth_portalModelImmunisations extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert immunisation_up_to_date + $item->immunisation_up_to_date = $this->selectionTranslation($item->immunisation_up_to_date, 'immunisation_up_to_date'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of immunisation_up_to_date language strings + if ($name === 'immunisation_up_to_date') + { + $immunisation_up_to_dateArray = array( + 0 => 'COM_EHEALTH_PORTAL_IMMUNISATION_YES', + 1 => 'COM_EHEALTH_PORTAL_IMMUNISATION_NO' + ); + // Now check if value is found in this array + if (isset($immunisation_up_to_dateArray[$value]) && Ehealth_portalHelper::checkString($immunisation_up_to_dateArray[$value])) + { + return $immunisation_up_to_dateArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_immunisation', 'a')); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('g.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'g') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('g.id') . ')'); + + // From the ehealth_portal_immunisation_vaccine_type table. + $query->select($db->quoteName('h.name','immunisation_vaccine_type_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_immunisation_vaccine_type', 'h') . ' ON (' . $db->quoteName('a.immunisation_vaccine_type') . ' = ' . $db->quoteName('h.id') . ')'); + + // From the ehealth_portal_administration_part table. + $query->select($db->quoteName('i.name','administration_part_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_administration_part', 'i') . ' ON (' . $db->quoteName('a.administration_part') . ' = ' . $db->quoteName('i.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_immunisation table + $query->from($db->quoteName('#__ehealth_portal_immunisation', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_immunisation"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_immunisation')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_immunisation'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/import.php b/admin/models/import.php new file mode 100644 index 0000000..16dc494 --- /dev/null +++ b/admin/models/import.php @@ -0,0 +1,755 @@ + + @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\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +use Joomla\Utilities\ArrayHelper; +use PhpOffice\PhpSpreadsheet\IOFactory; + +/** + * Ehealth_portal Import Model + */ +class Ehealth_portalModelImport extends JModelLegacy +{ + // set uploading values + protected $use_streams = false; + protected $allow_unsafe = false; + protected $safeFileOptions = array(); + + /** + * @var object JTable object + */ + protected $_table = null; + + /** + * @var object JTable object + */ + protected $_url = null; + + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_ehealth_portal.import'; + + /** + * Import Settings + */ + protected $getType = NULL; + protected $dataType = NULL; + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @return void + * + */ + protected function populateState() + { + $app = JFactory::getApplication('administrator'); + + $this->setState('message', $app->getUserState('com_ehealth_portal.message')); + $app->setUserState('com_ehealth_portal.message', ''); + + // Recall the 'Import from Directory' path. + $path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path')); + $this->setState('import.directory', $path); + parent::populateState(); + } + + /** + * Import an spreadsheet from either folder, url or upload. + * + * @return boolean result of import + * + */ + public function import() + { + $this->setState('action', 'import'); + $app = JFactory::getApplication(); + $session = JFactory::getSession(); + $package = null; + $continue = false; + // get import type + $this->getType = $app->input->getString('gettype', NULL); + // get import type + $this->dataType = $session->get('dataType_VDM_IMPORTINTO', NULL); + + if ($package === null) + { + switch ($this->getType) + { + case 'folder': + // Remember the 'Import from Directory' path. + $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory'); + $package = $this->_getPackageFromFolder(); + break; + + case 'upload': + $package = $this->_getPackageFromUpload(); + break; + + case 'url': + $package = $this->_getPackageFromUrl(); + break; + + case 'continue': + $continue = true; + $package = $session->get('package', null); + $package = json_decode($package, true); + // clear session + $session->clear('package'); + $session->clear('dataType'); + $session->clear('hasPackage'); + break; + + default: + $app->setUserState('com_ehealth_portal.message', JText::_('COM_EHEALTH_PORTAL_IMPORT_NO_IMPORT_TYPE_FOUND')); + + return false; + break; + } + } + // Was the package valid? + if (!$package || !$package['type']) + { + if (in_array($this->getType, array('upload', 'url'))) + { + $this->remove($package['packagename']); + } + + $app->setUserState('com_ehealth_portal.message', JText::_('COM_EHEALTH_PORTAL_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE')); + return false; + } + + // first link data to table headers + if(!$continue){ + $package = json_encode($package); + $session->set('package', $package); + $session->set('dataType', $this->dataType); + $session->set('hasPackage', true); + return true; + } + + // set the data + $headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false), true); + if (!$this->setData($package,$this->dataType,$headerList)) + { + // There was an error importing the package + $msg = JText::_('COM_EHEALTH_PORTAL_IMPORT_ERROR'); + $back = $session->get('backto_VDM_IMPORT', NULL); + if ($back) + { + $app->setUserState('com_ehealth_portal.redirect_url', 'index.php?option=com_ehealth_portal&view='.$back); + $session->clear('backto_VDM_IMPORT'); + } + $result = false; + } + else + { + // Package imported sucessfully + $msg = JText::sprintf('COM_EHEALTH_PORTAL_IMPORT_SUCCESS', $package['packagename']); + $back = $session->get('backto_VDM_IMPORT', NULL); + if ($back) + { + $app->setUserState('com_ehealth_portal.redirect_url', 'index.php?option=com_ehealth_portal&view='.$back); + $session->clear('backto_VDM_IMPORT'); + } + $result = true; + } + + // Set some model state values + $app->enqueueMessage($msg); + + // remove file after import + $this->remove($package['packagename']); + $session->clear($this->getType.'_VDM_IMPORTHEADERS'); + + return $result; + } + + /** + * Works out an importation spreadsheet from a HTTP upload + * + * @return spreadsheet definition or false on failure + */ + protected function _getPackageFromUpload() + { + // Get the uploaded file information + $app = JFactory::getApplication(); + $input = $app->input; + + // Do not change the filter type 'raw'. We need this to let files containing PHP code to upload. See JInputFiles::get. + $userfile = $input->files->get('import_package', null, 'raw'); + + // Make sure that file uploads are enabled in php + if (!(bool) ini_get('file_uploads')) + { + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_WARNIMPORTFILE'), 'warning'); + return false; + } + + // If there is no uploaded file, we have a problem... + if (!is_array($userfile)) + { + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_NO_FILE_SELECTED'), 'warning'); + return false; + } + + // Check if there was a problem uploading the file. + if ($userfile['error'] || $userfile['size'] < 1) + { + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_WARNIMPORTUPLOADERROR'), 'warning'); + return false; + } + + // Build the appropriate paths + $config = JFactory::getConfig(); + $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; + $tmp_src = $userfile['tmp_name']; + + // Move uploaded file + jimport('joomla.filesystem.file'); + $p_file = File::upload($tmp_src, $tmp_dest, $this->use_streams, $this->allow_unsafe, $this->safeFileOptions); + + // Was the package downloaded? + if (!$p_file) + { + $session = JFactory::getSession(); + $session->clear('package'); + $session->clear('dataType'); + $session->clear('hasPackage'); + // was not uploaded + return false; + } + + // check that this is a valid spreadsheet + $package = $this->check($userfile['name']); + + return $package; + } + + /** + * Import an spreadsheet from a directory + * + * @return array Spreadsheet details or false on failure + * + */ + protected function _getPackageFromFolder() + { + $app = JFactory::getApplication(); + $input = $app->input; + + // Get the path to the package to import + $p_dir = $input->getString('import_directory'); + $p_dir = JPath::clean($p_dir); + // Did you give us a valid path? + if (!file_exists($p_dir)) + { + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'warning'); + return false; + } + + // Detect the package type + $type = $this->getType; + + // Did you give us a valid package? + if (!$type) + { + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'warning'); + } + + // check the extention + if(!$this->checkExtension($p_dir)) + { + // set error message + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + return false; + } + + $package['packagename'] = null; + $package['dir'] = $p_dir; + $package['type'] = $type; + + return $package; + } + + /** + * Import an spreadsheet from a URL + * + * @return Package details or false on failure + * + */ + protected function _getPackageFromUrl() + { + $app = JFactory::getApplication(); + $input = $app->input; + + // Get the URL of the package to import + $url = $input->getString('import_url'); + + // Did you give us a URL? + if (!$url) + { + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_ENTER_A_URL'), 'warning'); + return false; + } + + // Download the package at the URL given + $p_file = JInstallerHelper::downloadPackage($url); + + // Was the package downloaded? + if (!$p_file) + { + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_INVALID_URL'), 'warning'); + return false; + } + + // check that this is a valid spreadsheet + $package = $this->check($p_file); + + return $package; + } + + /** + * Check a file and verifies it as a spreadsheet file + * Supports .csv .xlsx .xls and .ods + * + * @param string $p_filename The uploaded package filename or import directory + * + * @return array of elements + * + */ + protected function check($archivename) + { + $app = JFactory::getApplication(); + // Clean the name + $archivename = JPath::clean($archivename); + + // check the extention + if(!$this->checkExtension($archivename)) + { + // Cleanup the import files + $this->remove($archivename); + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning'); + return false; + } + + $config = JFactory::getConfig(); + // set Package Name + $check['packagename'] = $archivename; + + // set directory + $check['dir'] = $config->get('tmp_path'). '/' .$archivename; + + // set type + $check['type'] = $this->getType; + + return $check; + } + + /** + * Check the extension + * + * @param string $file Name of the uploaded file + * + * @return boolean True on success + * + */ + protected function checkExtension($file) + { + // check the extention + switch(strtolower(pathinfo($file, PATHINFO_EXTENSION))) + { + case 'xls': + case 'ods': + case 'csv': + return true; + break; + } + return false; + } + + /** + * Clean up temporary uploaded spreadsheet + * + * @param string $package Name of the uploaded spreadsheet file + * + * @return boolean True on success + * + */ + protected function remove($package) + { + jimport('joomla.filesystem.file'); + + $config = JFactory::getConfig(); + $package = $config->get('tmp_path'). '/' .$package; + + // Is the package file a valid file? + if (is_file($package)) + { + File::delete($package); + } + elseif (is_file(JPath::clean($package))) + { + // It might also be just a base filename + File::delete(JPath::clean($package)); + } + } + + /** + * Set the data from the spreadsheet to the database + * + * @param string $package Paths to the uploaded package file + * + * @return boolean false on failure + * + **/ + protected function setData($package,$table,$target_headers) + { + if (Ehealth_portalHelper::checkArray($target_headers)) + { + // make sure the file is loaded + Ehealth_portalHelper::composerAutoload('phpspreadsheet'); + $jinput = JFactory::getApplication()->input; + foreach($target_headers as $header) + { + if (($column = $jinput->getString($header, false)) !== false || + ($column = $jinput->getString(strtolower($header), false)) !== false) + { + $data['target_headers'][$header] = $column; + } + else + { + $data['target_headers'][$header] = null; + } + } + // set the data + if(isset($package['dir'])) + { + $inputFileType = IOFactory::identify($package['dir']); + $excelReader = IOFactory::createReader($inputFileType); + $excelReader->setReadDataOnly(true); + $excelObj = $excelReader->load($package['dir']); + $data['array'] = $excelObj->getActiveSheet()->toArray(null, true,true,true); + $excelObj->disconnectWorksheets(); + unset($excelObj); + return $this->save($data, $table); + } + } + return false; + } + + /** + * Save the data from the file to the database + * + * @param string $package Paths to the uploaded package file + * + * @return boolean false on failure + * + **/ + protected function save($data,$table) + { + // import the data if there is any + if(Ehealth_portalHelper::checkArray($data['array'])) + { + // get user object + $user = JFactory::getUser(); + // remove header if it has headers + $id_key = $data['target_headers']['id']; + $published_key = $data['target_headers']['published']; + $ordering_key = $data['target_headers']['ordering']; + // get the first array set + $firstSet = reset($data['array']); + + // check if first array is a header array and remove if true + if($firstSet[$id_key] == 'id' || $firstSet[$published_key] == 'published' || $firstSet[$ordering_key] == 'ordering') + { + array_shift($data['array']); + } + + // make sure there is still values in array and that it was not only headers + if(Ehealth_portalHelper::checkArray($data['array']) && $user->authorise($table.'.import', 'com_ehealth_portal') && $user->authorise('core.import', 'com_ehealth_portal')) + { + // set target. + $target = array_flip($data['target_headers']); + // Get a db connection. + $db = JFactory::getDbo(); + // set some defaults + $todayDate = JFactory::getDate()->toSql(); + // get global action permissions + $canDo = Ehealth_portalHelper::getActions($table); + $canEdit = $canDo->get('core.edit'); + $canState = $canDo->get('core.edit.state'); + $canCreate = $canDo->get('core.create'); + $hasAlias = $this->getAliasesUsed($table); + // prosses the data + foreach($data['array'] as $row) + { + $found = false; + if (isset($row[$id_key]) && is_numeric($row[$id_key]) && $row[$id_key] > 0) + { + // raw items import & update! + $query = $db->getQuery(true); + $query + ->select('version') + ->from($db->quoteName('#__ehealth_portal_'.$table)) + ->where($db->quoteName('id') . ' = '. $db->quote($row[$id_key])); + // Reset the query using our newly populated query object. + $db->setQuery($query); + $db->execute(); + $found = $db->getNumRows(); + } + + if($found && $canEdit) + { + // update item + $id = $row[$id_key]; + $version = $db->loadResult(); + // reset all buckets + $query = $db->getQuery(true); + $fields = array(); + // Fields to update. + foreach($row as $key => $cell) + { + // ignore column + if ('IGNORE' == $target[$key]) + { + continue; + } + // update modified + if ('modified_by' == $target[$key]) + { + continue; + } + // update modified + if ('modified' == $target[$key]) + { + continue; + } + // update version + if ('version' == $target[$key]) + { + $cell = (int) $version + 1; + } + // verify publish authority + if ('published' == $target[$key] && !$canState) + { + continue; + } + // set to update array + if(in_array($key, $data['target_headers']) && is_numeric($cell)) + { + $fields[] = $db->quoteName($target[$key]) . ' = ' . $cell; + } + elseif(in_array($key, $data['target_headers']) && is_string($cell)) + { + $fields[] = $db->quoteName($target[$key]) . ' = ' . $db->quote($cell); + } + elseif(in_array($key, $data['target_headers']) && is_null($cell)) + { + // if import data is null then set empty + $fields[] = $db->quoteName($target[$key]) . " = ''"; + } + } + // load the defaults + $fields[] = $db->quoteName('modified_by') . ' = ' . $db->quote($user->id); + $fields[] = $db->quoteName('modified') . ' = ' . $db->quote($todayDate); + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('id') . ' = ' . $id + ); + + $query->update($db->quoteName('#__ehealth_portal_'.$table))->set($fields)->where($conditions); + $db->setQuery($query); + $db->execute(); + } + elseif ($canCreate) + { + // insert item + $query = $db->getQuery(true); + // reset all buckets + $columns = array(); + $values = array(); + $version = false; + // Insert columns. Insert values. + foreach($row as $key => $cell) + { + // ignore column + if ('IGNORE' == $target[$key]) + { + continue; + } + // remove id + if ('id' == $target[$key]) + { + continue; + } + // update created + if ('created_by' == $target[$key]) + { + continue; + } + // update created + if ('created' == $target[$key]) + { + continue; + } + // Make sure the alias is incremented + if ('alias' == $target[$key]) + { + $cell = $this->getAlias($cell,$table); + } + // update version + if ('version' == $target[$key]) + { + $cell = 1; + $version = true; + } + // set to insert array + if(in_array($key, $data['target_headers']) && is_numeric($cell)) + { + $columns[] = $target[$key]; + $values[] = $cell; + } + elseif(in_array($key, $data['target_headers']) && is_string($cell)) + { + $columns[] = $target[$key]; + $values[] = $db->quote($cell); + } + elseif(in_array($key, $data['target_headers']) && is_null($cell)) + { + // if import data is null then set empty + $columns[] = $target[$key]; + $values[] = "''"; + } + } + // load the defaults + $columns[] = 'created_by'; + $values[] = $db->quote($user->id); + $columns[] = 'created'; + $values[] = $db->quote($todayDate); + if (!$version) + { + $columns[] = 'version'; + $values[] = 1; + } + // Prepare the insert query. + $query + ->insert($db->quoteName('#__ehealth_portal_'.$table)) + ->columns($db->quoteName($columns)) + ->values(implode(',', $values)); + // Set the query using our newly populated query object and execute it. + $db->setQuery($query); + $done = $db->execute(); + if ($done) + { + $aId = $db->insertid(); + // make sure the access of asset is set + Ehealth_portalHelper::setAsset($aId,$table); + } + } + else + { + return false; + } + } + return true; + } + } + return false; + } + + protected function getAlias($name,$type = false) + { + // sanitize the name to an alias + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $alias = JFilterOutput::stringURLUnicodeSlug($name); + } + else + { + $alias = JFilterOutput::stringURLSafe($name); + } + // must be a uniqe alias + if ($type) + { + return $this->getUniqe($alias,'alias',$type); + } + return $alias; + } + + /** + * Method to generate a uniqe value. + * + * @param string $field name. + * @param string $value data. + * @param string $type table. + * + * @return string New value. + */ + protected function getUniqe($value,$field,$type) + { + // insure the filed is always uniqe + while (isset($this->uniqeValueArray[$type][$field][$value])) + { + $value = JString::increment($value, 'dash'); + } + $this->uniqeValueArray[$type][$field][$value] = $value; + return $value; + } + + protected function getAliasesUsed($table) + { + // Get a db connection. + $db = JFactory::getDbo(); + // first we check if there is a alias column + $columns = $db->getTableColumns('#__ehealth_portal_'.$table); + if(isset($columns['alias'])){ + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array('alias'))); + $query->from($db->quoteName('#__ehealth_portal_'.$table)); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $aliases = $db->loadColumn(); + foreach($aliases as $alias) + { + $this->uniqeValueArray[$table]['alias'][$alias] = $alias; + } + } + return true; + } + return false; + } +} diff --git a/admin/models/index.html b/admin/models/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/models/medication.php b/admin/models/medication.php new file mode 100644 index 0000000..e786993 --- /dev/null +++ b/admin/models/medication.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Medication Model + */ +class Ehealth_portalModelMedication extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.medication'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'medication', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.medication'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.medication', 'medication', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.medication.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('medication.edit.name', 'com_ehealth_portal.medication.' . (int) $id)) + || ($id == 0 && !$user->authorise('medication.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('medication.edit.description', 'com_ehealth_portal.medication.' . (int) $id)) + || ($id == 0 && !$user->authorise('medication.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/medication.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.medication.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.medication.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.medication.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_medication')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.medication.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.medication', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('medication'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('medication'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('medication'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('medication', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_MEDICATION_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/medications.php b/admin/models/medications.php new file mode 100644 index 0000000..a579778 --- /dev/null +++ b/admin/models/medications.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Medications Model + */ +class Ehealth_portalModelMedications extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_medication', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_medication table + $query->from($db->quoteName('#__ehealth_portal_medication', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_medication"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_medication')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_medication'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/nonpay_reason.php b/admin/models/nonpay_reason.php new file mode 100644 index 0000000..f84ac0a --- /dev/null +++ b/admin/models/nonpay_reason.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Nonpay_reason Model + */ +class Ehealth_portalModelNonpay_reason extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.nonpay_reason'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'nonpay_reason', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.nonpay_reason'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.nonpay_reason', 'nonpay_reason', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.nonpay_reason.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('nonpay_reason.edit.name', 'com_ehealth_portal.nonpay_reason.' . (int) $id)) + || ($id == 0 && !$user->authorise('nonpay_reason.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('nonpay_reason.edit.description', 'com_ehealth_portal.nonpay_reason.' . (int) $id)) + || ($id == 0 && !$user->authorise('nonpay_reason.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/nonpay_reason.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.nonpay_reason.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.nonpay_reason.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.nonpay_reason.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_nonpay_reason')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.nonpay_reason.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.nonpay_reason', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('nonpay_reason'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('nonpay_reason'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('nonpay_reason'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('nonpay_reason', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_NONPAY_REASON_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/nonpay_reasons.php b/admin/models/nonpay_reasons.php new file mode 100644 index 0000000..5d5ed01 --- /dev/null +++ b/admin/models/nonpay_reasons.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Nonpay_reasons Model + */ +class Ehealth_portalModelNonpay_reasons extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_nonpay_reason', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_nonpay_reason table + $query->from($db->quoteName('#__ehealth_portal_nonpay_reason', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_nonpay_reason"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_nonpay_reason')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_nonpay_reason'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/patient_queue.php b/admin/models/patient_queue.php new file mode 100644 index 0000000..84e962d --- /dev/null +++ b/admin/models/patient_queue.php @@ -0,0 +1,166 @@ + + @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\Utilities\ArrayHelper; + +/** + * Ehealth_portal Patient_queue Model + */ +class Ehealth_portalModelPatient_queue extends JModelItem +{ + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_ehealth_portal.patient_queue'; + + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * @var object item + */ + protected $item; + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @since 1.6 + * + * @return void + */ + protected function populateState() + { + $this->app = JFactory::getApplication(); + $this->input = $this->app->input; + // Get the item main id + $id = $this->input->getInt('id', null); + $this->setState('patient_queue.id', $id); + + // Load the parameters. + parent::populateState(); + } + + /** + * Method to get article data. + * + * @param integer $pk The id of the article. + * + * @return mixed Menu item data object on success, false on failure. + */ + public function getItem($pk = null) + { + $this->user = JFactory::getUser(); + // check if this user has permission to access item + if (!$this->user->authorise('patient_queue.access', 'com_ehealth_portal')) + { + $app = JFactory::getApplication(); + $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + // redirect away if not a correct to cPanel/default view + $app->redirect('index.php?option=com_ehealth_portal'); + return false; + } + $this->userId = $this->user->get('id'); + $this->guest = $this->user->get('guest'); + $this->groups = $this->user->get('groups'); + $this->authorisedGroups = $this->user->getAuthorisedGroups(); + $this->levels = $this->user->getAuthorisedViewLevels(); + $this->initSet = true; + + $pk = (!empty($pk)) ? $pk : (int) $this->getState('patient_queue.id'); + + if ($this->_item === null) + { + $this->_item = array(); + } + + if (!isset($this->_item[$pk])) + { + try + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Get from #__users as a + $query->select($db->quoteName( + array('a.id','a.name','a.username','a.email','a.password','a.block','a.sendEmail','a.registerDate','a.lastvisitDate','a.activation','a.params','a.lastResetTime','a.resetCount','a.otpKey','a.otep','a.requireReset'), + array('id','name','username','email','password','block','sendEmail','registerDate','lastvisitDate','activation','params','lastResetTime','resetCount','otpKey','otep','requireReset'))); + $query->from($db->quoteName('#__users', 'a')); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + // Load the results as a stdClass object. + $data = $db->loadObject(); + + if (empty($data)) + { + $app = JFactory::getApplication(); + // If no data is found redirect to default page and show warning. + $app->enqueueMessage(JText::_('COM_EHEALTH_PORTAL_NOT_FOUND_OR_ACCESS_DENIED'), 'warning'); + $app->redirect('index.php?option=com_ehealth_portal'); + return false; + } + + // set data object to item. + $this->_item[$pk] = $data; + } + catch (Exception $e) + { + if ($e->getCode() == 404) + { + // Need to go thru the error handler to allow Redirect to work. + JError::raiseWarning(404, $e->getMessage()); + } + else + { + $this->setError($e); + $this->_item[$pk] = false; + } + } + } + + return $this->_item[$pk]; + } +} diff --git a/admin/models/payment.php b/admin/models/payment.php new file mode 100644 index 0000000..ff28a83 --- /dev/null +++ b/admin/models/payment.php @@ -0,0 +1,882 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Payment Model + */ +class Ehealth_portalModelPayment extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'payment_type', + 'payment_amount', + 'nonpay_reason', + 'receipt_no' + ), + 'above' => array( + 'patient', + 'payment_category' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.payment'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'payment', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.payment'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.payment', 'payment', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.payment.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Patient access controls. + if ($id != 0 && (!$user->authorise('payment.edit.patient', 'com_ehealth_portal.payment.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment.edit.patient', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('patient', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('patient', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('patient')) + { + // Disable fields while saving. + $form->setFieldAttribute('patient', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('patient', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/payment.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.payment.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.payment.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.payment.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_payment')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.payment.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.payment', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('payment'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('payment'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('payment'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/payment_amount.php b/admin/models/payment_amount.php new file mode 100644 index 0000000..c973bf3 --- /dev/null +++ b/admin/models/payment_amount.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Payment_amount Model + */ +class Ehealth_portalModelPayment_amount extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.payment_amount'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'payment_amount', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.payment_amount'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.payment_amount', 'payment_amount', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.payment_amount.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('payment_amount.edit.name', 'com_ehealth_portal.payment_amount.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment_amount.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('payment_amount.edit.description', 'com_ehealth_portal.payment_amount.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment_amount.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/payment_amount.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.payment_amount.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.payment_amount.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.payment_amount.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_payment_amount')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.payment_amount.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.payment_amount', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('payment_amount'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('payment_amount'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('payment_amount'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('payment_amount', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/payment_amounts.php b/admin/models/payment_amounts.php new file mode 100644 index 0000000..d3388e9 --- /dev/null +++ b/admin/models/payment_amounts.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payment_amounts Model + */ +class Ehealth_portalModelPayment_amounts extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_payment_amount', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_payment_amount table + $query->from($db->quoteName('#__ehealth_portal_payment_amount', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_payment_amount"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_payment_amount')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_payment_amount'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/payment_type.php b/admin/models/payment_type.php new file mode 100644 index 0000000..f26bde3 --- /dev/null +++ b/admin/models/payment_type.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Payment_type Model + */ +class Ehealth_portalModelPayment_type extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.payment_type'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'payment_type', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.payment_type'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.payment_type', 'payment_type', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.payment_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('payment_type.edit.name', 'com_ehealth_portal.payment_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment_type.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('payment_type.edit.description', 'com_ehealth_portal.payment_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('payment_type.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/payment_type.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.payment_type.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.payment_type.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.payment_type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_payment_type')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.payment_type.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.payment_type', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('payment_type'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('payment_type'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('payment_type'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('payment_type', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_PAYMENT_TYPE_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/payment_types.php b/admin/models/payment_types.php new file mode 100644 index 0000000..29e6371 --- /dev/null +++ b/admin/models/payment_types.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payment_types Model + */ +class Ehealth_portalModelPayment_types extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_payment_type', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_payment_type table + $query->from($db->quoteName('#__ehealth_portal_payment_type', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_payment_type"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_payment_type')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_payment_type'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/payments.php b/admin/models/payments.php new file mode 100644 index 0000000..2fa0c9e --- /dev/null +++ b/admin/models/payments.php @@ -0,0 +1,567 @@ + + @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\Utilities\ArrayHelper; + +/** + * Payments Model + */ +class Ehealth_portalModelPayments extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient', + 'a.payment_category','payment_category', + 'a.payment_amount','payment_amount' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + $payment_category = $this->getUserStateFromRequest($this->context . '.filter.payment_category', 'filter_payment_category'); + if ($formSubmited) + { + $payment_category = $app->input->post->get('payment_category'); + $this->setState('filter.payment_category', $payment_category); + } + + $payment_amount = $this->getUserStateFromRequest($this->context . '.filter.payment_amount', 'filter_payment_amount'); + if ($formSubmited) + { + $payment_amount = $app->input->post->get('payment_amount'); + $this->setState('filter.payment_amount', $payment_amount); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert payment_category + $item->payment_category = $this->selectionTranslation($item->payment_category, 'payment_category'); + // convert payment_amount + $item->payment_amount = $this->selectionTranslation($item->payment_amount, 'payment_amount'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of payment_category language strings + if ($name === 'payment_category') + { + $payment_categoryArray = array( + 0 => 'COM_EHEALTH_PORTAL_PAYMENT_DEBT_PAYMENT', + 1 => 'COM_EHEALTH_PORTAL_PAYMENT_RECEIVE_PAYMENT' + ); + // Now check if value is found in this array + if (isset($payment_categoryArray[$value]) && Ehealth_portalHelper::checkString($payment_categoryArray[$value])) + { + return $payment_categoryArray[$value]; + } + } + // Array of payment_amount language strings + if ($name === 'payment_amount') + { + $payment_amountArray = array( + 0 => 'COM_EHEALTH_PORTAL_PAYMENT_SELECT_AMOUNT_N', + 1 => 'COM_EHEALTH_PORTAL_PAYMENT_ZERO', + 2 => 'COM_EHEALTH_PORTAL_PAYMENT_TEN', + 3 => 'COM_EHEALTH_PORTAL_PAYMENT_SEVENTY_FIVE' + ); + // Now check if value is found in this array + if (isset($payment_amountArray[$value]) && Ehealth_portalHelper::checkString($payment_amountArray[$value])) + { + return $payment_amountArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_payment', 'a')); + + // From the ehealth_portal_payment_type table. + $query->select($db->quoteName('g.name','payment_type_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_payment_type', 'g') . ' ON (' . $db->quoteName('a.payment_type') . ' = ' . $db->quoteName('g.id') . ')'); + + // From the ehealth_portal_nonpay_reason table. + $query->select($db->quoteName('h.name','nonpay_reason_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_nonpay_reason', 'h') . ' ON (' . $db->quoteName('a.nonpay_reason') . ' = ' . $db->quoteName('h.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.' OR a.receipt_no LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + // Filter by Payment_category. + $_payment_category = $this->getState('filter.payment_category'); + if (is_numeric($_payment_category)) + { + if (is_float($_payment_category)) + { + $query->where('a.payment_category = ' . (float) $_payment_category); + } + else + { + $query->where('a.payment_category = ' . (int) $_payment_category); + } + } + elseif (Ehealth_portalHelper::checkString($_payment_category)) + { + $query->where('a.payment_category = ' . $db->quote($db->escape($_payment_category))); + } + // Filter by Payment_amount. + $_payment_amount = $this->getState('filter.payment_amount'); + if (is_numeric($_payment_amount)) + { + if (is_float($_payment_amount)) + { + $query->where('a.payment_amount = ' . (float) $_payment_amount); + } + else + { + $query->where('a.payment_amount = ' . (int) $_payment_amount); + } + } + elseif (Ehealth_portalHelper::checkString($_payment_amount)) + { + $query->where('a.payment_amount = ' . $db->quote($db->escape($_payment_amount))); + } + elseif (Ehealth_portalHelper::checkArray($_payment_amount)) + { + // Secure the array for the query + $_payment_amount = array_map( function ($val) use(&$db) { + if (is_numeric($val)) + { + if (is_float($val)) + { + return (float) $val; + } + else + { + return (int) $val; + } + } + elseif (Ehealth_portalHelper::checkString($val)) + { + return $db->quote($db->escape($val)); + } + }, $_payment_amount); + // Filter by the Payment_amount Array. + $query->where('a.payment_amount IN (' . implode(',', $_payment_amount) . ')'); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_payment table + $query->from($db->quoteName('#__ehealth_portal_payment', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_payment"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + $id .= ':' . $this->getState('filter.payment_category'); + // Check if the value is an array + $_payment_amount = $this->getState('filter.payment_amount'); + if (Ehealth_portalHelper::checkArray($_payment_amount)) + { + $id .= ':' . implode(':', $_payment_amount); + } + // Check if this is only an number or string + elseif (is_numeric($_payment_amount) + || Ehealth_portalHelper::checkString($_payment_amount)) + { + $id .= ':' . $_payment_amount; + } + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_payment')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_payment'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/planning_type.php b/admin/models/planning_type.php new file mode 100644 index 0000000..e78c481 --- /dev/null +++ b/admin/models/planning_type.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Planning_type Model + */ +class Ehealth_portalModelPlanning_type extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.planning_type'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'planning_type', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.planning_type'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.planning_type', 'planning_type', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.planning_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('planning_type.edit.name', 'com_ehealth_portal.planning_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('planning_type.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('planning_type.edit.description', 'com_ehealth_portal.planning_type.' . (int) $id)) + || ($id == 0 && !$user->authorise('planning_type.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/planning_type.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.planning_type.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.planning_type.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.planning_type.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_planning_type')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.planning_type.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.planning_type', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('planning_type'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('planning_type'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('planning_type'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('planning_type', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_PLANNING_TYPE_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/planning_types.php b/admin/models/planning_types.php new file mode 100644 index 0000000..ee28131 --- /dev/null +++ b/admin/models/planning_types.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Planning_types Model + */ +class Ehealth_portalModelPlanning_types extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_planning_type', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_planning_type table + $query->from($db->quoteName('#__ehealth_portal_planning_type', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_planning_type"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_planning_type')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_planning_type'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/prostate_and_testicular_cancer.php b/admin/models/prostate_and_testicular_cancer.php new file mode 100644 index 0000000..eca4232 --- /dev/null +++ b/admin/models/prostate_and_testicular_cancer.php @@ -0,0 +1,884 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Prostate_and_testicular_cancer Model + */ +class Ehealth_portalModelProstate_and_testicular_cancer extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'ptc_age', + 'txt_ptc_age', + 'ptc_fam_history', + 'txt_ptc_fam_history', + 'ptc_diet', + 'txt_ptc_diet', + 'ptc_phy_activity', + 'txt_ptc_phy_activity' + ), + 'right' => array( + 'ptc_overweight', + 'txt_ptc_overweight', + 'ptc_urinate', + 'txt_ptc_urinate', + 'ptc_urine_freq', + 'txt_ptc_urine_freq' + ), + 'above' => array( + 'patient' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.prostate_and_testicular_cancer'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'prostate_and_testicular_cancer', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.prostate_and_testicular_cancer'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.prostate_and_testicular_cancer', 'prostate_and_testicular_cancer', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.prostate_and_testicular_cancer.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/prostate_and_testicular_cancer.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.prostate_and_testicular_cancer.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.prostate_and_testicular_cancer.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.prostate_and_testicular_cancer.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_prostate_and_testicular_cancer')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.prostate_and_testicular_cancer.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.prostate_and_testicular_cancer', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('prostate_and_testicular_cancer'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('prostate_and_testicular_cancer'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('prostate_and_testicular_cancer'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/prostate_and_testicular_cancers.php b/admin/models/prostate_and_testicular_cancers.php new file mode 100644 index 0000000..8ea17b1 --- /dev/null +++ b/admin/models/prostate_and_testicular_cancers.php @@ -0,0 +1,550 @@ + + @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\Utilities\ArrayHelper; + +/** + * Prostate_and_testicular_cancers Model + */ +class Ehealth_portalModelProstate_and_testicular_cancers extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert ptc_age + $item->ptc_age = $this->selectionTranslation($item->ptc_age, 'ptc_age'); + // convert ptc_fam_history + $item->ptc_fam_history = $this->selectionTranslation($item->ptc_fam_history, 'ptc_fam_history'); + // convert ptc_diet + $item->ptc_diet = $this->selectionTranslation($item->ptc_diet, 'ptc_diet'); + // convert ptc_phy_activity + $item->ptc_phy_activity = $this->selectionTranslation($item->ptc_phy_activity, 'ptc_phy_activity'); + // convert ptc_overweight + $item->ptc_overweight = $this->selectionTranslation($item->ptc_overweight, 'ptc_overweight'); + // convert ptc_urinate + $item->ptc_urinate = $this->selectionTranslation($item->ptc_urinate, 'ptc_urinate'); + // convert ptc_urine_freq + $item->ptc_urine_freq = $this->selectionTranslation($item->ptc_urine_freq, 'ptc_urine_freq'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of ptc_age language strings + if ($name === 'ptc_age') + { + $ptc_ageArray = array( + 0 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($ptc_ageArray[$value]) && Ehealth_portalHelper::checkString($ptc_ageArray[$value])) + { + return $ptc_ageArray[$value]; + } + } + // Array of ptc_fam_history language strings + if ($name === 'ptc_fam_history') + { + $ptc_fam_historyArray = array( + 0 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($ptc_fam_historyArray[$value]) && Ehealth_portalHelper::checkString($ptc_fam_historyArray[$value])) + { + return $ptc_fam_historyArray[$value]; + } + } + // Array of ptc_diet language strings + if ($name === 'ptc_diet') + { + $ptc_dietArray = array( + 0 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($ptc_dietArray[$value]) && Ehealth_portalHelper::checkString($ptc_dietArray[$value])) + { + return $ptc_dietArray[$value]; + } + } + // Array of ptc_phy_activity language strings + if ($name === 'ptc_phy_activity') + { + $ptc_phy_activityArray = array( + 0 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($ptc_phy_activityArray[$value]) && Ehealth_portalHelper::checkString($ptc_phy_activityArray[$value])) + { + return $ptc_phy_activityArray[$value]; + } + } + // Array of ptc_overweight language strings + if ($name === 'ptc_overweight') + { + $ptc_overweightArray = array( + 0 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($ptc_overweightArray[$value]) && Ehealth_portalHelper::checkString($ptc_overweightArray[$value])) + { + return $ptc_overweightArray[$value]; + } + } + // Array of ptc_urinate language strings + if ($name === 'ptc_urinate') + { + $ptc_urinateArray = array( + 0 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($ptc_urinateArray[$value]) && Ehealth_portalHelper::checkString($ptc_urinateArray[$value])) + { + return $ptc_urinateArray[$value]; + } + } + // Array of ptc_urine_freq language strings + if ($name === 'ptc_urine_freq') + { + $ptc_urine_freqArray = array( + 0 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_YES', + 1 => 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NO' + ); + // Now check if value is found in this array + if (isset($ptc_urine_freqArray[$value]) && Ehealth_portalHelper::checkString($ptc_urine_freqArray[$value])) + { + return $ptc_urine_freqArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_prostate_and_testicular_cancer', 'a')); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('g.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'g') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_prostate_and_testicular_cancer table + $query->from($db->quoteName('#__ehealth_portal_prostate_and_testicular_cancer', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_prostate_and_testicular_cancer"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_prostate_and_testicular_cancer')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_prostate_and_testicular_cancer'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/referral.php b/admin/models/referral.php new file mode 100644 index 0000000..1f65fa8 --- /dev/null +++ b/admin/models/referral.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Referral Model + */ +class Ehealth_portalModelReferral extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.referral'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'referral', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.referral'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.referral', 'referral', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.referral.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('referral.edit.name', 'com_ehealth_portal.referral.' . (int) $id)) + || ($id == 0 && !$user->authorise('referral.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('referral.edit.description', 'com_ehealth_portal.referral.' . (int) $id)) + || ($id == 0 && !$user->authorise('referral.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/referral.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.referral.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.referral.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.referral.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_referral')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.referral.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.referral', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('referral'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('referral'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('referral'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('referral', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_REFERRAL_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/referrals.php b/admin/models/referrals.php new file mode 100644 index 0000000..300aab7 --- /dev/null +++ b/admin/models/referrals.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Referrals Model + */ +class Ehealth_portalModelReferrals extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_referral', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_referral table + $query->from($db->quoteName('#__ehealth_portal_referral', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_referral"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_referral')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_referral'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/rules/index.html b/admin/models/rules/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/models/rules/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/models/site.php b/admin/models/site.php new file mode 100644 index 0000000..0771c9a --- /dev/null +++ b/admin/models/site.php @@ -0,0 +1,1017 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Site Model + */ +class Ehealth_portalModelSite extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'site_region' + ), + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'site_name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.site'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'site', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.site'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.site', 'site', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.site.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Site Name access controls. + if ($id != 0 && (!$user->authorise('site.edit.site_name', 'com_ehealth_portal.site.' . (int) $id)) + || ($id == 0 && !$user->authorise('site.edit.site_name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('site_name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('site_name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('site_name')) + { + // Disable fields while saving. + $form->setFieldAttribute('site_name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('site_name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('site.edit.description', 'com_ehealth_portal.site.' . (int) $id)) + || ($id == 0 && !$user->authorise('site.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Modify the form based on Edit Site Region access controls. + if ($id != 0 && (!$user->authorise('site.edit.site_region', 'com_ehealth_portal.site.' . (int) $id)) + || ($id == 0 && !$user->authorise('site.edit.site_region', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('site_region', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('site_region', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('site_region')) + { + // Disable fields while saving. + $form->setFieldAttribute('site_region', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('site_region', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/site.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.site.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.site.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.site.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_site')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.site.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.site', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('site'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('site'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->site_name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->site_name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('site'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the site_name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['site_name'] == $origTable->site_name) + { + list($site_name, $alias) = $this->_generateNewTitle($data['alias'], $data['site_name']); + $data['site_name'] = $site_name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['site_name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['site_name']); + } + + $table = JTable::getInstance('site', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_SITE_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/sites.php b/admin/models/sites.php new file mode 100644 index 0000000..d13cb63 --- /dev/null +++ b/admin/models/sites.php @@ -0,0 +1,423 @@ + + @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\Utilities\ArrayHelper; + +/** + * Sites Model + */ +class Ehealth_portalModelSites extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.site_name','site_name', + 'a.description','description', + 'a.site_region','site_region' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $site_name = $this->getUserStateFromRequest($this->context . '.filter.site_name', 'filter_site_name'); + if ($formSubmited) + { + $site_name = $app->input->post->get('site_name'); + $this->setState('filter.site_name', $site_name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + $site_region = $this->getUserStateFromRequest($this->context . '.filter.site_region', 'filter_site_region'); + if ($formSubmited) + { + $site_region = $app->input->post->get('site_region'); + $this->setState('filter.site_region', $site_region); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_site', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.site_name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.site_region LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_site table + $query->from($db->quoteName('#__ehealth_portal_site', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_site"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.site_name'); + $id .= ':' . $this->getState('filter.description'); + $id .= ':' . $this->getState('filter.site_region'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_site')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_site'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/strength.php b/admin/models/strength.php new file mode 100644 index 0000000..5fc7663 --- /dev/null +++ b/admin/models/strength.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Strength Model + */ +class Ehealth_portalModelStrength extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.strength'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'strength', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.strength'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.strength', 'strength', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.strength.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('strength.edit.name', 'com_ehealth_portal.strength.' . (int) $id)) + || ($id == 0 && !$user->authorise('strength.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('strength.edit.description', 'com_ehealth_portal.strength.' . (int) $id)) + || ($id == 0 && !$user->authorise('strength.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/strength.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.strength.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.strength.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.strength.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_strength')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.strength.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.strength', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('strength'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('strength'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('strength'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('strength', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_STRENGTH_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/strengths.php b/admin/models/strengths.php new file mode 100644 index 0000000..b143645 --- /dev/null +++ b/admin/models/strengths.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Strengths Model + */ +class Ehealth_portalModelStrengths extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_strength', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_strength table + $query->from($db->quoteName('#__ehealth_portal_strength', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_strength"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_strength')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_strength'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/test.php b/admin/models/test.php new file mode 100644 index 0000000..237cf88 --- /dev/null +++ b/admin/models/test.php @@ -0,0 +1,909 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Test Model + */ +class Ehealth_portalModelTest extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'urine' => array( + 'left' => array( + 'urine_test_result' + ), + 'above' => array( + 'patient' + ) + ), + 'glucose' => array( + 'left' => array( + 'glucose_first_reading', + 'glucose_second_reading' + ) + ), + 'haemoglobin' => array( + 'left' => array( + 'haemoglobin_reading' + ) + ), + 'cholesterol' => array( + 'left' => array( + 'cholesterol_reading' + ) + ), + 'syphillis' => array( + 'left' => array( + 'syphilis_first_reading', + 'syphilis_second_reading' + ) + ), + 'hepatitis_b' => array( + 'left' => array( + 'hepatitis_first_reading', + 'hepatitis_second_reading' + ) + ), + 'malaria' => array( + 'left' => array( + 'malaria_first_reading', + 'malaria_second_reading' + ) + ), + 'pregnancy' => array( + 'left' => array( + 'pregnancy_first_reading', + 'pregnancy_second_reading' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.test'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'test', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.test'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.test', 'test', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.test.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/test.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.test.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.test.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.test.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_test')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.test.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.test', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('test'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('test'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('test'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/testing_reason.php b/admin/models/testing_reason.php new file mode 100644 index 0000000..75569f5 --- /dev/null +++ b/admin/models/testing_reason.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Testing_reason Model + */ +class Ehealth_portalModelTesting_reason extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.testing_reason'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'testing_reason', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.testing_reason'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.testing_reason', 'testing_reason', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.testing_reason.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('testing_reason.edit.name', 'com_ehealth_portal.testing_reason.' . (int) $id)) + || ($id == 0 && !$user->authorise('testing_reason.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('testing_reason.edit.description', 'com_ehealth_portal.testing_reason.' . (int) $id)) + || ($id == 0 && !$user->authorise('testing_reason.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/testing_reason.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.testing_reason.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.testing_reason.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.testing_reason.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_testing_reason')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.testing_reason.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.testing_reason', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('testing_reason'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('testing_reason'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('testing_reason'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('testing_reason', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_TESTING_REASON_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/testing_reasons.php b/admin/models/testing_reasons.php new file mode 100644 index 0000000..0be721f --- /dev/null +++ b/admin/models/testing_reasons.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Testing_reasons Model + */ +class Ehealth_portalModelTesting_reasons extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_testing_reason', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_testing_reason table + $query->from($db->quoteName('#__ehealth_portal_testing_reason', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_testing_reason"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_testing_reason')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_testing_reason'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/tests.php b/admin/models/tests.php new file mode 100644 index 0000000..daf520a --- /dev/null +++ b/admin/models/tests.php @@ -0,0 +1,588 @@ + + @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\Utilities\ArrayHelper; + +/** + * Tests Model + */ +class Ehealth_portalModelTests extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert urine_test_result + $item->urine_test_result = $this->selectionTranslation($item->urine_test_result, 'urine_test_result'); + // convert syphilis_first_reading + $item->syphilis_first_reading = $this->selectionTranslation($item->syphilis_first_reading, 'syphilis_first_reading'); + // convert syphilis_second_reading + $item->syphilis_second_reading = $this->selectionTranslation($item->syphilis_second_reading, 'syphilis_second_reading'); + // convert hepatitis_first_reading + $item->hepatitis_first_reading = $this->selectionTranslation($item->hepatitis_first_reading, 'hepatitis_first_reading'); + // convert hepatitis_second_reading + $item->hepatitis_second_reading = $this->selectionTranslation($item->hepatitis_second_reading, 'hepatitis_second_reading'); + // convert malaria_first_reading + $item->malaria_first_reading = $this->selectionTranslation($item->malaria_first_reading, 'malaria_first_reading'); + // convert malaria_second_reading + $item->malaria_second_reading = $this->selectionTranslation($item->malaria_second_reading, 'malaria_second_reading'); + // convert pregnancy_first_reading + $item->pregnancy_first_reading = $this->selectionTranslation($item->pregnancy_first_reading, 'pregnancy_first_reading'); + // convert pregnancy_second_reading + $item->pregnancy_second_reading = $this->selectionTranslation($item->pregnancy_second_reading, 'pregnancy_second_reading'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of urine_test_result language strings + if ($name === 'urine_test_result') + { + $urine_test_resultArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_NORMAL', + 1 => 'COM_EHEALTH_PORTAL_TEST_ABNORMAL' + ); + // Now check if value is found in this array + if (isset($urine_test_resultArray[$value]) && Ehealth_portalHelper::checkString($urine_test_resultArray[$value])) + { + return $urine_test_resultArray[$value]; + } + } + // Array of syphilis_first_reading language strings + if ($name === 'syphilis_first_reading') + { + $syphilis_first_readingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TEST_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($syphilis_first_readingArray[$value]) && Ehealth_portalHelper::checkString($syphilis_first_readingArray[$value])) + { + return $syphilis_first_readingArray[$value]; + } + } + // Array of syphilis_second_reading language strings + if ($name === 'syphilis_second_reading') + { + $syphilis_second_readingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TEST_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($syphilis_second_readingArray[$value]) && Ehealth_portalHelper::checkString($syphilis_second_readingArray[$value])) + { + return $syphilis_second_readingArray[$value]; + } + } + // Array of hepatitis_first_reading language strings + if ($name === 'hepatitis_first_reading') + { + $hepatitis_first_readingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TEST_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($hepatitis_first_readingArray[$value]) && Ehealth_portalHelper::checkString($hepatitis_first_readingArray[$value])) + { + return $hepatitis_first_readingArray[$value]; + } + } + // Array of hepatitis_second_reading language strings + if ($name === 'hepatitis_second_reading') + { + $hepatitis_second_readingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TEST_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($hepatitis_second_readingArray[$value]) && Ehealth_portalHelper::checkString($hepatitis_second_readingArray[$value])) + { + return $hepatitis_second_readingArray[$value]; + } + } + // Array of malaria_first_reading language strings + if ($name === 'malaria_first_reading') + { + $malaria_first_readingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TEST_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($malaria_first_readingArray[$value]) && Ehealth_portalHelper::checkString($malaria_first_readingArray[$value])) + { + return $malaria_first_readingArray[$value]; + } + } + // Array of malaria_second_reading language strings + if ($name === 'malaria_second_reading') + { + $malaria_second_readingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TEST_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($malaria_second_readingArray[$value]) && Ehealth_portalHelper::checkString($malaria_second_readingArray[$value])) + { + return $malaria_second_readingArray[$value]; + } + } + // Array of pregnancy_first_reading language strings + if ($name === 'pregnancy_first_reading') + { + $pregnancy_first_readingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TEST_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($pregnancy_first_readingArray[$value]) && Ehealth_portalHelper::checkString($pregnancy_first_readingArray[$value])) + { + return $pregnancy_first_readingArray[$value]; + } + } + // Array of pregnancy_second_reading language strings + if ($name === 'pregnancy_second_reading') + { + $pregnancy_second_readingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TEST_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TEST_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TEST_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($pregnancy_second_readingArray[$value]) && Ehealth_portalHelper::checkString($pregnancy_second_readingArray[$value])) + { + return $pregnancy_second_readingArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_test', 'a')); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('g.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'g') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_test table + $query->from($db->quoteName('#__ehealth_portal_test', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_test"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_test')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_test'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/tuberculoses.php b/admin/models/tuberculoses.php new file mode 100644 index 0000000..6f94528 --- /dev/null +++ b/admin/models/tuberculoses.php @@ -0,0 +1,681 @@ + + @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\Utilities\ArrayHelper; + +/** + * Tuberculoses Model + */ +class Ehealth_portalModelTuberculoses extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert recurring_night_sweats + $item->recurring_night_sweats = $this->selectionTranslation($item->recurring_night_sweats, 'recurring_night_sweats'); + // convert tb_fever + $item->tb_fever = $this->selectionTranslation($item->tb_fever, 'tb_fever'); + // convert persistent_cough + $item->persistent_cough = $this->selectionTranslation($item->persistent_cough, 'persistent_cough'); + // convert blood_streaked_sputum + $item->blood_streaked_sputum = $this->selectionTranslation($item->blood_streaked_sputum, 'blood_streaked_sputum'); + // convert unusual_tiredness + $item->unusual_tiredness = $this->selectionTranslation($item->unusual_tiredness, 'unusual_tiredness'); + // convert pain_in_chest + $item->pain_in_chest = $this->selectionTranslation($item->pain_in_chest, 'pain_in_chest'); + // convert shortness_of_breath + $item->shortness_of_breath = $this->selectionTranslation($item->shortness_of_breath, 'shortness_of_breath'); + // convert diagnosed_with_disease + $item->diagnosed_with_disease = $this->selectionTranslation($item->diagnosed_with_disease, 'diagnosed_with_disease'); + // convert tb_exposed + $item->tb_exposed = $this->selectionTranslation($item->tb_exposed, 'tb_exposed'); + // convert tb_treatment + $item->tb_treatment = $this->selectionTranslation($item->tb_treatment, 'tb_treatment'); + // convert sputum_collection_one + $item->sputum_collection_one = $this->selectionTranslation($item->sputum_collection_one, 'sputum_collection_one'); + // convert sputum_result_one + $item->sputum_result_one = $this->selectionTranslation($item->sputum_result_one, 'sputum_result_one'); + // convert referred_second_sputum + $item->referred_second_sputum = $this->selectionTranslation($item->referred_second_sputum, 'referred_second_sputum'); + // convert sputum_result_two + $item->sputum_result_two = $this->selectionTranslation($item->sputum_result_two, 'sputum_result_two'); + // convert weight_loss_wdieting + $item->weight_loss_wdieting = $this->selectionTranslation($item->weight_loss_wdieting, 'weight_loss_wdieting'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of recurring_night_sweats language strings + if ($name === 'recurring_night_sweats') + { + $recurring_night_sweatsArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($recurring_night_sweatsArray[$value]) && Ehealth_portalHelper::checkString($recurring_night_sweatsArray[$value])) + { + return $recurring_night_sweatsArray[$value]; + } + } + // Array of tb_fever language strings + if ($name === 'tb_fever') + { + $tb_feverArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($tb_feverArray[$value]) && Ehealth_portalHelper::checkString($tb_feverArray[$value])) + { + return $tb_feverArray[$value]; + } + } + // Array of persistent_cough language strings + if ($name === 'persistent_cough') + { + $persistent_coughArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($persistent_coughArray[$value]) && Ehealth_portalHelper::checkString($persistent_coughArray[$value])) + { + return $persistent_coughArray[$value]; + } + } + // Array of blood_streaked_sputum language strings + if ($name === 'blood_streaked_sputum') + { + $blood_streaked_sputumArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($blood_streaked_sputumArray[$value]) && Ehealth_portalHelper::checkString($blood_streaked_sputumArray[$value])) + { + return $blood_streaked_sputumArray[$value]; + } + } + // Array of unusual_tiredness language strings + if ($name === 'unusual_tiredness') + { + $unusual_tirednessArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($unusual_tirednessArray[$value]) && Ehealth_portalHelper::checkString($unusual_tirednessArray[$value])) + { + return $unusual_tirednessArray[$value]; + } + } + // Array of pain_in_chest language strings + if ($name === 'pain_in_chest') + { + $pain_in_chestArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($pain_in_chestArray[$value]) && Ehealth_portalHelper::checkString($pain_in_chestArray[$value])) + { + return $pain_in_chestArray[$value]; + } + } + // Array of shortness_of_breath language strings + if ($name === 'shortness_of_breath') + { + $shortness_of_breathArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($shortness_of_breathArray[$value]) && Ehealth_portalHelper::checkString($shortness_of_breathArray[$value])) + { + return $shortness_of_breathArray[$value]; + } + } + // Array of diagnosed_with_disease language strings + if ($name === 'diagnosed_with_disease') + { + $diagnosed_with_diseaseArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO' + ); + // Now check if value is found in this array + if (isset($diagnosed_with_diseaseArray[$value]) && Ehealth_portalHelper::checkString($diagnosed_with_diseaseArray[$value])) + { + return $diagnosed_with_diseaseArray[$value]; + } + } + // Array of tb_exposed language strings + if ($name === 'tb_exposed') + { + $tb_exposedArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($tb_exposedArray[$value]) && Ehealth_portalHelper::checkString($tb_exposedArray[$value])) + { + return $tb_exposedArray[$value]; + } + } + // Array of tb_treatment language strings + if ($name === 'tb_treatment') + { + $tb_treatmentArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO' + ); + // Now check if value is found in this array + if (isset($tb_treatmentArray[$value]) && Ehealth_portalHelper::checkString($tb_treatmentArray[$value])) + { + return $tb_treatmentArray[$value]; + } + } + // Array of sputum_collection_one language strings + if ($name === 'sputum_collection_one') + { + $sputum_collection_oneArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO' + ); + // Now check if value is found in this array + if (isset($sputum_collection_oneArray[$value]) && Ehealth_portalHelper::checkString($sputum_collection_oneArray[$value])) + { + return $sputum_collection_oneArray[$value]; + } + } + // Array of sputum_result_one language strings + if ($name === 'sputum_result_one') + { + $sputum_result_oneArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($sputum_result_oneArray[$value]) && Ehealth_portalHelper::checkString($sputum_result_oneArray[$value])) + { + return $sputum_result_oneArray[$value]; + } + } + // Array of referred_second_sputum language strings + if ($name === 'referred_second_sputum') + { + $referred_second_sputumArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO' + ); + // Now check if value is found in this array + if (isset($referred_second_sputumArray[$value]) && Ehealth_portalHelper::checkString($referred_second_sputumArray[$value])) + { + return $referred_second_sputumArray[$value]; + } + } + // Array of sputum_result_two language strings + if ($name === 'sputum_result_two') + { + $sputum_result_twoArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_POSITIVE', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NEGATIVE', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_INCONCLUSIVE' + ); + // Now check if value is found in this array + if (isset($sputum_result_twoArray[$value]) && Ehealth_portalHelper::checkString($sputum_result_twoArray[$value])) + { + return $sputum_result_twoArray[$value]; + } + } + // Array of weight_loss_wdieting language strings + if ($name === 'weight_loss_wdieting') + { + $weight_loss_wdietingArray = array( + 0 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_YES', + 1 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NO', + 2 => 'COM_EHEALTH_PORTAL_TUBERCULOSIS_UNCERTAIN' + ); + // Now check if value is found in this array + if (isset($weight_loss_wdietingArray[$value]) && Ehealth_portalHelper::checkString($weight_loss_wdietingArray[$value])) + { + return $weight_loss_wdietingArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_tuberculosis', 'a')); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('g.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'g') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_tuberculosis table + $query->from($db->quoteName('#__ehealth_portal_tuberculosis', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_tuberculosis"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_tuberculosis')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_tuberculosis'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/tuberculosis.php b/admin/models/tuberculosis.php new file mode 100644 index 0000000..d7be599 --- /dev/null +++ b/admin/models/tuberculosis.php @@ -0,0 +1,910 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Tuberculosis Model + */ +class Ehealth_portalModelTuberculosis extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'screening' => array( + 'left' => array( + 'weight_loss_wdieting', + 'recurring_night_sweats', + 'tb_fever', + 'persistent_cough', + 'blood_streaked_sputum', + 'unusual_tiredness', + 'pain_in_chest', + 'shortness_of_breath' + ), + 'right' => array( + 'diagnosed_with_disease', + 'tb_exposed', + 'tb_treatment', + 'date_of_treatment', + 'treating_dhc' + ), + 'above' => array( + 'patient' + ) + ), + 'sputum_collection' => array( + 'left' => array( + 'sputum_collection_one', + 'tb_reason_one', + 'sputum_result_one', + 'referred_second_sputum', + 'tb_reason_two', + 'sputum_result_two' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.tuberculosis'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'tuberculosis', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.tuberculosis'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.tuberculosis', 'tuberculosis', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.tuberculosis.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Patient access controls. + if ($id != 0 && (!$user->authorise('tuberculosis.edit.patient', 'com_ehealth_portal.tuberculosis.' . (int) $id)) + || ($id == 0 && !$user->authorise('tuberculosis.edit.patient', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('patient', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('patient', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('patient')) + { + // Disable fields while saving. + $form->setFieldAttribute('patient', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('patient', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/tuberculosis.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.tuberculosis.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.tuberculosis.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.tuberculosis.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_tuberculosis')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.tuberculosis.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.tuberculosis', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('tuberculosis'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('tuberculosis'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('tuberculosis'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/unit.php b/admin/models/unit.php new file mode 100644 index 0000000..442e3ef --- /dev/null +++ b/admin/models/unit.php @@ -0,0 +1,997 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Unit Model + */ +class Ehealth_portalModelUnit extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'fullwidth' => array( + 'description' + ), + 'above' => array( + 'name', + 'alias' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.unit'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'unit', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.unit'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.unit', 'unit', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.unit.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Modify the form based on Edit Name access controls. + if ($id != 0 && (!$user->authorise('unit.edit.name', 'com_ehealth_portal.unit.' . (int) $id)) + || ($id == 0 && !$user->authorise('unit.edit.name', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('name', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('name', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('name')) + { + // Disable fields while saving. + $form->setFieldAttribute('name', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('name', 'required', 'false'); + } + } + // Modify the form based on Edit Description access controls. + if ($id != 0 && (!$user->authorise('unit.edit.description', 'com_ehealth_portal.unit.' . (int) $id)) + || ($id == 0 && !$user->authorise('unit.edit.description', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('description', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('description', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('description')) + { + // Disable fields while saving. + $form->setFieldAttribute('description', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('description', 'required', 'false'); + } + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/unit.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.unit.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.unit.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.unit.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_unit')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.unit.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.unit', $data); + } + + return $data; + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('unit'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('unit'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('unit'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the name for save as copy + if ($input->get('task') === 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['name'] == $origTable->name) + { + list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); + $data['name'] = $name; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['published'] = 0; + } + + // Automatic handling of alias for empty fields + if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) + { + if ($data['alias'] == null || empty($data['alias'])) + { + if (JFactory::getConfig()->get('unicodeslugs') == 1) + { + $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); + } + else + { + $data['alias'] = JFilterOutput::stringURLSafe($data['name']); + } + + $table = JTable::getInstance('unit', 'ehealth_portalTable'); + + if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) + { + $msg = JText::_('COM_EHEALTH_PORTAL_UNIT_SAVE_WARNING'); + } + + $data['alias'] = $this->_generateNewTitle($data['alias']); + + if (isset($msg)) + { + JFactory::getApplication()->enqueueMessage($msg, 'warning'); + } + } + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } + + /** + * Method to change the title/s & alias. + * + * @param string $alias The alias. + * @param string/array $title The title. + * + * @return array/string Contains the modified title/s and/or alias. + * + */ + protected function _generateNewTitle($alias, $title = null) + { + + // Alter the title/s & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = StringHelper::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = StringHelper::increment($title); + } + $alias = StringHelper::increment($alias, 'dash'); + } + // Check if this is an array of titles + if (Ehealth_portalHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; + } +} diff --git a/admin/models/units.php b/admin/models/units.php new file mode 100644 index 0000000..eb1220f --- /dev/null +++ b/admin/models/units.php @@ -0,0 +1,414 @@ + + @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\Utilities\ArrayHelper; + +/** + * Units Model + */ +class Ehealth_portalModelUnits extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.name','name', + 'a.description','description' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // return items + return $items; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_unit', 'a')); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.alias LIKE '.$search.')'); + } + } + + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_unit table + $query->from($db->quoteName('#__ehealth_portal_unit', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_unit"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_unit')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_unit'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/models/vmmc.php b/admin/models/vmmc.php new file mode 100644 index 0000000..d4d7d73 --- /dev/null +++ b/admin/models/vmmc.php @@ -0,0 +1,909 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Ehealth_portal Vmmc Model + */ +class Ehealth_portalModelVmmc extends JModelAdmin +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'partner_circumcised', + 'are_you_circumcised', + 'interested_in_vmmc', + 'info_ben_vmcc' + ), + 'above' => array( + 'patient', + 'vmmc_gender' + ) + ), + 'referrals' => array( + 'left' => array( + 'referral' + ), + 'right' => array( + 'reason' + ) + ) + ); + + /** + * @var string The prefix to use with controller messages. + * @since 1.6 + */ + protected $text_prefix = 'COM_EHEALTH_PORTAL'; + + /** + * The type alias for this content type. + * + * @var string + * @since 3.2 + */ + public $typeAlias = 'com_ehealth_portal.vmmc'; + + /** + * Returns a Table object, always creating it + * + * @param type $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A database object + * + * @since 1.6 + */ + public function getTable($type = 'vmmc', $prefix = 'Ehealth_portalTable', $config = array()) + { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/tables'); + // get instance of the table + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.6 + */ + public function getItem($pk = null) + { + if ($item = parent::getItem($pk)) + { + if (!empty($item->params) && !is_array($item->params)) + { + // Convert the params field to an array. + $registry = new Registry; + $registry->loadString($item->params); + $item->params = $registry->toArray(); + } + + if (!empty($item->metadata)) + { + // Convert the metadata field to an array. + $registry = new Registry; + $registry->loadString($item->metadata); + $item->metadata = $registry->toArray(); + } + + if (!empty($item->id)) + { + $item->tags = new JHelperTags; + $item->tags->getTagIds($item->id, 'com_ehealth_portal.vmmc'); + } + } + + return $item; + } + + /** + * Method to get the record form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. + * + * @return mixed A JForm object on success, false on failure + * + * @since 1.6 + */ + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; + // check if xpath was set in options + $xpath = false; + if (isset($options['xpath'])) + { + $xpath = $options['xpath']; + unset($options['xpath']); + } + // check if clear form was set in options + $clear = false; + if (isset($options['clear'])) + { + $clear = $options['clear']; + unset($options['clear']); + } + + // Get the form. + $form = $this->loadForm('com_ehealth_portal.vmmc', 'vmmc', $options, $clear, $xpath); + + if (empty($form)) + { + return false; + } + + $jinput = JFactory::getApplication()->input; + + // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. + if ($jinput->get('a_id')) + { + $id = $jinput->get('a_id', 0, 'INT'); + } + // The back end uses id so we use that the rest of the time and set it to 0 by default. + else + { + $id = $jinput->get('id', 0, 'INT'); + } + + $user = JFactory::getUser(); + + // Check for existing item. + // Modify the form based on Edit State access controls. + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_ehealth_portal.vmmc.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_ehealth_portal'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('published', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('published', 'filter', 'unset'); + } + // If this is a new item insure the greated by is set. + if (0 == $id) + { + // Set the created_by to this user + $form->setValue('created_by', null, $user->id); + } + // Modify the form based on Edit Creaded By access controls. + if (!$user->authorise('core.edit.created_by', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created_by', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('created_by', 'readonly', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created_by', 'filter', 'unset'); + } + // Modify the form based on Edit Creaded Date access controls. + if (!$user->authorise('core.edit.created', 'com_ehealth_portal')) + { + // Disable fields for display. + $form->setFieldAttribute('created', 'disabled', 'true'); + // Disable fields while saving. + $form->setFieldAttribute('created', 'filter', 'unset'); + } + // Only load these values if no id is found + if (0 == $id) + { + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); + if (0 != $redirectedValue && $redirectedField) + { + // Now set the local-redirected field default value + $form->setValue($redirectedField, null, $redirectedValue); + } + } + return $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string script files + */ + public function getScript() + { + return 'media/com_ehealth_portal/js/vmmc.js'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->published != -2) + { + return; + } + + $user = JFactory::getUser(); + // The record has been set. Check the record permissions. + return $user->authorise('core.delete', 'com_ehealth_portal.vmmc.' . (int) $record->id); + } + return false; + } + + /** + * Method to test whether a record can have its state edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * + * @since 1.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + $recordId = (!empty($record->id)) ? $record->id : 0; + + if ($recordId) + { + // The record has been set. Check the record permissions. + $permission = $user->authorise('core.edit.state', 'com_ehealth_portal.vmmc.' . (int) $recordId); + if (!$permission && !is_null($permission)) + { + return false; + } + } + // In the absense of better information, revert to the component permissions. + return parent::canEditState($record); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * @since 2.5 + */ + protected function allowEdit($data = array(), $key = 'id') + { + // Check specific edit permission then general edit permission. + + return JFactory::getUser()->authorise('core.edit', 'com_ehealth_portal.vmmc.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key); + } + + /** + * Prepare and sanitise the table data prior to saving. + * + * @param JTable $table A JTable object. + * + * @return void + * + * @since 1.6 + */ + protected function prepareTable($table) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if (isset($table->name)) + { + $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); + } + + if (isset($table->alias) && empty($table->alias)) + { + $table->generateAlias(); + } + + if (empty($table->id)) + { + $table->created = $date->toSql(); + // set the user + if ($table->created_by == 0 || empty($table->created_by)) + { + $table->created_by = $user->id; + } + // Set ordering to the last item if not set + if (empty($table->ordering)) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('MAX(ordering)') + ->from($db->quoteName('#__ehealth_portal_vmmc')); + $db->setQuery($query); + $max = $db->loadResult(); + + $table->ordering = $max + 1; + } + } + else + { + $table->modified = $date->toSql(); + $table->modified_by = $user->id; + } + + if (!empty($table->id)) + { + // Increment the items version number. + $table->version++; + } + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = JFactory::getApplication()->getUserState('com_ehealth_portal.edit.vmmc.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + // run the perprocess of the data + $this->preprocessData('com_ehealth_portal.vmmc', $data); + } + + return $data; + } + + /** + * Method to validate the form data. + * + * @param JForm $form The form to validate against. + * @param array $data The data to validate. + * @param string $group The name of the field group to validate. + * + * @return mixed Array of filtered data if valid, false otherwise. + * + * @see JFormRule + * @see JFilterInput + * @since 12.2 + */ + public function validate($form, $data, $group = null) + { + // check if the not_required field is set + if (isset($data['not_required']) && Ehealth_portalHelper::checkString($data['not_required'])) + { + $requiredFields = (array) explode(',',(string) $data['not_required']); + $requiredFields = array_unique($requiredFields); + // now change the required field attributes value + foreach ($requiredFields as $requiredField) + { + // make sure there is a string value + if (Ehealth_portalHelper::checkString($requiredField)) + { + // change to false + $form->setFieldAttribute($requiredField, 'required', 'false'); + // also clear the data set + $data[$requiredField] = ''; + } + } + } + return parent::validate($form, $data, $group); + } + + /** + * Method to get the unique fields of this table. + * + * @return mixed An array of field names, boolean false if none is set. + * + * @since 3.0 + */ + protected function getUniqueFields() + { + return false; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since 12.2 + */ + public function delete(&$pks) + { + if (!parent::delete($pks)) + { + return false; + } + + return true; + } + + /** + * Method to change the published state of one or more records. + * + * @param array &$pks A list of the primary keys to change. + * @param integer $value The value of the published state. + * + * @return boolean True on success. + * + * @since 12.2 + */ + public function publish(&$pks, $value = 1) + { + if (!parent::publish($pks, $value)) + { + return false; + } + + return true; + } + + /** + * Method to perform batch operations on an item or a set of items. + * + * @param array $commands An array of commands to perform. + * @param array $pks An array of item ids. + * @param array $contexts An array of item contexts. + * + * @return boolean Returns true on success, false on failure. + * + * @since 12.2 + */ + public function batch($commands, $pks, $contexts) + { + // Sanitize ids. + $pks = array_unique($pks); + ArrayHelper::toInteger($pks); + + // Remove any values of zero. + if (array_search(0, $pks, true)) + { + unset($pks[array_search(0, $pks, true)]); + } + + if (empty($pks)) + { + $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; + } + + $done = false; + + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->contentType = new JUcmType; + $this->type = $this->contentType->getTypeByTable($this->tableClassName); + $this->canDo = Ehealth_portalHelper::getActions('vmmc'); + $this->batchSet = true; + + if (!$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; + } + + if ($this->type == false) + { + $type = new JUcmType; + $this->type = $type->getTypeByAlias($this->typeAlias); + } + + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); + + if (!empty($commands['move_copy'])) + { + $cmd = ArrayHelper::getValue($commands, 'move_copy', 'c'); + + if ($cmd == 'c') + { + $result = $this->batchCopy($commands, $pks, $contexts); + + if (is_array($result)) + { + foreach ($result as $old => $new) + { + $contexts[$new] = $contexts[$old]; + } + $pks = array_values($result); + } + else + { + return false; + } + } + elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) + { + return false; + } + + $done = true; + } + + if (!$done) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + + return false; + } + + // Clear the cache + $this->cleanCache(); + + return true; + } + + /** + * Batch copy items to a new category or current. + * + * @param integer $values The new values. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return mixed An array of new IDs on success, boolean false on failure. + * + * @since 12.2 + */ + protected function batchCopy($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('vmmc'); + } + + if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch')) + { + return false; + } + + // get list of unique fields + $uniqueFields = $this->getUniqueFields(); + // remove move_copy from array + unset($values['move_copy']); + + // make sure published is set + if (!isset($values['published'])) + { + $values['published'] = 0; + } + elseif (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + $values['published'] = 0; + } + + $newIds = array(); + // Parent exists so let's proceed + while (!empty($pks)) + { + // Pop the first ID off the stack + $pk = array_shift($pks); + + $this->table->reset(); + + // only allow copy if user may edit this item. + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + if (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + // update all unique fields + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField); + } + } + + // Reset the ID because we are making a copy + $this->table->id = 0; + + // TODO: Deal with ordering? + // $this->table->ordering = 1; + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + + // Get the new item ID + $newId = $this->table->get('id'); + + // Add the new ID to the array + $newIds[$pk] = $newId; + } + + // Clean the cache + $this->cleanCache(); + + return $newIds; + } + + /** + * Batch move items to a new category + * + * @param integer $value The new category ID. + * @param array $pks An array of row IDs. + * @param array $contexts An array of item contexts. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 12.2 + */ + protected function batchMove($values, $pks, $contexts) + { + if (empty($this->batchSet)) + { + // Set some needed variables. + $this->user = JFactory::getUser(); + $this->table = $this->getTable(); + $this->tableClassName = get_class($this->table); + $this->canDo = Ehealth_portalHelper::getActions('vmmc'); + } + + if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch')) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // make sure published only updates if user has the permission. + if (isset($values['published']) && !$this->canDo->get('core.edit.state')) + { + unset($values['published']); + } + // remove move_copy from array + unset($values['move_copy']); + + // Parent exists so we proceed + foreach ($pks as $pk) + { + if (!$this->user->authorise('core.edit', $contexts[$pk])) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; + } + + // Check that the row actually exists + if (!$this->table->load($pk)) + { + if ($error = $this->table->getError()) + { + // Fatal error + $this->setError($error); + return false; + } + else + { + // Not fatal error + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); + continue; + } + } + + // insert all set values. + if (Ehealth_portalHelper::checkArray($values)) + { + foreach ($values as $key => $value) + { + // Do special action for access. + if ('access' === $key && strlen($value) > 0) + { + $this->table->$key = $value; + } + elseif (strlen($value) > 0 && isset($this->table->$key)) + { + $this->table->$key = $value; + } + } + } + + + // Check the row. + if (!$this->table->check()) + { + $this->setError($this->table->getError()); + + return false; + } + + if (!empty($this->type)) + { + $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); + } + + // Store the row. + if (!$this->table->store()) + { + $this->setError($this->table->getError()); + + return false; + } + } + + // Clean the cache + $this->cleanCache(); + + return true; + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success. + * + * @since 1.6 + */ + public function save($data) + { + $input = JFactory::getApplication()->input; + $filter = JFilterInput::getInstance(); + + // set the metadata to the Item Data + if (isset($data['metadata']) && isset($data['metadata']['author'])) + { + $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); + + $metadata = new JRegistry; + $metadata->loadArray($data['metadata']); + $data['metadata'] = (string) $metadata; + } + + // Set the Params Items to data + if (isset($data['params']) && is_array($data['params'])) + { + $params = new JRegistry; + $params->loadArray($data['params']); + $data['params'] = (string) $params; + } + + // Alter the unique field for save as copy + if ($input->get('task') === 'save2copy') + { + // Automatic handling of other unique fields + $uniqueFields = $this->getUniqueFields(); + if (Ehealth_portalHelper::checkArray($uniqueFields)) + { + foreach ($uniqueFields as $uniqueField) + { + $data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]); + } + } + } + + if (parent::save($data)) + { + return true; + } + return false; + } + + /** + * Method to generate a unique value. + * + * @param string $field name. + * @param string $value data. + * + * @return string New value. + * + * @since 3.0 + */ + protected function generateUnique($field,$value) + { + + // set field value unique + $table = $this->getTable(); + + while ($table->load(array($field => $value))) + { + $value = StringHelper::increment($value); + } + + return $value; + } +} diff --git a/admin/models/vmmcs.php b/admin/models/vmmcs.php new file mode 100644 index 0000000..43e85a0 --- /dev/null +++ b/admin/models/vmmcs.php @@ -0,0 +1,565 @@ + + @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\Utilities\ArrayHelper; + +/** + * Vmmcs Model + */ +class Ehealth_portalModelVmmcs extends JModelList +{ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'a.id','id', + 'a.published','published', + 'a.access','access', + 'a.ordering','ordering', + 'a.created_by','created_by', + 'a.modified_by','modified_by', + 'a.patient','patient', + 'g.name','referral' + ); + } + + parent::__construct($config); + } + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + */ + protected function populateState($ordering = null, $direction = null) + { + $app = JFactory::getApplication(); + + // Adjust the context to support modal layouts. + if ($layout = $app->input->get('layout')) + { + $this->context .= '.' . $layout; + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $patient = $this->getUserStateFromRequest($this->context . '.filter.patient', 'filter_patient'); + if ($formSubmited) + { + $patient = $app->input->post->get('patient'); + $this->setState('filter.patient', $patient); + } + + $referral = $this->getUserStateFromRequest($this->context . '.filter.referral', 'filter_referral'); + if ($formSubmited) + { + $referral = $app->input->post->get('referral'); + $this->setState('filter.referral', $referral); + } + + // List state information. + parent::populateState($ordering, $direction); + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + // check in items + $this->checkInNow(); + + // load parent items + $items = parent::getItems(); + + // set selection value to a translatable value + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert are_you_circumcised + $item->are_you_circumcised = $this->selectionTranslation($item->are_you_circumcised, 'are_you_circumcised'); + // convert info_ben_vmcc + $item->info_ben_vmcc = $this->selectionTranslation($item->info_ben_vmcc, 'info_ben_vmcc'); + // convert interested_in_vmmc + $item->interested_in_vmmc = $this->selectionTranslation($item->interested_in_vmmc, 'interested_in_vmmc'); + // convert vmmc_gender + $item->vmmc_gender = $this->selectionTranslation($item->vmmc_gender, 'vmmc_gender'); + } + } + + + // return items + return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of are_you_circumcised language strings + if ($name === 'are_you_circumcised') + { + $are_you_circumcisedArray = array( + 0 => 'COM_EHEALTH_PORTAL_VMMC_YES', + 1 => 'COM_EHEALTH_PORTAL_VMMC_NO' + ); + // Now check if value is found in this array + if (isset($are_you_circumcisedArray[$value]) && Ehealth_portalHelper::checkString($are_you_circumcisedArray[$value])) + { + return $are_you_circumcisedArray[$value]; + } + } + // Array of info_ben_vmcc language strings + if ($name === 'info_ben_vmcc') + { + $info_ben_vmccArray = array( + 0 => 'COM_EHEALTH_PORTAL_VMMC_YES', + 1 => 'COM_EHEALTH_PORTAL_VMMC_NO' + ); + // Now check if value is found in this array + if (isset($info_ben_vmccArray[$value]) && Ehealth_portalHelper::checkString($info_ben_vmccArray[$value])) + { + return $info_ben_vmccArray[$value]; + } + } + // Array of interested_in_vmmc language strings + if ($name === 'interested_in_vmmc') + { + $interested_in_vmmcArray = array( + 0 => 'COM_EHEALTH_PORTAL_VMMC_YES', + 1 => 'COM_EHEALTH_PORTAL_VMMC_NO' + ); + // Now check if value is found in this array + if (isset($interested_in_vmmcArray[$value]) && Ehealth_portalHelper::checkString($interested_in_vmmcArray[$value])) + { + return $interested_in_vmmcArray[$value]; + } + } + // Array of vmmc_gender language strings + if ($name === 'vmmc_gender') + { + $vmmc_genderArray = array( + 0 => 'COM_EHEALTH_PORTAL_VMMC_MALE', + 1 => 'COM_EHEALTH_PORTAL_VMMC_FEMALE' + ); + // Now check if value is found in this array + if (isset($vmmc_genderArray[$value]) && Ehealth_portalHelper::checkString($vmmc_genderArray[$value])) + { + return $vmmc_genderArray[$value]; + } + } + return $value; + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the user object. + $user = JFactory::getUser(); + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_item table + $query->from($db->quoteName('#__ehealth_portal_vmmc', 'a')); + + // From the ehealth_portal_referral table. + $query->select($db->quoteName('g.name','referral_name')); + $query->join('LEFT', $db->quoteName('#__ehealth_portal_referral', 'g') . ' ON (' . $db->quoteName('a.referral') . ' = ' . $db->quoteName('g.id') . ')'); + + // Filter by published state + $published = $this->getState('filter.published'); + if (is_numeric($published)) + { + $query->where('a.published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(a.published = 0 OR a.published = 1)'); + } + + // Join over the asset groups. + $query->select('ag.title AS access_level'); + $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + // Filter by access level. + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) + { + $query->where('a.access = ' . (int) $_access); + } + elseif (Ehealth_portalHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + // Filter by search. + $search = $this->getState('filter.search'); + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->quote('%' . $db->escape($search) . '%'); + $query->where('(a.patient LIKE '.$search.')'); + } + } + + // Filter by Patient. + $_patient = $this->getState('filter.patient'); + if (is_numeric($_patient)) + { + if (is_float($_patient)) + { + $query->where('a.patient = ' . (float) $_patient); + } + else + { + $query->where('a.patient = ' . (int) $_patient); + } + } + elseif (Ehealth_portalHelper::checkString($_patient)) + { + $query->where('a.patient = ' . $db->quote($db->escape($_patient))); + } + // Filter by Referral. + $_referral = $this->getState('filter.referral'); + if (is_numeric($_referral)) + { + if (is_float($_referral)) + { + $query->where('a.referral = ' . (float) $_referral); + } + else + { + $query->where('a.referral = ' . (int) $_referral); + } + } + elseif (Ehealth_portalHelper::checkString($_referral)) + { + $query->where('a.referral = ' . $db->quote($db->escape($_referral))); + } + elseif (Ehealth_portalHelper::checkArray($_referral)) + { + // Secure the array for the query + $_referral = array_map( function ($val) use(&$db) { + if (is_numeric($val)) + { + if (is_float($val)) + { + return (float) $val; + } + else + { + return (int) $val; + } + } + elseif (Ehealth_portalHelper::checkString($val)) + { + return $db->quote($db->escape($val)); + } + }, $_referral); + // Filter by the Referral Array. + $query->where('a.referral IN (' . implode(',', $_referral) . ')'); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'a.id'); + $orderDirn = $this->state->get('list.direction', 'desc'); + if ($orderCol != '') + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Method to get list export data. + * + * @param array $pks The ids of the items to get + * @param JUser $user The user making the request + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExportData($pks, $user = null) + { + // setup the query + if (($pks_size = Ehealth_portalHelper::checkArray($pks)) !== false || 'bulk' === $pks) + { + // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) + $_export = true; + // Get the user object if not set. + if (!isset($user) || !Ehealth_portalHelper::checkObject($user)) + { + $user = JFactory::getUser(); + } + // Create a new query object. + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + + // Select some fields + $query->select('a.*'); + + // From the ehealth_portal_vmmc table + $query->from($db->quoteName('#__ehealth_portal_vmmc', 'a')); + // The bulk export path + if ('bulk' === $pks) + { + $query->where('a.id > 0'); + } + // A large array of ID's will not work out well + elseif ($pks_size > 500) + { + // Use lowest ID + $query->where('a.id >= ' . (int) min($pks)); + // Use highest ID + $query->where('a.id <= ' . (int) max($pks)); + } + // The normal default path + else + { + $query->where('a.id IN (' . implode(',',$pks) . ')'); + } + // Implement View Level Access + if (!$user->authorise('core.options', 'com_ehealth_portal')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + $items = $db->loadObjectList(); + + // Set values to display correctly. + if (Ehealth_portalHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // unset the values we don't want exported. + unset($item->asset_id); + unset($item->checked_out); + unset($item->checked_out_time); + } + } + // Add headers to items array. + $headers = $this->getExImPortHeaders(); + if (Ehealth_portalHelper::checkObject($headers)) + { + array_unshift($items,$headers); + } + return $items; + } + } + return false; + } + + /** + * Method to get header. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getExImPortHeaders() + { + // Get a db connection. + $db = JFactory::getDbo(); + // get the columns + $columns = $db->getTableColumns("#__ehealth_portal_vmmc"); + if (Ehealth_portalHelper::checkArray($columns)) + { + // remove the headers you don't import/export. + unset($columns['asset_id']); + unset($columns['checked_out']); + unset($columns['checked_out_time']); + $headers = new stdClass(); + foreach ($columns as $column => $type) + { + $headers->{$column} = $column; + } + return $headers; + } + return false; + } + + /** + * Method to get a store id based on model configuration state. + * + * @return string A store id. + * + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.id'); + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (Ehealth_portalHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || Ehealth_portalHelper::checkString($_access)) + { + $id .= ':' . $_access; + } + $id .= ':' . $this->getState('filter.ordering'); + $id .= ':' . $this->getState('filter.created_by'); + $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.patient'); + // Check if the value is an array + $_referral = $this->getState('filter.referral'); + if (Ehealth_portalHelper::checkArray($_referral)) + { + $id .= ':' . implode(':', $_referral); + } + // Check if this is only an number or string + elseif (is_numeric($_referral) + || Ehealth_portalHelper::checkString($_referral)) + { + $id .= ':' . $_referral; + } + + return parent::getStoreId($id); + } + + /** + * Build an SQL query to checkin all items left checked out longer then a set time. + * + * @return a bool + * + */ + protected function checkInNow() + { + // Get set check in time + $time = JComponentHelper::getParams('com_ehealth_portal')->get('check_in'); + + if ($time) + { + + // Get a db connection. + $db = JFactory::getDbo(); + // reset query + $query = $db->getQuery(true); + $query->select('*'); + $query->from($db->quoteName('#__ehealth_portal_vmmc')); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // Get Yesterdays date + $date = JFactory::getDate()->modify($time)->toSql(); + // reset query + $query = $db->getQuery(true); + + // Fields to update. + $fields = array( + $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', + $db->quoteName('checked_out') . '=0' + ); + + // Conditions for which records should be updated. + $conditions = array( + $db->quoteName('checked_out') . '!=0', + $db->quoteName('checked_out_time') . '<\''.$date.'\'' + ); + + // Check table + $query->update($db->quoteName('#__ehealth_portal_vmmc'))->set($fields)->where($conditions); + + $db->setQuery($query); + + $db->execute(); + } + } + + return false; + } +} diff --git a/admin/sql/index.html b/admin/sql/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/sql/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql new file mode 100644 index 0000000..11b57f6 --- /dev/null +++ b/admin/sql/install.mysql.utf8.sql @@ -0,0 +1,1029 @@ +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_payment` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `nonpay_reason` INT(11) NOT NULL DEFAULT 0, + `patient` INT(11) NOT NULL DEFAULT 0, + `payment_amount` VARCHAR(100) NOT NULL DEFAULT '', + `payment_category` VARCHAR(255) NOT NULL DEFAULT '', + `payment_type` INT(11) NOT NULL DEFAULT 0, + `receipt_no` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_general_medical_check_up` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `bmi` FLOAT(7) NULL DEFAULT 0, + `bp_diastolic_one` INT(7) NOT NULL DEFAULT 0, + `bp_diastolic_two` INT(7) NOT NULL DEFAULT 0, + `bp_systolic_one` INT(7) NOT NULL DEFAULT 0, + `bp_systolic_two` INT(7) NOT NULL DEFAULT 0, + `chronic_medication` TEXT NOT NULL, + `complaint` MEDIUMTEXT NOT NULL, + `diagnosis` INT(11) NOT NULL DEFAULT 0, + `dispensing` TEXT NOT NULL, + `height` FLOAT(7) NOT NULL DEFAULT 0, + `investigations` MEDIUMTEXT NOT NULL, + `notes` MEDIUMTEXT NOT NULL, + `patient` INT(11) NOT NULL DEFAULT 0, + `pulse` INT(7) NOT NULL DEFAULT 0, + `reason` MEDIUMTEXT NOT NULL, + `referral` INT(11) NOT NULL DEFAULT 0, + `temp_one` FLOAT(7) NOT NULL DEFAULT 0, + `temp_two` FLOAT(7) NOT NULL DEFAULT 0, + `weight` FLOAT(7) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_antenatal_care` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `caesarean_sections` INT(7) NOT NULL DEFAULT 0, + `foetal_engagement` INT(11) NOT NULL DEFAULT 0, + `foetal_heart_rate` INT(7) NOT NULL DEFAULT 0, + `foetal_lie` INT(11) NOT NULL DEFAULT 0, + `foetal_movements` MEDIUMTEXT NOT NULL, + `foetal_presentation` INT(11) NOT NULL DEFAULT 0, + `last_menstrual_period` DATE NOT NULL DEFAULT '0000-00-00', + `live_births` INT(7) NOT NULL DEFAULT 0, + `miscarriages` INT(7) NOT NULL DEFAULT 0, + `normal_births` INT(7) NOT NULL DEFAULT 0, + `patient` INT(11) NOT NULL DEFAULT 0, + `pregnancies_excl` INT(7) NOT NULL DEFAULT 0, + `still_births` INT(7) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_immunisation` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `administration_part` INT(11) NOT NULL DEFAULT 0, + `immunisation` TEXT NOT NULL, + `immunisation_up_to_date` VARCHAR(255) NOT NULL DEFAULT '', + `immunisation_vaccine_type` INT(11) NOT NULL DEFAULT 0, + `patient` INT(11) NOT NULL DEFAULT 0, + `reason` MEDIUMTEXT NOT NULL, + `referral` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_vmmc` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `are_you_circumcised` VARCHAR(255) NOT NULL DEFAULT '', + `info_ben_vmcc` VARCHAR(255) NOT NULL DEFAULT '', + `interested_in_vmmc` VARCHAR(255) NOT NULL DEFAULT '', + `partner_circumcised` VARCHAR(255) NOT NULL DEFAULT '', + `patient` INT(11) NOT NULL DEFAULT 0, + `reason` MEDIUMTEXT NOT NULL, + `referral` INT(11) NOT NULL DEFAULT 0, + `vmmc_gender` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_prostate_and_testicular_cancer` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `patient` INT(11) NOT NULL DEFAULT 0, + `ptc_age` VARCHAR(255) NOT NULL DEFAULT '', + `ptc_diet` VARCHAR(255) NOT NULL DEFAULT '', + `ptc_fam_history` VARCHAR(255) NOT NULL DEFAULT '', + `ptc_overweight` VARCHAR(255) NOT NULL DEFAULT '', + `ptc_phy_activity` VARCHAR(255) NOT NULL DEFAULT '', + `ptc_urinate` VARCHAR(255) NOT NULL DEFAULT '', + `ptc_urine_freq` VARCHAR(255) NOT NULL DEFAULT '', + `reason` MEDIUMTEXT NOT NULL, + `referral` INT(11) NOT NULL DEFAULT 0, + `txt_ptc_age` MEDIUMTEXT NOT NULL, + `txt_ptc_diet` MEDIUMTEXT NOT NULL, + `txt_ptc_fam_history` MEDIUMTEXT NOT NULL, + `txt_ptc_overweight` MEDIUMTEXT NOT NULL, + `txt_ptc_phy_activity` MEDIUMTEXT NOT NULL, + `txt_ptc_urinate` MEDIUMTEXT NOT NULL, + `txt_ptc_urine_freq` MEDIUMTEXT NOT NULL, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_tuberculosis` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `blood_streaked_sputum` VARCHAR(255) NOT NULL DEFAULT '', + `date_of_treatment` DATE NOT NULL DEFAULT '0000-00-00', + `diagnosed_with_disease` VARCHAR(255) NOT NULL DEFAULT '', + `pain_in_chest` VARCHAR(255) NOT NULL DEFAULT '', + `patient` INT(11) NOT NULL DEFAULT 0, + `persistent_cough` VARCHAR(255) NOT NULL DEFAULT '', + `reason` MEDIUMTEXT NOT NULL, + `recurring_night_sweats` VARCHAR(255) NOT NULL DEFAULT '', + `referral` INT(11) NOT NULL DEFAULT 0, + `referred_second_sputum` VARCHAR(255) NOT NULL DEFAULT '', + `shortness_of_breath` VARCHAR(255) NOT NULL DEFAULT '', + `sputum_collection_one` VARCHAR(255) NOT NULL DEFAULT '', + `sputum_result_one` VARCHAR(255) NOT NULL DEFAULT '', + `sputum_result_two` VARCHAR(255) NOT NULL DEFAULT '', + `tb_exposed` VARCHAR(255) NOT NULL DEFAULT '', + `tb_fever` VARCHAR(255) NOT NULL DEFAULT '', + `tb_reason_one` VARCHAR(255) NOT NULL DEFAULT '', + `tb_reason_two` VARCHAR(255) NOT NULL DEFAULT '', + `tb_treatment` VARCHAR(255) NOT NULL DEFAULT '', + `treating_dhc` VARCHAR(255) NOT NULL DEFAULT '', + `unusual_tiredness` VARCHAR(255) NOT NULL DEFAULT '', + `weight_loss_wdieting` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_hiv_counseling_and_testing` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `counseling_type` VARCHAR(255) NOT NULL DEFAULT '', + `eqa` VARCHAR(255) NOT NULL DEFAULT '', + `final_test_result` VARCHAR(255) NOT NULL DEFAULT '', + `last_test_date` VARCHAR(255) NOT NULL DEFAULT '', + `patient` INT(11) NOT NULL DEFAULT 0, + `prev_test_result` VARCHAR(255) NOT NULL DEFAULT '', + `reason` MEDIUMTEXT NOT NULL, + `referral` INT(11) NOT NULL DEFAULT 0, + `test_result_one` VARCHAR(255) NOT NULL DEFAULT '', + `test_result_two` VARCHAR(255) NOT NULL DEFAULT '', + `testing_reason` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_family_planning` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `diagnosis` INT(11) NOT NULL DEFAULT 0, + `patient` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_health_education` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `education_type` VARCHAR(100) NOT NULL DEFAULT '', + `health_education_topic` INT(11) NOT NULL DEFAULT 0, + `patient` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_cervical_cancer` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `cc_periods` VARCHAR(255) NOT NULL DEFAULT '', + `cc_reason` VARCHAR(255) NOT NULL DEFAULT '', + `cc_result` VARCHAR(255) NOT NULL DEFAULT '', + `cc_sex_actve` VARCHAR(255) NOT NULL DEFAULT '', + `cc_sex_partner` VARCHAR(255) NOT NULL DEFAULT '', + `cc_smoking` VARCHAR(255) NOT NULL DEFAULT '', + `cc_v_discharge` VARCHAR(255) NOT NULL DEFAULT '', + `cc_viginal_bleeding` VARCHAR(255) NOT NULL DEFAULT '', + `pap_smear_collection` VARCHAR(255) NOT NULL DEFAULT '', + `patient` INT(11) NOT NULL DEFAULT 0, + `reason` MEDIUMTEXT NOT NULL, + `referral` INT(11) NOT NULL DEFAULT 0, + `txt_cc_periods` MEDIUMTEXT NOT NULL, + `txt_cc_sex_actve` MEDIUMTEXT NOT NULL, + `txt_cc_sex_partner` MEDIUMTEXT NOT NULL, + `txt_cc_smoking` MEDIUMTEXT NOT NULL, + `txt_cc_v_discharge` MEDIUMTEXT NOT NULL, + `txt_cc_viginal_bleeding` MEDIUMTEXT NOT NULL, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_breast_cancer` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `bc_abnormal_skin` VARCHAR(255) NOT NULL DEFAULT '', + `bc_age_range` VARCHAR(255) NOT NULL DEFAULT '', + `bc_breast_shape` VARCHAR(255) NOT NULL DEFAULT '', + `bc_breastfeeding` VARCHAR(255) NOT NULL DEFAULT '', + `bc_dimpling` VARCHAR(255) NOT NULL DEFAULT '', + `bc_family_history` VARCHAR(255) NOT NULL DEFAULT '', + `bc_history_hrt` VARCHAR(255) NOT NULL DEFAULT '', + `bc_inward_nipple` VARCHAR(255) NOT NULL DEFAULT '', + `bc_lump_near_breast` VARCHAR(255) NOT NULL DEFAULT '', + `bc_nipple_discharge` VARCHAR(255) NOT NULL DEFAULT '', + `bc_overweight` VARCHAR(255) NOT NULL DEFAULT '', + `bc_preg_age` VARCHAR(255) NOT NULL DEFAULT '', + `bc_preg_freq` INT(7) NOT NULL DEFAULT 0, + `bc_race` VARCHAR(255) NOT NULL DEFAULT '', + `bc_reg_exercise` VARCHAR(255) NOT NULL DEFAULT '', + `patient` INT(11) NOT NULL DEFAULT 0, + `reason` MEDIUMTEXT NOT NULL, + `referral` INT(11) NOT NULL DEFAULT 0, + `txt_bc_abnormal_skin` MEDIUMTEXT NOT NULL, + `txt_bc_breast_shape` MEDIUMTEXT NOT NULL, + `txt_bc_dimpling` MEDIUMTEXT NOT NULL, + `txt_bc_inward_nipple` MEDIUMTEXT NOT NULL, + `txt_bc_lump_near_breast` MEDIUMTEXT NOT NULL, + `txt_bc_nipple_discharge` MEDIUMTEXT NOT NULL, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_test` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `cholesterol_reading` INT(7) NOT NULL DEFAULT 0, + `glucose_first_reading` INT(7) NOT NULL DEFAULT 0, + `glucose_second_reading` INT(7) NOT NULL DEFAULT 0, + `haemoglobin_reading` INT(7) NOT NULL DEFAULT 0, + `hepatitis_first_reading` VARCHAR(255) NOT NULL DEFAULT '', + `hepatitis_second_reading` VARCHAR(255) NOT NULL DEFAULT '', + `malaria_first_reading` VARCHAR(255) NOT NULL DEFAULT '', + `malaria_second_reading` VARCHAR(255) NOT NULL DEFAULT '', + `patient` INT(11) NOT NULL DEFAULT 0, + `pregnancy_first_reading` VARCHAR(255) NOT NULL DEFAULT '', + `pregnancy_second_reading` VARCHAR(255) NOT NULL DEFAULT '', + `reason` MEDIUMTEXT NOT NULL, + `referral` INT(11) NOT NULL DEFAULT 0, + `syphilis_first_reading` VARCHAR(255) NOT NULL DEFAULT '', + `syphilis_second_reading` VARCHAR(255) NOT NULL DEFAULT '', + `urine_test_result` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_immunisation_vaccine_type` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `administration_part` INT(11) NOT NULL DEFAULT 0, + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_foetal_presentation` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_foetal_lie` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_counseling_type` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_foetal_engagement` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_health_education_topic` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_testing_reason` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_clinic` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `clinic_name` VARCHAR(255) NOT NULL DEFAULT '', + `clinic_type` VARCHAR(255) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_clinic_name` (`clinic_name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_immunisation_type` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_unit` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_referral` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_planning_type` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_diagnosis_type` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_nonpay_reason` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_medication` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_payment_amount` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_administration_part` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_payment_type` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_strength` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `name` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_site` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `alias` CHAR(64) NOT NULL DEFAULT '', + `description` TEXT NOT NULL, + `site_name` VARCHAR(255) NOT NULL DEFAULT '', + `site_region` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_site_name` (`site_name`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + + diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql new file mode 100644 index 0000000..b62de6f --- /dev/null +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS `#__ehealth_portal_payment`; +DROP TABLE IF EXISTS `#__ehealth_portal_general_medical_check_up`; +DROP TABLE IF EXISTS `#__ehealth_portal_antenatal_care`; +DROP TABLE IF EXISTS `#__ehealth_portal_immunisation`; +DROP TABLE IF EXISTS `#__ehealth_portal_vmmc`; +DROP TABLE IF EXISTS `#__ehealth_portal_prostate_and_testicular_cancer`; +DROP TABLE IF EXISTS `#__ehealth_portal_tuberculosis`; +DROP TABLE IF EXISTS `#__ehealth_portal_hiv_counseling_and_testing`; +DROP TABLE IF EXISTS `#__ehealth_portal_family_planning`; +DROP TABLE IF EXISTS `#__ehealth_portal_health_education`; +DROP TABLE IF EXISTS `#__ehealth_portal_cervical_cancer`; +DROP TABLE IF EXISTS `#__ehealth_portal_breast_cancer`; +DROP TABLE IF EXISTS `#__ehealth_portal_test`; +DROP TABLE IF EXISTS `#__ehealth_portal_immunisation_vaccine_type`; +DROP TABLE IF EXISTS `#__ehealth_portal_foetal_presentation`; +DROP TABLE IF EXISTS `#__ehealth_portal_foetal_lie`; +DROP TABLE IF EXISTS `#__ehealth_portal_counseling_type`; +DROP TABLE IF EXISTS `#__ehealth_portal_foetal_engagement`; +DROP TABLE IF EXISTS `#__ehealth_portal_health_education_topic`; +DROP TABLE IF EXISTS `#__ehealth_portal_testing_reason`; +DROP TABLE IF EXISTS `#__ehealth_portal_clinic`; +DROP TABLE IF EXISTS `#__ehealth_portal_immunisation_type`; +DROP TABLE IF EXISTS `#__ehealth_portal_unit`; +DROP TABLE IF EXISTS `#__ehealth_portal_referral`; +DROP TABLE IF EXISTS `#__ehealth_portal_planning_type`; +DROP TABLE IF EXISTS `#__ehealth_portal_diagnosis_type`; +DROP TABLE IF EXISTS `#__ehealth_portal_nonpay_reason`; +DROP TABLE IF EXISTS `#__ehealth_portal_medication`; +DROP TABLE IF EXISTS `#__ehealth_portal_payment_amount`; +DROP TABLE IF EXISTS `#__ehealth_portal_administration_part`; +DROP TABLE IF EXISTS `#__ehealth_portal_payment_type`; +DROP TABLE IF EXISTS `#__ehealth_portal_strength`; +DROP TABLE IF EXISTS `#__ehealth_portal_site`; + diff --git a/admin/sql/updates/index.html b/admin/sql/updates/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/sql/updates/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/sql/updates/mysql/1.0.2.sql b/admin/sql/updates/mysql/1.0.2.sql new file mode 100644 index 0000000..6fac555 --- /dev/null +++ b/admin/sql/updates/mysql/1.0.2.sql @@ -0,0 +1 @@ +ALTER TABLE `#__ehealth_portal_health_education` ADD `education_type` VARCHAR(100) NOT NULL DEFAULT '' AFTER `asset_id`; diff --git a/admin/sql/updates/mysql/1.0.3.sql b/admin/sql/updates/mysql/1.0.3.sql new file mode 100644 index 0000000..13e0f51 --- /dev/null +++ b/admin/sql/updates/mysql/1.0.3.sql @@ -0,0 +1,34 @@ +CREATE TABLE IF NOT EXISTS `#__ehealth_portal_look` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `add` TINYINT(1) NOT NULL DEFAULT 0, + `alias` CHAR(64) NOT NULL DEFAULT '', + `dateofbirth` DATE NOT NULL DEFAULT '0000-00-00', + `description` TEXT NOT NULL, + `email` VARCHAR(255) NOT NULL DEFAULT '', + `image` VARCHAR(255) NOT NULL DEFAULT '', + `mobile_phone` VARCHAR(64) NOT NULL DEFAULT '', + `name` VARCHAR(255) NOT NULL DEFAULT '', + `website` VARCHAR(255) NOT NULL DEFAULT '', + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_name` (`name`), + KEY `idx_add` (`add`), + KEY `idx_alias` (`alias`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_general_ci; diff --git a/admin/sql/updates/mysql/1.0.4.sql b/admin/sql/updates/mysql/1.0.4.sql new file mode 100644 index 0000000..a331775 --- /dev/null +++ b/admin/sql/updates/mysql/1.0.4.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__ehealth_portal_immunisation` ADD `administration_part` INT(11) NOT NULL DEFAULT 0 AFTER `asset_id`; + +ALTER TABLE `#__ehealth_portal_immunisation` ADD `immunisation_vaccine_type` INT(11) NOT NULL DEFAULT 0 AFTER `immunisation_up_to_date`; diff --git a/admin/sql/updates/mysql/index.html b/admin/sql/updates/mysql/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/sql/updates/mysql/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/tables/administration_part.php b/admin/tables/administration_part.php new file mode 100644 index 0000000..4b93f67 --- /dev/null +++ b/admin/tables/administration_part.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Administration_parts Table class + */ +class Ehealth_portalTableAdministration_part extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_administration_part', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.administration_part')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Administration_part table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New administration_part. A administration_part created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('administration_part', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_ADMINISTRATION_PART_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('administration_part', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.administration_part.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.administration_part.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/antenatal_care.php b/admin/tables/antenatal_care.php new file mode 100644 index 0000000..2c706b9 --- /dev/null +++ b/admin/tables/antenatal_care.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Antenatal_cares Table class + */ +class Ehealth_portalTableAntenatal_care extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_antenatal_care', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.antenatal_care')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Antenatal_care table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New antenatal_care. A antenatal_care created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('antenatal_care', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_ANTENATAL_CARE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('antenatal_care', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.antenatal_care.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.antenatal_care.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/breast_cancer.php b/admin/tables/breast_cancer.php new file mode 100644 index 0000000..d6c90b4 --- /dev/null +++ b/admin/tables/breast_cancer.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Breast_cancers Table class + */ +class Ehealth_portalTableBreast_cancer extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_breast_cancer', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.breast_cancer')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Breast_cancer table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New breast_cancer. A breast_cancer created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('breast_cancer', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_BREAST_CANCER_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('breast_cancer', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.breast_cancer.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.breast_cancer.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/cervical_cancer.php b/admin/tables/cervical_cancer.php new file mode 100644 index 0000000..5b69046 --- /dev/null +++ b/admin/tables/cervical_cancer.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Cervical_cancers Table class + */ +class Ehealth_portalTableCervical_cancer extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_cervical_cancer', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.cervical_cancer')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Cervical_cancer table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New cervical_cancer. A cervical_cancer created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('cervical_cancer', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_CERVICAL_CANCER_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('cervical_cancer', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.cervical_cancer.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.cervical_cancer.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/clinic.php b/admin/tables/clinic.php new file mode 100644 index 0000000..ad08ed6 --- /dev/null +++ b/admin/tables/clinic.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Clinics Table class + */ +class Ehealth_portalTableClinic extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_clinic', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.clinic')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Clinic table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New clinic. A clinic created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('clinic', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_CLINIC_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('clinic', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.clinic.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.clinic.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->clinic_name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/counseling_type.php b/admin/tables/counseling_type.php new file mode 100644 index 0000000..8e489c2 --- /dev/null +++ b/admin/tables/counseling_type.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Counseling_types Table class + */ +class Ehealth_portalTableCounseling_type extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_counseling_type', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.counseling_type')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Counseling_type table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New counseling_type. A counseling_type created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('counseling_type', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_COUNSELING_TYPE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('counseling_type', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.counseling_type.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.counseling_type.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/diagnosis_type.php b/admin/tables/diagnosis_type.php new file mode 100644 index 0000000..de63c67 --- /dev/null +++ b/admin/tables/diagnosis_type.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Diagnosis_types Table class + */ +class Ehealth_portalTableDiagnosis_type extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_diagnosis_type', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.diagnosis_type')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Diagnosis_type table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New diagnosis_type. A diagnosis_type created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('diagnosis_type', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('diagnosis_type', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.diagnosis_type.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.diagnosis_type.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/family_planning.php b/admin/tables/family_planning.php new file mode 100644 index 0000000..1e43602 --- /dev/null +++ b/admin/tables/family_planning.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Family_plannings Table class + */ +class Ehealth_portalTableFamily_planning extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_family_planning', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.family_planning')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Family_planning table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New family_planning. A family_planning created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('family_planning', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_FAMILY_PLANNING_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('family_planning', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.family_planning.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.family_planning.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/foetal_engagement.php b/admin/tables/foetal_engagement.php new file mode 100644 index 0000000..52f31aa --- /dev/null +++ b/admin/tables/foetal_engagement.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Foetal_engagements Table class + */ +class Ehealth_portalTableFoetal_engagement extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_foetal_engagement', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.foetal_engagement')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Foetal_engagement table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New foetal_engagement. A foetal_engagement created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('foetal_engagement', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('foetal_engagement', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.foetal_engagement.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.foetal_engagement.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/foetal_lie.php b/admin/tables/foetal_lie.php new file mode 100644 index 0000000..7c84bf9 --- /dev/null +++ b/admin/tables/foetal_lie.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Foetal_lies Table class + */ +class Ehealth_portalTableFoetal_lie extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_foetal_lie', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.foetal_lie')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Foetal_lie table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New foetal_lie. A foetal_lie created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('foetal_lie', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_FOETAL_LIE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('foetal_lie', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.foetal_lie.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.foetal_lie.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/foetal_presentation.php b/admin/tables/foetal_presentation.php new file mode 100644 index 0000000..c691af9 --- /dev/null +++ b/admin/tables/foetal_presentation.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Foetal_presentations Table class + */ +class Ehealth_portalTableFoetal_presentation extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_foetal_presentation', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.foetal_presentation')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Foetal_presentation table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New foetal_presentation. A foetal_presentation created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('foetal_presentation', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('foetal_presentation', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.foetal_presentation.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.foetal_presentation.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/general_medical_check_up.php b/admin/tables/general_medical_check_up.php new file mode 100644 index 0000000..885cd0c --- /dev/null +++ b/admin/tables/general_medical_check_up.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * General_medical_check_ups Table class + */ +class Ehealth_portalTableGeneral_medical_check_up extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_general_medical_check_up', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.general_medical_check_up')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the General_medical_check_up table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New general_medical_check_up. A general_medical_check_up created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('general_medical_check_up', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('general_medical_check_up', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.general_medical_check_up.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.general_medical_check_up.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/health_education.php b/admin/tables/health_education.php new file mode 100644 index 0000000..c01faab --- /dev/null +++ b/admin/tables/health_education.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Health_educations Table class + */ +class Ehealth_portalTableHealth_education extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_health_education', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.health_education')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Health_education table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New health_education. A health_education created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('health_education', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('health_education', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.health_education.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.health_education.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/health_education_topic.php b/admin/tables/health_education_topic.php new file mode 100644 index 0000000..69f517f --- /dev/null +++ b/admin/tables/health_education_topic.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Health_education_topics Table class + */ +class Ehealth_portalTableHealth_education_topic extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_health_education_topic', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.health_education_topic')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Health_education_topic table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New health_education_topic. A health_education_topic created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('health_education_topic', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('health_education_topic', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.health_education_topic.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.health_education_topic.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/hiv_counseling_and_testing.php b/admin/tables/hiv_counseling_and_testing.php new file mode 100644 index 0000000..83c2365 --- /dev/null +++ b/admin/tables/hiv_counseling_and_testing.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Hiv_counselings_and_testings Table class + */ +class Ehealth_portalTableHiv_counseling_and_testing extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_hiv_counseling_and_testing', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.hiv_counseling_and_testing')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Hiv_counseling_and_testing table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New hiv_counseling_and_testing. A hiv_counseling_and_testing created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('hiv_counseling_and_testing', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('hiv_counseling_and_testing', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.hiv_counseling_and_testing.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.hiv_counseling_and_testing.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/immunisation.php b/admin/tables/immunisation.php new file mode 100644 index 0000000..75be5e5 --- /dev/null +++ b/admin/tables/immunisation.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Immunisations Table class + */ +class Ehealth_portalTableImmunisation extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_immunisation', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.immunisation')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Immunisation table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New immunisation. A immunisation created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('immunisation', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('immunisation', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.immunisation.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.immunisation.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/immunisation_type.php b/admin/tables/immunisation_type.php new file mode 100644 index 0000000..fc3e8d2 --- /dev/null +++ b/admin/tables/immunisation_type.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Immunisation_types Table class + */ +class Ehealth_portalTableImmunisation_type extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_immunisation_type', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.immunisation_type')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Immunisation_type table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New immunisation_type. A immunisation_type created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('immunisation_type', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('immunisation_type', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.immunisation_type.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.immunisation_type.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/immunisation_vaccine_type.php b/admin/tables/immunisation_vaccine_type.php new file mode 100644 index 0000000..a01d995 --- /dev/null +++ b/admin/tables/immunisation_vaccine_type.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Immunisation_vaccine_types Table class + */ +class Ehealth_portalTableImmunisation_vaccine_type extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_immunisation_vaccine_type', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.immunisation_vaccine_type')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Immunisation_vaccine_type table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New immunisation_vaccine_type. A immunisation_vaccine_type created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('immunisation_vaccine_type', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('immunisation_vaccine_type', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.immunisation_vaccine_type.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.immunisation_vaccine_type.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/index.html b/admin/tables/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/tables/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/tables/medication.php b/admin/tables/medication.php new file mode 100644 index 0000000..faba0d2 --- /dev/null +++ b/admin/tables/medication.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Medications Table class + */ +class Ehealth_portalTableMedication extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_medication', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.medication')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Medication table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New medication. A medication created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('medication', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_MEDICATION_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('medication', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.medication.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.medication.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/nonpay_reason.php b/admin/tables/nonpay_reason.php new file mode 100644 index 0000000..a8af17b --- /dev/null +++ b/admin/tables/nonpay_reason.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Nonpay_reasons Table class + */ +class Ehealth_portalTableNonpay_reason extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_nonpay_reason', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.nonpay_reason')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Nonpay_reason table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New nonpay_reason. A nonpay_reason created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('nonpay_reason', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_NONPAY_REASON_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('nonpay_reason', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.nonpay_reason.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.nonpay_reason.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/payment.php b/admin/tables/payment.php new file mode 100644 index 0000000..fe7d5c5 --- /dev/null +++ b/admin/tables/payment.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Payments Table class + */ +class Ehealth_portalTablePayment extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_payment', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.payment')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Payment table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New payment. A payment created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('payment', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_PAYMENT_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('payment', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.payment.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.payment.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/payment_amount.php b/admin/tables/payment_amount.php new file mode 100644 index 0000000..40a0d76 --- /dev/null +++ b/admin/tables/payment_amount.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Payment_amounts Table class + */ +class Ehealth_portalTablePayment_amount extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_payment_amount', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.payment_amount')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Payment_amount table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New payment_amount. A payment_amount created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('payment_amount', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('payment_amount', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.payment_amount.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.payment_amount.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/payment_type.php b/admin/tables/payment_type.php new file mode 100644 index 0000000..b83d07f --- /dev/null +++ b/admin/tables/payment_type.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Payment_types Table class + */ +class Ehealth_portalTablePayment_type extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_payment_type', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.payment_type')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Payment_type table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New payment_type. A payment_type created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('payment_type', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_PAYMENT_TYPE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('payment_type', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.payment_type.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.payment_type.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/planning_type.php b/admin/tables/planning_type.php new file mode 100644 index 0000000..93337f1 --- /dev/null +++ b/admin/tables/planning_type.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Planning_types Table class + */ +class Ehealth_portalTablePlanning_type extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_planning_type', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.planning_type')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Planning_type table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New planning_type. A planning_type created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('planning_type', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_PLANNING_TYPE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('planning_type', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.planning_type.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.planning_type.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/prostate_and_testicular_cancer.php b/admin/tables/prostate_and_testicular_cancer.php new file mode 100644 index 0000000..8857701 --- /dev/null +++ b/admin/tables/prostate_and_testicular_cancer.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Prostate_and_testicular_cancers Table class + */ +class Ehealth_portalTableProstate_and_testicular_cancer extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_prostate_and_testicular_cancer', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.prostate_and_testicular_cancer')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Prostate_and_testicular_cancer table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New prostate_and_testicular_cancer. A prostate_and_testicular_cancer created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('prostate_and_testicular_cancer', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('prostate_and_testicular_cancer', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.prostate_and_testicular_cancer.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.prostate_and_testicular_cancer.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/referral.php b/admin/tables/referral.php new file mode 100644 index 0000000..b4a3412 --- /dev/null +++ b/admin/tables/referral.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Referrals Table class + */ +class Ehealth_portalTableReferral extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_referral', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.referral')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Referral table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New referral. A referral created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('referral', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_REFERRAL_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('referral', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.referral.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.referral.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/site.php b/admin/tables/site.php new file mode 100644 index 0000000..9e7819c --- /dev/null +++ b/admin/tables/site.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Sites Table class + */ +class Ehealth_portalTableSite extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_site', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.site')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Site table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New site. A site created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('site', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_SITE_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('site', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.site.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.site.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->site_name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/strength.php b/admin/tables/strength.php new file mode 100644 index 0000000..0024606 --- /dev/null +++ b/admin/tables/strength.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Strengths Table class + */ +class Ehealth_portalTableStrength extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_strength', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.strength')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Strength table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New strength. A strength created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('strength', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_STRENGTH_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('strength', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.strength.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.strength.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/test.php b/admin/tables/test.php new file mode 100644 index 0000000..5e7546a --- /dev/null +++ b/admin/tables/test.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Tests Table class + */ +class Ehealth_portalTableTest extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_test', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.test')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Test table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New test. A test created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('test', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_TEST_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('test', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.test.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.test.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/testing_reason.php b/admin/tables/testing_reason.php new file mode 100644 index 0000000..74bc40a --- /dev/null +++ b/admin/tables/testing_reason.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Testing_reasons Table class + */ +class Ehealth_portalTableTesting_reason extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_testing_reason', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.testing_reason')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Testing_reason table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New testing_reason. A testing_reason created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('testing_reason', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_TESTING_REASON_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('testing_reason', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.testing_reason.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.testing_reason.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/tuberculosis.php b/admin/tables/tuberculosis.php new file mode 100644 index 0000000..7bfda00 --- /dev/null +++ b/admin/tables/tuberculosis.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Tuberculoses Table class + */ +class Ehealth_portalTableTuberculosis extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_tuberculosis', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.tuberculosis')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Tuberculosis table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New tuberculosis. A tuberculosis created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('tuberculosis', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_TUBERCULOSIS_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('tuberculosis', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.tuberculosis.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.tuberculosis.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/tables/unit.php b/admin/tables/unit.php new file mode 100644 index 0000000..29a8c7d --- /dev/null +++ b/admin/tables/unit.php @@ -0,0 +1,350 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Units Table class + */ +class Ehealth_portalTableUnit extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_unit', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.unit')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Unit table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New unit. A unit created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('unit', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_UNIT_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('unit', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.unit.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.unit.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; + } + +} diff --git a/admin/tables/vmmc.php b/admin/tables/vmmc.php new file mode 100644 index 0000000..5128371 --- /dev/null +++ b/admin/tables/vmmc.php @@ -0,0 +1,337 @@ + + @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\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Vmmcs Table class + */ +class Ehealth_portalTableVmmc extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { + parent::__construct('#__ehealth_portal_vmmc', 'id', $db); + + // Adding History Options + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_ehealth_portal.vmmc')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Vmmc table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New vmmc. A vmmc created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('vmmc', 'Ehealth_portalTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_EHEALTH_PORTAL_VMMC_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('vmmc', 'ehealth_portalTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_ehealth_portal.vmmc.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_ehealth_portal.vmmc.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_ehealth_portal'); + + return $asset->id; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; + } + +} diff --git a/admin/views/administration_part/submitbutton.js b/admin/views/administration_part/submitbutton.js new file mode 100644 index 0000000..67207b7 --- /dev/null +++ b/admin/views/administration_part/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('administration_part, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/administration_part/tmpl/edit.php b/admin/views/administration_part/tmpl/edit.php new file mode 100644 index 0000000..8de85ea --- /dev/null +++ b/admin/views/administration_part/tmpl/edit.php @@ -0,0 +1,132 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/administration_part/tmpl/index.html b/admin/views/administration_part/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/administration_part/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/administration_part/view.html.php b/admin/views/administration_part/view.html.php new file mode 100644 index 0000000..ba22374 --- /dev/null +++ b/admin/views/administration_part/view.html.php @@ -0,0 +1,236 @@ + + @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'); + +/** + * Administration_part View class + */ +class Ehealth_portalViewAdministration_part extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('administration_part', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Get Linked view data + $this->vvyvaccines = $this->get('Vvyvaccines'); + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_ADMINISTRATION_PART_NEW' : 'COM_EHEALTH_PORTAL_ADMINISTRATION_PART_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('administration_part.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('administration_part.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('administration_part.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('administration_part.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('administration_part.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('administration_part.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('administration_part.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('administration_part.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('administration_part.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('administration_part.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('administration_part.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('administration_part.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.administration_part', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('administration_part.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('administration_part.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('administration_part'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_ADMINISTRATION_PART_NEW' : 'COM_EHEALTH_PORTAL_ADMINISTRATION_PART_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/administration_part.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + + // Add the CSS for Footable. + $this->document->addStyleSheet(JURI::root() .'media/com_ehealth_portal/footable-v2/css/footable.core.min.css', (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + + // Use the Metro Style + if (!isset($this->fooTableStyle) || 0 == $this->fooTableStyle) + { + $this->document->addStyleSheet(JURI::root() .'media/com_ehealth_portal/footable-v2/css/footable.metro.min.css', (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + // Use the Legacy Style. + elseif (isset($this->fooTableStyle) && 1 == $this->fooTableStyle) + { + $this->document->addStyleSheet(JURI::root() .'media/com_ehealth_portal/footable-v2/css/footable.standalone.min.css', (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + // Add the JavaScript for Footable + $this->document->addScript(JURI::root() .'media/com_ehealth_portal/footable-v2/js/footable.js', (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() .'media/com_ehealth_portal/footable-v2/js/footable.sort.js', (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() .'media/com_ehealth_portal/footable-v2/js/footable.filter.js', (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() .'media/com_ehealth_portal/footable-v2/js/footable.paginate.js', (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + + $footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable(); }); jQuery('.nav-tabs').on('click', 'li', function() { setTimeout(tableFix, 10); }); }); function tableFix() { jQuery('.footable').trigger('footable_resize'); }"; + $this->document->addScriptDeclaration($footable); + + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/administration_part/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/administration_parts/index.html b/admin/views/administration_parts/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/administration_parts/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/administration_parts/tmpl/default.php b/admin/views/administration_parts/tmpl/default.php new file mode 100644 index 0000000..d252771 --- /dev/null +++ b/admin/views/administration_parts/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=administration_parts.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'administration_partList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/administration_parts/tmpl/default_batch_body.php b/admin/views/administration_parts/tmpl/default_batch_body.php new file mode 100644 index 0000000..c30dbbf --- /dev/null +++ b/admin/views/administration_parts/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/administration_parts/tmpl/default_batch_footer.php b/admin/views/administration_parts/tmpl/default_batch_footer.php new file mode 100644 index 0000000..f1b0c5a --- /dev/null +++ b/admin/views/administration_parts/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/administration_parts/tmpl/default_body.php b/admin/views/administration_parts/tmpl/default_body.php new file mode 100644 index 0000000..a61d828 --- /dev/null +++ b/admin/views/administration_parts/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=administration_parts&task=administration_part.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('administration_part',$item,'administration_parts'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'administration_parts.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'administration_parts.', true, 'cb'); ?> + + published, $i, 'administration_parts.', false, 'cb'); ?> + + + published, $i, 'administration_parts.', true, 'cb'); ?> + + + published, $i, 'administration_parts.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/administration_parts/tmpl/default_foot.php b/admin/views/administration_parts/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/administration_parts/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/administration_parts/tmpl/default_head.php b/admin/views/administration_parts/tmpl/default_head.php new file mode 100644 index 0000000..0aa3073 --- /dev/null +++ b/admin/views/administration_parts/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/administration_parts/tmpl/default_toolbar.php b/admin/views/administration_parts/tmpl/default_toolbar.php new file mode 100644 index 0000000..f5743ac --- /dev/null +++ b/admin/views/administration_parts/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/administration_parts/tmpl/index.html b/admin/views/administration_parts/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/administration_parts/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/administration_parts/view.html.php b/admin/views/administration_parts/view.html.php new file mode 100644 index 0000000..3ca51e8 --- /dev/null +++ b/admin/views/administration_parts/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Administration_parts + */ +class Ehealth_portalViewAdministration_parts extends JViewLegacy +{ + /** + * Administration_parts view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('administration_parts'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('administration_part'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=administration_parts'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('administration_part.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('administration_part.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('administration_parts.publish'); + JToolBarHelper::unpublishList('administration_parts.unpublish'); + JToolBarHelper::archiveList('administration_parts.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('administration_parts.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'administration_parts.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('administration_parts.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('administration_part.export')) + { + JToolBarHelper::custom('administration_parts.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('administration_part.import')) + { + JToolBarHelper::custom('administration_parts.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('administration_parts'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_ADMINISTRATION_PARTS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/administration_parts.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_ADMINISTRATION_PART_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_ADMINISTRATION_PART_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/antenatal_care/submitbutton.js b/admin/views/antenatal_care/submitbutton.js new file mode 100644 index 0000000..d308ce6 --- /dev/null +++ b/admin/views/antenatal_care/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('antenatal_care, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/antenatal_care/tmpl/edit.php b/admin/views/antenatal_care/tmpl/edit.php new file mode 100644 index 0000000..ed4ba96 --- /dev/null +++ b/admin/views/antenatal_care/tmpl/edit.php @@ -0,0 +1,134 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/antenatal_care/tmpl/index.html b/admin/views/antenatal_care/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/antenatal_care/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/antenatal_care/view.html.php b/admin/views/antenatal_care/view.html.php new file mode 100644 index 0000000..aa1c2b5 --- /dev/null +++ b/admin/views/antenatal_care/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Antenatal_care View class + */ +class Ehealth_portalViewAntenatal_care extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('antenatal_care', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_ANTENATAL_CARE_NEW' : 'COM_EHEALTH_PORTAL_ANTENATAL_CARE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('antenatal_care.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('antenatal_care.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('antenatal_care.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('antenatal_care.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('antenatal_care.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('antenatal_care.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('antenatal_care.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('antenatal_care.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('antenatal_care.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('antenatal_care.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('antenatal_care.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('antenatal_care.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.antenatal_care', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('antenatal_care.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('antenatal_care.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('antenatal_care'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_ANTENATAL_CARE_NEW' : 'COM_EHEALTH_PORTAL_ANTENATAL_CARE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/antenatal_care.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/antenatal_care/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/antenatal_cares/index.html b/admin/views/antenatal_cares/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/antenatal_cares/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/antenatal_cares/tmpl/default.php b/admin/views/antenatal_cares/tmpl/default.php new file mode 100644 index 0000000..14c7e57 --- /dev/null +++ b/admin/views/antenatal_cares/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=antenatal_cares.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'antenatal_careList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_ANTENATAL_CARES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/antenatal_cares/tmpl/default_batch_body.php b/admin/views/antenatal_cares/tmpl/default_batch_body.php new file mode 100644 index 0000000..094455a --- /dev/null +++ b/admin/views/antenatal_cares/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/antenatal_cares/tmpl/default_batch_footer.php b/admin/views/antenatal_cares/tmpl/default_batch_footer.php new file mode 100644 index 0000000..cfd7e81 --- /dev/null +++ b/admin/views/antenatal_cares/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/antenatal_cares/tmpl/default_body.php b/admin/views/antenatal_cares/tmpl/default_body.php new file mode 100644 index 0000000..3f91850 --- /dev/null +++ b/admin/views/antenatal_cares/tmpl/default_body.php @@ -0,0 +1,117 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=antenatal_cares&task=antenatal_care.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('antenatal_care',$item,'antenatal_cares'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + escape($item->foetal_lie_name); ?> + + + escape($item->foetal_presentation_name); ?> + + + escape($item->foetal_engagement_name); ?> + + + escape($item->foetal_heart_rate); ?> + + + escape($item->foetal_movements); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'antenatal_cares.', true, 'cb'); ?> + + published, $i, 'antenatal_cares.', false, 'cb'); ?> + + + published, $i, 'antenatal_cares.', true, 'cb'); ?> + + + published, $i, 'antenatal_cares.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/antenatal_cares/tmpl/default_foot.php b/admin/views/antenatal_cares/tmpl/default_foot.php new file mode 100644 index 0000000..ff69f10 --- /dev/null +++ b/admin/views/antenatal_cares/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/antenatal_cares/tmpl/default_head.php b/admin/views/antenatal_cares/tmpl/default_head.php new file mode 100644 index 0000000..eae46d8 --- /dev/null +++ b/admin/views/antenatal_cares/tmpl/default_head.php @@ -0,0 +1,76 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/antenatal_cares/tmpl/default_toolbar.php b/admin/views/antenatal_cares/tmpl/default_toolbar.php new file mode 100644 index 0000000..2dcf6a6 --- /dev/null +++ b/admin/views/antenatal_cares/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/antenatal_cares/tmpl/index.html b/admin/views/antenatal_cares/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/antenatal_cares/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/antenatal_cares/view.html.php b/admin/views/antenatal_cares/view.html.php new file mode 100644 index 0000000..8d8c958 --- /dev/null +++ b/admin/views/antenatal_cares/view.html.php @@ -0,0 +1,283 @@ + + @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'); + +/** + * Ehealth_portal View class for the Antenatal_cares + */ +class Ehealth_portalViewAntenatal_cares extends JViewLegacy +{ + /** + * Antenatal_cares view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('antenatal_cares'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('antenatal_care'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_ANTENATAL_CARES'), 'flash'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=antenatal_cares'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('antenatal_care.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('antenatal_care.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('antenatal_cares.publish'); + JToolBarHelper::unpublishList('antenatal_cares.unpublish'); + JToolBarHelper::archiveList('antenatal_cares.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('antenatal_cares.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'antenatal_cares.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('antenatal_cares.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('antenatal_care.export')) + { + JToolBarHelper::custom('antenatal_cares.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('antenatal_care.import')) + { + JToolBarHelper::custom('antenatal_cares.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('antenatal_cares'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('antenatalcaresfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_ANTENATAL_CARE_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + + // Only load Foetal Lie Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Foetal Lie Name Selection + $this->foetal_lieNameOptions = JFormHelper::loadFieldType('Foetallie')->options; + // We do some sanitation for Foetal Lie Name filter + if (Ehealth_portalHelper::checkArray($this->foetal_lieNameOptions) && + isset($this->foetal_lieNameOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->foetal_lieNameOptions[0]->value)) + { + unset($this->foetal_lieNameOptions[0]); + } + // Foetal Lie Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_ANTENATAL_CARE_FOETAL_LIE_LABEL').' -', + 'batch[foetal_lie]', + JHtml::_('select.options', $this->foetal_lieNameOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_ANTENATAL_CARES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/antenatal_cares.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_ANTENATAL_CARE_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/breast_cancer/submitbutton.js b/admin/views/breast_cancer/submitbutton.js new file mode 100644 index 0000000..64c40ba --- /dev/null +++ b/admin/views/breast_cancer/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('breast_cancer, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/breast_cancer/tmpl/edit.php b/admin/views/breast_cancer/tmpl/edit.php new file mode 100644 index 0000000..912d534 --- /dev/null +++ b/admin/views/breast_cancer/tmpl/edit.php @@ -0,0 +1,140 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/breast_cancer/tmpl/index.html b/admin/views/breast_cancer/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/breast_cancer/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/breast_cancer/view.html.php b/admin/views/breast_cancer/view.html.php new file mode 100644 index 0000000..2d51aaf --- /dev/null +++ b/admin/views/breast_cancer/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Breast_cancer View class + */ +class Ehealth_portalViewBreast_cancer extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('breast_cancer', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_BREAST_CANCER_NEW' : 'COM_EHEALTH_PORTAL_BREAST_CANCER_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('breast_cancer.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('breast_cancer.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('breast_cancer.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('breast_cancer.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('breast_cancer.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('breast_cancer.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('breast_cancer.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('breast_cancer.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('breast_cancer.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('breast_cancer.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('breast_cancer.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('breast_cancer.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.breast_cancer', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('breast_cancer.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('breast_cancer.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('breast_cancer'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_BREAST_CANCER_NEW' : 'COM_EHEALTH_PORTAL_BREAST_CANCER_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/breast_cancer.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/breast_cancer/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/breast_cancers/index.html b/admin/views/breast_cancers/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/breast_cancers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/breast_cancers/tmpl/default.php b/admin/views/breast_cancers/tmpl/default.php new file mode 100644 index 0000000..4cc3951 --- /dev/null +++ b/admin/views/breast_cancers/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=breast_cancers.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'breast_cancerList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_BREAST_CANCERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/breast_cancers/tmpl/default_batch_body.php b/admin/views/breast_cancers/tmpl/default_batch_body.php new file mode 100644 index 0000000..c53a6ec --- /dev/null +++ b/admin/views/breast_cancers/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/breast_cancers/tmpl/default_batch_footer.php b/admin/views/breast_cancers/tmpl/default_batch_footer.php new file mode 100644 index 0000000..a649280 --- /dev/null +++ b/admin/views/breast_cancers/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/breast_cancers/tmpl/default_body.php b/admin/views/breast_cancers/tmpl/default_body.php new file mode 100644 index 0000000..b5107ad --- /dev/null +++ b/admin/views/breast_cancers/tmpl/default_body.php @@ -0,0 +1,153 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=breast_cancers&task=breast_cancer.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('breast_cancer',$item,'breast_cancers'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + bc_age_range); ?> + + + bc_family_history); ?> + + + bc_race); ?> + + + bc_breastfeeding); ?> + + + escape($item->bc_preg_freq); ?> + + + bc_preg_age); ?> + + + bc_history_hrt); ?> + + + bc_reg_exercise); ?> + + + bc_overweight); ?> + + + bc_lump_near_breast); ?> + + + bc_dimpling); ?> + + + bc_inward_nipple); ?> + + + bc_nipple_discharge); ?> + + + bc_abnormal_skin); ?> + + + bc_breast_shape); ?> + + + escape($item->referral_name); ?> + + + escape($item->reason); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'breast_cancers.', true, 'cb'); ?> + + published, $i, 'breast_cancers.', false, 'cb'); ?> + + + published, $i, 'breast_cancers.', true, 'cb'); ?> + + + published, $i, 'breast_cancers.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/breast_cancers/tmpl/default_foot.php b/admin/views/breast_cancers/tmpl/default_foot.php new file mode 100644 index 0000000..b9a022b --- /dev/null +++ b/admin/views/breast_cancers/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/breast_cancers/tmpl/default_head.php b/admin/views/breast_cancers/tmpl/default_head.php new file mode 100644 index 0000000..89132c1 --- /dev/null +++ b/admin/views/breast_cancers/tmpl/default_head.php @@ -0,0 +1,112 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/breast_cancers/tmpl/default_toolbar.php b/admin/views/breast_cancers/tmpl/default_toolbar.php new file mode 100644 index 0000000..59f7eb5 --- /dev/null +++ b/admin/views/breast_cancers/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/breast_cancers/tmpl/index.html b/admin/views/breast_cancers/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/breast_cancers/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/breast_cancers/view.html.php b/admin/views/breast_cancers/view.html.php new file mode 100644 index 0000000..4829806 --- /dev/null +++ b/admin/views/breast_cancers/view.html.php @@ -0,0 +1,263 @@ + + @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'); + +/** + * Ehealth_portal View class for the Breast_cancers + */ +class Ehealth_portalViewBreast_cancers extends JViewLegacy +{ + /** + * Breast_cancers view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('breast_cancers'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('breast_cancer'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_BREAST_CANCERS'), 'heart'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=breast_cancers'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('breast_cancer.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('breast_cancer.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('breast_cancers.publish'); + JToolBarHelper::unpublishList('breast_cancers.unpublish'); + JToolBarHelper::archiveList('breast_cancers.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('breast_cancers.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'breast_cancers.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('breast_cancers.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('breast_cancer.export')) + { + JToolBarHelper::custom('breast_cancers.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('breast_cancer.import')) + { + JToolBarHelper::custom('breast_cancers.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('breast_cancers'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('breastcancersfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_BREAST_CANCER_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_BREAST_CANCERS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/breast_cancers.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_BREAST_CANCER_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/cervical_cancer/submitbutton.js b/admin/views/cervical_cancer/submitbutton.js new file mode 100644 index 0000000..ff192b2 --- /dev/null +++ b/admin/views/cervical_cancer/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('cervical_cancer, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/cervical_cancer/tmpl/edit.php b/admin/views/cervical_cancer/tmpl/edit.php new file mode 100644 index 0000000..d1e5cb4 --- /dev/null +++ b/admin/views/cervical_cancer/tmpl/edit.php @@ -0,0 +1,140 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/cervical_cancer/tmpl/index.html b/admin/views/cervical_cancer/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/cervical_cancer/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/cervical_cancer/view.html.php b/admin/views/cervical_cancer/view.html.php new file mode 100644 index 0000000..8020e35 --- /dev/null +++ b/admin/views/cervical_cancer/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Cervical_cancer View class + */ +class Ehealth_portalViewCervical_cancer extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('cervical_cancer', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NEW' : 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('cervical_cancer.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('cervical_cancer.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('cervical_cancer.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('cervical_cancer.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('cervical_cancer.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('cervical_cancer.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('cervical_cancer.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('cervical_cancer.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('cervical_cancer.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('cervical_cancer.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('cervical_cancer.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('cervical_cancer.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.cervical_cancer', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('cervical_cancer.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('cervical_cancer.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('cervical_cancer'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_NEW' : 'COM_EHEALTH_PORTAL_CERVICAL_CANCER_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/cervical_cancer.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/cervical_cancer/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/cervical_cancers/index.html b/admin/views/cervical_cancers/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/cervical_cancers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/cervical_cancers/tmpl/default.php b/admin/views/cervical_cancers/tmpl/default.php new file mode 100644 index 0000000..1a66d12 --- /dev/null +++ b/admin/views/cervical_cancers/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=cervical_cancers.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'cervical_cancerList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_CERVICAL_CANCERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/cervical_cancers/tmpl/default_batch_body.php b/admin/views/cervical_cancers/tmpl/default_batch_body.php new file mode 100644 index 0000000..4da165d --- /dev/null +++ b/admin/views/cervical_cancers/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/cervical_cancers/tmpl/default_batch_footer.php b/admin/views/cervical_cancers/tmpl/default_batch_footer.php new file mode 100644 index 0000000..080bd8c --- /dev/null +++ b/admin/views/cervical_cancers/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/cervical_cancers/tmpl/default_body.php b/admin/views/cervical_cancers/tmpl/default_body.php new file mode 100644 index 0000000..680e13a --- /dev/null +++ b/admin/views/cervical_cancers/tmpl/default_body.php @@ -0,0 +1,132 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=cervical_cancers&task=cervical_cancer.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('cervical_cancer',$item,'cervical_cancers'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + cc_viginal_bleeding); ?> + + + cc_v_discharge); ?> + + + cc_periods); ?> + + + cc_smoking); ?> + + + cc_sex_actve); ?> + + + cc_sex_partner); ?> + + + pap_smear_collection); ?> + + + cc_result); ?> + + + escape($item->referral_name); ?> + + + escape($item->reason); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'cervical_cancers.', true, 'cb'); ?> + + published, $i, 'cervical_cancers.', false, 'cb'); ?> + + + published, $i, 'cervical_cancers.', true, 'cb'); ?> + + + published, $i, 'cervical_cancers.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/cervical_cancers/tmpl/default_foot.php b/admin/views/cervical_cancers/tmpl/default_foot.php new file mode 100644 index 0000000..41fce50 --- /dev/null +++ b/admin/views/cervical_cancers/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/cervical_cancers/tmpl/default_head.php b/admin/views/cervical_cancers/tmpl/default_head.php new file mode 100644 index 0000000..0a07100 --- /dev/null +++ b/admin/views/cervical_cancers/tmpl/default_head.php @@ -0,0 +1,91 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/cervical_cancers/tmpl/default_toolbar.php b/admin/views/cervical_cancers/tmpl/default_toolbar.php new file mode 100644 index 0000000..a9e9481 --- /dev/null +++ b/admin/views/cervical_cancers/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/cervical_cancers/tmpl/index.html b/admin/views/cervical_cancers/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/cervical_cancers/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/cervical_cancers/view.html.php b/admin/views/cervical_cancers/view.html.php new file mode 100644 index 0000000..5747ee4 --- /dev/null +++ b/admin/views/cervical_cancers/view.html.php @@ -0,0 +1,263 @@ + + @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'); + +/** + * Ehealth_portal View class for the Cervical_cancers + */ +class Ehealth_portalViewCervical_cancers extends JViewLegacy +{ + /** + * Cervical_cancers view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('cervical_cancers'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('cervical_cancer'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_CERVICAL_CANCERS'), 'heart-2'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=cervical_cancers'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('cervical_cancer.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('cervical_cancer.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('cervical_cancers.publish'); + JToolBarHelper::unpublishList('cervical_cancers.unpublish'); + JToolBarHelper::archiveList('cervical_cancers.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('cervical_cancers.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'cervical_cancers.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('cervical_cancers.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('cervical_cancer.export')) + { + JToolBarHelper::custom('cervical_cancers.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('cervical_cancer.import')) + { + JToolBarHelper::custom('cervical_cancers.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('cervical_cancers'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('cervicalcancersfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_CERVICAL_CANCER_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_CERVICAL_CANCERS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/cervical_cancers.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_CERVICAL_CANCER_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/clinic/submitbutton.js b/admin/views/clinic/submitbutton.js new file mode 100644 index 0000000..e4a3470 --- /dev/null +++ b/admin/views/clinic/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('clinic, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/clinic/tmpl/edit.php b/admin/views/clinic/tmpl/edit.php new file mode 100644 index 0000000..b36ef40 --- /dev/null +++ b/admin/views/clinic/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/clinic/tmpl/index.html b/admin/views/clinic/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/clinic/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/clinic/view.html.php b/admin/views/clinic/view.html.php new file mode 100644 index 0000000..7e7ab83 --- /dev/null +++ b/admin/views/clinic/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Clinic View class + */ +class Ehealth_portalViewClinic extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('clinic', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_CLINIC_NEW' : 'COM_EHEALTH_PORTAL_CLINIC_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('clinic.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('clinic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('clinic.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('clinic.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('clinic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('clinic.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.clinic', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('clinic.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('clinic.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('clinic'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_CLINIC_NEW' : 'COM_EHEALTH_PORTAL_CLINIC_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/clinic.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/clinic/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/clinics/index.html b/admin/views/clinics/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/clinics/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default.php b/admin/views/clinics/tmpl/default.php new file mode 100644 index 0000000..c65abb1 --- /dev/null +++ b/admin/views/clinics/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=clinics.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'clinicList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_CLINICS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/clinics/tmpl/default_batch_body.php b/admin/views/clinics/tmpl/default_batch_body.php new file mode 100644 index 0000000..8001db4 --- /dev/null +++ b/admin/views/clinics/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_batch_footer.php b/admin/views/clinics/tmpl/default_batch_footer.php new file mode 100644 index 0000000..baeb558 --- /dev/null +++ b/admin/views/clinics/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_body.php b/admin/views/clinics/tmpl/default_body.php new file mode 100644 index 0000000..9734560 --- /dev/null +++ b/admin/views/clinics/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=clinics&task=clinic.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('clinic',$item,'clinics'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->clinic_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'clinics.', $canCheckin); ?> + + + escape($item->clinic_name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'clinics.', true, 'cb'); ?> + + published, $i, 'clinics.', false, 'cb'); ?> + + + published, $i, 'clinics.', true, 'cb'); ?> + + + published, $i, 'clinics.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_foot.php b/admin/views/clinics/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/clinics/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_head.php b/admin/views/clinics/tmpl/default_head.php new file mode 100644 index 0000000..901a664 --- /dev/null +++ b/admin/views/clinics/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/clinics/tmpl/default_toolbar.php b/admin/views/clinics/tmpl/default_toolbar.php new file mode 100644 index 0000000..baa695e --- /dev/null +++ b/admin/views/clinics/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/clinics/tmpl/index.html b/admin/views/clinics/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/clinics/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/clinics/view.html.php b/admin/views/clinics/view.html.php new file mode 100644 index 0000000..9ec5db0 --- /dev/null +++ b/admin/views/clinics/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Clinics + */ +class Ehealth_portalViewClinics extends JViewLegacy +{ + /** + * Clinics view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('clinics'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('clinic'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_CLINICS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=clinics'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('clinic.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('clinic.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('clinics.publish'); + JToolBarHelper::unpublishList('clinics.unpublish'); + JToolBarHelper::archiveList('clinics.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('clinics.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'clinics.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('clinics.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('clinic.export')) + { + JToolBarHelper::custom('clinics.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('clinic.import')) + { + JToolBarHelper::custom('clinics.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('clinics'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_CLINICS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/clinics.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.clinic_name' => JText::_('COM_EHEALTH_PORTAL_CLINIC_CLINIC_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_CLINIC_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/counseling_type/submitbutton.js b/admin/views/counseling_type/submitbutton.js new file mode 100644 index 0000000..a04c4b8 --- /dev/null +++ b/admin/views/counseling_type/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('counseling_type, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/counseling_type/tmpl/edit.php b/admin/views/counseling_type/tmpl/edit.php new file mode 100644 index 0000000..5c6a03a --- /dev/null +++ b/admin/views/counseling_type/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/counseling_type/tmpl/index.html b/admin/views/counseling_type/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/counseling_type/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/counseling_type/view.html.php b/admin/views/counseling_type/view.html.php new file mode 100644 index 0000000..5dfe3c1 --- /dev/null +++ b/admin/views/counseling_type/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Counseling_type View class + */ +class Ehealth_portalViewCounseling_type extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('counseling_type', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_COUNSELING_TYPE_NEW' : 'COM_EHEALTH_PORTAL_COUNSELING_TYPE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('counseling_type.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('counseling_type.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('counseling_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('counseling_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('counseling_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('counseling_type.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('counseling_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('counseling_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('counseling_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('counseling_type.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('counseling_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('counseling_type.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.counseling_type', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('counseling_type.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('counseling_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('counseling_type'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_COUNSELING_TYPE_NEW' : 'COM_EHEALTH_PORTAL_COUNSELING_TYPE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/counseling_type.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/counseling_type/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/counseling_types/index.html b/admin/views/counseling_types/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/counseling_types/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/counseling_types/tmpl/default.php b/admin/views/counseling_types/tmpl/default.php new file mode 100644 index 0000000..4b7024c --- /dev/null +++ b/admin/views/counseling_types/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=counseling_types.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'counseling_typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_COUNSELING_TYPES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/counseling_types/tmpl/default_batch_body.php b/admin/views/counseling_types/tmpl/default_batch_body.php new file mode 100644 index 0000000..f29d51e --- /dev/null +++ b/admin/views/counseling_types/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/counseling_types/tmpl/default_batch_footer.php b/admin/views/counseling_types/tmpl/default_batch_footer.php new file mode 100644 index 0000000..fc4d655 --- /dev/null +++ b/admin/views/counseling_types/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/counseling_types/tmpl/default_body.php b/admin/views/counseling_types/tmpl/default_body.php new file mode 100644 index 0000000..ca2aa43 --- /dev/null +++ b/admin/views/counseling_types/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=counseling_types&task=counseling_type.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('counseling_type',$item,'counseling_types'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'counseling_types.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'counseling_types.', true, 'cb'); ?> + + published, $i, 'counseling_types.', false, 'cb'); ?> + + + published, $i, 'counseling_types.', true, 'cb'); ?> + + + published, $i, 'counseling_types.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/counseling_types/tmpl/default_foot.php b/admin/views/counseling_types/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/counseling_types/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/counseling_types/tmpl/default_head.php b/admin/views/counseling_types/tmpl/default_head.php new file mode 100644 index 0000000..926e9ed --- /dev/null +++ b/admin/views/counseling_types/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/counseling_types/tmpl/default_toolbar.php b/admin/views/counseling_types/tmpl/default_toolbar.php new file mode 100644 index 0000000..287ecbd --- /dev/null +++ b/admin/views/counseling_types/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/counseling_types/tmpl/index.html b/admin/views/counseling_types/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/counseling_types/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/counseling_types/view.html.php b/admin/views/counseling_types/view.html.php new file mode 100644 index 0000000..ccfe6b0 --- /dev/null +++ b/admin/views/counseling_types/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Counseling_types + */ +class Ehealth_portalViewCounseling_types extends JViewLegacy +{ + /** + * Counseling_types view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('counseling_types'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('counseling_type'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_COUNSELING_TYPES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=counseling_types'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('counseling_type.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('counseling_type.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('counseling_types.publish'); + JToolBarHelper::unpublishList('counseling_types.unpublish'); + JToolBarHelper::archiveList('counseling_types.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('counseling_types.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'counseling_types.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('counseling_types.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('counseling_type.export')) + { + JToolBarHelper::custom('counseling_types.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('counseling_type.import')) + { + JToolBarHelper::custom('counseling_types.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('counseling_types'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_COUNSELING_TYPES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/counseling_types.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_COUNSELING_TYPE_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_COUNSELING_TYPE_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/diagnosis_type/submitbutton.js b/admin/views/diagnosis_type/submitbutton.js new file mode 100644 index 0000000..35651d2 --- /dev/null +++ b/admin/views/diagnosis_type/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('diagnosis_type, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/diagnosis_type/tmpl/edit.php b/admin/views/diagnosis_type/tmpl/edit.php new file mode 100644 index 0000000..27f607d --- /dev/null +++ b/admin/views/diagnosis_type/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/diagnosis_type/tmpl/index.html b/admin/views/diagnosis_type/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/diagnosis_type/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/diagnosis_type/view.html.php b/admin/views/diagnosis_type/view.html.php new file mode 100644 index 0000000..28661a9 --- /dev/null +++ b/admin/views/diagnosis_type/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Diagnosis_type View class + */ +class Ehealth_portalViewDiagnosis_type extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('diagnosis_type', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_NEW' : 'COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('diagnosis_type.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('diagnosis_type.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('diagnosis_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('diagnosis_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('diagnosis_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('diagnosis_type.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('diagnosis_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('diagnosis_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('diagnosis_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('diagnosis_type.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('diagnosis_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('diagnosis_type.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.diagnosis_type', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('diagnosis_type.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('diagnosis_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('diagnosis_type'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_NEW' : 'COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/diagnosis_type.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/diagnosis_type/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/diagnosis_types/index.html b/admin/views/diagnosis_types/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/diagnosis_types/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/diagnosis_types/tmpl/default.php b/admin/views/diagnosis_types/tmpl/default.php new file mode 100644 index 0000000..9892483 --- /dev/null +++ b/admin/views/diagnosis_types/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=diagnosis_types.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'diagnosis_typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/diagnosis_types/tmpl/default_batch_body.php b/admin/views/diagnosis_types/tmpl/default_batch_body.php new file mode 100644 index 0000000..9b7cd01 --- /dev/null +++ b/admin/views/diagnosis_types/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/diagnosis_types/tmpl/default_batch_footer.php b/admin/views/diagnosis_types/tmpl/default_batch_footer.php new file mode 100644 index 0000000..5a41977 --- /dev/null +++ b/admin/views/diagnosis_types/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/diagnosis_types/tmpl/default_body.php b/admin/views/diagnosis_types/tmpl/default_body.php new file mode 100644 index 0000000..05279a4 --- /dev/null +++ b/admin/views/diagnosis_types/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=diagnosis_types&task=diagnosis_type.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('diagnosis_type',$item,'diagnosis_types'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'diagnosis_types.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'diagnosis_types.', true, 'cb'); ?> + + published, $i, 'diagnosis_types.', false, 'cb'); ?> + + + published, $i, 'diagnosis_types.', true, 'cb'); ?> + + + published, $i, 'diagnosis_types.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/diagnosis_types/tmpl/default_foot.php b/admin/views/diagnosis_types/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/diagnosis_types/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/diagnosis_types/tmpl/default_head.php b/admin/views/diagnosis_types/tmpl/default_head.php new file mode 100644 index 0000000..8741d47 --- /dev/null +++ b/admin/views/diagnosis_types/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/diagnosis_types/tmpl/default_toolbar.php b/admin/views/diagnosis_types/tmpl/default_toolbar.php new file mode 100644 index 0000000..5160413 --- /dev/null +++ b/admin/views/diagnosis_types/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/diagnosis_types/tmpl/index.html b/admin/views/diagnosis_types/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/diagnosis_types/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/diagnosis_types/view.html.php b/admin/views/diagnosis_types/view.html.php new file mode 100644 index 0000000..c01024d --- /dev/null +++ b/admin/views/diagnosis_types/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Diagnosis_types + */ +class Ehealth_portalViewDiagnosis_types extends JViewLegacy +{ + /** + * Diagnosis_types view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('diagnosis_types'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('diagnosis_type'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=diagnosis_types'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('diagnosis_type.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('diagnosis_type.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('diagnosis_types.publish'); + JToolBarHelper::unpublishList('diagnosis_types.unpublish'); + JToolBarHelper::archiveList('diagnosis_types.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('diagnosis_types.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'diagnosis_types.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('diagnosis_types.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('diagnosis_type.export')) + { + JToolBarHelper::custom('diagnosis_types.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('diagnosis_type.import')) + { + JToolBarHelper::custom('diagnosis_types.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('diagnosis_types'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_DIAGNOSIS_TYPES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/diagnosis_types.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_DIAGNOSIS_TYPE_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/ehealth_portal/index.html b/admin/views/ehealth_portal/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/ehealth_portal/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/ehealth_portal/tmpl/default.php b/admin/views/ehealth_portal/tmpl/default.php new file mode 100644 index 0000000..102f33d --- /dev/null +++ b/admin/views/ehealth_portal/tmpl/default.php @@ -0,0 +1,47 @@ + + @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'); + +JHtml::_('behavior.tooltip'); + +?> +
+
+ 'main')); ?> + + loadTemplate('main');?> + + +
+
+ 'vdm')); ?> + + loadTemplate('vdm');?> + + +
+
\ No newline at end of file diff --git a/admin/views/ehealth_portal/tmpl/default_main.php b/admin/views/ehealth_portal/tmpl/default_main.php new file mode 100644 index 0000000..c404006 --- /dev/null +++ b/admin/views/ehealth_portal/tmpl/default_main.php @@ -0,0 +1,44 @@ + + @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'); + +?> +icons['main']) && is_array($this->icons['main'])) :?> + icons['main'] as $icon): ?> + + +
+ +

+ \ No newline at end of file diff --git a/admin/views/ehealth_portal/tmpl/default_vdm.php b/admin/views/ehealth_portal/tmpl/default_vdm.php new file mode 100644 index 0000000..659441f --- /dev/null +++ b/admin/views/ehealth_portal/tmpl/default_vdm.php @@ -0,0 +1,52 @@ + + @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'); + +?> +<?php echo JText::_('COM_EHEALTH_PORTAL'); ?> + +
+contributors)): ?> + contributors) > 1): ?> +

+ +

+ +
    + contributors as $contributor): ?> +
  • :
  • + +
+
+ \ No newline at end of file diff --git a/admin/views/ehealth_portal/tmpl/index.html b/admin/views/ehealth_portal/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/ehealth_portal/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/ehealth_portal/view.html.php b/admin/views/ehealth_portal/view.html.php new file mode 100644 index 0000000..565fa8f --- /dev/null +++ b/admin/views/ehealth_portal/view.html.php @@ -0,0 +1,102 @@ + + @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'); + +/** + * Ehealth_portal View class + */ +class Ehealth_portalViewEhealth_portal extends JViewLegacy +{ + /** + * View display method + * @return void + */ + function display($tpl = null) + { + // Assign data to the view + $this->icons = $this->get('Icons'); + $this->contributors = Ehealth_portalHelper::getContributors(); + + // get the manifest details of the component + $this->manifest = Ehealth_portalHelper::manifest(); + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + $canDo = Ehealth_portalHelper::getActions('ehealth_portal'); + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_DASHBOARD'), 'grid-2'); + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('ehealth_portal'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + if ($canDo->get('core.admin') || $canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $document = JFactory::getDocument(); + + // add dashboard style sheets + $document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/dashboard.css"); + + // set page title + $document->setTitle(JText::_('COM_EHEALTH_PORTAL_DASHBOARD')); + + // add manifest to page JavaScript + $document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript"); + } +} diff --git a/admin/views/family_planning/submitbutton.js b/admin/views/family_planning/submitbutton.js new file mode 100644 index 0000000..c90d58b --- /dev/null +++ b/admin/views/family_planning/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('family_planning, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/family_planning/tmpl/edit.php b/admin/views/family_planning/tmpl/edit.php new file mode 100644 index 0000000..4a122aa --- /dev/null +++ b/admin/views/family_planning/tmpl/edit.php @@ -0,0 +1,118 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/family_planning/tmpl/index.html b/admin/views/family_planning/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/family_planning/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/family_planning/view.html.php b/admin/views/family_planning/view.html.php new file mode 100644 index 0000000..6415bf2 --- /dev/null +++ b/admin/views/family_planning/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Family_planning View class + */ +class Ehealth_portalViewFamily_planning extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('family_planning', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_FAMILY_PLANNING_NEW' : 'COM_EHEALTH_PORTAL_FAMILY_PLANNING_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('family_planning.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('family_planning.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('family_planning.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('family_planning.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('family_planning.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('family_planning.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('family_planning.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('family_planning.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('family_planning.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('family_planning.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('family_planning.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('family_planning.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.family_planning', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('family_planning.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('family_planning.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('family_planning'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_FAMILY_PLANNING_NEW' : 'COM_EHEALTH_PORTAL_FAMILY_PLANNING_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/family_planning.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/family_planning/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/family_plannings/index.html b/admin/views/family_plannings/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/family_plannings/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/family_plannings/tmpl/default.php b/admin/views/family_plannings/tmpl/default.php new file mode 100644 index 0000000..b7b4efa --- /dev/null +++ b/admin/views/family_plannings/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=family_plannings.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'family_planningList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_FAMILY_PLANNINGS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/family_plannings/tmpl/default_batch_body.php b/admin/views/family_plannings/tmpl/default_batch_body.php new file mode 100644 index 0000000..21961c0 --- /dev/null +++ b/admin/views/family_plannings/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/family_plannings/tmpl/default_batch_footer.php b/admin/views/family_plannings/tmpl/default_batch_footer.php new file mode 100644 index 0000000..b71f845 --- /dev/null +++ b/admin/views/family_plannings/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/family_plannings/tmpl/default_body.php b/admin/views/family_plannings/tmpl/default_body.php new file mode 100644 index 0000000..95385b6 --- /dev/null +++ b/admin/views/family_plannings/tmpl/default_body.php @@ -0,0 +1,111 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=family_plannings&task=family_planning.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('family_planning',$item,'family_plannings'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + +
+ user->authorise('core.edit', 'com_ehealth_portal.planning_type.' . (int)$item->diagnosis)): ?> + escape($item->diagnosis_name); ?> + + escape($item->diagnosis_name); ?> + +
+ + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'family_plannings.', true, 'cb'); ?> + + published, $i, 'family_plannings.', false, 'cb'); ?> + + + published, $i, 'family_plannings.', true, 'cb'); ?> + + + published, $i, 'family_plannings.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/family_plannings/tmpl/default_foot.php b/admin/views/family_plannings/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/family_plannings/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/family_plannings/tmpl/default_head.php b/admin/views/family_plannings/tmpl/default_head.php new file mode 100644 index 0000000..4209edf --- /dev/null +++ b/admin/views/family_plannings/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/family_plannings/tmpl/default_toolbar.php b/admin/views/family_plannings/tmpl/default_toolbar.php new file mode 100644 index 0000000..4e522bd --- /dev/null +++ b/admin/views/family_plannings/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/family_plannings/tmpl/index.html b/admin/views/family_plannings/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/family_plannings/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/family_plannings/view.html.php b/admin/views/family_plannings/view.html.php new file mode 100644 index 0000000..f58d269 --- /dev/null +++ b/admin/views/family_plannings/view.html.php @@ -0,0 +1,264 @@ + + @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'); + +/** + * Ehealth_portal View class for the Family_plannings + */ +class Ehealth_portalViewFamily_plannings extends JViewLegacy +{ + /** + * Family_plannings view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('family_plannings'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('family_planning'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_FAMILY_PLANNINGS'), 'calendar-2'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=family_plannings'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('family_planning.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('family_planning.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('family_plannings.publish'); + JToolBarHelper::unpublishList('family_plannings.unpublish'); + JToolBarHelper::archiveList('family_plannings.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('family_plannings.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'family_plannings.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('family_plannings.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('family_planning.export')) + { + JToolBarHelper::custom('family_plannings.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('family_planning.import')) + { + JToolBarHelper::custom('family_plannings.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('family_plannings'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('familyplanningsfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_FAMILY_PLANNING_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_FAMILY_PLANNINGS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/family_plannings.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_FAMILY_PLANNING_PATIENT_LABEL'), + 'g.name' => JText::_('COM_EHEALTH_PORTAL_FAMILY_PLANNING_DIAGNOSIS_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/foetal_engagement/submitbutton.js b/admin/views/foetal_engagement/submitbutton.js new file mode 100644 index 0000000..6591181 --- /dev/null +++ b/admin/views/foetal_engagement/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('foetal_engagement, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/foetal_engagement/tmpl/edit.php b/admin/views/foetal_engagement/tmpl/edit.php new file mode 100644 index 0000000..2eab0d0 --- /dev/null +++ b/admin/views/foetal_engagement/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/foetal_engagement/tmpl/index.html b/admin/views/foetal_engagement/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_engagement/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_engagement/view.html.php b/admin/views/foetal_engagement/view.html.php new file mode 100644 index 0000000..68a702e --- /dev/null +++ b/admin/views/foetal_engagement/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Foetal_engagement View class + */ +class Ehealth_portalViewFoetal_engagement extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('foetal_engagement', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_NEW' : 'COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('foetal_engagement.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('foetal_engagement.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('foetal_engagement.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('foetal_engagement.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('foetal_engagement.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('foetal_engagement.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('foetal_engagement.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('foetal_engagement.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('foetal_engagement.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('foetal_engagement.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('foetal_engagement.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('foetal_engagement.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.foetal_engagement', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('foetal_engagement.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('foetal_engagement.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('foetal_engagement'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_NEW' : 'COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/foetal_engagement.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/foetal_engagement/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/foetal_engagements/index.html b/admin/views/foetal_engagements/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_engagements/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_engagements/tmpl/default.php b/admin/views/foetal_engagements/tmpl/default.php new file mode 100644 index 0000000..c8b5d66 --- /dev/null +++ b/admin/views/foetal_engagements/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=foetal_engagements.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'foetal_engagementList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/foetal_engagements/tmpl/default_batch_body.php b/admin/views/foetal_engagements/tmpl/default_batch_body.php new file mode 100644 index 0000000..593605a --- /dev/null +++ b/admin/views/foetal_engagements/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/foetal_engagements/tmpl/default_batch_footer.php b/admin/views/foetal_engagements/tmpl/default_batch_footer.php new file mode 100644 index 0000000..bcd74cc --- /dev/null +++ b/admin/views/foetal_engagements/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/foetal_engagements/tmpl/default_body.php b/admin/views/foetal_engagements/tmpl/default_body.php new file mode 100644 index 0000000..f06ea54 --- /dev/null +++ b/admin/views/foetal_engagements/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=foetal_engagements&task=foetal_engagement.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('foetal_engagement',$item,'foetal_engagements'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'foetal_engagements.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'foetal_engagements.', true, 'cb'); ?> + + published, $i, 'foetal_engagements.', false, 'cb'); ?> + + + published, $i, 'foetal_engagements.', true, 'cb'); ?> + + + published, $i, 'foetal_engagements.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/foetal_engagements/tmpl/default_foot.php b/admin/views/foetal_engagements/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/foetal_engagements/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/foetal_engagements/tmpl/default_head.php b/admin/views/foetal_engagements/tmpl/default_head.php new file mode 100644 index 0000000..f499178 --- /dev/null +++ b/admin/views/foetal_engagements/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/foetal_engagements/tmpl/default_toolbar.php b/admin/views/foetal_engagements/tmpl/default_toolbar.php new file mode 100644 index 0000000..1ab4e1b --- /dev/null +++ b/admin/views/foetal_engagements/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/foetal_engagements/tmpl/index.html b/admin/views/foetal_engagements/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_engagements/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_engagements/view.html.php b/admin/views/foetal_engagements/view.html.php new file mode 100644 index 0000000..e7c5452 --- /dev/null +++ b/admin/views/foetal_engagements/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Foetal_engagements + */ +class Ehealth_portalViewFoetal_engagements extends JViewLegacy +{ + /** + * Foetal_engagements view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('foetal_engagements'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('foetal_engagement'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=foetal_engagements'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('foetal_engagement.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('foetal_engagement.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('foetal_engagements.publish'); + JToolBarHelper::unpublishList('foetal_engagements.unpublish'); + JToolBarHelper::archiveList('foetal_engagements.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('foetal_engagements.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'foetal_engagements.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('foetal_engagements.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('foetal_engagement.export')) + { + JToolBarHelper::custom('foetal_engagements.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('foetal_engagement.import')) + { + JToolBarHelper::custom('foetal_engagements.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('foetal_engagements'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENTS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/foetal_engagements.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_FOETAL_ENGAGEMENT_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/foetal_lie/submitbutton.js b/admin/views/foetal_lie/submitbutton.js new file mode 100644 index 0000000..2fb2932 --- /dev/null +++ b/admin/views/foetal_lie/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('foetal_lie, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/foetal_lie/tmpl/edit.php b/admin/views/foetal_lie/tmpl/edit.php new file mode 100644 index 0000000..c885e93 --- /dev/null +++ b/admin/views/foetal_lie/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/foetal_lie/tmpl/index.html b/admin/views/foetal_lie/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_lie/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_lie/view.html.php b/admin/views/foetal_lie/view.html.php new file mode 100644 index 0000000..67aa369 --- /dev/null +++ b/admin/views/foetal_lie/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Foetal_lie View class + */ +class Ehealth_portalViewFoetal_lie extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('foetal_lie', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_FOETAL_LIE_NEW' : 'COM_EHEALTH_PORTAL_FOETAL_LIE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('foetal_lie.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('foetal_lie.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('foetal_lie.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('foetal_lie.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('foetal_lie.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('foetal_lie.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('foetal_lie.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('foetal_lie.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('foetal_lie.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('foetal_lie.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('foetal_lie.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('foetal_lie.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.foetal_lie', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('foetal_lie.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('foetal_lie.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('foetal_lie'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_FOETAL_LIE_NEW' : 'COM_EHEALTH_PORTAL_FOETAL_LIE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/foetal_lie.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/foetal_lie/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/foetal_lies/index.html b/admin/views/foetal_lies/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_lies/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_lies/tmpl/default.php b/admin/views/foetal_lies/tmpl/default.php new file mode 100644 index 0000000..f539312 --- /dev/null +++ b/admin/views/foetal_lies/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=foetal_lies.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'foetal_lieList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_FOETAL_LIES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/foetal_lies/tmpl/default_batch_body.php b/admin/views/foetal_lies/tmpl/default_batch_body.php new file mode 100644 index 0000000..017ecbe --- /dev/null +++ b/admin/views/foetal_lies/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/foetal_lies/tmpl/default_batch_footer.php b/admin/views/foetal_lies/tmpl/default_batch_footer.php new file mode 100644 index 0000000..fc82baa --- /dev/null +++ b/admin/views/foetal_lies/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/foetal_lies/tmpl/default_body.php b/admin/views/foetal_lies/tmpl/default_body.php new file mode 100644 index 0000000..1451134 --- /dev/null +++ b/admin/views/foetal_lies/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=foetal_lies&task=foetal_lie.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('foetal_lie',$item,'foetal_lies'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'foetal_lies.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'foetal_lies.', true, 'cb'); ?> + + published, $i, 'foetal_lies.', false, 'cb'); ?> + + + published, $i, 'foetal_lies.', true, 'cb'); ?> + + + published, $i, 'foetal_lies.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/foetal_lies/tmpl/default_foot.php b/admin/views/foetal_lies/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/foetal_lies/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/foetal_lies/tmpl/default_head.php b/admin/views/foetal_lies/tmpl/default_head.php new file mode 100644 index 0000000..1cde947 --- /dev/null +++ b/admin/views/foetal_lies/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/foetal_lies/tmpl/default_toolbar.php b/admin/views/foetal_lies/tmpl/default_toolbar.php new file mode 100644 index 0000000..b516359 --- /dev/null +++ b/admin/views/foetal_lies/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/foetal_lies/tmpl/index.html b/admin/views/foetal_lies/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_lies/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_lies/view.html.php b/admin/views/foetal_lies/view.html.php new file mode 100644 index 0000000..cc8d572 --- /dev/null +++ b/admin/views/foetal_lies/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Foetal_lies + */ +class Ehealth_portalViewFoetal_lies extends JViewLegacy +{ + /** + * Foetal_lies view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('foetal_lies'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('foetal_lie'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_FOETAL_LIES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=foetal_lies'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('foetal_lie.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('foetal_lie.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('foetal_lies.publish'); + JToolBarHelper::unpublishList('foetal_lies.unpublish'); + JToolBarHelper::archiveList('foetal_lies.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('foetal_lies.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'foetal_lies.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('foetal_lies.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('foetal_lie.export')) + { + JToolBarHelper::custom('foetal_lies.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('foetal_lie.import')) + { + JToolBarHelper::custom('foetal_lies.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('foetal_lies'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_FOETAL_LIES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/foetal_lies.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_FOETAL_LIE_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_FOETAL_LIE_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/foetal_presentation/submitbutton.js b/admin/views/foetal_presentation/submitbutton.js new file mode 100644 index 0000000..e7d4f86 --- /dev/null +++ b/admin/views/foetal_presentation/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('foetal_presentation, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/foetal_presentation/tmpl/edit.php b/admin/views/foetal_presentation/tmpl/edit.php new file mode 100644 index 0000000..0246b44 --- /dev/null +++ b/admin/views/foetal_presentation/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/foetal_presentation/tmpl/index.html b/admin/views/foetal_presentation/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_presentation/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_presentation/view.html.php b/admin/views/foetal_presentation/view.html.php new file mode 100644 index 0000000..f0d3d6e --- /dev/null +++ b/admin/views/foetal_presentation/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Foetal_presentation View class + */ +class Ehealth_portalViewFoetal_presentation extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('foetal_presentation', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_NEW' : 'COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('foetal_presentation.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('foetal_presentation.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('foetal_presentation.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('foetal_presentation.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('foetal_presentation.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('foetal_presentation.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('foetal_presentation.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('foetal_presentation.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('foetal_presentation.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('foetal_presentation.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('foetal_presentation.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('foetal_presentation.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.foetal_presentation', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('foetal_presentation.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('foetal_presentation.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('foetal_presentation'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_NEW' : 'COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/foetal_presentation.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/foetal_presentation/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/foetal_presentations/index.html b/admin/views/foetal_presentations/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_presentations/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_presentations/tmpl/default.php b/admin/views/foetal_presentations/tmpl/default.php new file mode 100644 index 0000000..e9dbed4 --- /dev/null +++ b/admin/views/foetal_presentations/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=foetal_presentations.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'foetal_presentationList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/foetal_presentations/tmpl/default_batch_body.php b/admin/views/foetal_presentations/tmpl/default_batch_body.php new file mode 100644 index 0000000..56c10d0 --- /dev/null +++ b/admin/views/foetal_presentations/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/foetal_presentations/tmpl/default_batch_footer.php b/admin/views/foetal_presentations/tmpl/default_batch_footer.php new file mode 100644 index 0000000..85f9513 --- /dev/null +++ b/admin/views/foetal_presentations/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/foetal_presentations/tmpl/default_body.php b/admin/views/foetal_presentations/tmpl/default_body.php new file mode 100644 index 0000000..d1a03d0 --- /dev/null +++ b/admin/views/foetal_presentations/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=foetal_presentations&task=foetal_presentation.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('foetal_presentation',$item,'foetal_presentations'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'foetal_presentations.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'foetal_presentations.', true, 'cb'); ?> + + published, $i, 'foetal_presentations.', false, 'cb'); ?> + + + published, $i, 'foetal_presentations.', true, 'cb'); ?> + + + published, $i, 'foetal_presentations.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/foetal_presentations/tmpl/default_foot.php b/admin/views/foetal_presentations/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/foetal_presentations/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/foetal_presentations/tmpl/default_head.php b/admin/views/foetal_presentations/tmpl/default_head.php new file mode 100644 index 0000000..99f57fd --- /dev/null +++ b/admin/views/foetal_presentations/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/foetal_presentations/tmpl/default_toolbar.php b/admin/views/foetal_presentations/tmpl/default_toolbar.php new file mode 100644 index 0000000..b34d8ed --- /dev/null +++ b/admin/views/foetal_presentations/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/foetal_presentations/tmpl/index.html b/admin/views/foetal_presentations/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/foetal_presentations/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/foetal_presentations/view.html.php b/admin/views/foetal_presentations/view.html.php new file mode 100644 index 0000000..83d39a6 --- /dev/null +++ b/admin/views/foetal_presentations/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Foetal_presentations + */ +class Ehealth_portalViewFoetal_presentations extends JViewLegacy +{ + /** + * Foetal_presentations view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('foetal_presentations'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('foetal_presentation'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=foetal_presentations'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('foetal_presentation.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('foetal_presentation.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('foetal_presentations.publish'); + JToolBarHelper::unpublishList('foetal_presentations.unpublish'); + JToolBarHelper::archiveList('foetal_presentations.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('foetal_presentations.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'foetal_presentations.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('foetal_presentations.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('foetal_presentation.export')) + { + JToolBarHelper::custom('foetal_presentations.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('foetal_presentation.import')) + { + JToolBarHelper::custom('foetal_presentations.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('foetal_presentations'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_FOETAL_PRESENTATIONS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/foetal_presentations.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_FOETAL_PRESENTATION_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/general_medical_check_up/submitbutton.js b/admin/views/general_medical_check_up/submitbutton.js new file mode 100644 index 0000000..6ae3595 --- /dev/null +++ b/admin/views/general_medical_check_up/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('general_medical_check_up, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/general_medical_check_up/tmpl/edit.php b/admin/views/general_medical_check_up/tmpl/edit.php new file mode 100644 index 0000000..550049e --- /dev/null +++ b/admin/views/general_medical_check_up/tmpl/edit.php @@ -0,0 +1,181 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + + + diff --git a/admin/views/general_medical_check_up/tmpl/index.html b/admin/views/general_medical_check_up/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/general_medical_check_up/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/general_medical_check_up/view.html.php b/admin/views/general_medical_check_up/view.html.php new file mode 100644 index 0000000..0c3d149 --- /dev/null +++ b/admin/views/general_medical_check_up/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * General_medical_check_up View class + */ +class Ehealth_portalViewGeneral_medical_check_up extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('general_medical_check_up', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_NEW' : 'COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('general_medical_check_up.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('general_medical_check_up.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('general_medical_check_up.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('general_medical_check_up.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('general_medical_check_up.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('general_medical_check_up.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('general_medical_check_up.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('general_medical_check_up.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('general_medical_check_up.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('general_medical_check_up.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('general_medical_check_up.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('general_medical_check_up.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.general_medical_check_up', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('general_medical_check_up.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('general_medical_check_up.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('general_medical_check_up'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_NEW' : 'COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/general_medical_check_up.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/general_medical_check_up/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/general_medical_check_ups/index.html b/admin/views/general_medical_check_ups/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/general_medical_check_ups/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/general_medical_check_ups/tmpl/default.php b/admin/views/general_medical_check_ups/tmpl/default.php new file mode 100644 index 0000000..aa14e4f --- /dev/null +++ b/admin/views/general_medical_check_ups/tmpl/default.php @@ -0,0 +1,96 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=general_medical_check_ups.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'general_medical_check_upList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + + diff --git a/admin/views/general_medical_check_ups/tmpl/default_batch_body.php b/admin/views/general_medical_check_ups/tmpl/default_batch_body.php new file mode 100644 index 0000000..3f7914e --- /dev/null +++ b/admin/views/general_medical_check_ups/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/general_medical_check_ups/tmpl/default_batch_footer.php b/admin/views/general_medical_check_ups/tmpl/default_batch_footer.php new file mode 100644 index 0000000..593e582 --- /dev/null +++ b/admin/views/general_medical_check_ups/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/general_medical_check_ups/tmpl/default_body.php b/admin/views/general_medical_check_ups/tmpl/default_body.php new file mode 100644 index 0000000..7046a3b --- /dev/null +++ b/admin/views/general_medical_check_ups/tmpl/default_body.php @@ -0,0 +1,153 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=general_medical_check_ups&task=general_medical_check_up.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('general_medical_check_up',$item,'general_medical_check_ups'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + escape($item->bp_diastolic_one); ?> + + + escape($item->bp_systolic_one); ?> + + + escape($item->temp_one); ?> + + + escape($item->weight); ?> + + + escape($item->pulse); ?> + + + escape($item->chronic_medication); ?> + + + escape($item->bp_diastolic_two); ?> + + + escape($item->bp_systolic_two); ?> + + + escape($item->temp_two); ?> + + + escape($item->height); ?> + + + escape($item->bmi); ?> + + + escape($item->complaint); ?> + + + escape($item->investigations); ?> + + + escape($item->notes); ?> + + + escape($item->diagnosis_name); ?> + + + escape($item->referral_name); ?> + + + escape($item->reason); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'general_medical_check_ups.', true, 'cb'); ?> + + published, $i, 'general_medical_check_ups.', false, 'cb'); ?> + + + published, $i, 'general_medical_check_ups.', true, 'cb'); ?> + + + published, $i, 'general_medical_check_ups.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/general_medical_check_ups/tmpl/default_foot.php b/admin/views/general_medical_check_ups/tmpl/default_foot.php new file mode 100644 index 0000000..b9a022b --- /dev/null +++ b/admin/views/general_medical_check_ups/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/general_medical_check_ups/tmpl/default_head.php b/admin/views/general_medical_check_ups/tmpl/default_head.php new file mode 100644 index 0000000..3037779 --- /dev/null +++ b/admin/views/general_medical_check_ups/tmpl/default_head.php @@ -0,0 +1,112 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + + listDirn, $this->listOrder); ?> + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/general_medical_check_ups/tmpl/default_toolbar.php b/admin/views/general_medical_check_ups/tmpl/default_toolbar.php new file mode 100644 index 0000000..e626cc3 --- /dev/null +++ b/admin/views/general_medical_check_ups/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/general_medical_check_ups/tmpl/index.html b/admin/views/general_medical_check_ups/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/general_medical_check_ups/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/general_medical_check_ups/view.html.php b/admin/views/general_medical_check_ups/view.html.php new file mode 100644 index 0000000..d90b0bd --- /dev/null +++ b/admin/views/general_medical_check_ups/view.html.php @@ -0,0 +1,273 @@ + + @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'); + +/** + * Ehealth_portal View class for the General_medical_check_ups + */ +class Ehealth_portalViewGeneral_medical_check_ups extends JViewLegacy +{ + /** + * General_medical_check_ups view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('general_medical_check_ups'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('general_medical_check_up'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS'), 'health'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=general_medical_check_ups'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('general_medical_check_up.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('general_medical_check_up.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('general_medical_check_ups.publish'); + JToolBarHelper::unpublishList('general_medical_check_ups.unpublish'); + JToolBarHelper::archiveList('general_medical_check_ups.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('general_medical_check_ups.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'general_medical_check_ups.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('general_medical_check_ups.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('general_medical_check_up.export')) + { + JToolBarHelper::custom('general_medical_check_ups.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('general_medical_check_up.import')) + { + JToolBarHelper::custom('general_medical_check_ups.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('general_medical_check_ups'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('generalmedicalcheckupsfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UPS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/general_medical_check_ups.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_PATIENT_LABEL'), + 'a.bp_diastolic_one' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_DIASTOLIC_ONE_LABEL'), + 'a.bp_systolic_one' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_SYSTOLIC_ONE_LABEL'), + 'a.temp_one' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_TEMP_ONE_LABEL'), + 'a.weight' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_WEIGHT_LABEL'), + 'a.pulse' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_PULSE_LABEL'), + 'a.bp_diastolic_two' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_DIASTOLIC_TWO_LABEL'), + 'a.bp_systolic_two' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_BP_SYSTOLIC_TWO_LABEL'), + 'a.temp_two' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_TEMP_TWO_LABEL'), + 'a.height' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_HEIGHT_LABEL'), + 'h.name' => JText::_('COM_EHEALTH_PORTAL_GENERAL_MEDICAL_CHECK_UP_REFERRAL_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/health_education/submitbutton.js b/admin/views/health_education/submitbutton.js new file mode 100644 index 0000000..4b1fad9 --- /dev/null +++ b/admin/views/health_education/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('health_education, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/health_education/tmpl/edit.php b/admin/views/health_education/tmpl/edit.php new file mode 100644 index 0000000..cb7f6bf --- /dev/null +++ b/admin/views/health_education/tmpl/edit.php @@ -0,0 +1,118 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/health_education/tmpl/index.html b/admin/views/health_education/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/health_education/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/health_education/view.html.php b/admin/views/health_education/view.html.php new file mode 100644 index 0000000..94c144e --- /dev/null +++ b/admin/views/health_education/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Health_education View class + */ +class Ehealth_portalViewHealth_education extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('health_education', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_NEW' : 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('health_education.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('health_education.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('health_education.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('health_education.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('health_education.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('health_education.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('health_education.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('health_education.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('health_education.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('health_education.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('health_education.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('health_education.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.health_education', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('health_education.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('health_education.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('health_education'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_NEW' : 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/health_education.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/health_education/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/health_education_topic/submitbutton.js b/admin/views/health_education_topic/submitbutton.js new file mode 100644 index 0000000..ca29f4a --- /dev/null +++ b/admin/views/health_education_topic/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('health_education_topic, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/health_education_topic/tmpl/edit.php b/admin/views/health_education_topic/tmpl/edit.php new file mode 100644 index 0000000..7aa12f4 --- /dev/null +++ b/admin/views/health_education_topic/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/health_education_topic/tmpl/index.html b/admin/views/health_education_topic/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/health_education_topic/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/health_education_topic/view.html.php b/admin/views/health_education_topic/view.html.php new file mode 100644 index 0000000..6929acb --- /dev/null +++ b/admin/views/health_education_topic/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Health_education_topic View class + */ +class Ehealth_portalViewHealth_education_topic extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('health_education_topic', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_NEW' : 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('health_education_topic.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('health_education_topic.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('health_education_topic.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('health_education_topic.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('health_education_topic.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('health_education_topic.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('health_education_topic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('health_education_topic.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('health_education_topic.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('health_education_topic.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('health_education_topic.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('health_education_topic.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.health_education_topic', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('health_education_topic.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('health_education_topic.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('health_education_topic'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_NEW' : 'COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/health_education_topic.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/health_education_topic/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/health_education_topics/index.html b/admin/views/health_education_topics/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/health_education_topics/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/health_education_topics/tmpl/default.php b/admin/views/health_education_topics/tmpl/default.php new file mode 100644 index 0000000..46bb8b5 --- /dev/null +++ b/admin/views/health_education_topics/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=health_education_topics.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'health_education_topicList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/health_education_topics/tmpl/default_batch_body.php b/admin/views/health_education_topics/tmpl/default_batch_body.php new file mode 100644 index 0000000..dc447df --- /dev/null +++ b/admin/views/health_education_topics/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/health_education_topics/tmpl/default_batch_footer.php b/admin/views/health_education_topics/tmpl/default_batch_footer.php new file mode 100644 index 0000000..b012d34 --- /dev/null +++ b/admin/views/health_education_topics/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/health_education_topics/tmpl/default_body.php b/admin/views/health_education_topics/tmpl/default_body.php new file mode 100644 index 0000000..920de0c --- /dev/null +++ b/admin/views/health_education_topics/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=health_education_topics&task=health_education_topic.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('health_education_topic',$item,'health_education_topics'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'health_education_topics.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'health_education_topics.', true, 'cb'); ?> + + published, $i, 'health_education_topics.', false, 'cb'); ?> + + + published, $i, 'health_education_topics.', true, 'cb'); ?> + + + published, $i, 'health_education_topics.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/health_education_topics/tmpl/default_foot.php b/admin/views/health_education_topics/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/health_education_topics/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/health_education_topics/tmpl/default_head.php b/admin/views/health_education_topics/tmpl/default_head.php new file mode 100644 index 0000000..55ab7a9 --- /dev/null +++ b/admin/views/health_education_topics/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/health_education_topics/tmpl/default_toolbar.php b/admin/views/health_education_topics/tmpl/default_toolbar.php new file mode 100644 index 0000000..b609d9b --- /dev/null +++ b/admin/views/health_education_topics/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/health_education_topics/tmpl/index.html b/admin/views/health_education_topics/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/health_education_topics/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/health_education_topics/view.html.php b/admin/views/health_education_topics/view.html.php new file mode 100644 index 0000000..2d6293e --- /dev/null +++ b/admin/views/health_education_topics/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Health_education_topics + */ +class Ehealth_portalViewHealth_education_topics extends JViewLegacy +{ + /** + * Health_education_topics view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('health_education_topics'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('health_education_topic'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=health_education_topics'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('health_education_topic.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('health_education_topic.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('health_education_topics.publish'); + JToolBarHelper::unpublishList('health_education_topics.unpublish'); + JToolBarHelper::archiveList('health_education_topics.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('health_education_topics.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'health_education_topics.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('health_education_topics.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('health_education_topic.export')) + { + JToolBarHelper::custom('health_education_topics.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('health_education_topic.import')) + { + JToolBarHelper::custom('health_education_topics.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('health_education_topics'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPICS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/health_education_topics.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_TOPIC_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/health_educations/index.html b/admin/views/health_educations/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/health_educations/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/health_educations/tmpl/default.php b/admin/views/health_educations/tmpl/default.php new file mode 100644 index 0000000..9325165 --- /dev/null +++ b/admin/views/health_educations/tmpl/default.php @@ -0,0 +1,81 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleHealtheducationsfilterpatient', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_PATIENT_NAME') . ' -')); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=health_educations.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'health_educationList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/health_educations/tmpl/default_batch_body.php b/admin/views/health_educations/tmpl/default_batch_body.php new file mode 100644 index 0000000..252bf5c --- /dev/null +++ b/admin/views/health_educations/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/health_educations/tmpl/default_batch_footer.php b/admin/views/health_educations/tmpl/default_batch_footer.php new file mode 100644 index 0000000..2c3e784 --- /dev/null +++ b/admin/views/health_educations/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/health_educations/tmpl/default_body.php b/admin/views/health_educations/tmpl/default_body.php new file mode 100644 index 0000000..fdc791d --- /dev/null +++ b/admin/views/health_educations/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=health_educations&task=health_education.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('health_education',$item,'health_educations'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + + education_type); ?> + + + escape($item->health_education_topic_name); ?> + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'health_educations.', true, 'cb'); ?> + + published, $i, 'health_educations.', false, 'cb'); ?> + + + published, $i, 'health_educations.', true, 'cb'); ?> + + + published, $i, 'health_educations.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/health_educations/tmpl/default_foot.php b/admin/views/health_educations/tmpl/default_foot.php new file mode 100644 index 0000000..84f7d61 --- /dev/null +++ b/admin/views/health_educations/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/health_educations/tmpl/default_head.php b/admin/views/health_educations/tmpl/default_head.php new file mode 100644 index 0000000..fd3d907 --- /dev/null +++ b/admin/views/health_educations/tmpl/default_head.php @@ -0,0 +1,67 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/health_educations/tmpl/default_toolbar.php b/admin/views/health_educations/tmpl/default_toolbar.php new file mode 100644 index 0000000..48ba5e9 --- /dev/null +++ b/admin/views/health_educations/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/health_educations/tmpl/index.html b/admin/views/health_educations/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/health_educations/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/health_educations/view.html.php b/admin/views/health_educations/view.html.php new file mode 100644 index 0000000..a2cd86f --- /dev/null +++ b/admin/views/health_educations/view.html.php @@ -0,0 +1,284 @@ + + @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'); + +/** + * Ehealth_portal View class for the Health_educations + */ +class Ehealth_portalViewHealth_educations extends JViewLegacy +{ + /** + * Health_educations view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('health_educations'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('health_education'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS'), 'file-add'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=health_educations'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('health_education.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('health_education.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('health_educations.publish'); + JToolBarHelper::unpublishList('health_educations.unpublish'); + JToolBarHelper::archiveList('health_educations.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('health_educations.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'health_educations.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('health_educations.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('health_education.export')) + { + JToolBarHelper::custom('health_educations.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('health_education.import')) + { + JToolBarHelper::custom('health_educations.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('health_educations'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Education Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Education Type Selection + $this->education_typeOptions = JFormHelper::loadFieldType('healtheducationsfiltereducationtype')->options; + // We do some sanitation for Education Type filter + if (Ehealth_portalHelper::checkArray($this->education_typeOptions) && + isset($this->education_typeOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->education_typeOptions[0]->value)) + { + unset($this->education_typeOptions[0]); + } + // Education Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_EDUCATION_TYPE_LABEL').' -', + 'batch[education_type]', + JHtml::_('select.options', $this->education_typeOptions, 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('healtheducationsfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATIONS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/health_educations.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'g.name' => JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_HEALTH_EDUCATION_TOPIC_LABEL'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_HEALTH_EDUCATION_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/hiv_counseling_and_testing/submitbutton.js b/admin/views/hiv_counseling_and_testing/submitbutton.js new file mode 100644 index 0000000..e51cd6f --- /dev/null +++ b/admin/views/hiv_counseling_and_testing/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('hiv_counseling_and_testing, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/hiv_counseling_and_testing/tmpl/edit.php b/admin/views/hiv_counseling_and_testing/tmpl/edit.php new file mode 100644 index 0000000..1fab723 --- /dev/null +++ b/admin/views/hiv_counseling_and_testing/tmpl/edit.php @@ -0,0 +1,129 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/hiv_counseling_and_testing/tmpl/index.html b/admin/views/hiv_counseling_and_testing/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/hiv_counseling_and_testing/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/hiv_counseling_and_testing/view.html.php b/admin/views/hiv_counseling_and_testing/view.html.php new file mode 100644 index 0000000..9a1dad3 --- /dev/null +++ b/admin/views/hiv_counseling_and_testing/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Hiv_counseling_and_testing View class + */ +class Ehealth_portalViewHiv_counseling_and_testing extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('hiv_counseling_and_testing', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEW' : 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('hiv_counseling_and_testing.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('hiv_counseling_and_testing.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('hiv_counseling_and_testing.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('hiv_counseling_and_testing.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('hiv_counseling_and_testing.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('hiv_counseling_and_testing.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('hiv_counseling_and_testing.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('hiv_counseling_and_testing.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('hiv_counseling_and_testing.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('hiv_counseling_and_testing.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('hiv_counseling_and_testing.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('hiv_counseling_and_testing.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.hiv_counseling_and_testing', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('hiv_counseling_and_testing.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('hiv_counseling_and_testing.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('hiv_counseling_and_testing'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_NEW' : 'COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/hiv_counseling_and_testing.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/hiv_counseling_and_testing/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/hiv_counselings_and_testings/index.html b/admin/views/hiv_counselings_and_testings/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/hiv_counselings_and_testings/tmpl/default.php b/admin/views/hiv_counselings_and_testings/tmpl/default.php new file mode 100644 index 0000000..03ea1fe --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=hiv_counselings_and_testings.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'hiv_counseling_and_testingList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/hiv_counselings_and_testings/tmpl/default_batch_body.php b/admin/views/hiv_counselings_and_testings/tmpl/default_batch_body.php new file mode 100644 index 0000000..772a6d7 --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/hiv_counselings_and_testings/tmpl/default_batch_footer.php b/admin/views/hiv_counselings_and_testings/tmpl/default_batch_footer.php new file mode 100644 index 0000000..ab3736b --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/hiv_counselings_and_testings/tmpl/default_body.php b/admin/views/hiv_counselings_and_testings/tmpl/default_body.php new file mode 100644 index 0000000..d32fdf3 --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/tmpl/default_body.php @@ -0,0 +1,132 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=hiv_counselings_and_testings&task=hiv_counseling_and_testing.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('hiv_counseling_and_testing',$item,'hiv_counselings_and_testings'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + counseling_type); ?> + + + escape($item->testing_reason_name); ?> + + + last_test_date); ?> + + + prev_test_result); ?> + + + test_result_one); ?> + + + test_result_two); ?> + + + final_test_result); ?> + + + eqa); ?> + + + escape($item->referral_name); ?> + + + escape($item->reason); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'hiv_counselings_and_testings.', true, 'cb'); ?> + + published, $i, 'hiv_counselings_and_testings.', false, 'cb'); ?> + + + published, $i, 'hiv_counselings_and_testings.', true, 'cb'); ?> + + + published, $i, 'hiv_counselings_and_testings.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/hiv_counselings_and_testings/tmpl/default_foot.php b/admin/views/hiv_counselings_and_testings/tmpl/default_foot.php new file mode 100644 index 0000000..41fce50 --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/hiv_counselings_and_testings/tmpl/default_head.php b/admin/views/hiv_counselings_and_testings/tmpl/default_head.php new file mode 100644 index 0000000..a7a33f2 --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/tmpl/default_head.php @@ -0,0 +1,91 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/hiv_counselings_and_testings/tmpl/default_toolbar.php b/admin/views/hiv_counselings_and_testings/tmpl/default_toolbar.php new file mode 100644 index 0000000..69596e1 --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/hiv_counselings_and_testings/tmpl/index.html b/admin/views/hiv_counselings_and_testings/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/hiv_counselings_and_testings/view.html.php b/admin/views/hiv_counselings_and_testings/view.html.php new file mode 100644 index 0000000..124380a --- /dev/null +++ b/admin/views/hiv_counselings_and_testings/view.html.php @@ -0,0 +1,263 @@ + + @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'); + +/** + * Ehealth_portal View class for the Hiv_counselings_and_testings + */ +class Ehealth_portalViewHiv_counselings_and_testings extends JViewLegacy +{ + /** + * Hiv_counselings_and_testings view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('hiv_counselings_and_testings'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('hiv_counseling_and_testing'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS'), 'pencil-2'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=hiv_counselings_and_testings'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('hiv_counseling_and_testing.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('hiv_counseling_and_testing.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('hiv_counselings_and_testings.publish'); + JToolBarHelper::unpublishList('hiv_counselings_and_testings.unpublish'); + JToolBarHelper::archiveList('hiv_counselings_and_testings.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('hiv_counselings_and_testings.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'hiv_counselings_and_testings.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('hiv_counselings_and_testings.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('hiv_counseling_and_testing.export')) + { + JToolBarHelper::custom('hiv_counselings_and_testings.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('hiv_counseling_and_testing.import')) + { + JToolBarHelper::custom('hiv_counselings_and_testings.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('hiv_counselings_and_testings'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('hivcounselingsandtestingsfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_HIV_COUNSELINGS_AND_TESTINGS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/hiv_counselings_and_testings.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_HIV_COUNSELING_AND_TESTING_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/immunisation/submitbutton.js b/admin/views/immunisation/submitbutton.js new file mode 100644 index 0000000..94d6109 --- /dev/null +++ b/admin/views/immunisation/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('immunisation, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/immunisation/tmpl/edit.php b/admin/views/immunisation/tmpl/edit.php new file mode 100644 index 0000000..a78ded0 --- /dev/null +++ b/admin/views/immunisation/tmpl/edit.php @@ -0,0 +1,160 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + + + diff --git a/admin/views/immunisation/tmpl/index.html b/admin/views/immunisation/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisation/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisation/view.html.php b/admin/views/immunisation/view.html.php new file mode 100644 index 0000000..ef19205 --- /dev/null +++ b/admin/views/immunisation/view.html.php @@ -0,0 +1,211 @@ + + @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'); + +/** + * Immunisation View class + */ +class Ehealth_portalViewImmunisation extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('immunisation', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_IMMUNISATION_NEW' : 'COM_EHEALTH_PORTAL_IMMUNISATION_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('immunisation.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('immunisation.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('immunisation.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('immunisation.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('immunisation.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('immunisation.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('immunisation.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('immunisation.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('immunisation.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('immunisation.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('immunisation.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('immunisation.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.immunisation', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('immunisation.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('immunisation.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('immunisation'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_IMMUNISATION_NEW' : 'COM_EHEALTH_PORTAL_IMMUNISATION_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/immunisation.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // Add Ajax Token + $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/immunisation/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/immunisation_type/submitbutton.js b/admin/views/immunisation_type/submitbutton.js new file mode 100644 index 0000000..25a934e --- /dev/null +++ b/admin/views/immunisation_type/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('immunisation_type, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/immunisation_type/tmpl/edit.php b/admin/views/immunisation_type/tmpl/edit.php new file mode 100644 index 0000000..dfa2d55 --- /dev/null +++ b/admin/views/immunisation_type/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/immunisation_type/tmpl/index.html b/admin/views/immunisation_type/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisation_type/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisation_type/view.html.php b/admin/views/immunisation_type/view.html.php new file mode 100644 index 0000000..f62c2cc --- /dev/null +++ b/admin/views/immunisation_type/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Immunisation_type View class + */ +class Ehealth_portalViewImmunisation_type extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('immunisation_type', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_NEW' : 'COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('immunisation_type.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('immunisation_type.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('immunisation_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('immunisation_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('immunisation_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('immunisation_type.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('immunisation_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('immunisation_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('immunisation_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('immunisation_type.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('immunisation_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('immunisation_type.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.immunisation_type', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('immunisation_type.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('immunisation_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('immunisation_type'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_NEW' : 'COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/immunisation_type.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/immunisation_type/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/immunisation_types/index.html b/admin/views/immunisation_types/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisation_types/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisation_types/tmpl/default.php b/admin/views/immunisation_types/tmpl/default.php new file mode 100644 index 0000000..71f136c --- /dev/null +++ b/admin/views/immunisation_types/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=immunisation_types.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'immunisation_typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_TYPES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/immunisation_types/tmpl/default_batch_body.php b/admin/views/immunisation_types/tmpl/default_batch_body.php new file mode 100644 index 0000000..8f29275 --- /dev/null +++ b/admin/views/immunisation_types/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/immunisation_types/tmpl/default_batch_footer.php b/admin/views/immunisation_types/tmpl/default_batch_footer.php new file mode 100644 index 0000000..ef76cde --- /dev/null +++ b/admin/views/immunisation_types/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/immunisation_types/tmpl/default_body.php b/admin/views/immunisation_types/tmpl/default_body.php new file mode 100644 index 0000000..d53ec0c --- /dev/null +++ b/admin/views/immunisation_types/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=immunisation_types&task=immunisation_type.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('immunisation_type',$item,'immunisation_types'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'immunisation_types.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'immunisation_types.', true, 'cb'); ?> + + published, $i, 'immunisation_types.', false, 'cb'); ?> + + + published, $i, 'immunisation_types.', true, 'cb'); ?> + + + published, $i, 'immunisation_types.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/immunisation_types/tmpl/default_foot.php b/admin/views/immunisation_types/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/immunisation_types/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/immunisation_types/tmpl/default_head.php b/admin/views/immunisation_types/tmpl/default_head.php new file mode 100644 index 0000000..14b552b --- /dev/null +++ b/admin/views/immunisation_types/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/immunisation_types/tmpl/default_toolbar.php b/admin/views/immunisation_types/tmpl/default_toolbar.php new file mode 100644 index 0000000..3c9efda --- /dev/null +++ b/admin/views/immunisation_types/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/immunisation_types/tmpl/index.html b/admin/views/immunisation_types/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisation_types/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisation_types/view.html.php b/admin/views/immunisation_types/view.html.php new file mode 100644 index 0000000..1fa1e26 --- /dev/null +++ b/admin/views/immunisation_types/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Immunisation_types + */ +class Ehealth_portalViewImmunisation_types extends JViewLegacy +{ + /** + * Immunisation_types view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('immunisation_types'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('immunisation_type'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_TYPES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=immunisation_types'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('immunisation_type.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('immunisation_type.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('immunisation_types.publish'); + JToolBarHelper::unpublishList('immunisation_types.unpublish'); + JToolBarHelper::archiveList('immunisation_types.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('immunisation_types.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'immunisation_types.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('immunisation_types.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('immunisation_type.export')) + { + JToolBarHelper::custom('immunisation_types.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('immunisation_type.import')) + { + JToolBarHelper::custom('immunisation_types.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('immunisation_types'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_TYPES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/immunisation_types.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_TYPE_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/immunisation_vaccine_type/submitbutton.js b/admin/views/immunisation_vaccine_type/submitbutton.js new file mode 100644 index 0000000..a435985 --- /dev/null +++ b/admin/views/immunisation_vaccine_type/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('immunisation_vaccine_type, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_type/tmpl/edit.php b/admin/views/immunisation_vaccine_type/tmpl/edit.php new file mode 100644 index 0000000..86d7cb5 --- /dev/null +++ b/admin/views/immunisation_vaccine_type/tmpl/edit.php @@ -0,0 +1,123 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/immunisation_vaccine_type/tmpl/index.html b/admin/views/immunisation_vaccine_type/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisation_vaccine_type/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_type/view.html.php b/admin/views/immunisation_vaccine_type/view.html.php new file mode 100644 index 0000000..8b55ade --- /dev/null +++ b/admin/views/immunisation_vaccine_type/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Immunisation_vaccine_type View class + */ +class Ehealth_portalViewImmunisation_vaccine_type extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('immunisation_vaccine_type', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_NEW' : 'COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('immunisation_vaccine_type.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('immunisation_vaccine_type.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('immunisation_vaccine_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('immunisation_vaccine_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('immunisation_vaccine_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('immunisation_vaccine_type.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('immunisation_vaccine_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('immunisation_vaccine_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('immunisation_vaccine_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('immunisation_vaccine_type.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('immunisation_vaccine_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('immunisation_vaccine_type.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.immunisation_vaccine_type', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('immunisation_vaccine_type.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('immunisation_vaccine_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('immunisation_vaccine_type'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_NEW' : 'COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/immunisation_vaccine_type.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/immunisation_vaccine_type/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/immunisation_vaccine_types/index.html b/admin/views/immunisation_vaccine_types/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisation_vaccine_types/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_types/tmpl/default.php b/admin/views/immunisation_vaccine_types/tmpl/default.php new file mode 100644 index 0000000..ea4baf5 --- /dev/null +++ b/admin/views/immunisation_vaccine_types/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=immunisation_vaccine_types.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'immunisation_vaccine_typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/immunisation_vaccine_types/tmpl/default_batch_body.php b/admin/views/immunisation_vaccine_types/tmpl/default_batch_body.php new file mode 100644 index 0000000..ea0cf82 --- /dev/null +++ b/admin/views/immunisation_vaccine_types/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_types/tmpl/default_batch_footer.php b/admin/views/immunisation_vaccine_types/tmpl/default_batch_footer.php new file mode 100644 index 0000000..8c5aa01 --- /dev/null +++ b/admin/views/immunisation_vaccine_types/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_types/tmpl/default_body.php b/admin/views/immunisation_vaccine_types/tmpl/default_body.php new file mode 100644 index 0000000..07f981d --- /dev/null +++ b/admin/views/immunisation_vaccine_types/tmpl/default_body.php @@ -0,0 +1,111 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=immunisation_vaccine_types&task=immunisation_vaccine_type.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('immunisation_vaccine_type',$item,'immunisation_vaccine_types'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'immunisation_vaccine_types.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->administration_part_name); ?> + + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'immunisation_vaccine_types.', true, 'cb'); ?> + + published, $i, 'immunisation_vaccine_types.', false, 'cb'); ?> + + + published, $i, 'immunisation_vaccine_types.', true, 'cb'); ?> + + + published, $i, 'immunisation_vaccine_types.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_types/tmpl/default_foot.php b/admin/views/immunisation_vaccine_types/tmpl/default_foot.php new file mode 100644 index 0000000..84f7d61 --- /dev/null +++ b/admin/views/immunisation_vaccine_types/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_types/tmpl/default_head.php b/admin/views/immunisation_vaccine_types/tmpl/default_head.php new file mode 100644 index 0000000..b0b72a6 --- /dev/null +++ b/admin/views/immunisation_vaccine_types/tmpl/default_head.php @@ -0,0 +1,67 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_types/tmpl/default_toolbar.php b/admin/views/immunisation_vaccine_types/tmpl/default_toolbar.php new file mode 100644 index 0000000..ef32a40 --- /dev/null +++ b/admin/views/immunisation_vaccine_types/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/immunisation_vaccine_types/tmpl/index.html b/admin/views/immunisation_vaccine_types/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisation_vaccine_types/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisation_vaccine_types/view.html.php b/admin/views/immunisation_vaccine_types/view.html.php new file mode 100644 index 0000000..1326be5 --- /dev/null +++ b/admin/views/immunisation_vaccine_types/view.html.php @@ -0,0 +1,265 @@ + + @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'); + +/** + * Ehealth_portal View class for the Immunisation_vaccine_types + */ +class Ehealth_portalViewImmunisation_vaccine_types extends JViewLegacy +{ + /** + * Immunisation_vaccine_types view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('immunisation_vaccine_types'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('immunisation_vaccine_type'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=immunisation_vaccine_types'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('immunisation_vaccine_type.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('immunisation_vaccine_type.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('immunisation_vaccine_types.publish'); + JToolBarHelper::unpublishList('immunisation_vaccine_types.unpublish'); + JToolBarHelper::archiveList('immunisation_vaccine_types.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('immunisation_vaccine_types.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'immunisation_vaccine_types.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('immunisation_vaccine_types.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('immunisation_vaccine_type.export')) + { + JToolBarHelper::custom('immunisation_vaccine_types.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('immunisation_vaccine_type.import')) + { + JToolBarHelper::custom('immunisation_vaccine_types.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('immunisation_vaccine_types'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Administration Part Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Administration Part Name Selection + $this->administration_partNameOptions = JFormHelper::loadFieldType('Administrationparts')->options; + // We do some sanitation for Administration Part Name filter + if (Ehealth_portalHelper::checkArray($this->administration_partNameOptions) && + isset($this->administration_partNameOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->administration_partNameOptions[0]->value)) + { + unset($this->administration_partNameOptions[0]); + } + // Administration Part Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ADMINISTRATION_PART_LABEL').' -', + 'batch[administration_part]', + JHtml::_('select.options', $this->administration_partNameOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/immunisation_vaccine_types.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_NAME_LABEL'), + 'g.name' => JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_ADMINISTRATION_PART_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_VACCINE_TYPE_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/immunisations/index.html b/admin/views/immunisations/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisations/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisations/tmpl/default.php b/admin/views/immunisations/tmpl/default.php new file mode 100644 index 0000000..effd153 --- /dev/null +++ b/admin/views/immunisations/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=immunisations.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'immunisationList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_IMMUNISATIONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/immunisations/tmpl/default_batch_body.php b/admin/views/immunisations/tmpl/default_batch_body.php new file mode 100644 index 0000000..6f9c9ff --- /dev/null +++ b/admin/views/immunisations/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/immunisations/tmpl/default_batch_footer.php b/admin/views/immunisations/tmpl/default_batch_footer.php new file mode 100644 index 0000000..3b02080 --- /dev/null +++ b/admin/views/immunisations/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/immunisations/tmpl/default_body.php b/admin/views/immunisations/tmpl/default_body.php new file mode 100644 index 0000000..f05f48e --- /dev/null +++ b/admin/views/immunisations/tmpl/default_body.php @@ -0,0 +1,117 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=immunisations&task=immunisation.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('immunisation',$item,'immunisations'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + escape($item->referral_name); ?> + + + immunisation_up_to_date); ?> + + + escape($item->reason); ?> + + + escape($item->immunisation_vaccine_type_name); ?> + + + escape($item->administration_part_name); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'immunisations.', true, 'cb'); ?> + + published, $i, 'immunisations.', false, 'cb'); ?> + + + published, $i, 'immunisations.', true, 'cb'); ?> + + + published, $i, 'immunisations.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/immunisations/tmpl/default_foot.php b/admin/views/immunisations/tmpl/default_foot.php new file mode 100644 index 0000000..ff69f10 --- /dev/null +++ b/admin/views/immunisations/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/immunisations/tmpl/default_head.php b/admin/views/immunisations/tmpl/default_head.php new file mode 100644 index 0000000..03bc668 --- /dev/null +++ b/admin/views/immunisations/tmpl/default_head.php @@ -0,0 +1,76 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/immunisations/tmpl/default_toolbar.php b/admin/views/immunisations/tmpl/default_toolbar.php new file mode 100644 index 0000000..18cdca0 --- /dev/null +++ b/admin/views/immunisations/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/immunisations/tmpl/index.html b/admin/views/immunisations/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/immunisations/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/immunisations/view.html.php b/admin/views/immunisations/view.html.php new file mode 100644 index 0000000..747fa67 --- /dev/null +++ b/admin/views/immunisations/view.html.php @@ -0,0 +1,263 @@ + + @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'); + +/** + * Ehealth_portal View class for the Immunisations + */ +class Ehealth_portalViewImmunisations extends JViewLegacy +{ + /** + * Immunisations view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('immunisations'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('immunisation'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_IMMUNISATIONS'), 'calendar-3'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=immunisations'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('immunisation.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('immunisation.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('immunisations.publish'); + JToolBarHelper::unpublishList('immunisations.unpublish'); + JToolBarHelper::archiveList('immunisations.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('immunisations.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'immunisations.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('immunisations.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('immunisation.export')) + { + JToolBarHelper::custom('immunisations.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('immunisation.import')) + { + JToolBarHelper::custom('immunisations.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('immunisations'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('immunisationsfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_IMMUNISATIONS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/immunisations.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_IMMUNISATION_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/import/index.html b/admin/views/import/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/import/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/import/tmpl/default.php b/admin/views/import/tmpl/default.php new file mode 100644 index 0000000..ba3d125 --- /dev/null +++ b/admin/views/import/tmpl/default.php @@ -0,0 +1,231 @@ + + @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'); + +JHtml::_('jquery.framework'); +JHtml::_('bootstrap.tooltip'); +JHtml::_('script', 'system/core.js', false, true); +JHtml::_('behavior.keepalive'); +?> + + +
+
+ + sidebar)) : ?> +
+ sidebar; ?> +
+
+ +
+ + + hasPackage && Ehealth_portalHelper::checkArray($this->headerList) && Ehealth_portalHelper::checkArray($this->headers)) : ?> +
+ +
+ +
+ +
+
+ headerList as $name => $title): ?> +
+ +
+ +
+
+ +
+ +
+
+ + + 'upload')); ?> + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + + + + + +
\ No newline at end of file diff --git a/admin/views/import/tmpl/index.html b/admin/views/import/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/import/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php new file mode 100644 index 0000000..cb27590 --- /dev/null +++ b/admin/views/import/view.html.php @@ -0,0 +1,107 @@ + + @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'); + +/** + * Ehealth_portal Import View + */ +class Ehealth_portalViewImport extends JViewLegacy +{ + protected $headerList; + protected $hasPackage = false; + protected $headers; + protected $hasHeader = 0; + protected $dataType; + + public function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('import'); + } + + $paths = new stdClass; + $paths->first = ''; + $state = $this->get('state'); + + $this->paths = &$paths; + $this->state = &$state; + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('import'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + } + + // get the session object + $session = JFactory::getSession(); + // check if it has package + $this->hasPackage = $session->get('hasPackage', false); + $this->dataType = $session->get('dataType', false); + if($this->hasPackage && $this->dataType) + { + $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); + $this->headers = Ehealth_portalHelper::getFileHeaders($this->dataType); + // clear the data type + $session->clear('dataType'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_IMPORT_TITLE'), 'upload'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=import'); + + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('import'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } +} diff --git a/admin/views/index.html b/admin/views/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/medication/submitbutton.js b/admin/views/medication/submitbutton.js new file mode 100644 index 0000000..f1be415 --- /dev/null +++ b/admin/views/medication/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('medication, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/medication/tmpl/edit.php b/admin/views/medication/tmpl/edit.php new file mode 100644 index 0000000..680ced6 --- /dev/null +++ b/admin/views/medication/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/medication/tmpl/index.html b/admin/views/medication/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/medication/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/medication/view.html.php b/admin/views/medication/view.html.php new file mode 100644 index 0000000..6823a7e --- /dev/null +++ b/admin/views/medication/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Medication View class + */ +class Ehealth_portalViewMedication extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('medication', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_MEDICATION_NEW' : 'COM_EHEALTH_PORTAL_MEDICATION_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('medication.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('medication.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('medication.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('medication.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('medication.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('medication.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('medication.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('medication.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('medication.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('medication.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('medication.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('medication.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.medication', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('medication.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('medication.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('medication'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_MEDICATION_NEW' : 'COM_EHEALTH_PORTAL_MEDICATION_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/medication.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/medication/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/medications/index.html b/admin/views/medications/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/medications/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/medications/tmpl/default.php b/admin/views/medications/tmpl/default.php new file mode 100644 index 0000000..6bb3410 --- /dev/null +++ b/admin/views/medications/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=medications.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'medicationList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_MEDICATIONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/medications/tmpl/default_batch_body.php b/admin/views/medications/tmpl/default_batch_body.php new file mode 100644 index 0000000..bc86a5c --- /dev/null +++ b/admin/views/medications/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/medications/tmpl/default_batch_footer.php b/admin/views/medications/tmpl/default_batch_footer.php new file mode 100644 index 0000000..2896af2 --- /dev/null +++ b/admin/views/medications/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/medications/tmpl/default_body.php b/admin/views/medications/tmpl/default_body.php new file mode 100644 index 0000000..b0fe5fa --- /dev/null +++ b/admin/views/medications/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=medications&task=medication.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('medication',$item,'medications'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'medications.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'medications.', true, 'cb'); ?> + + published, $i, 'medications.', false, 'cb'); ?> + + + published, $i, 'medications.', true, 'cb'); ?> + + + published, $i, 'medications.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/medications/tmpl/default_foot.php b/admin/views/medications/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/medications/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/medications/tmpl/default_head.php b/admin/views/medications/tmpl/default_head.php new file mode 100644 index 0000000..de910f1 --- /dev/null +++ b/admin/views/medications/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/medications/tmpl/default_toolbar.php b/admin/views/medications/tmpl/default_toolbar.php new file mode 100644 index 0000000..a18fd66 --- /dev/null +++ b/admin/views/medications/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/medications/tmpl/index.html b/admin/views/medications/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/medications/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/medications/view.html.php b/admin/views/medications/view.html.php new file mode 100644 index 0000000..9f54886 --- /dev/null +++ b/admin/views/medications/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Medications + */ +class Ehealth_portalViewMedications extends JViewLegacy +{ + /** + * Medications view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('medications'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('medication'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_MEDICATIONS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=medications'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('medication.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('medication.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('medications.publish'); + JToolBarHelper::unpublishList('medications.unpublish'); + JToolBarHelper::archiveList('medications.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('medications.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'medications.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('medications.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('medication.export')) + { + JToolBarHelper::custom('medications.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('medication.import')) + { + JToolBarHelper::custom('medications.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('medications'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_MEDICATIONS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/medications.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_MEDICATION_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_MEDICATION_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/nonpay_reason/submitbutton.js b/admin/views/nonpay_reason/submitbutton.js new file mode 100644 index 0000000..d9130ec --- /dev/null +++ b/admin/views/nonpay_reason/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('nonpay_reason, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/nonpay_reason/tmpl/edit.php b/admin/views/nonpay_reason/tmpl/edit.php new file mode 100644 index 0000000..16518ee --- /dev/null +++ b/admin/views/nonpay_reason/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/nonpay_reason/tmpl/index.html b/admin/views/nonpay_reason/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/nonpay_reason/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/nonpay_reason/view.html.php b/admin/views/nonpay_reason/view.html.php new file mode 100644 index 0000000..1777af8 --- /dev/null +++ b/admin/views/nonpay_reason/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Nonpay_reason View class + */ +class Ehealth_portalViewNonpay_reason extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('nonpay_reason', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_NONPAY_REASON_NEW' : 'COM_EHEALTH_PORTAL_NONPAY_REASON_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('nonpay_reason.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('nonpay_reason.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('nonpay_reason.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('nonpay_reason.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('nonpay_reason.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('nonpay_reason.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('nonpay_reason.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('nonpay_reason.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('nonpay_reason.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('nonpay_reason.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('nonpay_reason.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('nonpay_reason.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.nonpay_reason', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('nonpay_reason.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('nonpay_reason.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('nonpay_reason'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_NONPAY_REASON_NEW' : 'COM_EHEALTH_PORTAL_NONPAY_REASON_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/nonpay_reason.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/nonpay_reason/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/nonpay_reasons/index.html b/admin/views/nonpay_reasons/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/nonpay_reasons/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/nonpay_reasons/tmpl/default.php b/admin/views/nonpay_reasons/tmpl/default.php new file mode 100644 index 0000000..3899cb2 --- /dev/null +++ b/admin/views/nonpay_reasons/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=nonpay_reasons.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'nonpay_reasonList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_NONPAY_REASONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/nonpay_reasons/tmpl/default_batch_body.php b/admin/views/nonpay_reasons/tmpl/default_batch_body.php new file mode 100644 index 0000000..d5aeca1 --- /dev/null +++ b/admin/views/nonpay_reasons/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/nonpay_reasons/tmpl/default_batch_footer.php b/admin/views/nonpay_reasons/tmpl/default_batch_footer.php new file mode 100644 index 0000000..b29e2ee --- /dev/null +++ b/admin/views/nonpay_reasons/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/nonpay_reasons/tmpl/default_body.php b/admin/views/nonpay_reasons/tmpl/default_body.php new file mode 100644 index 0000000..b530a19 --- /dev/null +++ b/admin/views/nonpay_reasons/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=nonpay_reasons&task=nonpay_reason.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('nonpay_reason',$item,'nonpay_reasons'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'nonpay_reasons.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'nonpay_reasons.', true, 'cb'); ?> + + published, $i, 'nonpay_reasons.', false, 'cb'); ?> + + + published, $i, 'nonpay_reasons.', true, 'cb'); ?> + + + published, $i, 'nonpay_reasons.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/nonpay_reasons/tmpl/default_foot.php b/admin/views/nonpay_reasons/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/nonpay_reasons/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/nonpay_reasons/tmpl/default_head.php b/admin/views/nonpay_reasons/tmpl/default_head.php new file mode 100644 index 0000000..861080c --- /dev/null +++ b/admin/views/nonpay_reasons/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/nonpay_reasons/tmpl/default_toolbar.php b/admin/views/nonpay_reasons/tmpl/default_toolbar.php new file mode 100644 index 0000000..203a870 --- /dev/null +++ b/admin/views/nonpay_reasons/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/nonpay_reasons/tmpl/index.html b/admin/views/nonpay_reasons/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/nonpay_reasons/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/nonpay_reasons/view.html.php b/admin/views/nonpay_reasons/view.html.php new file mode 100644 index 0000000..7e6b969 --- /dev/null +++ b/admin/views/nonpay_reasons/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Nonpay_reasons + */ +class Ehealth_portalViewNonpay_reasons extends JViewLegacy +{ + /** + * Nonpay_reasons view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('nonpay_reasons'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('nonpay_reason'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_NONPAY_REASONS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=nonpay_reasons'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('nonpay_reason.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('nonpay_reason.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('nonpay_reasons.publish'); + JToolBarHelper::unpublishList('nonpay_reasons.unpublish'); + JToolBarHelper::archiveList('nonpay_reasons.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('nonpay_reasons.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'nonpay_reasons.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('nonpay_reasons.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('nonpay_reason.export')) + { + JToolBarHelper::custom('nonpay_reasons.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('nonpay_reason.import')) + { + JToolBarHelper::custom('nonpay_reasons.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('nonpay_reasons'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_NONPAY_REASONS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/nonpay_reasons.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_NONPAY_REASON_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_NONPAY_REASON_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/patient_queue/index.html b/admin/views/patient_queue/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/patient_queue/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/patient_queue/tmpl/default.php b/admin/views/patient_queue/tmpl/default.php new file mode 100644 index 0000000..254ed35 --- /dev/null +++ b/admin/views/patient_queue/tmpl/default.php @@ -0,0 +1,149 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +?> +canDo->get('patient_queue.access')): ?> + +item->id)) ? '&id='. (int) $this->item->id : ''; ?> +
+ +insert(1, 0); +$q->insert(2, 0); +$q->insert(3, 0); +$q->insert(4, 0); + +while (!$q->isEmpty()) { + echo $q->extract() . " "; +} +?> + + + + +Document + + + +

Implementation of queue in JavaScript.

+
+
+ + + +

Click on the above buttons to perform queue operations

+ + + + + +
+ +

+ + diff --git a/admin/views/patient_queue/tmpl/index.html b/admin/views/patient_queue/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/patient_queue/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/patient_queue/view.html.php b/admin/views/patient_queue/view.html.php new file mode 100644 index 0000000..eadf5db --- /dev/null +++ b/admin/views/patient_queue/view.html.php @@ -0,0 +1,132 @@ + + @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'); + +/** + * Ehealth_portal View class for the Patient_queue + */ +class Ehealth_portalViewPatient_queue extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get component params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // get the application + $this->app = JFactory::getApplication(); + // get the user object + $this->user = JFactory::getUser(); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('patient_queue'); + // Initialise variables. + $this->item = $this->get('Item'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + // add the tool bar + $this->addToolBar(); + } + + // set the document + $this->setDocument(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode(PHP_EOL, $errors), 500); + } + + parent::display($tpl); + } + + /** + * Prepares the document + */ + protected function setDocument() + { + + // always make sure jquery is loaded. + JHtml::_('jquery.framework'); + // Load the header checker class. + require_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' ); + // Initialize the header checker. + $HeaderCheck = new ehealth_portalHeaderCheck; + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_ehealth_portal/assets/css/patient_queue.css', (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + // hide the main menu + $this->app->input->set('hidemainmenu', true); + // set the title + if (isset($this->item->name) && $this->item->name) + { + $title = $this->item->name; + } + // Check for empty title and add view name if param is set + if (empty($title)) + { + $title = JText::_('COM_EHEALTH_PORTAL_PATIENT_QUEUE'); + } + // add title to the page + JToolbarHelper::title($title,'joomla'); + // add cpanel button + JToolBarHelper::custom('patient_queue.dashboard', 'grid-2', '', 'COM_EHEALTH_PORTAL_DASH', false); + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('patient_queue'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } +} +?> diff --git a/admin/views/payment/submitbutton.js b/admin/views/payment/submitbutton.js new file mode 100644 index 0000000..8c9b4d7 --- /dev/null +++ b/admin/views/payment/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('payment, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/payment/tmpl/edit.php b/admin/views/payment/tmpl/edit.php new file mode 100644 index 0000000..ee90377 --- /dev/null +++ b/admin/views/payment/tmpl/edit.php @@ -0,0 +1,152 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + + + diff --git a/admin/views/payment/tmpl/index.html b/admin/views/payment/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payment/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payment/view.html.php b/admin/views/payment/view.html.php new file mode 100644 index 0000000..9dd58e3 --- /dev/null +++ b/admin/views/payment/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Payment View class + */ +class Ehealth_portalViewPayment extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('payment', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_PAYMENT_NEW' : 'COM_EHEALTH_PORTAL_PAYMENT_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('payment.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('payment.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('payment.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('payment.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('payment.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('payment.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('payment.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('payment.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('payment.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('payment.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('payment.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('payment.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.payment', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('payment.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('payment.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('payment'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_PAYMENT_NEW' : 'COM_EHEALTH_PORTAL_PAYMENT_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/payment.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/payment/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/payment_amount/submitbutton.js b/admin/views/payment_amount/submitbutton.js new file mode 100644 index 0000000..aa89a97 --- /dev/null +++ b/admin/views/payment_amount/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('payment_amount, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/payment_amount/tmpl/edit.php b/admin/views/payment_amount/tmpl/edit.php new file mode 100644 index 0000000..4a3b67f --- /dev/null +++ b/admin/views/payment_amount/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/payment_amount/tmpl/index.html b/admin/views/payment_amount/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payment_amount/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payment_amount/view.html.php b/admin/views/payment_amount/view.html.php new file mode 100644 index 0000000..348d0e0 --- /dev/null +++ b/admin/views/payment_amount/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Payment_amount View class + */ +class Ehealth_portalViewPayment_amount extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('payment_amount', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_NEW' : 'COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('payment_amount.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('payment_amount.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('payment_amount.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('payment_amount.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('payment_amount.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('payment_amount.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('payment_amount.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('payment_amount.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('payment_amount.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('payment_amount.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('payment_amount.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('payment_amount.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.payment_amount', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('payment_amount.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('payment_amount.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('payment_amount'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_NEW' : 'COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/payment_amount.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/payment_amount/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/payment_amounts/index.html b/admin/views/payment_amounts/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payment_amounts/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payment_amounts/tmpl/default.php b/admin/views/payment_amounts/tmpl/default.php new file mode 100644 index 0000000..4e3e282 --- /dev/null +++ b/admin/views/payment_amounts/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=payment_amounts.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'payment_amountList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/payment_amounts/tmpl/default_batch_body.php b/admin/views/payment_amounts/tmpl/default_batch_body.php new file mode 100644 index 0000000..178ec95 --- /dev/null +++ b/admin/views/payment_amounts/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/payment_amounts/tmpl/default_batch_footer.php b/admin/views/payment_amounts/tmpl/default_batch_footer.php new file mode 100644 index 0000000..b370ce1 --- /dev/null +++ b/admin/views/payment_amounts/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/payment_amounts/tmpl/default_body.php b/admin/views/payment_amounts/tmpl/default_body.php new file mode 100644 index 0000000..c6792f0 --- /dev/null +++ b/admin/views/payment_amounts/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=payment_amounts&task=payment_amount.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('payment_amount',$item,'payment_amounts'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'payment_amounts.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'payment_amounts.', true, 'cb'); ?> + + published, $i, 'payment_amounts.', false, 'cb'); ?> + + + published, $i, 'payment_amounts.', true, 'cb'); ?> + + + published, $i, 'payment_amounts.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/payment_amounts/tmpl/default_foot.php b/admin/views/payment_amounts/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/payment_amounts/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/payment_amounts/tmpl/default_head.php b/admin/views/payment_amounts/tmpl/default_head.php new file mode 100644 index 0000000..7a5bfef --- /dev/null +++ b/admin/views/payment_amounts/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/payment_amounts/tmpl/default_toolbar.php b/admin/views/payment_amounts/tmpl/default_toolbar.php new file mode 100644 index 0000000..1e1e60b --- /dev/null +++ b/admin/views/payment_amounts/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/payment_amounts/tmpl/index.html b/admin/views/payment_amounts/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payment_amounts/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payment_amounts/view.html.php b/admin/views/payment_amounts/view.html.php new file mode 100644 index 0000000..cb6467e --- /dev/null +++ b/admin/views/payment_amounts/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Payment_amounts + */ +class Ehealth_portalViewPayment_amounts extends JViewLegacy +{ + /** + * Payment_amounts view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('payment_amounts'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('payment_amount'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=payment_amounts'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('payment_amount.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('payment_amount.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('payment_amounts.publish'); + JToolBarHelper::unpublishList('payment_amounts.unpublish'); + JToolBarHelper::archiveList('payment_amounts.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('payment_amounts.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'payment_amounts.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('payment_amounts.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('payment_amount.export')) + { + JToolBarHelper::custom('payment_amounts.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('payment_amount.import')) + { + JToolBarHelper::custom('payment_amounts.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('payment_amounts'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_PAYMENT_AMOUNTS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/payment_amounts.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_PAYMENT_AMOUNT_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/payment_type/submitbutton.js b/admin/views/payment_type/submitbutton.js new file mode 100644 index 0000000..8211b68 --- /dev/null +++ b/admin/views/payment_type/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('payment_type, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/payment_type/tmpl/edit.php b/admin/views/payment_type/tmpl/edit.php new file mode 100644 index 0000000..bb9a8d8 --- /dev/null +++ b/admin/views/payment_type/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/payment_type/tmpl/index.html b/admin/views/payment_type/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payment_type/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payment_type/view.html.php b/admin/views/payment_type/view.html.php new file mode 100644 index 0000000..8a54d96 --- /dev/null +++ b/admin/views/payment_type/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Payment_type View class + */ +class Ehealth_portalViewPayment_type extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('payment_type', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_PAYMENT_TYPE_NEW' : 'COM_EHEALTH_PORTAL_PAYMENT_TYPE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('payment_type.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('payment_type.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('payment_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('payment_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('payment_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('payment_type.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('payment_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('payment_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('payment_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('payment_type.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('payment_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('payment_type.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.payment_type', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('payment_type.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('payment_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('payment_type'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_PAYMENT_TYPE_NEW' : 'COM_EHEALTH_PORTAL_PAYMENT_TYPE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/payment_type.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/payment_type/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/payment_types/index.html b/admin/views/payment_types/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payment_types/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payment_types/tmpl/default.php b/admin/views/payment_types/tmpl/default.php new file mode 100644 index 0000000..e6a3f15 --- /dev/null +++ b/admin/views/payment_types/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=payment_types.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'payment_typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_PAYMENT_TYPES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/payment_types/tmpl/default_batch_body.php b/admin/views/payment_types/tmpl/default_batch_body.php new file mode 100644 index 0000000..8f08222 --- /dev/null +++ b/admin/views/payment_types/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/payment_types/tmpl/default_batch_footer.php b/admin/views/payment_types/tmpl/default_batch_footer.php new file mode 100644 index 0000000..cf03fe7 --- /dev/null +++ b/admin/views/payment_types/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/payment_types/tmpl/default_body.php b/admin/views/payment_types/tmpl/default_body.php new file mode 100644 index 0000000..58750e1 --- /dev/null +++ b/admin/views/payment_types/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=payment_types&task=payment_type.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('payment_type',$item,'payment_types'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'payment_types.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'payment_types.', true, 'cb'); ?> + + published, $i, 'payment_types.', false, 'cb'); ?> + + + published, $i, 'payment_types.', true, 'cb'); ?> + + + published, $i, 'payment_types.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/payment_types/tmpl/default_foot.php b/admin/views/payment_types/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/payment_types/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/payment_types/tmpl/default_head.php b/admin/views/payment_types/tmpl/default_head.php new file mode 100644 index 0000000..8cf5384 --- /dev/null +++ b/admin/views/payment_types/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/payment_types/tmpl/default_toolbar.php b/admin/views/payment_types/tmpl/default_toolbar.php new file mode 100644 index 0000000..9f720e5 --- /dev/null +++ b/admin/views/payment_types/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/payment_types/tmpl/index.html b/admin/views/payment_types/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payment_types/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payment_types/view.html.php b/admin/views/payment_types/view.html.php new file mode 100644 index 0000000..1a1dd80 --- /dev/null +++ b/admin/views/payment_types/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Payment_types + */ +class Ehealth_portalViewPayment_types extends JViewLegacy +{ + /** + * Payment_types view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('payment_types'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('payment_type'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_PAYMENT_TYPES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=payment_types'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('payment_type.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('payment_type.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('payment_types.publish'); + JToolBarHelper::unpublishList('payment_types.unpublish'); + JToolBarHelper::archiveList('payment_types.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('payment_types.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'payment_types.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('payment_types.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('payment_type.export')) + { + JToolBarHelper::custom('payment_types.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('payment_type.import')) + { + JToolBarHelper::custom('payment_types.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('payment_types'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_PAYMENT_TYPES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/payment_types.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_PAYMENT_TYPE_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_PAYMENT_TYPE_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/payments/index.html b/admin/views/payments/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payments/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default.php b/admin/views/payments/tmpl/default.php new file mode 100644 index 0000000..7972bea --- /dev/null +++ b/admin/views/payments/tmpl/default.php @@ -0,0 +1,81 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multiplePaymentsfilterpaymentamount', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_AMOUNT_N') . ' -')); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=payments.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'paymentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_PAYMENTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/payments/tmpl/default_batch_body.php b/admin/views/payments/tmpl/default_batch_body.php new file mode 100644 index 0000000..1171ce1 --- /dev/null +++ b/admin/views/payments/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_batch_footer.php b/admin/views/payments/tmpl/default_batch_footer.php new file mode 100644 index 0000000..285291f --- /dev/null +++ b/admin/views/payments/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_body.php b/admin/views/payments/tmpl/default_body.php new file mode 100644 index 0000000..2e871ea --- /dev/null +++ b/admin/views/payments/tmpl/default_body.php @@ -0,0 +1,117 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=payments&task=payment.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('payment',$item,'payments'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + payment_category); ?> + + + escape($item->payment_type_name); ?> + + + payment_amount); ?> + + + escape($item->nonpay_reason_name); ?> + + + escape($item->receipt_no); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'payments.', true, 'cb'); ?> + + published, $i, 'payments.', false, 'cb'); ?> + + + published, $i, 'payments.', true, 'cb'); ?> + + + published, $i, 'payments.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_foot.php b/admin/views/payments/tmpl/default_foot.php new file mode 100644 index 0000000..ff69f10 --- /dev/null +++ b/admin/views/payments/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_head.php b/admin/views/payments/tmpl/default_head.php new file mode 100644 index 0000000..a6b9016 --- /dev/null +++ b/admin/views/payments/tmpl/default_head.php @@ -0,0 +1,76 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/payments/tmpl/default_toolbar.php b/admin/views/payments/tmpl/default_toolbar.php new file mode 100644 index 0000000..a56b09c --- /dev/null +++ b/admin/views/payments/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/payments/tmpl/index.html b/admin/views/payments/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/payments/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/payments/view.html.php b/admin/views/payments/view.html.php new file mode 100644 index 0000000..d9b2dc3 --- /dev/null +++ b/admin/views/payments/view.html.php @@ -0,0 +1,302 @@ + + @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'); + +/** + * Ehealth_portal View class for the Payments + */ +class Ehealth_portalViewPayments extends JViewLegacy +{ + /** + * Payments view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('payments'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('payment'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_PAYMENTS'), 'chart'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=payments'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('payment.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('payment.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('payments.publish'); + JToolBarHelper::unpublishList('payments.unpublish'); + JToolBarHelper::archiveList('payments.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('payments.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'payments.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('payments.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('payment.export')) + { + JToolBarHelper::custom('payments.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('payment.import')) + { + JToolBarHelper::custom('payments.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('payments'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('paymentsfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_PAYMENT_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + + // Only load Payment Category batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Payment Category Selection + $this->payment_categoryOptions = JFormHelper::loadFieldType('paymentsfilterpaymentcategory')->options; + // We do some sanitation for Payment Category filter + if (Ehealth_portalHelper::checkArray($this->payment_categoryOptions) && + isset($this->payment_categoryOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->payment_categoryOptions[0]->value)) + { + unset($this->payment_categoryOptions[0]); + } + // Payment Category Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_PAYMENT_PAYMENT_CATEGORY_LABEL').' -', + 'batch[payment_category]', + JHtml::_('select.options', $this->payment_categoryOptions, 'value', 'text') + ); + } + + // Only load Payment Amount batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Payment Amount Selection + $this->payment_amountOptions = JFormHelper::loadFieldType('paymentsfilterpaymentamount')->options; + // We do some sanitation for Payment Amount filter + if (Ehealth_portalHelper::checkArray($this->payment_amountOptions) && + isset($this->payment_amountOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->payment_amountOptions[0]->value)) + { + unset($this->payment_amountOptions[0]); + } + // Payment Amount Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_PAYMENT_PAYMENT_AMOUNT_LABEL').' -', + 'batch[payment_amount]', + JHtml::_('select.options', $this->payment_amountOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_PAYMENTS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/payments.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/planning_type/submitbutton.js b/admin/views/planning_type/submitbutton.js new file mode 100644 index 0000000..f209bcd --- /dev/null +++ b/admin/views/planning_type/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('planning_type, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/planning_type/tmpl/edit.php b/admin/views/planning_type/tmpl/edit.php new file mode 100644 index 0000000..0cb6286 --- /dev/null +++ b/admin/views/planning_type/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/planning_type/tmpl/index.html b/admin/views/planning_type/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/planning_type/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/planning_type/view.html.php b/admin/views/planning_type/view.html.php new file mode 100644 index 0000000..e0ac017 --- /dev/null +++ b/admin/views/planning_type/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Planning_type View class + */ +class Ehealth_portalViewPlanning_type extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('planning_type', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_PLANNING_TYPE_NEW' : 'COM_EHEALTH_PORTAL_PLANNING_TYPE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('planning_type.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('planning_type.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('planning_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('planning_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('planning_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('planning_type.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('planning_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('planning_type.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('planning_type.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('planning_type.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('planning_type.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('planning_type.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.planning_type', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('planning_type.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('planning_type.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('planning_type'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_PLANNING_TYPE_NEW' : 'COM_EHEALTH_PORTAL_PLANNING_TYPE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/planning_type.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/planning_type/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/planning_types/index.html b/admin/views/planning_types/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/planning_types/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/planning_types/tmpl/default.php b/admin/views/planning_types/tmpl/default.php new file mode 100644 index 0000000..8e604a8 --- /dev/null +++ b/admin/views/planning_types/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=planning_types.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'planning_typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_PLANNING_TYPES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/planning_types/tmpl/default_batch_body.php b/admin/views/planning_types/tmpl/default_batch_body.php new file mode 100644 index 0000000..1aeeb66 --- /dev/null +++ b/admin/views/planning_types/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/planning_types/tmpl/default_batch_footer.php b/admin/views/planning_types/tmpl/default_batch_footer.php new file mode 100644 index 0000000..867abbc --- /dev/null +++ b/admin/views/planning_types/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/planning_types/tmpl/default_body.php b/admin/views/planning_types/tmpl/default_body.php new file mode 100644 index 0000000..0180c8c --- /dev/null +++ b/admin/views/planning_types/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=planning_types&task=planning_type.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('planning_type',$item,'planning_types'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'planning_types.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'planning_types.', true, 'cb'); ?> + + published, $i, 'planning_types.', false, 'cb'); ?> + + + published, $i, 'planning_types.', true, 'cb'); ?> + + + published, $i, 'planning_types.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/planning_types/tmpl/default_foot.php b/admin/views/planning_types/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/planning_types/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/planning_types/tmpl/default_head.php b/admin/views/planning_types/tmpl/default_head.php new file mode 100644 index 0000000..4580e33 --- /dev/null +++ b/admin/views/planning_types/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/planning_types/tmpl/default_toolbar.php b/admin/views/planning_types/tmpl/default_toolbar.php new file mode 100644 index 0000000..ac8fed2 --- /dev/null +++ b/admin/views/planning_types/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/planning_types/tmpl/index.html b/admin/views/planning_types/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/planning_types/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/planning_types/view.html.php b/admin/views/planning_types/view.html.php new file mode 100644 index 0000000..a494695 --- /dev/null +++ b/admin/views/planning_types/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Planning_types + */ +class Ehealth_portalViewPlanning_types extends JViewLegacy +{ + /** + * Planning_types view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('planning_types'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('planning_type'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_PLANNING_TYPES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=planning_types'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('planning_type.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('planning_type.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('planning_types.publish'); + JToolBarHelper::unpublishList('planning_types.unpublish'); + JToolBarHelper::archiveList('planning_types.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('planning_types.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'planning_types.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('planning_types.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('planning_type.export')) + { + JToolBarHelper::custom('planning_types.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('planning_type.import')) + { + JToolBarHelper::custom('planning_types.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('planning_types'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_PLANNING_TYPES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/planning_types.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_PLANNING_TYPE_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_PLANNING_TYPE_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/prostate_and_testicular_cancer/submitbutton.js b/admin/views/prostate_and_testicular_cancer/submitbutton.js new file mode 100644 index 0000000..8bc9328 --- /dev/null +++ b/admin/views/prostate_and_testicular_cancer/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('prostate_and_testicular_cancer, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancer/tmpl/edit.php b/admin/views/prostate_and_testicular_cancer/tmpl/edit.php new file mode 100644 index 0000000..66e2f6a --- /dev/null +++ b/admin/views/prostate_and_testicular_cancer/tmpl/edit.php @@ -0,0 +1,132 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/prostate_and_testicular_cancer/tmpl/index.html b/admin/views/prostate_and_testicular_cancer/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/prostate_and_testicular_cancer/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancer/view.html.php b/admin/views/prostate_and_testicular_cancer/view.html.php new file mode 100644 index 0000000..c69c9ef --- /dev/null +++ b/admin/views/prostate_and_testicular_cancer/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Prostate_and_testicular_cancer View class + */ +class Ehealth_portalViewProstate_and_testicular_cancer extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('prostate_and_testicular_cancer', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NEW' : 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('prostate_and_testicular_cancer.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('prostate_and_testicular_cancer.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('prostate_and_testicular_cancer.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('prostate_and_testicular_cancer.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('prostate_and_testicular_cancer.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('prostate_and_testicular_cancer.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('prostate_and_testicular_cancer.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('prostate_and_testicular_cancer.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('prostate_and_testicular_cancer.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('prostate_and_testicular_cancer.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('prostate_and_testicular_cancer.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('prostate_and_testicular_cancer.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.prostate_and_testicular_cancer', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('prostate_and_testicular_cancer.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('prostate_and_testicular_cancer.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('prostate_and_testicular_cancer'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_NEW' : 'COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/prostate_and_testicular_cancer.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/prostate_and_testicular_cancer/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/prostate_and_testicular_cancers/index.html b/admin/views/prostate_and_testicular_cancers/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancers/tmpl/default.php b/admin/views/prostate_and_testicular_cancers/tmpl/default.php new file mode 100644 index 0000000..4e95969 --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=prostate_and_testicular_cancers.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'prostate_and_testicular_cancerList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/prostate_and_testicular_cancers/tmpl/default_batch_body.php b/admin/views/prostate_and_testicular_cancers/tmpl/default_batch_body.php new file mode 100644 index 0000000..208385d --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancers/tmpl/default_batch_footer.php b/admin/views/prostate_and_testicular_cancers/tmpl/default_batch_footer.php new file mode 100644 index 0000000..59a597a --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancers/tmpl/default_body.php b/admin/views/prostate_and_testicular_cancers/tmpl/default_body.php new file mode 100644 index 0000000..91f8931 --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/tmpl/default_body.php @@ -0,0 +1,150 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=prostate_and_testicular_cancers&task=prostate_and_testicular_cancer.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('prostate_and_testicular_cancer',$item,'prostate_and_testicular_cancers'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + +
+ ptc_age); ?> + escape($item->txt_ptc_age); ?> +
+ + +
+ ptc_fam_history); ?> + escape($item->txt_ptc_fam_history); ?> +
+ + +
+ ptc_diet); ?> + escape($item->txt_ptc_diet); ?> +
+ + +
+ ptc_phy_activity); ?> + escape($item->txt_ptc_phy_activity); ?> +
+ + +
+ ptc_overweight); ?> + escape($item->txt_ptc_overweight); ?> +
+ + +
+ ptc_urinate); ?> + escape($item->txt_ptc_urinate); ?> +
+ + +
+ ptc_urine_freq); ?> + escape($item->txt_ptc_urine_freq); ?> +
+ + + escape($item->referral_name); ?> + + + escape($item->reason); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'prostate_and_testicular_cancers.', true, 'cb'); ?> + + published, $i, 'prostate_and_testicular_cancers.', false, 'cb'); ?> + + + published, $i, 'prostate_and_testicular_cancers.', true, 'cb'); ?> + + + published, $i, 'prostate_and_testicular_cancers.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancers/tmpl/default_foot.php b/admin/views/prostate_and_testicular_cancers/tmpl/default_foot.php new file mode 100644 index 0000000..2c6f3c1 --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancers/tmpl/default_head.php b/admin/views/prostate_and_testicular_cancers/tmpl/default_head.php new file mode 100644 index 0000000..3470b60 --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/tmpl/default_head.php @@ -0,0 +1,88 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancers/tmpl/default_toolbar.php b/admin/views/prostate_and_testicular_cancers/tmpl/default_toolbar.php new file mode 100644 index 0000000..8ae4d0e --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancers/tmpl/index.html b/admin/views/prostate_and_testicular_cancers/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/prostate_and_testicular_cancers/view.html.php b/admin/views/prostate_and_testicular_cancers/view.html.php new file mode 100644 index 0000000..60584af --- /dev/null +++ b/admin/views/prostate_and_testicular_cancers/view.html.php @@ -0,0 +1,263 @@ + + @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'); + +/** + * Ehealth_portal View class for the Prostate_and_testicular_cancers + */ +class Ehealth_portalViewProstate_and_testicular_cancers extends JViewLegacy +{ + /** + * Prostate_and_testicular_cancers view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('prostate_and_testicular_cancers'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('prostate_and_testicular_cancer'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS'), 'health'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=prostate_and_testicular_cancers'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('prostate_and_testicular_cancer.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('prostate_and_testicular_cancer.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('prostate_and_testicular_cancers.publish'); + JToolBarHelper::unpublishList('prostate_and_testicular_cancers.unpublish'); + JToolBarHelper::archiveList('prostate_and_testicular_cancers.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('prostate_and_testicular_cancers.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'prostate_and_testicular_cancers.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('prostate_and_testicular_cancers.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('prostate_and_testicular_cancer.export')) + { + JToolBarHelper::custom('prostate_and_testicular_cancers.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('prostate_and_testicular_cancer.import')) + { + JToolBarHelper::custom('prostate_and_testicular_cancers.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('prostate_and_testicular_cancers'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('prostateandtesticularcancersfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCERS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/prostate_and_testicular_cancers.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_PROSTATE_AND_TESTICULAR_CANCER_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/referral/submitbutton.js b/admin/views/referral/submitbutton.js new file mode 100644 index 0000000..fda292e --- /dev/null +++ b/admin/views/referral/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('referral, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/referral/tmpl/edit.php b/admin/views/referral/tmpl/edit.php new file mode 100644 index 0000000..ee0283e --- /dev/null +++ b/admin/views/referral/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/referral/tmpl/index.html b/admin/views/referral/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/referral/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/referral/view.html.php b/admin/views/referral/view.html.php new file mode 100644 index 0000000..fcc4c6c --- /dev/null +++ b/admin/views/referral/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Referral View class + */ +class Ehealth_portalViewReferral extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('referral', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_REFERRAL_NEW' : 'COM_EHEALTH_PORTAL_REFERRAL_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('referral.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('referral.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('referral.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('referral.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('referral.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('referral.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('referral.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('referral.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('referral.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('referral.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('referral.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('referral.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.referral', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('referral.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('referral.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('referral'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_REFERRAL_NEW' : 'COM_EHEALTH_PORTAL_REFERRAL_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/referral.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/referral/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/referrals/index.html b/admin/views/referrals/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/referrals/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/referrals/tmpl/default.php b/admin/views/referrals/tmpl/default.php new file mode 100644 index 0000000..7de261e --- /dev/null +++ b/admin/views/referrals/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=referrals.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'referralList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_REFERRALS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/referrals/tmpl/default_batch_body.php b/admin/views/referrals/tmpl/default_batch_body.php new file mode 100644 index 0000000..e2e516d --- /dev/null +++ b/admin/views/referrals/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/referrals/tmpl/default_batch_footer.php b/admin/views/referrals/tmpl/default_batch_footer.php new file mode 100644 index 0000000..4b9e12d --- /dev/null +++ b/admin/views/referrals/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/referrals/tmpl/default_body.php b/admin/views/referrals/tmpl/default_body.php new file mode 100644 index 0000000..06d1e42 --- /dev/null +++ b/admin/views/referrals/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=referrals&task=referral.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('referral',$item,'referrals'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'referrals.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'referrals.', true, 'cb'); ?> + + published, $i, 'referrals.', false, 'cb'); ?> + + + published, $i, 'referrals.', true, 'cb'); ?> + + + published, $i, 'referrals.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/referrals/tmpl/default_foot.php b/admin/views/referrals/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/referrals/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/referrals/tmpl/default_head.php b/admin/views/referrals/tmpl/default_head.php new file mode 100644 index 0000000..f787a49 --- /dev/null +++ b/admin/views/referrals/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/referrals/tmpl/default_toolbar.php b/admin/views/referrals/tmpl/default_toolbar.php new file mode 100644 index 0000000..c76b395 --- /dev/null +++ b/admin/views/referrals/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/referrals/tmpl/index.html b/admin/views/referrals/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/referrals/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/referrals/view.html.php b/admin/views/referrals/view.html.php new file mode 100644 index 0000000..222ab27 --- /dev/null +++ b/admin/views/referrals/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Referrals + */ +class Ehealth_portalViewReferrals extends JViewLegacy +{ + /** + * Referrals view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('referrals'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('referral'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_REFERRALS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=referrals'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('referral.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('referral.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('referrals.publish'); + JToolBarHelper::unpublishList('referrals.unpublish'); + JToolBarHelper::archiveList('referrals.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('referrals.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'referrals.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('referrals.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('referral.export')) + { + JToolBarHelper::custom('referrals.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('referral.import')) + { + JToolBarHelper::custom('referrals.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('referrals'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_REFERRALS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/referrals.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_REFERRAL_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_REFERRAL_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/site/submitbutton.js b/admin/views/site/submitbutton.js new file mode 100644 index 0000000..507e3f8 --- /dev/null +++ b/admin/views/site/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('site, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/site/tmpl/edit.php b/admin/views/site/tmpl/edit.php new file mode 100644 index 0000000..399c0d4 --- /dev/null +++ b/admin/views/site/tmpl/edit.php @@ -0,0 +1,123 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/site/tmpl/index.html b/admin/views/site/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/site/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/site/view.html.php b/admin/views/site/view.html.php new file mode 100644 index 0000000..a0da3f6 --- /dev/null +++ b/admin/views/site/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Site View class + */ +class Ehealth_portalViewSite extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('site', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_SITE_NEW' : 'COM_EHEALTH_PORTAL_SITE_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('site.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('site.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('site.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('site.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('site.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('site.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('site.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('site.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('site.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('site.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('site.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('site.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.site', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('site.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('site.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('site'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_SITE_NEW' : 'COM_EHEALTH_PORTAL_SITE_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/site.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/site/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/sites/index.html b/admin/views/sites/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/sites/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/sites/tmpl/default.php b/admin/views/sites/tmpl/default.php new file mode 100644 index 0000000..c9344cc --- /dev/null +++ b/admin/views/sites/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=sites.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'siteList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_SITES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/sites/tmpl/default_batch_body.php b/admin/views/sites/tmpl/default_batch_body.php new file mode 100644 index 0000000..bcce1d2 --- /dev/null +++ b/admin/views/sites/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/sites/tmpl/default_batch_footer.php b/admin/views/sites/tmpl/default_batch_footer.php new file mode 100644 index 0000000..a0b1d11 --- /dev/null +++ b/admin/views/sites/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/sites/tmpl/default_body.php b/admin/views/sites/tmpl/default_body.php new file mode 100644 index 0000000..af3c13a --- /dev/null +++ b/admin/views/sites/tmpl/default_body.php @@ -0,0 +1,111 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=sites&task=site.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('site',$item,'sites'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->site_name); ?> + checked_out): ?> + name, $item->checked_out_time, 'sites.', $canCheckin); ?> + + + escape($item->site_name); ?> + +
+ + + escape($item->description); ?> + + + escape($item->site_region); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'sites.', true, 'cb'); ?> + + published, $i, 'sites.', false, 'cb'); ?> + + + published, $i, 'sites.', true, 'cb'); ?> + + + published, $i, 'sites.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/sites/tmpl/default_foot.php b/admin/views/sites/tmpl/default_foot.php new file mode 100644 index 0000000..84f7d61 --- /dev/null +++ b/admin/views/sites/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/sites/tmpl/default_head.php b/admin/views/sites/tmpl/default_head.php new file mode 100644 index 0000000..a79ea2f --- /dev/null +++ b/admin/views/sites/tmpl/default_head.php @@ -0,0 +1,67 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/sites/tmpl/default_toolbar.php b/admin/views/sites/tmpl/default_toolbar.php new file mode 100644 index 0000000..7fa735b --- /dev/null +++ b/admin/views/sites/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/sites/tmpl/index.html b/admin/views/sites/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/sites/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/sites/view.html.php b/admin/views/sites/view.html.php new file mode 100644 index 0000000..0de1349 --- /dev/null +++ b/admin/views/sites/view.html.php @@ -0,0 +1,245 @@ + + @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'); + +/** + * Ehealth_portal View class for the Sites + */ +class Ehealth_portalViewSites extends JViewLegacy +{ + /** + * Sites view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('sites'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('site'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_SITES'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=sites'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('site.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('site.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('sites.publish'); + JToolBarHelper::unpublishList('sites.unpublish'); + JToolBarHelper::archiveList('sites.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('sites.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'sites.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('sites.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('site.export')) + { + JToolBarHelper::custom('sites.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('site.import')) + { + JToolBarHelper::custom('sites.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('sites'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_SITES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/sites.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.site_name' => JText::_('COM_EHEALTH_PORTAL_SITE_SITE_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_SITE_DESCRIPTION_LABEL'), + 'a.site_region' => JText::_('COM_EHEALTH_PORTAL_SITE_SITE_REGION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/strength/submitbutton.js b/admin/views/strength/submitbutton.js new file mode 100644 index 0000000..72c84c9 --- /dev/null +++ b/admin/views/strength/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('strength, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/strength/tmpl/edit.php b/admin/views/strength/tmpl/edit.php new file mode 100644 index 0000000..1c3366e --- /dev/null +++ b/admin/views/strength/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/strength/tmpl/index.html b/admin/views/strength/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/strength/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/strength/view.html.php b/admin/views/strength/view.html.php new file mode 100644 index 0000000..c3c4108 --- /dev/null +++ b/admin/views/strength/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Strength View class + */ +class Ehealth_portalViewStrength extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('strength', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_STRENGTH_NEW' : 'COM_EHEALTH_PORTAL_STRENGTH_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('strength.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('strength.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('strength.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('strength.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('strength.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('strength.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('strength.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('strength.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('strength.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('strength.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('strength.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('strength.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.strength', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('strength.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('strength.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('strength'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_STRENGTH_NEW' : 'COM_EHEALTH_PORTAL_STRENGTH_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/strength.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/strength/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/strengths/index.html b/admin/views/strengths/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/strengths/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/strengths/tmpl/default.php b/admin/views/strengths/tmpl/default.php new file mode 100644 index 0000000..f75536e --- /dev/null +++ b/admin/views/strengths/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=strengths.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'strengthList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_STRENGTHS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/strengths/tmpl/default_batch_body.php b/admin/views/strengths/tmpl/default_batch_body.php new file mode 100644 index 0000000..9ee3372 --- /dev/null +++ b/admin/views/strengths/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/strengths/tmpl/default_batch_footer.php b/admin/views/strengths/tmpl/default_batch_footer.php new file mode 100644 index 0000000..7d2f179 --- /dev/null +++ b/admin/views/strengths/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/strengths/tmpl/default_body.php b/admin/views/strengths/tmpl/default_body.php new file mode 100644 index 0000000..f8d68e0 --- /dev/null +++ b/admin/views/strengths/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=strengths&task=strength.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('strength',$item,'strengths'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'strengths.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'strengths.', true, 'cb'); ?> + + published, $i, 'strengths.', false, 'cb'); ?> + + + published, $i, 'strengths.', true, 'cb'); ?> + + + published, $i, 'strengths.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/strengths/tmpl/default_foot.php b/admin/views/strengths/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/strengths/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/strengths/tmpl/default_head.php b/admin/views/strengths/tmpl/default_head.php new file mode 100644 index 0000000..987be4d --- /dev/null +++ b/admin/views/strengths/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/strengths/tmpl/default_toolbar.php b/admin/views/strengths/tmpl/default_toolbar.php new file mode 100644 index 0000000..57ec7ae --- /dev/null +++ b/admin/views/strengths/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/strengths/tmpl/index.html b/admin/views/strengths/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/strengths/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/strengths/view.html.php b/admin/views/strengths/view.html.php new file mode 100644 index 0000000..b10b6ad --- /dev/null +++ b/admin/views/strengths/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Strengths + */ +class Ehealth_portalViewStrengths extends JViewLegacy +{ + /** + * Strengths view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('strengths'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('strength'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_STRENGTHS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=strengths'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('strength.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('strength.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('strengths.publish'); + JToolBarHelper::unpublishList('strengths.unpublish'); + JToolBarHelper::archiveList('strengths.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('strengths.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'strengths.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('strengths.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('strength.export')) + { + JToolBarHelper::custom('strengths.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('strength.import')) + { + JToolBarHelper::custom('strengths.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('strengths'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_STRENGTHS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/strengths.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_STRENGTH_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_STRENGTH_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/test/submitbutton.js b/admin/views/test/submitbutton.js new file mode 100644 index 0000000..dee516d --- /dev/null +++ b/admin/views/test/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('test, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/test/tmpl/edit.php b/admin/views/test/tmpl/edit.php new file mode 100644 index 0000000..483636e --- /dev/null +++ b/admin/views/test/tmpl/edit.php @@ -0,0 +1,185 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/test/tmpl/index.html b/admin/views/test/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/test/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/test/view.html.php b/admin/views/test/view.html.php new file mode 100644 index 0000000..8dde51c --- /dev/null +++ b/admin/views/test/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Test View class + */ +class Ehealth_portalViewTest extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('test', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_TEST_NEW' : 'COM_EHEALTH_PORTAL_TEST_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('test.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('test.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('test.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('test.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('test.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('test.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('test.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('test.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('test.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('test.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('test.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('test.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.test', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('test.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('test.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('test'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_TEST_NEW' : 'COM_EHEALTH_PORTAL_TEST_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/test.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/test/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/testing_reason/submitbutton.js b/admin/views/testing_reason/submitbutton.js new file mode 100644 index 0000000..795c44c --- /dev/null +++ b/admin/views/testing_reason/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('testing_reason, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/testing_reason/tmpl/edit.php b/admin/views/testing_reason/tmpl/edit.php new file mode 100644 index 0000000..73a5f5a --- /dev/null +++ b/admin/views/testing_reason/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/testing_reason/tmpl/index.html b/admin/views/testing_reason/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/testing_reason/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/testing_reason/view.html.php b/admin/views/testing_reason/view.html.php new file mode 100644 index 0000000..d8be5e1 --- /dev/null +++ b/admin/views/testing_reason/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Testing_reason View class + */ +class Ehealth_portalViewTesting_reason extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('testing_reason', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_TESTING_REASON_NEW' : 'COM_EHEALTH_PORTAL_TESTING_REASON_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('testing_reason.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('testing_reason.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('testing_reason.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('testing_reason.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('testing_reason.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('testing_reason.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('testing_reason.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('testing_reason.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('testing_reason.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('testing_reason.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('testing_reason.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('testing_reason.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.testing_reason', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('testing_reason.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('testing_reason.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('testing_reason'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_TESTING_REASON_NEW' : 'COM_EHEALTH_PORTAL_TESTING_REASON_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/testing_reason.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/testing_reason/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/testing_reasons/index.html b/admin/views/testing_reasons/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/testing_reasons/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/testing_reasons/tmpl/default.php b/admin/views/testing_reasons/tmpl/default.php new file mode 100644 index 0000000..4bb012b --- /dev/null +++ b/admin/views/testing_reasons/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=testing_reasons.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'testing_reasonList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_TESTING_REASONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/testing_reasons/tmpl/default_batch_body.php b/admin/views/testing_reasons/tmpl/default_batch_body.php new file mode 100644 index 0000000..b185ca8 --- /dev/null +++ b/admin/views/testing_reasons/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/testing_reasons/tmpl/default_batch_footer.php b/admin/views/testing_reasons/tmpl/default_batch_footer.php new file mode 100644 index 0000000..0a92ccf --- /dev/null +++ b/admin/views/testing_reasons/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/testing_reasons/tmpl/default_body.php b/admin/views/testing_reasons/tmpl/default_body.php new file mode 100644 index 0000000..dfa0c1b --- /dev/null +++ b/admin/views/testing_reasons/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=testing_reasons&task=testing_reason.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('testing_reason',$item,'testing_reasons'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'testing_reasons.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'testing_reasons.', true, 'cb'); ?> + + published, $i, 'testing_reasons.', false, 'cb'); ?> + + + published, $i, 'testing_reasons.', true, 'cb'); ?> + + + published, $i, 'testing_reasons.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/testing_reasons/tmpl/default_foot.php b/admin/views/testing_reasons/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/testing_reasons/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/testing_reasons/tmpl/default_head.php b/admin/views/testing_reasons/tmpl/default_head.php new file mode 100644 index 0000000..b351464 --- /dev/null +++ b/admin/views/testing_reasons/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/testing_reasons/tmpl/default_toolbar.php b/admin/views/testing_reasons/tmpl/default_toolbar.php new file mode 100644 index 0000000..568ebe8 --- /dev/null +++ b/admin/views/testing_reasons/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/testing_reasons/tmpl/index.html b/admin/views/testing_reasons/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/testing_reasons/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/testing_reasons/view.html.php b/admin/views/testing_reasons/view.html.php new file mode 100644 index 0000000..4bea651 --- /dev/null +++ b/admin/views/testing_reasons/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Testing_reasons + */ +class Ehealth_portalViewTesting_reasons extends JViewLegacy +{ + /** + * Testing_reasons view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('testing_reasons'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('testing_reason'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_TESTING_REASONS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=testing_reasons'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('testing_reason.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('testing_reason.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('testing_reasons.publish'); + JToolBarHelper::unpublishList('testing_reasons.unpublish'); + JToolBarHelper::archiveList('testing_reasons.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('testing_reasons.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'testing_reasons.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('testing_reasons.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('testing_reason.export')) + { + JToolBarHelper::custom('testing_reasons.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('testing_reason.import')) + { + JToolBarHelper::custom('testing_reasons.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('testing_reasons'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_TESTING_REASONS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/testing_reasons.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_TESTING_REASON_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_TESTING_REASON_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/tests/index.html b/admin/views/tests/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/tests/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/tests/tmpl/default.php b/admin/views/tests/tmpl/default.php new file mode 100644 index 0000000..12b9539 --- /dev/null +++ b/admin/views/tests/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=tests.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'testList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_TESTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/tests/tmpl/default_batch_body.php b/admin/views/tests/tmpl/default_batch_body.php new file mode 100644 index 0000000..85b20e8 --- /dev/null +++ b/admin/views/tests/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/tests/tmpl/default_batch_footer.php b/admin/views/tests/tmpl/default_batch_footer.php new file mode 100644 index 0000000..354fd1f --- /dev/null +++ b/admin/views/tests/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/tests/tmpl/default_body.php b/admin/views/tests/tmpl/default_body.php new file mode 100644 index 0000000..e4f5b15 --- /dev/null +++ b/admin/views/tests/tmpl/default_body.php @@ -0,0 +1,147 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=tests&task=test.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('test',$item,'tests'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + urine_test_result); ?> + + + escape($item->glucose_first_reading); ?> + + + escape($item->glucose_second_reading); ?> + + + escape($item->haemoglobin_reading); ?> + + + escape($item->cholesterol_reading); ?> + + + syphilis_first_reading); ?> + + + syphilis_second_reading); ?> + + + hepatitis_first_reading); ?> + + + hepatitis_second_reading); ?> + + + malaria_first_reading); ?> + + + malaria_second_reading); ?> + + + pregnancy_first_reading); ?> + + + pregnancy_second_reading); ?> + + + escape($item->referral_name); ?> + + + escape($item->reason); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'tests.', true, 'cb'); ?> + + published, $i, 'tests.', false, 'cb'); ?> + + + published, $i, 'tests.', true, 'cb'); ?> + + + published, $i, 'tests.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/tests/tmpl/default_foot.php b/admin/views/tests/tmpl/default_foot.php new file mode 100644 index 0000000..b4c6f02 --- /dev/null +++ b/admin/views/tests/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/tests/tmpl/default_head.php b/admin/views/tests/tmpl/default_head.php new file mode 100644 index 0000000..790a779 --- /dev/null +++ b/admin/views/tests/tmpl/default_head.php @@ -0,0 +1,106 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/tests/tmpl/default_toolbar.php b/admin/views/tests/tmpl/default_toolbar.php new file mode 100644 index 0000000..4677597 --- /dev/null +++ b/admin/views/tests/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/tests/tmpl/index.html b/admin/views/tests/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/tests/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/tests/view.html.php b/admin/views/tests/view.html.php new file mode 100644 index 0000000..3a49279 --- /dev/null +++ b/admin/views/tests/view.html.php @@ -0,0 +1,263 @@ + + @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'); + +/** + * Ehealth_portal View class for the Tests + */ +class Ehealth_portalViewTests extends JViewLegacy +{ + /** + * Tests view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('tests'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('test'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_TESTS'), 'chart'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=tests'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('test.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('test.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('tests.publish'); + JToolBarHelper::unpublishList('tests.unpublish'); + JToolBarHelper::archiveList('tests.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('tests.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'tests.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('tests.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('test.export')) + { + JToolBarHelper::custom('tests.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('test.import')) + { + JToolBarHelper::custom('tests.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('tests'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('testsfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_TEST_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_TESTS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/tests.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_TEST_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/tuberculoses/index.html b/admin/views/tuberculoses/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/tuberculoses/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/tuberculoses/tmpl/default.php b/admin/views/tuberculoses/tmpl/default.php new file mode 100644 index 0000000..a1cc766 --- /dev/null +++ b/admin/views/tuberculoses/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=tuberculoses.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'tuberculosisList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_TUBERCULOSES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/tuberculoses/tmpl/default_batch_body.php b/admin/views/tuberculoses/tmpl/default_batch_body.php new file mode 100644 index 0000000..8a7b502 --- /dev/null +++ b/admin/views/tuberculoses/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/tuberculoses/tmpl/default_batch_footer.php b/admin/views/tuberculoses/tmpl/default_batch_footer.php new file mode 100644 index 0000000..218c2eb --- /dev/null +++ b/admin/views/tuberculoses/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/tuberculoses/tmpl/default_body.php b/admin/views/tuberculoses/tmpl/default_body.php new file mode 100644 index 0000000..b5ca2cf --- /dev/null +++ b/admin/views/tuberculoses/tmpl/default_body.php @@ -0,0 +1,162 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=tuberculoses&task=tuberculosis.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('tuberculosis',$item,'tuberculoses'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + recurring_night_sweats); ?> + + + tb_fever); ?> + + + persistent_cough); ?> + + + blood_streaked_sputum); ?> + + + unusual_tiredness); ?> + + + pain_in_chest); ?> + + + shortness_of_breath); ?> + + + diagnosed_with_disease); ?> + + + tb_exposed); ?> + + + tb_treatment); ?> + + + escape($item->date_of_treatment); ?> + + + escape($item->treating_dhc); ?> + + + sputum_collection_one); ?> + + + escape($item->tb_reason_one); ?> + + + sputum_result_one); ?> + + + referred_second_sputum); ?> + + + escape($item->tb_reason_two); ?> + + + sputum_result_two); ?> + + + weight_loss_wdieting); ?> + + + escape($item->referral_name); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'tuberculoses.', true, 'cb'); ?> + + published, $i, 'tuberculoses.', false, 'cb'); ?> + + + published, $i, 'tuberculoses.', true, 'cb'); ?> + + + published, $i, 'tuberculoses.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/tuberculoses/tmpl/default_foot.php b/admin/views/tuberculoses/tmpl/default_foot.php new file mode 100644 index 0000000..10d2090 --- /dev/null +++ b/admin/views/tuberculoses/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/tuberculoses/tmpl/default_head.php b/admin/views/tuberculoses/tmpl/default_head.php new file mode 100644 index 0000000..8f4c02e --- /dev/null +++ b/admin/views/tuberculoses/tmpl/default_head.php @@ -0,0 +1,121 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/tuberculoses/tmpl/default_toolbar.php b/admin/views/tuberculoses/tmpl/default_toolbar.php new file mode 100644 index 0000000..afdce65 --- /dev/null +++ b/admin/views/tuberculoses/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/tuberculoses/tmpl/index.html b/admin/views/tuberculoses/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/tuberculoses/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/tuberculoses/view.html.php b/admin/views/tuberculoses/view.html.php new file mode 100644 index 0000000..fec70ad --- /dev/null +++ b/admin/views/tuberculoses/view.html.php @@ -0,0 +1,263 @@ + + @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'); + +/** + * Ehealth_portal View class for the Tuberculoses + */ +class Ehealth_portalViewTuberculoses extends JViewLegacy +{ + /** + * Tuberculoses view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('tuberculoses'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('tuberculosis'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_TUBERCULOSES'), 'loop'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=tuberculoses'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('tuberculosis.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('tuberculosis.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('tuberculoses.publish'); + JToolBarHelper::unpublishList('tuberculoses.unpublish'); + JToolBarHelper::archiveList('tuberculoses.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('tuberculoses.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'tuberculoses.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('tuberculoses.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('tuberculosis.export')) + { + JToolBarHelper::custom('tuberculoses.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('tuberculosis.import')) + { + JToolBarHelper::custom('tuberculoses.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('tuberculoses'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('tuberculosesfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_TUBERCULOSIS_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_TUBERCULOSES')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/tuberculoses.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_TUBERCULOSIS_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/tuberculosis/submitbutton.js b/admin/views/tuberculosis/submitbutton.js new file mode 100644 index 0000000..f733365 --- /dev/null +++ b/admin/views/tuberculosis/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('tuberculosis, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/tuberculosis/tmpl/edit.php b/admin/views/tuberculosis/tmpl/edit.php new file mode 100644 index 0000000..5ce1409 --- /dev/null +++ b/admin/views/tuberculosis/tmpl/edit.php @@ -0,0 +1,140 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/tuberculosis/tmpl/index.html b/admin/views/tuberculosis/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/tuberculosis/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/tuberculosis/view.html.php b/admin/views/tuberculosis/view.html.php new file mode 100644 index 0000000..b492be5 --- /dev/null +++ b/admin/views/tuberculosis/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Tuberculosis View class + */ +class Ehealth_portalViewTuberculosis extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('tuberculosis', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NEW' : 'COM_EHEALTH_PORTAL_TUBERCULOSIS_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('tuberculosis.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('tuberculosis.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('tuberculosis.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('tuberculosis.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('tuberculosis.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('tuberculosis.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('tuberculosis.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('tuberculosis.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('tuberculosis.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('tuberculosis.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('tuberculosis.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('tuberculosis.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.tuberculosis', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('tuberculosis.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('tuberculosis.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('tuberculosis'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_TUBERCULOSIS_NEW' : 'COM_EHEALTH_PORTAL_TUBERCULOSIS_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/tuberculosis.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/tuberculosis/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/unit/submitbutton.js b/admin/views/unit/submitbutton.js new file mode 100644 index 0000000..f44b161 --- /dev/null +++ b/admin/views/unit/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('unit, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/unit/tmpl/edit.php b/admin/views/unit/tmpl/edit.php new file mode 100644 index 0000000..8d96125 --- /dev/null +++ b/admin/views/unit/tmpl/edit.php @@ -0,0 +1,120 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + diff --git a/admin/views/unit/tmpl/index.html b/admin/views/unit/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/unit/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/unit/view.html.php b/admin/views/unit/view.html.php new file mode 100644 index 0000000..095eb69 --- /dev/null +++ b/admin/views/unit/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Unit View class + */ +class Ehealth_portalViewUnit extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('unit', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_UNIT_NEW' : 'COM_EHEALTH_PORTAL_UNIT_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('unit.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('unit.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('unit.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('unit.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('unit.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('unit.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('unit.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('unit.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('unit.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('unit.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('unit.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('unit.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.unit', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('unit.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('unit.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('unit'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_UNIT_NEW' : 'COM_EHEALTH_PORTAL_UNIT_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/unit.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/unit/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/units/index.html b/admin/views/units/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/units/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/units/tmpl/default.php b/admin/views/units/tmpl/default.php new file mode 100644 index 0000000..bc75829 --- /dev/null +++ b/admin/views/units/tmpl/default.php @@ -0,0 +1,80 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=units.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'unitList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_UNITS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/units/tmpl/default_batch_body.php b/admin/views/units/tmpl/default_batch_body.php new file mode 100644 index 0000000..35d01f3 --- /dev/null +++ b/admin/views/units/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/units/tmpl/default_batch_footer.php b/admin/views/units/tmpl/default_batch_footer.php new file mode 100644 index 0000000..b0119fb --- /dev/null +++ b/admin/views/units/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/units/tmpl/default_body.php b/admin/views/units/tmpl/default_body.php new file mode 100644 index 0000000..af58d0f --- /dev/null +++ b/admin/views/units/tmpl/default_body.php @@ -0,0 +1,108 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=units&task=unit.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('unit',$item,'units'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ get('core.edit')): ?> + escape($item->name); ?> + checked_out): ?> + name, $item->checked_out_time, 'units.', $canCheckin); ?> + + + escape($item->name); ?> + +
+ + + escape($item->description); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'units.', true, 'cb'); ?> + + published, $i, 'units.', false, 'cb'); ?> + + + published, $i, 'units.', true, 'cb'); ?> + + + published, $i, 'units.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/units/tmpl/default_foot.php b/admin/views/units/tmpl/default_foot.php new file mode 100644 index 0000000..8552621 --- /dev/null +++ b/admin/views/units/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/units/tmpl/default_head.php b/admin/views/units/tmpl/default_head.php new file mode 100644 index 0000000..67eb963 --- /dev/null +++ b/admin/views/units/tmpl/default_head.php @@ -0,0 +1,64 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + listDirn, $this->listOrder); ?> + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/units/tmpl/default_toolbar.php b/admin/views/units/tmpl/default_toolbar.php new file mode 100644 index 0000000..c49c712 --- /dev/null +++ b/admin/views/units/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/units/tmpl/index.html b/admin/views/units/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/units/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/units/view.html.php b/admin/views/units/view.html.php new file mode 100644 index 0000000..0e7204f --- /dev/null +++ b/admin/views/units/view.html.php @@ -0,0 +1,244 @@ + + @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'); + +/** + * Ehealth_portal View class for the Units + */ +class Ehealth_portalViewUnits extends JViewLegacy +{ + /** + * Units view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('units'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('unit'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_UNITS'), 'joomla'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=units'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('unit.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('unit.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('units.publish'); + JToolBarHelper::unpublishList('units.unpublish'); + JToolBarHelper::archiveList('units.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('units.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'units.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('units.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('unit.export')) + { + JToolBarHelper::custom('units.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('unit.import')) + { + JToolBarHelper::custom('units.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('units'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_UNITS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/units.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_EHEALTH_PORTAL_UNIT_NAME_LABEL'), + 'a.description' => JText::_('COM_EHEALTH_PORTAL_UNIT_DESCRIPTION_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/admin/views/vmmc/submitbutton.js b/admin/views/vmmc/submitbutton.js new file mode 100644 index 0000000..e1dd256 --- /dev/null +++ b/admin/views/vmmc/submitbutton.js @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage submitbutton.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('vmmc, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } +} \ No newline at end of file diff --git a/admin/views/vmmc/tmpl/edit.php b/admin/views/vmmc/tmpl/edit.php new file mode 100644 index 0000000..24afc1a --- /dev/null +++ b/admin/views/vmmc/tmpl/edit.php @@ -0,0 +1,163 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> + + + + diff --git a/admin/views/vmmc/tmpl/index.html b/admin/views/vmmc/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/vmmc/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/vmmc/view.html.php b/admin/views/vmmc/view.html.php new file mode 100644 index 0000000..636ff6d --- /dev/null +++ b/admin/views/vmmc/view.html.php @@ -0,0 +1,209 @@ + + @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'); + +/** + * Vmmc View class + */ +class Ehealth_portalViewVmmc extends JViewLegacy +{ + /** + * display method of View + * @return void + */ + public function display($tpl = null) + { + // set params + $this->params = JComponentHelper::getParams('com_ehealth_portal'); + // Assign the variables + $this->form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + $this->state = $this->get('State'); + // get action permissions + $this->canDo = Ehealth_portalHelper::getActions('vmmc', $this->item); + // get input + $jinput = JFactory::getApplication()->input; + $this->ref = $jinput->get('ref', 0, 'word'); + $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string + $this->referral = ''; + if ($this->refid && $this->ref) + { + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; + } + elseif($this->ref) + { + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; + } + + // Set the toolbar + $this->addToolBar(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JFactory::getApplication()->input->set('hidemainmenu', true); + $user = JFactory::getUser(); + $userId = $user->id; + $isNew = $this->item->id == 0; + + JToolbarHelper::title( JText::_($isNew ? 'COM_EHEALTH_PORTAL_VMMC_NEW' : 'COM_EHEALTH_PORTAL_VMMC_EDIT'), 'pencil-2 article-add'); + // Built the actions for new and existing records. + if (Ehealth_portalHelper::checkString($this->referral)) + { + if ($this->canDo->get('core.create') && $isNew) + { + // We can create the record. + JToolBarHelper::save('vmmc.save', 'JTOOLBAR_SAVE'); + } + elseif ($this->canDo->get('core.edit')) + { + // We can save the record. + JToolBarHelper::save('vmmc.save', 'JTOOLBAR_SAVE'); + } + if ($isNew) + { + // Do not creat but cancel. + JToolBarHelper::cancel('vmmc.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + // We can close it. + JToolBarHelper::cancel('vmmc.cancel', 'JTOOLBAR_CLOSE'); + } + } + else + { + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('vmmc.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('vmmc.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('vmmc.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + }; + JToolBarHelper::cancel('vmmc.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('vmmc.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('vmmc.save', 'JTOOLBAR_SAVE'); + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('vmmc.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + $canVersion = ($this->canDo->get('core.version') && $this->canDo->get('vmmc.version')); + if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion) + { + JToolbarHelper::versions('com_ehealth_portal.vmmc', $this->item->id); + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('vmmc.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('vmmc.cancel', 'JTOOLBAR_CLOSE'); + } + } + JToolbarHelper::divider(); + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('vmmc'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 30) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true, 30); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id < 1); + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_($isNew ? 'COM_EHEALTH_PORTAL_VMMC_NEW' : 'COM_EHEALTH_PORTAL_VMMC_EDIT')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/vmmc.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript(JURI::root() . $this->script, (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript(JURI::root() . "administrator/components/com_ehealth_portal/views/vmmc/submitbutton.js", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + JText::script('view not acceptable. Error'); + } +} diff --git a/admin/views/vmmcs/index.html b/admin/views/vmmcs/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/vmmcs/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/vmmcs/tmpl/default.php b/admin/views/vmmcs/tmpl/default.php new file mode 100644 index 0000000..595576e --- /dev/null +++ b/admin/views/vmmcs/tmpl/default.php @@ -0,0 +1,81 @@ + + @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'); + +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleReferrals', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_REFERRED_TO') . ' -')); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_EHEALTH_PORTAL_FILTER_SELECT_ACCESS') . ' -')); +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_ehealth_portal&task=vmmcs.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'vmmcList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?> +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_EHEALTH_PORTAL_VMMCS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/vmmcs/tmpl/default_batch_body.php b/admin/views/vmmcs/tmpl/default_batch_body.php new file mode 100644 index 0000000..76709dc --- /dev/null +++ b/admin/views/vmmcs/tmpl/default_batch_body.php @@ -0,0 +1,32 @@ + + @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'); + +?> + +

+batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/vmmcs/tmpl/default_batch_footer.php b/admin/views/vmmcs/tmpl/default_batch_footer.php new file mode 100644 index 0000000..c5be731 --- /dev/null +++ b/admin/views/vmmcs/tmpl/default_batch_footer.php @@ -0,0 +1,37 @@ + + @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'); + +?> + + + + \ No newline at end of file diff --git a/admin/views/vmmcs/tmpl/default_body.php b/admin/views/vmmcs/tmpl/default_body.php new file mode 100644 index 0000000..215bbd5 --- /dev/null +++ b/admin/views/vmmcs/tmpl/default_body.php @@ -0,0 +1,120 @@ + + @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'); + +$edit = "index.php?option=com_ehealth_portal&view=vmmcs&task=vmmc.edit"; + +?> +items as $i => $item): ?> + user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; + $userChkOut = JFactory::getUser($item->checked_out); + $canDo = Ehealth_portalHelper::getActions('vmmc',$item,'vmmcs'); + ?> + + + get('core.edit.state')): ?> + saveOrder) + { + $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + saveOrder) : ?> + + + + ⋮ + + + + get('core.edit')): ?> + checked_out) : ?> + + id); ?> + + □ + + + id); ?> + + + □ + + + +
+ user->authorise('core.edit', 'com_users')): ?> + patient)->name; ?> + + patient)->name; ?> + +
+ + + are_you_circumcised); ?> + + + info_ben_vmcc); ?> + + + interested_in_vmmc); ?> + + + vmmc_gender); ?> + + + escape($item->reason); ?> + + + escape($item->referral_name); ?> + + + get('core.edit.state')) : ?> + checked_out) : ?> + + published, $i, 'vmmcs.', true, 'cb'); ?> + + published, $i, 'vmmcs.', false, 'cb'); ?> + + + published, $i, 'vmmcs.', true, 'cb'); ?> + + + published, $i, 'vmmcs.', false, 'cb'); ?> + + + + id; ?> + + + \ No newline at end of file diff --git a/admin/views/vmmcs/tmpl/default_foot.php b/admin/views/vmmcs/tmpl/default_foot.php new file mode 100644 index 0000000..20b1f88 --- /dev/null +++ b/admin/views/vmmcs/tmpl/default_foot.php @@ -0,0 +1,32 @@ + + @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'); + +?> + + pagination->getListFooter(); ?> + \ No newline at end of file diff --git a/admin/views/vmmcs/tmpl/default_head.php b/admin/views/vmmcs/tmpl/default_head.php new file mode 100644 index 0000000..b4879a3 --- /dev/null +++ b/admin/views/vmmcs/tmpl/default_head.php @@ -0,0 +1,79 @@ + + @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'); + +?> + + canEdit&& $this->canState): ?> + + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> + + + + + + + ▾ + + + ■ + + + + listDirn, $this->listOrder); ?> + + + + + + + + + + + + + + + + + + + + canState): ?> + + listDirn, $this->listOrder); ?> + + + + + + + + listDirn, $this->listOrder); ?> + + \ No newline at end of file diff --git a/admin/views/vmmcs/tmpl/default_toolbar.php b/admin/views/vmmcs/tmpl/default_toolbar.php new file mode 100644 index 0000000..86cd1f0 --- /dev/null +++ b/admin/views/vmmcs/tmpl/default_toolbar.php @@ -0,0 +1,59 @@ + + @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'); + +?> +
+ +
+ + +
+
+ + pagination->getLimitBox(); ?> +
+
+ + +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/vmmcs/tmpl/index.html b/admin/views/vmmcs/tmpl/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/admin/views/vmmcs/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/vmmcs/view.html.php b/admin/views/vmmcs/view.html.php new file mode 100644 index 0000000..6a5887e --- /dev/null +++ b/admin/views/vmmcs/view.html.php @@ -0,0 +1,283 @@ + + @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'); + +/** + * Ehealth_portal View class for the Vmmcs + */ +class Ehealth_portalViewVmmcs extends JViewLegacy +{ + /** + * Vmmcs view display method + * @return void + */ + function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + Ehealth_portalHelper::addSubmenu('vmmcs'); + } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); + // Add the list ordering clause. + $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions + $this->canDo = Ehealth_portalHelper::getActions('vmmc'); + $this->canEdit = $this->canDo->get('core.edit'); + $this->canState = $this->canDo->get('core.edit.state'); + $this->canCreate = $this->canDo->get('core.create'); + $this->canDelete = $this->canDo->get('core.delete'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_EHEALTH_PORTAL_VMMCS'), 'wand'); + JHtmlSidebar::setAction('index.php?option=com_ehealth_portal&view=vmmcs'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('vmmc.add'); + } + + // Only load if there are items + if (Ehealth_portalHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('vmmc.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('vmmcs.publish'); + JToolBarHelper::unpublishList('vmmcs.unpublish'); + JToolBarHelper::archiveList('vmmcs.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('vmmcs.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'vmmcs.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('vmmcs.trash'); + } + + if ($this->canDo->get('core.export') && $this->canDo->get('vmmc.export')) + { + JToolBarHelper::custom('vmmcs.exportData', 'download', '', 'COM_EHEALTH_PORTAL_EXPORT_DATA', true); + } + } + + if ($this->canDo->get('core.import') && $this->canDo->get('vmmc.import')) + { + JToolBarHelper::custom('vmmcs.importData', 'upload', '', 'COM_EHEALTH_PORTAL_IMPORT_DATA', false); + } + + // set help url for this view if found + $help_url = Ehealth_portalHelper::getHelpUrl('vmmcs'); + if (Ehealth_portalHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_EHEALTH_PORTAL_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_ehealth_portal'); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_EHEALTH_PORTAL_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Patient batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Patient Selection + $this->patientOptions = JFormHelper::loadFieldType('vmmcsfilterpatient')->options; + // We do some sanitation for Patient filter + if (Ehealth_portalHelper::checkArray($this->patientOptions) && + isset($this->patientOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->patientOptions[0]->value)) + { + unset($this->patientOptions[0]); + } + // Patient Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_VMMC_PATIENT_LABEL').' -', + 'batch[patient]', + JHtml::_('select.options', $this->patientOptions, 'value', 'text') + ); + } + + // Only load Referral Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Referral Name Selection + $this->referralNameOptions = JFormHelper::loadFieldType('Referrals')->options; + // We do some sanitation for Referral Name filter + if (Ehealth_portalHelper::checkArray($this->referralNameOptions) && + isset($this->referralNameOptions[0]->value) && + !Ehealth_portalHelper::checkString($this->referralNameOptions[0]->value)) + { + unset($this->referralNameOptions[0]); + } + // Referral Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_EHEALTH_PORTAL_VMMC_REFERRAL_LABEL').' -', + 'batch[referral]', + JHtml::_('select.options', $this->referralNameOptions, 'value', 'text') + ); + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_EHEALTH_PORTAL_VMMCS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_ehealth_portal/assets/css/vmmcs.css", (Ehealth_portalHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return Ehealth_portalHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return Ehealth_portalHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.patient' => JText::_('COM_EHEALTH_PORTAL_VMMC_PATIENT_LABEL'), + 'a.id' => JText::_('JGRID_HEADING_ID') + ); + } +} diff --git a/ehealth_portal.xml b/ehealth_portal.xml new file mode 100644 index 0000000..9d1c457 --- /dev/null +++ b/ehealth_portal.xml @@ -0,0 +1,95 @@ + + + COM_EHEALTH_PORTAL + 24th April, 2021 + Oh Martin + oh.martin@vdm.io + https://github.com/namibia/eHealth-Portal + Copyright (C) 2020 Vast Development Method. All rights reserved. + GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + 1.0.5 + eHealth Portal (v.1.0.5) +
+

eHealth Portal is a secure web-based viewer that offers health care providers that may not have access to one of the provincial clinical viewers, a single point of access to their patients' digital health information.

+

Created by Oh Martin
Development started 13th August, 2020

+ ]]>
+ + + + + sql/install.mysql.utf8.sql + + + + + + + sql/uninstall.mysql.utf8.sql + + + + + script.php + + + index.html + js + css + images + + + + + + sql/updates/mysql/ + + + + + + + + + COM_EHEALTH_PORTAL_MENU + + + COM_EHEALTH_PORTAL_MENU_PAYMENTS + COM_EHEALTH_PORTAL_MENU_GENERAL_MEDICAL_CHECK_UPS + COM_EHEALTH_PORTAL_MENU_ANTENATAL_CARES + COM_EHEALTH_PORTAL_MENU_IMMUNISATIONS + COM_EHEALTH_PORTAL_MENU_VMMCS + COM_EHEALTH_PORTAL_MENU_PROSTATE_AND_TESTICULAR_CANCERS + COM_EHEALTH_PORTAL_MENU_TUBERCULOSES + COM_EHEALTH_PORTAL_MENU_HIV_COUNSELINGS_AND_TESTINGS + COM_EHEALTH_PORTAL_MENU_FAMILY_PLANNINGS + COM_EHEALTH_PORTAL_MENU_HEALTH_EDUCATIONS + COM_EHEALTH_PORTAL_MENU_CERVICAL_CANCERS + COM_EHEALTH_PORTAL_MENU_BREAST_CANCERS + COM_EHEALTH_PORTAL_MENU_TESTS + COM_EHEALTH_PORTAL_MENU_PATIENT_QUEUE + + + access.xml + config.xml + controller.php + index.html + ehealth_portal.php + README.txt + assets + controllers + helpers + models + sql + tables + views + layouts + + + + language/en-GB/en-GB.com_ehealth_portal.ini + language/en-GB/en-GB.com_ehealth_portal.sys.ini + + + +
\ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/phpspreadsheet/vendor/.htaccess b/libraries/phpspreadsheet/vendor/.htaccess new file mode 100644 index 0000000..9afb1a1 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/.htaccess @@ -0,0 +1,9 @@ +# Apache 2.4+ + + Require all denied + + +# Apache 2.0-2.2 + + Deny from all + diff --git a/libraries/phpspreadsheet/vendor/autoload.php b/libraries/phpspreadsheet/vendor/autoload.php new file mode 100644 index 0000000..4d0fd74 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/libraries/phpspreadsheet/vendor/composer/LICENSE b/libraries/phpspreadsheet/vendor/composer/LICENSE new file mode 100644 index 0000000..4b615a3 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/composer/LICENSE @@ -0,0 +1,56 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Composer +Upstream-Contact: Jordi Boggiano +Source: https://github.com/composer/composer + +Files: * +Copyright: 2016, Nils Adermann + 2016, Jordi Boggiano +License: Expat + +Files: src/Composer/Util/TlsHelper.php +Copyright: 2016, Nils Adermann + 2016, Jordi Boggiano + 2013, Evan Coury +License: Expat and BSD-2-Clause + +License: BSD-2-Clause + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + . + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + . + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is furnished + to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/libraries/phpspreadsheet/vendor/composer/autoload_classmap.php b/libraries/phpspreadsheet/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..b3fec89 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/composer/autoload_classmap.php @@ -0,0 +1,240 @@ + $vendorDir . '/markbaker/complex/classes/src/Complex.php', + 'Complex\\Exception' => $vendorDir . '/markbaker/complex/classes/src/Exception.php', + 'Matrix\\Builder' => $vendorDir . '/markbaker/matrix/classes/src/Builder.php', + 'Matrix\\Exception' => $vendorDir . '/markbaker/matrix/classes/src/Exception.php', + 'Matrix\\Functions' => $vendorDir . '/markbaker/matrix/classes/src/Functions.php', + 'Matrix\\Matrix' => $vendorDir . '/markbaker/matrix/classes/src/Matrix.php', + 'Matrix\\Operators\\Addition' => $vendorDir . '/markbaker/matrix/classes/src/Operators/Addition.php', + 'Matrix\\Operators\\DirectSum' => $vendorDir . '/markbaker/matrix/classes/src/Operators/DirectSum.php', + 'Matrix\\Operators\\Division' => $vendorDir . '/markbaker/matrix/classes/src/Operators/Division.php', + 'Matrix\\Operators\\Multiplication' => $vendorDir . '/markbaker/matrix/classes/src/Operators/Multiplication.php', + 'Matrix\\Operators\\Operator' => $vendorDir . '/markbaker/matrix/classes/src/Operators/Operator.php', + 'Matrix\\Operators\\Subtraction' => $vendorDir . '/markbaker/matrix/classes/src/Operators/Subtraction.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Calculation' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Category' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Category.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Database' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Database.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\DateTime' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Engine\\CyclicReferenceStack' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Engine\\Logger' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Engineering' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Exception' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\ExceptionHandler' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ExceptionHandler.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Financial' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\FormulaParser' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaParser.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\FormulaToken' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaToken.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Functions' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Logical' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\LookupRef' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\MathTrig' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Statistical' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\TextData' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Token\\Stack' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\AdvancedValueBinder' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\Cell' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\Coordinate' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\DataType' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\DataValidation' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidation.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\DataValidator' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\DefaultValueBinder' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DefaultValueBinder.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\Hyperlink' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Hyperlink.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\IValueBinder' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/IValueBinder.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\StringValueBinder' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/StringValueBinder.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Axis' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Axis.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Chart' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Chart.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\DataSeries' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeries.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\DataSeriesValues' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Exception' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\GridLines' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/GridLines.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Layout' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Layout.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Legend' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Legend.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\PlotArea' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/PlotArea.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Properties' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Properties.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Renderer\\IRenderer' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Renderer\\JpGraph' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Title' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Title.php', + 'PhpOffice\\PhpSpreadsheet\\Collection\\Cells' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php', + 'PhpOffice\\PhpSpreadsheet\\Collection\\CellsFactory' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/CellsFactory.php', + 'PhpOffice\\PhpSpreadsheet\\Collection\\Memory' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php', + 'PhpOffice\\PhpSpreadsheet\\Comment' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php', + 'PhpOffice\\PhpSpreadsheet\\Document\\Properties' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php', + 'PhpOffice\\PhpSpreadsheet\\Document\\Security' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Security.php', + 'PhpOffice\\PhpSpreadsheet\\Exception' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\HashTable' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/HashTable.php', + 'PhpOffice\\PhpSpreadsheet\\Helper\\Html' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php', + 'PhpOffice\\PhpSpreadsheet\\Helper\\Migrator' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Migrator.php', + 'PhpOffice\\PhpSpreadsheet\\Helper\\Sample' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Sample.php', + 'PhpOffice\\PhpSpreadsheet\\IComparable' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IComparable.php', + 'PhpOffice\\PhpSpreadsheet\\IOFactory' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php', + 'PhpOffice\\PhpSpreadsheet\\NamedRange' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/NamedRange.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\BaseReader' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Csv' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\DefaultReadFilter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/DefaultReadFilter.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Exception' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Gnumeric' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Gnumeric.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Html' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\IReadFilter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReadFilter.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\IReader' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReader.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Ods' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Ods\\Properties' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/Properties.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Security\\XmlScanner' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Security/XmlScanner.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Slk' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Color' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Color\\BIFF5' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Color\\BIFF8' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Color\\BuiltIn' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\ErrorCode' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Escher' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Escher.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\MD5' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\RC4' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/RC4.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Style\\Border' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/Border.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Style\\FillPattern' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\AutoFilter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\BaseParserClass' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Chart' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\ColumnAndRowAttributes' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\ConditionalStyles' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\DataValidations' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Hyperlinks' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\PageSetup' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Properties' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Properties.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\SheetViewOptions' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\SheetViews' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Styles' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Theme' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Theme.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xml' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php', + 'PhpOffice\\PhpSpreadsheet\\ReferenceHelper' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php', + 'PhpOffice\\PhpSpreadsheet\\RichText\\ITextElement' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/ITextElement.php', + 'PhpOffice\\PhpSpreadsheet\\RichText\\RichText' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/RichText.php', + 'PhpOffice\\PhpSpreadsheet\\RichText\\Run' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/Run.php', + 'PhpOffice\\PhpSpreadsheet\\RichText\\TextElement' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/TextElement.php', + 'PhpOffice\\PhpSpreadsheet\\Settings' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\CodePage' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/CodePage.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Date' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Drawing' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DgContainer' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DgContainer\\SpgrContainer' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DgContainer\\SpgrContainer\\SpContainer' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DggContainer' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DggContainer\\BstoreContainer' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DggContainer\\BstoreContainer\\BSE' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DggContainer\\BstoreContainer\\BSE\\Blip' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\File' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Font' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\CholeskyDecomposition' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\EigenvalueDecomposition' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\LUDecomposition' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\Matrix' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\QRDecomposition' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\SingularValueDecomposition' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLERead' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE\\ChainedBlockStream' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE\\PPS' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE\\PPS\\File' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/File.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE\\PPS\\Root' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\PasswordHasher' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/PasswordHasher.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\StringHelper' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\TimeZone' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/TimeZone.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\BestFit' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/BestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\ExponentialBestFit' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\LinearBestFit' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\LogarithmicBestFit' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\PolynomialBestFit' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\PowerBestFit' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\Trend' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\XMLWriter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Xls' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Xls.php', + 'PhpOffice\\PhpSpreadsheet\\Spreadsheet' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Alignment' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Border' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Borders' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Color' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Conditional' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Fill' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Fill.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Font' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\NumberFormat' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Protection' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Style' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Supervisor' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\AutoFilter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\AutoFilter\\Column' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\AutoFilter\\Column\\Rule' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\BaseDrawing' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\CellIterator' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/CellIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Column' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Column.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\ColumnCellIterator' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\ColumnDimension' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\ColumnIterator' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Dimension' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Drawing' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Drawing\\Shadow' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\HeaderFooter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooter.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\HeaderFooterDrawing' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Iterator' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Iterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\MemoryDrawing' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\PageMargins' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageMargins.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\PageSetup' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Protection' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Protection.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Row' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\RowCellIterator' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowCellIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\RowDimension' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\RowIterator' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\SheetView' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/SheetView.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Worksheet' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\BaseWriter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Csv' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Csv.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Exception' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Html' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\IWriter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/IWriter.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Cell\\Comment' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Content' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Meta' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Meta.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\MetaInf' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/MetaInf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Mimetype' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Mimetype.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Settings' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Settings.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Styles' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Styles.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Thumbnails' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\WriterPart' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/WriterPart.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Pdf' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Pdf\\Dompdf' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Pdf\\Mpdf' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Pdf\\Tcpdf' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\BIFFwriter' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Escher' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Escher.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Font' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Font.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Parser' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Parser.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Workbook' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Workbook.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Worksheet' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Xf' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Xf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Chart' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Chart.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Comments' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\ContentTypes' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\DocProps' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Drawing' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Rels' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\RelsRibbon' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\RelsVBA' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\StringTable' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Style' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Theme' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Theme.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Workbook' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Worksheet' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\WriterPart' => $vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php', + 'Psr\\SimpleCache\\CacheException' => $vendorDir . '/psr/simple-cache/src/CacheException.php', + 'Psr\\SimpleCache\\CacheInterface' => $vendorDir . '/psr/simple-cache/src/CacheInterface.php', + 'Psr\\SimpleCache\\InvalidArgumentException' => $vendorDir . '/psr/simple-cache/src/InvalidArgumentException.php', +); diff --git a/libraries/phpspreadsheet/vendor/composer/autoload_files.php b/libraries/phpspreadsheet/vendor/composer/autoload_files.php new file mode 100644 index 0000000..2101c35 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/composer/autoload_files.php @@ -0,0 +1,67 @@ + $vendorDir . '/markbaker/complex/classes/src/functions/abs.php', + '21a5860fbef5be28db5ddfbc3cca67c4' => $vendorDir . '/markbaker/complex/classes/src/functions/acos.php', + '1546e3f9d127f2a9bb2d1b6c31c26ef1' => $vendorDir . '/markbaker/complex/classes/src/functions/acosh.php', + 'd2516f7f4fba5ea5905f494b4a8262e0' => $vendorDir . '/markbaker/complex/classes/src/functions/acot.php', + '4511163d560956219b96882c0980b65e' => $vendorDir . '/markbaker/complex/classes/src/functions/acoth.php', + 'c361f5616dc2a8da4fa3e137077cd4ea' => $vendorDir . '/markbaker/complex/classes/src/functions/acsc.php', + '02d68920fc98da71991ce569c91df0f6' => $vendorDir . '/markbaker/complex/classes/src/functions/acsch.php', + '88e19525eae308b4a6aa3419364875d3' => $vendorDir . '/markbaker/complex/classes/src/functions/argument.php', + '60e8e2d0827b58bfc904f13957e51849' => $vendorDir . '/markbaker/complex/classes/src/functions/asec.php', + '13d2f040713999eab66c359b4d79871d' => $vendorDir . '/markbaker/complex/classes/src/functions/asech.php', + '838ab38beb32c68a79d3cd2c007d5a04' => $vendorDir . '/markbaker/complex/classes/src/functions/asin.php', + 'bb28eccd0f8f008333a1b3c163d604ac' => $vendorDir . '/markbaker/complex/classes/src/functions/asinh.php', + '9e483de83558c98f7d3feaa402c78cb3' => $vendorDir . '/markbaker/complex/classes/src/functions/atan.php', + '36b74b5b765ded91ee58c8ee3c0e85e3' => $vendorDir . '/markbaker/complex/classes/src/functions/atanh.php', + '05c15ee9510da7fd6bf6136f436500c0' => $vendorDir . '/markbaker/complex/classes/src/functions/conjugate.php', + 'd3208dfbce2505e370788f9f22f6785f' => $vendorDir . '/markbaker/complex/classes/src/functions/cos.php', + '141cf1fb3a3046f8b64534b0ebab33ca' => $vendorDir . '/markbaker/complex/classes/src/functions/cosh.php', + 'be660df75fd0dbe7fa7c03b7434b3294' => $vendorDir . '/markbaker/complex/classes/src/functions/cot.php', + '01e31ea298a51bc9e91517e3ce6b9e76' => $vendorDir . '/markbaker/complex/classes/src/functions/coth.php', + '803ddd97f7b1da68982a7b087c3476f6' => $vendorDir . '/markbaker/complex/classes/src/functions/csc.php', + '3001cdfd101ec3c32da34ee43c2e149b' => $vendorDir . '/markbaker/complex/classes/src/functions/csch.php', + '77b2d7629ef2a93fabb8c56754a91051' => $vendorDir . '/markbaker/complex/classes/src/functions/exp.php', + '4a4471296dec796c21d4f4b6552396a9' => $vendorDir . '/markbaker/complex/classes/src/functions/inverse.php', + 'c3e9897e1744b88deb56fcdc39d34d85' => $vendorDir . '/markbaker/complex/classes/src/functions/ln.php', + 'a83cacf2de942cff288de15a83afd26d' => $vendorDir . '/markbaker/complex/classes/src/functions/log2.php', + '6a861dacc9ee2f3061241d4c7772fa21' => $vendorDir . '/markbaker/complex/classes/src/functions/log10.php', + '4d2522d968c8ba78d6c13548a1b4200e' => $vendorDir . '/markbaker/complex/classes/src/functions/negative.php', + 'fd587ca933fc0447fa5ab4843bdd97f7' => $vendorDir . '/markbaker/complex/classes/src/functions/pow.php', + '383ef01c62028fc78cd4388082fce3c2' => $vendorDir . '/markbaker/complex/classes/src/functions/rho.php', + '150fbd1b95029dc47292da97ecab9375' => $vendorDir . '/markbaker/complex/classes/src/functions/sec.php', + '549abd9bae174286d660bdaa07407c68' => $vendorDir . '/markbaker/complex/classes/src/functions/sech.php', + '6bfbf5eaea6b17a0ed85cb21ba80370c' => $vendorDir . '/markbaker/complex/classes/src/functions/sin.php', + '22efe13f1a497b8e199540ae2d9dc59c' => $vendorDir . '/markbaker/complex/classes/src/functions/sinh.php', + 'e90135ab8e787795a509ed7147de207d' => $vendorDir . '/markbaker/complex/classes/src/functions/sqrt.php', + 'bb0a7923ffc6a90919cd64ec54ff06bc' => $vendorDir . '/markbaker/complex/classes/src/functions/tan.php', + '2d302f32ce0fd4e433dd91c5bb404a28' => $vendorDir . '/markbaker/complex/classes/src/functions/tanh.php', + '24dd4658a952171a4ee79218c4f9fd06' => $vendorDir . '/markbaker/complex/classes/src/functions/theta.php', + 'e49b7876281d6f5bc39536dde96d1f4a' => $vendorDir . '/markbaker/complex/classes/src/operations/add.php', + '47596e02b43cd6da7700134fd08f88cf' => $vendorDir . '/markbaker/complex/classes/src/operations/subtract.php', + '883af48563631547925fa4c3b48ead07' => $vendorDir . '/markbaker/complex/classes/src/operations/multiply.php', + 'f190e3308e6ca23234a2875edc985c03' => $vendorDir . '/markbaker/complex/classes/src/operations/divideby.php', + 'ac9e33ce6841aa5bf5d16d465a2f03a7' => $vendorDir . '/markbaker/complex/classes/src/operations/divideinto.php', + '9d8e013a5160a09477beb8e44f8ae97b' => $vendorDir . '/markbaker/matrix/classes/src/functions/adjoint.php', + '6e78d1bdea6248d6aa117229efae50f2' => $vendorDir . '/markbaker/matrix/classes/src/functions/antidiagonal.php', + '4623d87924d94f5412fe5afbf1cef31d' => $vendorDir . '/markbaker/matrix/classes/src/functions/cofactors.php', + '901fd1f6950a637ca85f66b701a45e13' => $vendorDir . '/markbaker/matrix/classes/src/functions/determinant.php', + '83057abc0e4acc99ba80154ee5d02a49' => $vendorDir . '/markbaker/matrix/classes/src/functions/diagonal.php', + '07b7fd7a434451149b4fd477fca0ce06' => $vendorDir . '/markbaker/matrix/classes/src/functions/identity.php', + 'c8d43b340583e07ae89f2a3baef2cf89' => $vendorDir . '/markbaker/matrix/classes/src/functions/inverse.php', + '499bb10ed7a3aee2ba4c09a31a85e8d1' => $vendorDir . '/markbaker/matrix/classes/src/functions/minors.php', + '1cad2e6414d652e8b1c64e8967f6f37d' => $vendorDir . '/markbaker/matrix/classes/src/functions/trace.php', + '95a7f134ac17161d07def442b3b737e8' => $vendorDir . '/markbaker/matrix/classes/src/functions/transpose.php', + 'b3a6bc628377118d4b4b8ba08d1eb949' => $vendorDir . '/markbaker/matrix/classes/src/operations/add.php', + '5fef6d0e407f3f8887266dfa4a6c534c' => $vendorDir . '/markbaker/matrix/classes/src/operations/directsum.php', + '684ba247e1385946e3babdaa054119de' => $vendorDir . '/markbaker/matrix/classes/src/operations/subtract.php', + 'aa53dcba601214d17ad405b7c291b7e8' => $vendorDir . '/markbaker/matrix/classes/src/operations/multiply.php', + '75c79eb1b25749b05a47976f32b0d8a2' => $vendorDir . '/markbaker/matrix/classes/src/operations/divideby.php', + '6ab8ad87a734f276a6bcd5a0fe1289be' => $vendorDir . '/markbaker/matrix/classes/src/operations/divideinto.php', +); diff --git a/libraries/phpspreadsheet/vendor/composer/autoload_namespaces.php b/libraries/phpspreadsheet/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..b7fc012 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($vendorDir . '/psr/simple-cache/src'), + 'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'), + 'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'), + 'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'), +); diff --git a/libraries/phpspreadsheet/vendor/composer/autoload_real.php b/libraries/phpspreadsheet/vendor/composer/autoload_real.php new file mode 100644 index 0000000..aba32ac --- /dev/null +++ b/libraries/phpspreadsheet/vendor/composer/autoload_real.php @@ -0,0 +1,70 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit6afe6fcd54e00add00a5fe0e5fb044f9::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInit6afe6fcd54e00add00a5fe0e5fb044f9::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire6afe6fcd54e00add00a5fe0e5fb044f9($fileIdentifier, $file); + } + + return $loader; + } +} + +function composerRequire6afe6fcd54e00add00a5fe0e5fb044f9($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +} diff --git a/libraries/phpspreadsheet/vendor/composer/autoload_static.php b/libraries/phpspreadsheet/vendor/composer/autoload_static.php new file mode 100644 index 0000000..2c24a05 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/composer/autoload_static.php @@ -0,0 +1,348 @@ + __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/abs.php', + '21a5860fbef5be28db5ddfbc3cca67c4' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acos.php', + '1546e3f9d127f2a9bb2d1b6c31c26ef1' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acosh.php', + 'd2516f7f4fba5ea5905f494b4a8262e0' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acot.php', + '4511163d560956219b96882c0980b65e' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acoth.php', + 'c361f5616dc2a8da4fa3e137077cd4ea' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acsc.php', + '02d68920fc98da71991ce569c91df0f6' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acsch.php', + '88e19525eae308b4a6aa3419364875d3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/argument.php', + '60e8e2d0827b58bfc904f13957e51849' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asec.php', + '13d2f040713999eab66c359b4d79871d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asech.php', + '838ab38beb32c68a79d3cd2c007d5a04' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asin.php', + 'bb28eccd0f8f008333a1b3c163d604ac' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asinh.php', + '9e483de83558c98f7d3feaa402c78cb3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/atan.php', + '36b74b5b765ded91ee58c8ee3c0e85e3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/atanh.php', + '05c15ee9510da7fd6bf6136f436500c0' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/conjugate.php', + 'd3208dfbce2505e370788f9f22f6785f' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cos.php', + '141cf1fb3a3046f8b64534b0ebab33ca' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cosh.php', + 'be660df75fd0dbe7fa7c03b7434b3294' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cot.php', + '01e31ea298a51bc9e91517e3ce6b9e76' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/coth.php', + '803ddd97f7b1da68982a7b087c3476f6' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/csc.php', + '3001cdfd101ec3c32da34ee43c2e149b' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/csch.php', + '77b2d7629ef2a93fabb8c56754a91051' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/exp.php', + '4a4471296dec796c21d4f4b6552396a9' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/inverse.php', + 'c3e9897e1744b88deb56fcdc39d34d85' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/ln.php', + 'a83cacf2de942cff288de15a83afd26d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/log2.php', + '6a861dacc9ee2f3061241d4c7772fa21' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/log10.php', + '4d2522d968c8ba78d6c13548a1b4200e' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/negative.php', + 'fd587ca933fc0447fa5ab4843bdd97f7' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/pow.php', + '383ef01c62028fc78cd4388082fce3c2' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/rho.php', + '150fbd1b95029dc47292da97ecab9375' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sec.php', + '549abd9bae174286d660bdaa07407c68' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sech.php', + '6bfbf5eaea6b17a0ed85cb21ba80370c' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sin.php', + '22efe13f1a497b8e199540ae2d9dc59c' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sinh.php', + 'e90135ab8e787795a509ed7147de207d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sqrt.php', + 'bb0a7923ffc6a90919cd64ec54ff06bc' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/tan.php', + '2d302f32ce0fd4e433dd91c5bb404a28' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/tanh.php', + '24dd4658a952171a4ee79218c4f9fd06' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/theta.php', + 'e49b7876281d6f5bc39536dde96d1f4a' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/add.php', + '47596e02b43cd6da7700134fd08f88cf' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/subtract.php', + '883af48563631547925fa4c3b48ead07' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/multiply.php', + 'f190e3308e6ca23234a2875edc985c03' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/divideby.php', + 'ac9e33ce6841aa5bf5d16d465a2f03a7' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/divideinto.php', + '9d8e013a5160a09477beb8e44f8ae97b' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/adjoint.php', + '6e78d1bdea6248d6aa117229efae50f2' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/antidiagonal.php', + '4623d87924d94f5412fe5afbf1cef31d' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/cofactors.php', + '901fd1f6950a637ca85f66b701a45e13' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/determinant.php', + '83057abc0e4acc99ba80154ee5d02a49' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/diagonal.php', + '07b7fd7a434451149b4fd477fca0ce06' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/identity.php', + 'c8d43b340583e07ae89f2a3baef2cf89' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/inverse.php', + '499bb10ed7a3aee2ba4c09a31a85e8d1' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/minors.php', + '1cad2e6414d652e8b1c64e8967f6f37d' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/trace.php', + '95a7f134ac17161d07def442b3b737e8' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/functions/transpose.php', + 'b3a6bc628377118d4b4b8ba08d1eb949' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/add.php', + '5fef6d0e407f3f8887266dfa4a6c534c' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/directsum.php', + '684ba247e1385946e3babdaa054119de' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/subtract.php', + 'aa53dcba601214d17ad405b7c291b7e8' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/multiply.php', + '75c79eb1b25749b05a47976f32b0d8a2' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/divideby.php', + '6ab8ad87a734f276a6bcd5a0fe1289be' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/operations/divideinto.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'P' => + array ( + 'Psr\\SimpleCache\\' => 16, + 'PhpOffice\\PhpSpreadsheet\\' => 25, + ), + 'M' => + array ( + 'Matrix\\' => 7, + ), + 'C' => + array ( + 'Complex\\' => 8, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Psr\\SimpleCache\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/simple-cache/src', + ), + 'PhpOffice\\PhpSpreadsheet\\' => + array ( + 0 => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet', + ), + 'Matrix\\' => + array ( + 0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src', + ), + 'Complex\\' => + array ( + 0 => __DIR__ . '/..' . '/markbaker/complex/classes/src', + ), + ); + + public static $classMap = array ( + 'Complex\\Complex' => __DIR__ . '/..' . '/markbaker/complex/classes/src/Complex.php', + 'Complex\\Exception' => __DIR__ . '/..' . '/markbaker/complex/classes/src/Exception.php', + 'Matrix\\Builder' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Builder.php', + 'Matrix\\Exception' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Exception.php', + 'Matrix\\Functions' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Functions.php', + 'Matrix\\Matrix' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Matrix.php', + 'Matrix\\Operators\\Addition' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Operators/Addition.php', + 'Matrix\\Operators\\DirectSum' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Operators/DirectSum.php', + 'Matrix\\Operators\\Division' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Operators/Division.php', + 'Matrix\\Operators\\Multiplication' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Operators/Multiplication.php', + 'Matrix\\Operators\\Operator' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Operators/Operator.php', + 'Matrix\\Operators\\Subtraction' => __DIR__ . '/..' . '/markbaker/matrix/classes/src/Operators/Subtraction.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Calculation' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Category' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Category.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Database' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Database.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\DateTime' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Engine\\CyclicReferenceStack' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Engine\\Logger' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Engineering' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Exception' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\ExceptionHandler' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ExceptionHandler.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Financial' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Financial.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\FormulaParser' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaParser.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\FormulaToken' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaToken.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Functions' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Logical' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\LookupRef' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\MathTrig' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Statistical' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\TextData' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php', + 'PhpOffice\\PhpSpreadsheet\\Calculation\\Token\\Stack' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\AdvancedValueBinder' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\Cell' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\Coordinate' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\DataType' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\DataValidation' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidation.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\DataValidator' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\DefaultValueBinder' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DefaultValueBinder.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\Hyperlink' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Hyperlink.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\IValueBinder' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/IValueBinder.php', + 'PhpOffice\\PhpSpreadsheet\\Cell\\StringValueBinder' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/StringValueBinder.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Axis' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Axis.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Chart' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Chart.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\DataSeries' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeries.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\DataSeriesValues' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Exception' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\GridLines' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/GridLines.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Layout' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Layout.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Legend' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Legend.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\PlotArea' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/PlotArea.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Properties' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Properties.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Renderer\\IRenderer' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Renderer\\JpGraph' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/JpGraph.php', + 'PhpOffice\\PhpSpreadsheet\\Chart\\Title' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Title.php', + 'PhpOffice\\PhpSpreadsheet\\Collection\\Cells' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php', + 'PhpOffice\\PhpSpreadsheet\\Collection\\CellsFactory' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/CellsFactory.php', + 'PhpOffice\\PhpSpreadsheet\\Collection\\Memory' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Memory.php', + 'PhpOffice\\PhpSpreadsheet\\Comment' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php', + 'PhpOffice\\PhpSpreadsheet\\Document\\Properties' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php', + 'PhpOffice\\PhpSpreadsheet\\Document\\Security' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Security.php', + 'PhpOffice\\PhpSpreadsheet\\Exception' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\HashTable' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/HashTable.php', + 'PhpOffice\\PhpSpreadsheet\\Helper\\Html' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php', + 'PhpOffice\\PhpSpreadsheet\\Helper\\Migrator' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Migrator.php', + 'PhpOffice\\PhpSpreadsheet\\Helper\\Sample' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Sample.php', + 'PhpOffice\\PhpSpreadsheet\\IComparable' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IComparable.php', + 'PhpOffice\\PhpSpreadsheet\\IOFactory' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php', + 'PhpOffice\\PhpSpreadsheet\\NamedRange' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/NamedRange.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\BaseReader' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Csv' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\DefaultReadFilter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/DefaultReadFilter.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Exception' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Gnumeric' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Gnumeric.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Html' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\IReadFilter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReadFilter.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\IReader' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReader.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Ods' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Ods\\Properties' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/Properties.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Security\\XmlScanner' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Security/XmlScanner.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Slk' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Color' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Color\\BIFF5' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Color\\BIFF8' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Color\\BuiltIn' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\ErrorCode' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Escher' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Escher.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\MD5' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\RC4' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/RC4.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Style\\Border' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/Border.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xls\\Style\\FillPattern' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\AutoFilter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\BaseParserClass' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Chart' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Chart.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\ColumnAndRowAttributes' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\ConditionalStyles' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\DataValidations' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Hyperlinks' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\PageSetup' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Properties' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Properties.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\SheetViewOptions' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\SheetViews' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Styles' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Theme' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Theme.php', + 'PhpOffice\\PhpSpreadsheet\\Reader\\Xml' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php', + 'PhpOffice\\PhpSpreadsheet\\ReferenceHelper' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php', + 'PhpOffice\\PhpSpreadsheet\\RichText\\ITextElement' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/ITextElement.php', + 'PhpOffice\\PhpSpreadsheet\\RichText\\RichText' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/RichText.php', + 'PhpOffice\\PhpSpreadsheet\\RichText\\Run' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/Run.php', + 'PhpOffice\\PhpSpreadsheet\\RichText\\TextElement' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/TextElement.php', + 'PhpOffice\\PhpSpreadsheet\\Settings' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\CodePage' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/CodePage.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Date' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Date.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Drawing' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DgContainer' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DgContainer\\SpgrContainer' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DgContainer\\SpgrContainer\\SpContainer' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DggContainer' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DggContainer\\BstoreContainer' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DggContainer\\BstoreContainer\\BSE' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Escher\\DggContainer\\BstoreContainer\\BSE\\Blip' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\File' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Font' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\CholeskyDecomposition' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\EigenvalueDecomposition' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\LUDecomposition' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\Matrix' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\QRDecomposition' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\JAMA\\SingularValueDecomposition' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLERead' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE\\ChainedBlockStream' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE\\PPS' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE\\PPS\\File' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/File.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\OLE\\PPS\\Root' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\PasswordHasher' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/PasswordHasher.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\StringHelper' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\TimeZone' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/TimeZone.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\BestFit' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/BestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\ExponentialBestFit' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\LinearBestFit' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\LogarithmicBestFit' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\PolynomialBestFit' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\PowerBestFit' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Trend\\Trend' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\XMLWriter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php', + 'PhpOffice\\PhpSpreadsheet\\Shared\\Xls' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Xls.php', + 'PhpOffice\\PhpSpreadsheet\\Spreadsheet' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Alignment' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Border' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Borders' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Color' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Conditional' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Fill' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Fill.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Font' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\NumberFormat' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Protection' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Style' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php', + 'PhpOffice\\PhpSpreadsheet\\Style\\Supervisor' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\AutoFilter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\AutoFilter\\Column' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\AutoFilter\\Column\\Rule' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\BaseDrawing' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\CellIterator' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/CellIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Column' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Column.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\ColumnCellIterator' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\ColumnDimension' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\ColumnIterator' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Dimension' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Drawing' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Drawing\\Shadow' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\HeaderFooter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooter.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\HeaderFooterDrawing' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Iterator' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Iterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\MemoryDrawing' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\PageMargins' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageMargins.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\PageSetup' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Protection' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Protection.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Row' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\RowCellIterator' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowCellIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\RowDimension' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\RowIterator' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowIterator.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\SheetView' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/SheetView.php', + 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Worksheet' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\BaseWriter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Csv' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Csv.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Exception' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Exception.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Html' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\IWriter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/IWriter.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Cell\\Comment' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Content' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Meta' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Meta.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\MetaInf' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/MetaInf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Mimetype' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Mimetype.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Settings' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Settings.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Styles' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Styles.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\Thumbnails' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Ods\\WriterPart' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/WriterPart.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Pdf' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Pdf\\Dompdf' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Pdf\\Mpdf' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Pdf\\Tcpdf' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\BIFFwriter' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Escher' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Escher.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Font' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Font.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Parser' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Parser.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Workbook' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Workbook.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Worksheet' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xls\\Xf' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Xf.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Chart' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Chart.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Comments' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\ContentTypes' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\DocProps' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Drawing' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Rels' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\RelsRibbon' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\RelsVBA' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\StringTable' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Style' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Theme' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Theme.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Workbook' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\Worksheet' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php', + 'PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx\\WriterPart' => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php', + 'Psr\\SimpleCache\\CacheException' => __DIR__ . '/..' . '/psr/simple-cache/src/CacheException.php', + 'Psr\\SimpleCache\\CacheInterface' => __DIR__ . '/..' . '/psr/simple-cache/src/CacheInterface.php', + 'Psr\\SimpleCache\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/simple-cache/src/InvalidArgumentException.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit6afe6fcd54e00add00a5fe0e5fb044f9::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit6afe6fcd54e00add00a5fe0e5fb044f9::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit6afe6fcd54e00add00a5fe0e5fb044f9::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/libraries/phpspreadsheet/vendor/composer/installed.json b/libraries/phpspreadsheet/vendor/composer/installed.json new file mode 100644 index 0000000..c248650 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/composer/installed.json @@ -0,0 +1,315 @@ +[ + { + "name": "markbaker/complex", + "version": "1.4.8", + "version_normalized": "1.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "8eaa40cceec7bf0518187530b2e63871be661b72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/8eaa40cceec7bf0518187530b2e63871be661b72", + "reference": "8eaa40cceec7bf0518187530b2e63871be661b72", + "shasum": "" + }, + "require": { + "php": "^5.6.0|^7.0.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", + "phpcompatibility/php-compatibility": "^9.0", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "2.*", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^4.8.35|^5.4.0", + "sebastian/phpcpd": "2.*", + "squizlabs/php_codesniffer": "^3.4.0" + }, + "time": "2020-03-11T20:15:49+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + }, + "files": [ + "classes/src/functions/abs.php", + "classes/src/functions/acos.php", + "classes/src/functions/acosh.php", + "classes/src/functions/acot.php", + "classes/src/functions/acoth.php", + "classes/src/functions/acsc.php", + "classes/src/functions/acsch.php", + "classes/src/functions/argument.php", + "classes/src/functions/asec.php", + "classes/src/functions/asech.php", + "classes/src/functions/asin.php", + "classes/src/functions/asinh.php", + "classes/src/functions/atan.php", + "classes/src/functions/atanh.php", + "classes/src/functions/conjugate.php", + "classes/src/functions/cos.php", + "classes/src/functions/cosh.php", + "classes/src/functions/cot.php", + "classes/src/functions/coth.php", + "classes/src/functions/csc.php", + "classes/src/functions/csch.php", + "classes/src/functions/exp.php", + "classes/src/functions/inverse.php", + "classes/src/functions/ln.php", + "classes/src/functions/log2.php", + "classes/src/functions/log10.php", + "classes/src/functions/negative.php", + "classes/src/functions/pow.php", + "classes/src/functions/rho.php", + "classes/src/functions/sec.php", + "classes/src/functions/sech.php", + "classes/src/functions/sin.php", + "classes/src/functions/sinh.php", + "classes/src/functions/sqrt.php", + "classes/src/functions/tan.php", + "classes/src/functions/tanh.php", + "classes/src/functions/theta.php", + "classes/src/operations/add.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ] + }, + { + "name": "markbaker/matrix", + "version": "1.2.0", + "version_normalized": "1.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/5348c5a67e3b75cd209d70103f916a93b1f1ed21", + "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21", + "shasum": "" + }, + "require": { + "php": "^5.6.0|^7.0.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "dev-master", + "phploc/phploc": "^4", + "phpmd/phpmd": "dev-master", + "phpunit/phpunit": "^5.7", + "sebastian/phpcpd": "^3.0", + "squizlabs/php_codesniffer": "^3.0@dev" + }, + "time": "2019-10-06T11:29:25+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + }, + "files": [ + "classes/src/functions/adjoint.php", + "classes/src/functions/antidiagonal.php", + "classes/src/functions/cofactors.php", + "classes/src/functions/determinant.php", + "classes/src/functions/diagonal.php", + "classes/src/functions/identity.php", + "classes/src/functions/inverse.php", + "classes/src/functions/minors.php", + "classes/src/functions/trace.php", + "classes/src/functions/transpose.php", + "classes/src/operations/add.php", + "classes/src/operations/directsum.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ] + }, + { + "name": "phpoffice/phpspreadsheet", + "version": "1.11.0", + "version_normalized": "1.11.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "c2a205e82f9cf1cc9fab86b79e808d86dd680470" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/c2a205e82f9cf1cc9fab86b79e808d86dd680470", + "reference": "c2a205e82f9cf1cc9fab86b79e808d86dd680470", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "markbaker/complex": "^1.4", + "markbaker/matrix": "^1.2", + "php": "^7.1", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "dompdf/dompdf": "^0.8.3", + "friendsofphp/php-cs-fixer": "^2.16", + "jpgraph/jpgraph": "^4.0", + "mpdf/mpdf": "^8.0", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^7.5", + "squizlabs/php_codesniffer": "^3.5", + "tecnickcom/tcpdf": "^6.3" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "time": "2020-03-02T13:09:03+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ] + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-10-23T01:57:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ] + } +] diff --git a/libraries/phpspreadsheet/vendor/htaccess.txt b/libraries/phpspreadsheet/vendor/htaccess.txt new file mode 100644 index 0000000..9afb1a1 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/htaccess.txt @@ -0,0 +1,9 @@ +# Apache 2.4+ + + Require all denied + + +# Apache 2.0-2.2 + + Deny from all + diff --git a/libraries/phpspreadsheet/vendor/index.html b/libraries/phpspreadsheet/vendor/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/Autoloader.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/Autoloader.php new file mode 100644 index 0000000..792ecef --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/Autoloader.php @@ -0,0 +1,53 @@ +regex = $regex; + parent::__construct($it, $regex); + } +} + +class FilenameFilter extends FilesystemRegexFilter +{ + // Filter files against the regex + public function accept() + { + return (!$this->isFile() || preg_match($this->regex, $this->getFilename())); + } +} + + +$srcFolder = __DIR__ . DIRECTORY_SEPARATOR . 'src'; +$srcDirectory = new RecursiveDirectoryIterator($srcFolder); + +$filteredFileList = new FilenameFilter($srcDirectory, '/(?:php)$/i'); +$filteredFileList = new FilenameFilter($filteredFileList, '/^(?!.*(Complex|Exception)\.php).*$/i'); + +foreach (new RecursiveIteratorIterator($filteredFileList) as $file) { + if ($file->isFile()) { + include_once $file; + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/Complex.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/Complex.php new file mode 100644 index 0000000..4f873af --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/Complex.php @@ -0,0 +1,390 @@ +realPart = (float) $realPart; + $this->imaginaryPart = (float) $imaginaryPart; + $this->suffix = strtolower($suffix); + } + + /** + * Gets the real part of this complex number + * + * @return Float + */ + public function getReal() + { + return $this->realPart; + } + + /** + * Gets the imaginary part of this complex number + * + * @return Float + */ + public function getImaginary() + { + return $this->imaginaryPart; + } + + /** + * Gets the suffix of this complex number + * + * @return String + */ + public function getSuffix() + { + return $this->suffix; + } + + /** + * Returns true if this is a real value, false if a complex value + * + * @return Bool + */ + public function isReal() + { + return $this->imaginaryPart == 0.0; + } + + /** + * Returns true if this is a complex value, false if a real value + * + * @return Bool + */ + public function isComplex() + { + return !$this->isReal(); + } + + public function format() + { + $str = ""; + if ($this->imaginaryPart != 0.0) { + if (\abs($this->imaginaryPart) != 1.0) { + $str .= $this->imaginaryPart . $this->suffix; + } else { + $str .= (($this->imaginaryPart < 0.0) ? '-' : '') . $this->suffix; + } + } + if ($this->realPart != 0.0) { + if (($str) && ($this->imaginaryPart > 0.0)) { + $str = "+" . $str; + } + $str = $this->realPart . $str; + } + if (!$str) { + $str = "0.0"; + } + + return $str; + } + + public function __toString() + { + return $this->format(); + } + + /** + * Validates whether the argument is a valid complex number, converting scalar or array values if possible + * + * @param mixed $complex The value to validate + * @return Complex + * @throws Exception If the argument isn't a Complex number or cannot be converted to one + */ + public static function validateComplexArgument($complex) + { + if (is_scalar($complex) || is_array($complex)) { + $complex = new Complex($complex); + } elseif (!is_object($complex) || !($complex instanceof Complex)) { + throw new Exception('Value is not a valid complex number'); + } + + return $complex; + } + + /** + * Returns the reverse of this complex number + * + * @return Complex + */ + public function reverse() + { + return new Complex( + $this->imaginaryPart, + $this->realPart, + ($this->realPart == 0.0) ? null : $this->suffix + ); + } + + public function invertImaginary() + { + return new Complex( + $this->realPart, + $this->imaginaryPart * -1, + ($this->imaginaryPart == 0.0) ? null : $this->suffix + ); + } + + public function invertReal() + { + return new Complex( + $this->realPart * -1, + $this->imaginaryPart, + ($this->imaginaryPart == 0.0) ? null : $this->suffix + ); + } + + protected static $functions = [ + 'abs', + 'acos', + 'acosh', + 'acot', + 'acoth', + 'acsc', + 'acsch', + 'argument', + 'asec', + 'asech', + 'asin', + 'asinh', + 'atan', + 'atanh', + 'conjugate', + 'cos', + 'cosh', + 'cot', + 'coth', + 'csc', + 'csch', + 'exp', + 'inverse', + 'ln', + 'log2', + 'log10', + 'negative', + 'pow', + 'rho', + 'sec', + 'sech', + 'sin', + 'sinh', + 'sqrt', + 'tan', + 'tanh', + 'theta', + ]; + + protected static $operations = [ + 'add', + 'subtract', + 'multiply', + 'divideby', + 'divideinto', + ]; + + /** + * Returns the result of the function call or operation + * + * @return Complex|float + * @throws Exception|\InvalidArgumentException + */ + public function __call($functionName, $arguments) + { + $functionName = strtolower(str_replace('_', '', $functionName)); + + // Test for function calls + if (in_array($functionName, self::$functions)) { + $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}"; + return $functionName($this, ...$arguments); + } + // Test for operation calls + if (in_array($functionName, self::$operations)) { + $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}"; + return $functionName($this, ...$arguments); + } + throw new Exception('Function or Operation does not exist'); + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/Exception.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/Exception.php new file mode 100644 index 0000000..a2beb73 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/Exception.php @@ -0,0 +1,13 @@ +getReal() - $invsqrt->getImaginary(), + $complex->getImaginary() + $invsqrt->getReal() + ); + $log = ln($adjust); + + return new Complex( + $log->getImaginary(), + -1 * $log->getReal() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acosh.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acosh.php new file mode 100644 index 0000000..18a992e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acosh.php @@ -0,0 +1,34 @@ +isReal() && ($complex->getReal() > 1)) { + return new Complex(\acosh($complex->getReal())); + } + + $acosh = acos($complex) + ->reverse(); + if ($acosh->getReal() < 0.0) { + $acosh = $acosh->invertReal(); + } + + return $acosh; +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acot.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acot.php new file mode 100644 index 0000000..11bee46 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acot.php @@ -0,0 +1,25 @@ +getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return INF; + } + + return asin(inverse($complex)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acsch.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acsch.php new file mode 100644 index 0000000..bb45d34 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/acsch.php @@ -0,0 +1,29 @@ +getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return INF; + } + + return asinh(inverse($complex)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/argument.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/argument.php new file mode 100644 index 0000000..d7209cc --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/argument.php @@ -0,0 +1,28 @@ +getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return INF; + } + + return acos(inverse($complex)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asech.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asech.php new file mode 100644 index 0000000..b36c40e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asech.php @@ -0,0 +1,29 @@ +getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return INF; + } + + return acosh(inverse($complex)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asin.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asin.php new file mode 100644 index 0000000..9c982ac --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asin.php @@ -0,0 +1,37 @@ +getReal() - $complex->getImaginary(), + $invsqrt->getImaginary() + $complex->getReal() + ); + $log = ln($adjust); + + return new Complex( + $log->getImaginary(), + -1 * $log->getReal() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asinh.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asinh.php new file mode 100644 index 0000000..c1243fd --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/asinh.php @@ -0,0 +1,33 @@ +isReal() && ($complex->getReal() > 1)) { + return new Complex(\asinh($complex->getReal())); + } + + $asinh = clone $complex; + $asinh = $asinh->reverse() + ->invertReal(); + $asinh = asin($asinh); + return $asinh->reverse() + ->invertImaginary(); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/atan.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/atan.php new file mode 100644 index 0000000..2c75dcf --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/atan.php @@ -0,0 +1,45 @@ +isReal()) { + return new Complex(\atan($complex->getReal())); + } + + $t1Value = new Complex(-1 * $complex->getImaginary(), $complex->getReal()); + $uValue = new Complex(1, 0); + + $d1Value = clone $uValue; + $d1Value = subtract($d1Value, $t1Value); + $d2Value = add($t1Value, $uValue); + $uResult = $d1Value->divideBy($d2Value); + $uResult = ln($uResult); + + return new Complex( + (($uResult->getImaginary() == M_PI) ? -M_PI : $uResult->getImaginary()) * -0.5, + $uResult->getReal() * 0.5, + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/atanh.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/atanh.php new file mode 100644 index 0000000..c53f2a9 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/atanh.php @@ -0,0 +1,38 @@ +isReal()) { + $real = $complex->getReal(); + if ($real >= -1.0 && $real <= 1.0) { + return new Complex(\atanh($real)); + } else { + return new Complex(\atanh(1 / $real), (($real < 0.0) ? M_PI_2 : -1 * M_PI_2)); + } + } + + $iComplex = clone $complex; + $iComplex = $iComplex->invertImaginary() + ->reverse(); + return atan($iComplex) + ->invertReal() + ->reverse(); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/conjugate.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/conjugate.php new file mode 100644 index 0000000..bd1984b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/conjugate.php @@ -0,0 +1,28 @@ +getReal(), + -1 * $complex->getImaginary(), + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cos.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cos.php new file mode 100644 index 0000000..80a4683 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cos.php @@ -0,0 +1,34 @@ +isReal()) { + return new Complex(\cos($complex->getReal())); + } + + return conjugate( + new Complex( + \cos($complex->getReal()) * \cosh($complex->getImaginary()), + \sin($complex->getReal()) * \sinh($complex->getImaginary()), + $complex->getSuffix() + ) + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cosh.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cosh.php new file mode 100644 index 0000000..a4bea65 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cosh.php @@ -0,0 +1,32 @@ +isReal()) { + return new Complex(\cosh($complex->getReal())); + } + + return new Complex( + \cosh($complex->getReal()) * \cos($complex->getImaginary()), + \sinh($complex->getReal()) * \sin($complex->getImaginary()), + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cot.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cot.php new file mode 100644 index 0000000..339101e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/cot.php @@ -0,0 +1,29 @@ +getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return new Complex(INF); + } + + return inverse(tan($complex)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/coth.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/coth.php new file mode 100644 index 0000000..7fe705a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/coth.php @@ -0,0 +1,24 @@ +getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return INF; + } + + return inverse(sin($complex)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/csch.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/csch.php new file mode 100644 index 0000000..f450098 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/csch.php @@ -0,0 +1,29 @@ +getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return INF; + } + + return inverse(sinh($complex)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/exp.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/exp.php new file mode 100644 index 0000000..4cac696 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/exp.php @@ -0,0 +1,34 @@ +getReal() == 0.0) && (\abs($complex->getImaginary()) == M_PI)) { + return new Complex(-1.0, 0.0); + } + + $rho = \exp($complex->getReal()); + + return new Complex( + $rho * \cos($complex->getImaginary()), + $rho * \sin($complex->getImaginary()), + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/inverse.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/inverse.php new file mode 100644 index 0000000..7d3182a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/inverse.php @@ -0,0 +1,29 @@ +getReal() == 0.0 && $complex->getImaginary() == 0.0) { + throw new \InvalidArgumentException('Division by zero'); + } + + return $complex->divideInto(1.0); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/ln.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/ln.php new file mode 100644 index 0000000..39071cf --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/ln.php @@ -0,0 +1,33 @@ +getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { + throw new \InvalidArgumentException(); + } + + return new Complex( + \log(rho($complex)), + theta($complex), + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/log10.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/log10.php new file mode 100644 index 0000000..694d3d0 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/log10.php @@ -0,0 +1,32 @@ +getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { + throw new \InvalidArgumentException(); + } elseif (($complex->getReal() > 0.0) && ($complex->getImaginary() == 0.0)) { + return new Complex(\log10($complex->getReal()), 0.0, $complex->getSuffix()); + } + + return ln($complex) + ->multiply(\log10(Complex::EULER)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/log2.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/log2.php new file mode 100644 index 0000000..081f2c4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/log2.php @@ -0,0 +1,32 @@ +getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { + throw new \InvalidArgumentException(); + } elseif (($complex->getReal() > 0.0) && ($complex->getImaginary() == 0.0)) { + return new Complex(\log($complex->getReal(), 2), 0.0, $complex->getSuffix()); + } + + return ln($complex) + ->multiply(\log(Complex::EULER, 2)); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/negative.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/negative.php new file mode 100644 index 0000000..dbd1192 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/negative.php @@ -0,0 +1,31 @@ +getReal(), + -1 * $complex->getImaginary(), + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/pow.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/pow.php new file mode 100644 index 0000000..18ee269 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/pow.php @@ -0,0 +1,40 @@ +getImaginary() == 0.0 && $complex->getReal() >= 0.0) { + return new Complex(\pow($complex->getReal(), $power)); + } + + $rValue = \sqrt(($complex->getReal() * $complex->getReal()) + ($complex->getImaginary() * $complex->getImaginary())); + $rPower = \pow($rValue, $power); + $theta = $complex->argument() * $power; + if ($theta == 0) { + return new Complex(1); + } + + return new Complex($rPower * \cos($theta), $rPower * \sin($theta), $complex->getSuffix()); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/rho.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/rho.php new file mode 100644 index 0000000..750f3f9 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/rho.php @@ -0,0 +1,28 @@ +getReal() * $complex->getReal()) + + ($complex->getImaginary() * $complex->getImaginary()) + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sec.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sec.php new file mode 100644 index 0000000..7dd43ea --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sec.php @@ -0,0 +1,25 @@ +isReal()) { + return new Complex(\sin($complex->getReal())); + } + + return new Complex( + \sin($complex->getReal()) * \cosh($complex->getImaginary()), + \cos($complex->getReal()) * \sinh($complex->getImaginary()), + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sinh.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sinh.php new file mode 100644 index 0000000..4c0f650 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sinh.php @@ -0,0 +1,32 @@ +isReal()) { + return new Complex(\sinh($complex->getReal())); + } + + return new Complex( + \sinh($complex->getReal()) * \cos($complex->getImaginary()), + \cosh($complex->getReal()) * \sin($complex->getImaginary()), + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sqrt.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sqrt.php new file mode 100644 index 0000000..9c171b8 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/sqrt.php @@ -0,0 +1,29 @@ +getSuffix()); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/tan.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/tan.php new file mode 100644 index 0000000..014d798 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/tan.php @@ -0,0 +1,40 @@ +isReal()) { + return new Complex(\tan($complex->getReal())); + } + + $real = $complex->getReal(); + $imaginary = $complex->getImaginary(); + $divisor = 1 + \pow(\tan($real), 2) * \pow(\tanh($imaginary), 2); + if ($divisor == 0.0) { + throw new \InvalidArgumentException('Division by zero'); + } + + return new Complex( + \pow(sech($imaginary)->getReal(), 2) * \tan($real) / $divisor, + \pow(sec($real)->getReal(), 2) * \tanh($imaginary) / $divisor, + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/tanh.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/tanh.php new file mode 100644 index 0000000..028741d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/tanh.php @@ -0,0 +1,35 @@ +getReal(); + $imaginary = $complex->getImaginary(); + $divisor = \cos($imaginary) * \cos($imaginary) + \sinh($real) * \sinh($real); + if ($divisor == 0.0) { + throw new \InvalidArgumentException('Division by zero'); + } + + return new Complex( + \sinh($real) * \cosh($real) / $divisor, + 0.5 * \sin(2 * $imaginary) / $divisor, + $complex->getSuffix() + ); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/theta.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/theta.php new file mode 100644 index 0000000..d12866c --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/functions/theta.php @@ -0,0 +1,38 @@ +getReal() == 0.0) { + if ($complex->isReal()) { + return 0.0; + } elseif ($complex->getImaginary() < 0.0) { + return M_PI / -2; + } + return M_PI / 2; + } elseif ($complex->getReal() > 0.0) { + return \atan($complex->getImaginary() / $complex->getReal()); + } elseif ($complex->getImaginary() < 0.0) { + return -(M_PI - \atan(\abs($complex->getImaginary()) / \abs($complex->getReal()))); + } + + return M_PI - \atan($complex->getImaginary() / \abs($complex->getReal())); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/add.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/add.php new file mode 100644 index 0000000..10bd42f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/add.php @@ -0,0 +1,46 @@ +isComplex() && $complex->isComplex() && + $result->getSuffix() !== $complex->getSuffix()) { + throw new Exception('Suffix Mismatch'); + } + + $real = $result->getReal() + $complex->getReal(); + $imaginary = $result->getImaginary() + $complex->getImaginary(); + + $result = new Complex( + $real, + $imaginary, + ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) + ); + } + + return $result; +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/divideby.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/divideby.php new file mode 100644 index 0000000..089e0ef --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/divideby.php @@ -0,0 +1,56 @@ +isComplex() && $complex->isComplex() && + $result->getSuffix() !== $complex->getSuffix()) { + throw new Exception('Suffix Mismatch'); + } + if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { + throw new \InvalidArgumentException('Division by zero'); + } + + $delta1 = ($result->getReal() * $complex->getReal()) + + ($result->getImaginary() * $complex->getImaginary()); + $delta2 = ($result->getImaginary() * $complex->getReal()) - + ($result->getReal() * $complex->getImaginary()); + $delta3 = ($complex->getReal() * $complex->getReal()) + + ($complex->getImaginary() * $complex->getImaginary()); + + $real = $delta1 / $delta3; + $imaginary = $delta2 / $delta3; + + $result = new Complex( + $real, + $imaginary, + ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) + ); + } + + return $result; +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/divideinto.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/divideinto.php new file mode 100644 index 0000000..3dfe085 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/divideinto.php @@ -0,0 +1,56 @@ +isComplex() && $complex->isComplex() && + $result->getSuffix() !== $complex->getSuffix()) { + throw new Exception('Suffix Mismatch'); + } + if ($result->getReal() == 0.0 && $result->getImaginary() == 0.0) { + throw new \InvalidArgumentException('Division by zero'); + } + + $delta1 = ($complex->getReal() * $result->getReal()) + + ($complex->getImaginary() * $result->getImaginary()); + $delta2 = ($complex->getImaginary() * $result->getReal()) - + ($complex->getReal() * $result->getImaginary()); + $delta3 = ($result->getReal() * $result->getReal()) + + ($result->getImaginary() * $result->getImaginary()); + + $real = $delta1 / $delta3; + $imaginary = $delta2 / $delta3; + + $result = new Complex( + $real, + $imaginary, + ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) + ); + } + + return $result; +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/multiply.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/multiply.php new file mode 100644 index 0000000..bf2473e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/multiply.php @@ -0,0 +1,48 @@ +isComplex() && $complex->isComplex() && + $result->getSuffix() !== $complex->getSuffix()) { + throw new Exception('Suffix Mismatch'); + } + + $real = ($result->getReal() * $complex->getReal()) - + ($result->getImaginary() * $complex->getImaginary()); + $imaginary = ($result->getReal() * $complex->getImaginary()) + + ($result->getImaginary() * $complex->getReal()); + + $result = new Complex( + $real, + $imaginary, + ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) + ); + } + + return $result; +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/subtract.php b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/subtract.php new file mode 100644 index 0000000..075ef44 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/complex/classes/src/operations/subtract.php @@ -0,0 +1,46 @@ +isComplex() && $complex->isComplex() && + $result->getSuffix() !== $complex->getSuffix()) { + throw new Exception('Suffix Mismatch'); + } + + $real = $result->getReal() - $complex->getReal(); + $imaginary = $result->getImaginary() - $complex->getImaginary(); + + $result = new Complex( + $real, + $imaginary, + ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) + ); + } + + return $result; +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/buildPhar.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/buildPhar.php new file mode 100644 index 0000000..e1b8f96 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/buildPhar.php @@ -0,0 +1,62 @@ + 'Mark Baker ', + 'Description' => 'PHP Class for working with Matrix numbers', + 'Copyright' => 'Mark Baker (c) 2013-' . date('Y'), + 'Timestamp' => time(), + 'Version' => '0.1.0', + 'Date' => date('Y-m-d') +); + +// cleanup +if (file_exists($pharName)) { + echo "Removed: {$pharName}\n"; + unlink($pharName); +} + +echo "Building phar file...\n"; + +// the phar object +$phar = new Phar($pharName, null, 'Matrix'); +$phar->buildFromDirectory($sourceDir); +$phar->setStub( +<<<'EOT' +getMessage()); + exit(1); + } + + include 'phar://functions/sqrt.php'; + + __HALT_COMPILER(); +EOT +); +$phar->setMetadata($metaData); +$phar->compressFiles(Phar::GZ); + +echo "Complete.\n"; + +exit(); diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/Autoloader.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/Autoloader.php new file mode 100644 index 0000000..279d176 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/Autoloader.php @@ -0,0 +1,53 @@ +regex = $regex; + parent::__construct($it, $regex); + } +} + +class FilenameFilter extends FilesystemRegexFilter +{ + // Filter files against the regex + public function accept() + { + return (!$this->isFile() || preg_match($this->regex, $this->getFilename())); + } +} + + +$srcFolder = __DIR__ . DIRECTORY_SEPARATOR . 'src'; +$srcDirectory = new RecursiveDirectoryIterator($srcFolder); + +$filteredFileList = new FilenameFilter($srcDirectory, '/(?:php)$/i'); +$filteredFileList = new FilenameFilter($filteredFileList, '/^(?!.*(Matrix|Exception)\.php).*$/i'); + +foreach (new RecursiveIteratorIterator($filteredFileList) as $file) { + if ($file->isFile()) { + include_once $file; + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Builder.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Builder.php new file mode 100644 index 0000000..6bc334a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Builder.php @@ -0,0 +1,70 @@ +toArray(); + + for ($x = 0; $x < $dimensions; ++$x) { + $grid[$x][$x] = 1; + } + + return new Matrix($grid); + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Exception.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Exception.php new file mode 100644 index 0000000..55a428c --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Exception.php @@ -0,0 +1,13 @@ +isSquare()) { + throw new Exception('Adjoint can only be calculated for a square matrix'); + } + + return self::getAdjoint($matrix); + } + + /** + * Calculate the cofactors of the matrix + * + * @param Matrix $matrix The matrix whose cofactors we wish to calculate + * @return Matrix + * + * @throws Exception + */ + private static function getCofactors(Matrix $matrix) + { + $cofactors = self::getMinors($matrix); + $dimensions = $matrix->rows; + + $cof = 1; + for ($i = 0; $i < $dimensions; ++$i) { + $cofs = $cof; + for ($j = 0; $j < $dimensions; ++$j) { + $cofactors[$i][$j] *= $cofs; + $cofs = -$cofs; + } + $cof = -$cof; + } + + return new Matrix($cofactors); + } + + /** + * Return the cofactors of this matrix + * + * @param Matrix $matrix The matrix whose cofactors we wish to calculate + * @return Matrix + * + * @throws Exception + */ + public static function cofactors(Matrix $matrix) + { + if (!$matrix->isSquare()) { + throw new Exception('Cofactors can only be calculated for a square matrix'); + } + + return self::getCofactors($matrix); + } + + /** + * @param Matrix $matrix + * @param int $row + * @param int $column + * @return float + * @throws Exception + */ + private static function getDeterminantSegment(Matrix $matrix, $row, $column) + { + $tmpMatrix = $matrix->toArray(); + unset($tmpMatrix[$row]); + array_walk( + $tmpMatrix, + function (&$row) use ($column) { + unset($row[$column]); + } + ); + + return self::getDeterminant(new Matrix($tmpMatrix)); + } + + /** + * Calculate the determinant of the matrix + * + * @param Matrix $matrix The matrix whose determinant we wish to calculate + * @return float + * + * @throws Exception + */ + private static function getDeterminant(Matrix $matrix) + { + $dimensions = $matrix->rows; + $determinant = 0; + + switch ($dimensions) { + case 1: + $determinant = $matrix->getValue(1, 1); + break; + case 2: + $determinant = $matrix->getValue(1, 1) * $matrix->getValue(2, 2) - + $matrix->getValue(1, 2) * $matrix->getValue(2, 1); + break; + default: + for ($i = 1; $i <= $dimensions; ++$i) { + $det = $matrix->getValue(1, $i) * self::getDeterminantSegment($matrix, 0, $i - 1); + if (($i % 2) == 0) { + $determinant -= $det; + } else { + $determinant += $det; + } + } + break; + } + + return $determinant; + } + + /** + * Return the determinant of this matrix + * + * @param Matrix $matrix The matrix whose determinant we wish to calculate + * @return float + * @throws Exception + **/ + public static function determinant(Matrix $matrix) + { + if (!$matrix->isSquare()) { + throw new Exception('Determinant can only be calculated for a square matrix'); + } + + return self::getDeterminant($matrix); + } + + /** + * Return the diagonal of this matrix + * + * @param Matrix $matrix The matrix whose diagonal we wish to calculate + * @return Matrix + * @throws Exception + **/ + public static function diagonal(Matrix $matrix) + { + if (!$matrix->isSquare()) { + throw new Exception('Diagonal can only be extracted from a square matrix'); + } + + $dimensions = $matrix->rows; + $grid = Builder::createFilledMatrix(0, $dimensions, $dimensions) + ->toArray(); + + for ($i = 0; $i < $dimensions; ++$i) { + $grid[$i][$i] = $matrix->getValue($i + 1, $i + 1); + } + + return new Matrix($grid); + } + + /** + * Return the antidiagonal of this matrix + * + * @param Matrix $matrix The matrix whose antidiagonal we wish to calculate + * @return Matrix + * @throws Exception + **/ + public static function antidiagonal(Matrix $matrix) + { + if (!$matrix->isSquare()) { + throw new Exception('Anti-Diagonal can only be extracted from a square matrix'); + } + + $dimensions = $matrix->rows; + $grid = Builder::createFilledMatrix(0, $dimensions, $dimensions) + ->toArray(); + + for ($i = 0; $i < $dimensions; ++$i) { + $grid[$i][$dimensions - $i - 1] = $matrix->getValue($i + 1, $dimensions - $i); + } + + return new Matrix($grid); + } + + /** + * Return the identity matrix + * The identity matrix, or sometimes ambiguously called a unit matrix, of size n is the n × n square matrix + * with ones on the main diagonal and zeros elsewhere + * + * @param Matrix $matrix The matrix whose identity we wish to calculate + * @return Matrix + * @throws Exception + **/ + public static function identity(Matrix $matrix) + { + if (!$matrix->isSquare()) { + throw new Exception('Identity can only be created for a square matrix'); + } + + $dimensions = $matrix->rows; + + return Builder::createIdentityMatrix($dimensions); + } + + /** + * Return the inverse of this matrix + * + * @param Matrix $matrix The matrix whose inverse we wish to calculate + * @return Matrix + * @throws Exception + **/ + public static function inverse(Matrix $matrix) + { + if (!$matrix->isSquare()) { + throw new Exception('Inverse can only be calculated for a square matrix'); + } + + $determinant = self::getDeterminant($matrix); + if ($determinant == 0.0) { + throw new Exception('Inverse can only be calculated for a matrix with a non-zero determinant'); + } + + if ($matrix->rows == 1) { + return new Matrix([[1 / $matrix->getValue(1, 1)]]); + } + + return self::getAdjoint($matrix) + ->multiply(1 / $determinant); + } + + /** + * Calculate the minors of the matrix + * + * @param Matrix $matrix The matrix whose minors we wish to calculate + * @return array[] + * + * @throws Exception + */ + protected static function getMinors(Matrix $matrix) + { + $minors = $matrix->toArray(); + $dimensions = $matrix->rows; + if ($dimensions == 1) { + return $minors; + } + + for ($i = 0; $i < $dimensions; ++$i) { + for ($j = 0; $j < $dimensions; ++$j) { + $minors[$i][$j] = self::getDeterminantSegment($matrix, $i, $j); + } + } + + return $minors; + } + + /** + * Return the minors of the matrix + * The minor of a matrix A is the determinant of some smaller square matrix, cut down from A by removing one or + * more of its rows or columns. + * Minors obtained by removing just one row and one column from square matrices (first minors) are required for + * calculating matrix cofactors, which in turn are useful for computing both the determinant and inverse of + * square matrices. + * + * @param Matrix $matrix The matrix whose minors we wish to calculate + * @return Matrix + * @throws Exception + **/ + public static function minors(Matrix $matrix) + { + if (!$matrix->isSquare()) { + throw new Exception('Minors can only be calculated for a square matrix'); + } + + return new Matrix(self::getMinors($matrix)); + } + + /** + * Return the trace of this matrix + * The trace is defined as the sum of the elements on the main diagonal (the diagonal from the upper left to the lower right) + * of the matrix + * + * @param Matrix $matrix The matrix whose trace we wish to calculate + * @return float + * @throws Exception + **/ + public static function trace(Matrix $matrix) + { + if (!$matrix->isSquare()) { + throw new Exception('Trace can only be extracted from a square matrix'); + } + + $dimensions = $matrix->rows; + $result = 0; + for ($i = 1; $i <= $dimensions; ++$i) { + $result += $matrix->getValue($i, $i); + } + + return $result; + } + + /** + * Return the transpose of this matrix + * + * @param Matrix $matrix The matrix whose transpose we wish to calculate + * @return Matrix + **/ + public static function transpose(Matrix $matrix) + { + $array = array_values(array_merge([null], $matrix->toArray())); + $grid = call_user_func_array( + 'array_map', + $array + ); + + return new Matrix($grid); + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Matrix.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Matrix.php new file mode 100644 index 0000000..a4f0495 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Matrix.php @@ -0,0 +1,400 @@ +buildFromArray(array_values($grid)); + } + + /* + * Create a new Matrix object from an array of values + * + * @param array $grid + */ + protected function buildFromArray(array $grid) + { + $this->rows = count($grid); + $columns = array_reduce( + $grid, + function ($carry, $value) { + return max($carry, is_array($value) ? count($value) : 1); + } + ); + $this->columns = $columns; + + array_walk( + $grid, + function (&$value) use ($columns) { + if (!is_array($value)) { + $value = [$value]; + } + $value = array_pad(array_values($value), $columns, null); + } + ); + + $this->grid = $grid; + } + + /** + * Validate that a row number is a positive integer + * + * @param int $row + * @return int + * @throws Exception + */ + public static function validateRow($row) + { + if ((!is_numeric($row)) || (intval($row) < 1)) { + throw new Exception('Invalid Row'); + } + + return (int)$row; + } + + /** + * Validate that a column number is a positive integer + * + * @param int $column + * @return int + * @throws Exception + */ + public static function validateColumn($column) + { + if ((!is_numeric($column)) || (intval($column) < 1)) { + throw new Exception('Invalid Column'); + } + + return (int)$column; + } + + /** + * Validate that a row number falls within the set of rows for this matrix + * + * @param int $row + * @return int + * @throws Exception + */ + protected function validateRowInRange($row) + { + $row = static::validateRow($row); + if ($row > $this->rows) { + throw new Exception('Requested Row exceeds matrix size'); + } + + return $row; + } + + /** + * Validate that a column number falls within the set of columns for this matrix + * + * @param int $column + * @return int + * @throws Exception + */ + protected function validateColumnInRange($column) + { + $column = static::validateColumn($column); + if ($column > $this->columns) { + throw new Exception('Requested Column exceeds matrix size'); + } + + return $column; + } + + /** + * Return a new matrix as a subset of rows from this matrix, starting at row number $row, and $rowCount rows + * A $rowCount value of 0 will return all rows of the matrix from $row + * A negative $rowCount value will return rows until that many rows from the end of the matrix + * + * Note that row numbers start from 1, not from 0 + * + * @param int $row + * @param int $rowCount + * @return static + * @throws Exception + */ + public function getRows($row, $rowCount = 1) + { + $row = $this->validateRowInRange($row); + if ($rowCount === 0) { + $rowCount = $this->rows - $row + 1; + } + + return new static(array_slice($this->grid, $row - 1, (int)$rowCount)); + } + + /** + * Return a new matrix as a subset of columns from this matrix, starting at column number $column, and $columnCount columns + * A $columnCount value of 0 will return all columns of the matrix from $column + * A negative $columnCount value will return columns until that many columns from the end of the matrix + * + * Note that column numbers start from 1, not from 0 + * + * @param int $column + * @param int $columnCount + * @return Matrix + * @throws Exception + */ + public function getColumns($column, $columnCount = 1) + { + $column = $this->validateColumnInRange($column); + if ($columnCount < 1) { + $columnCount = $this->columns + $columnCount - $column + 1; + } + + $grid = []; + for ($i = $column - 1; $i < $column + $columnCount - 1; ++$i) { + $grid[] = array_column($this->grid, $i); + } + + return (new static($grid))->transpose(); + } + + /** + * Return a new matrix as a subset of rows from this matrix, dropping rows starting at row number $row, + * and $rowCount rows + * A negative $rowCount value will drop rows until that many rows from the end of the matrix + * A $rowCount value of 0 will remove all rows of the matrix from $row + * + * Note that row numbers start from 1, not from 0 + * + * @param int $row + * @param int $rowCount + * @return static + * @throws Exception + */ + public function dropRows($row, $rowCount = 1) + { + $this->validateRowInRange($row); + if ($rowCount === 0) { + $rowCount = $this->rows - $row + 1; + } + + $grid = $this->grid; + array_splice($grid, $row - 1, (int)$rowCount); + + return new static($grid); + } + + /** + * Return a new matrix as a subset of columns from this matrix, dropping columns starting at column number $column, + * and $columnCount columns + * A negative $columnCount value will drop columns until that many columns from the end of the matrix + * A $columnCount value of 0 will remove all columns of the matrix from $column + * + * Note that column numbers start from 1, not from 0 + * + * @param int $column + * @param int $columnCount + * @return static + * @throws Exception + */ + public function dropColumns($column, $columnCount = 1) + { + $this->validateColumnInRange($column); + if ($columnCount < 1) { + $columnCount = $this->columns + $columnCount - $column + 1; + } + + $grid = $this->grid; + array_walk( + $grid, + function (&$row) use ($column, $columnCount) { + array_splice($row, $column - 1, (int)$columnCount); + } + ); + + return new static($grid); + } + + /** + * Return a value from this matrix, from the "cell" identified by the row and column numbers + * Note that row and column numbers start from 1, not from 0 + * + * @param int $row + * @param int $column + * @return mixed + * @throws Exception + */ + public function getValue($row, $column) + { + $row = $this->validateRowInRange($row); + $column = $this->validateColumnInRange($column); + + return $this->grid[$row - 1][$column - 1]; + } + + /** + * Returns a Generator that will yield each row of the matrix in turn as a vector matrix + * or the value of each cell if the matrix is a vector + * + * @return \Generator|Matrix[]|mixed[] + */ + public function rows() + { + foreach ($this->grid as $i => $row) { + yield $i + 1 => ($this->columns == 1) + ? $row[0] + : new static([$row]); + } + } + + /** + * Returns a Generator that will yield each column of the matrix in turn as a vector matrix + * or the value of each cell if the matrix is a vector + * + * @return \Generator|Matrix[]|mixed[] + */ + public function columns() + { + for ($i = 0; $i < $this->columns; ++$i) { + yield $i + 1 => ($this->rows == 1) + ? $this->grid[0][$i] + : new static(array_column($this->grid, $i)); + } + } + + /** + * Identify if the row and column dimensions of this matrix are equal, + * i.e. if it is a "square" matrix + * + * @return bool + */ + public function isSquare() + { + return $this->rows == $this->columns; + } + + /** + * Identify if this matrix is a vector + * i.e. if it comprises only a single row or a single column + * + * @return bool + */ + public function isVector() + { + return $this->rows == 1 || $this->columns == 1; + } + + /** + * Return the matrix as a 2-dimensional array + * + * @return array + */ + public function toArray() + { + return $this->grid; + } + + protected static $getters = [ + 'rows', + 'columns', + ]; + + /** + * Access specific properties as read-only (no setters) + * + * @param string $propertyName + * @return mixed + * @throws Exception + */ + public function __get($propertyName) + { + $propertyName = strtolower($propertyName); + + // Test for function calls + if (in_array($propertyName, self::$getters)) { + return $this->$propertyName; + } + + throw new Exception('Property does not exist'); + } + + protected static $functions = [ + 'antidiagonal', + 'adjoint', + 'cofactors', + 'determinant', + 'diagonal', + 'identity', + 'inverse', + 'minors', + 'trace', + 'transpose', + ]; + + protected static $operations = [ + 'add', + 'subtract', + 'multiply', + 'divideby', + 'divideinto', + 'directsum', + ]; + + /** + * Returns the result of the function call or operation + * + * @param string $functionName + * @param mixed[] $arguments + * @return Matrix|float + * @throws Exception + */ + public function __call($functionName, $arguments) + { + $functionName = strtolower(str_replace('_', '', $functionName)); + + if (in_array($functionName, self::$functions) || in_array($functionName, self::$operations)) { + $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}"; + if (is_callable($functionName)) { + $arguments = array_values(array_merge([$this], $arguments)); + return call_user_func_array($functionName, $arguments); + } + } + throw new Exception('Function or Operation does not exist'); + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Addition.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Addition.php new file mode 100644 index 0000000..e78c6d7 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Addition.php @@ -0,0 +1,68 @@ +addMatrix($value); + } elseif (is_numeric($value)) { + return $this->addScalar($value); + } + + throw new Exception('Invalid argument for addition'); + } + + /** + * Execute the addition for a scalar + * + * @param mixed $value The numeric value to add to the current base value + * @return $this The operation object, allowing multiple additions to be chained + **/ + protected function addScalar($value) + { + for ($row = 0; $row < $this->rows; ++$row) { + for ($column = 0; $column < $this->columns; ++$column) { + $this->matrix[$row][$column] += $value; + } + } + + return $this; + } + + /** + * Execute the addition for a matrix + * + * @param Matrix $value The numeric value to add to the current base value + * @return $this The operation object, allowing multiple additions to be chained + * @throws Exception If the provided argument is not appropriate for the operation + **/ + protected function addMatrix(Matrix $value) + { + $this->validateMatchingDimensions($value); + + for ($row = 0; $row < $this->rows; ++$row) { + for ($column = 0; $column < $this->columns; ++$column) { + $this->matrix[$row][$column] += $value->getValue($row + 1, $column + 1); + } + } + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/DirectSum.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/DirectSum.php new file mode 100644 index 0000000..6db0853 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/DirectSum.php @@ -0,0 +1,64 @@ +directSumMatrix($value); + } + + throw new Exception('Invalid argument for addition'); + } + + /** + * Execute the direct sum for a matrix + * + * @param Matrix $value The numeric value to concatenate/direct sum with the current base value + * @return $this The operation object, allowing multiple additions to be chained + **/ + private function directSumMatrix($value) + { + $originalColumnCount = count($this->matrix[0]); + $originalRowCount = count($this->matrix); + $valColumnCount = $value->columns; + $valRowCount = $value->rows; + $value = $value->toArray(); + + for ($row = 0; $row < $this->rows; ++$row) { + $this->matrix[$row] = array_merge($this->matrix[$row], array_fill(0, $valColumnCount, 0)); + } + + $this->matrix = array_merge( + $this->matrix, + array_fill(0, $valRowCount, array_fill(0, $originalColumnCount, 0)) + ); + + for ($row = $originalRowCount; $row < $originalRowCount + $valRowCount; ++$row) { + array_splice( + $this->matrix[$row], + $originalColumnCount, + $valColumnCount, + $value[$row - $originalRowCount] + ); + } + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Division.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Division.php new file mode 100644 index 0000000..2a573f5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Division.php @@ -0,0 +1,38 @@ +multiplyMatrix($value); + } elseif (is_numeric($value)) { + return $this->multiplyScalar(1 / $value); + } + + throw new Exception('Invalid argument for division'); + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Multiplication.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Multiplication.php new file mode 100644 index 0000000..63df162 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Multiplication.php @@ -0,0 +1,77 @@ +multiplyMatrix($value); + } elseif (is_numeric($value)) { + return $this->multiplyScalar($value); + } + + throw new Exception('Invalid argument for multiplication'); + } + + /** + * Execute the multiplication for a scalar + * + * @param mixed $value The numeric value to multiply with the current base value + * @return $this The operation object, allowing multiple mutiplications to be chained + **/ + protected function multiplyScalar($value) + { + for ($row = 0; $row < $this->rows; ++$row) { + for ($column = 0; $column < $this->columns; ++$column) { + $this->matrix[$row][$column] *= $value; + } + } + + return $this; + } + + /** + * Execute the multiplication for a matrix + * + * @param Matrix $value The numeric value to multiply with the current base value + * @return $this The operation object, allowing multiple mutiplications to be chained + * @throws Exception If the provided argument is not appropriate for the operation + **/ + protected function multiplyMatrix(Matrix $value) + { + $this->validateReflectingDimensions($value); + + $newRows = $this->rows; + $newColumns = $value->columns; + $matrix = Builder::createFilledMatrix(0, $newRows, $newColumns) + ->toArray(); + for ($row = 0; $row < $newRows; ++$row) { + for ($column = 0; $column < $newColumns; ++$column) { + $columnData = $value->getColumns($column + 1)->toArray(); + foreach ($this->matrix[$row] as $key => $valueData) { + $matrix[$row][$column] += $valueData * $columnData[$key][0]; + } + } + } + $this->matrix = $matrix; + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Operator.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Operator.php new file mode 100644 index 0000000..87d3f3b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Operator.php @@ -0,0 +1,78 @@ +rows = $matrix->rows; + $this->columns = $matrix->columns; + $this->matrix = $matrix->toArray(); + } + + /** + * Compare the dimensions of the matrices being operated on to see if they are valid for addition/subtraction + * + * @param Matrix $matrix The second Matrix object on which the operation will be performed + * @throws Exception + */ + protected function validateMatchingDimensions(Matrix $matrix) + { + if (($this->rows != $matrix->rows) || ($this->columns != $matrix->columns)) { + throw new Exception('Matrices have mismatched dimensions'); + } + } + + /** + * Compare the dimensions of the matrices being operated on to see if they are valid for multiplication/division + * + * @param Matrix $matrix The second Matrix object on which the operation will be performed + * @throws Exception + */ + protected function validateReflectingDimensions(Matrix $matrix) + { + if ($this->columns != $matrix->rows) { + throw new Exception('Matrices have mismatched dimensions'); + } + } + + /** + * Return the result of the operation + * + * @return Matrix + */ + public function result() + { + return new Matrix($this->matrix); + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Subtraction.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Subtraction.php new file mode 100644 index 0000000..57c0b14 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/Operators/Subtraction.php @@ -0,0 +1,68 @@ +subtractMatrix($value); + } elseif (is_numeric($value)) { + return $this->subtractScalar($value); + } + + throw new Exception('Invalid argument for subtraction'); + } + + /** + * Execute the subtraction for a scalar + * + * @param mixed $value The numeric value to subtracted from the current base value + * @return $this The operation object, allowing multiple additions to be chained + **/ + protected function subtractScalar($value) + { + for ($row = 0; $row < $this->rows; ++$row) { + for ($column = 0; $column < $this->columns; ++$column) { + $this->matrix[$row][$column] -= $value; + } + } + + return $this; + } + + /** + * Execute the subtraction for a matrix + * + * @param Matrix $value The numeric value to subtract from the current base value + * @return $this The operation object, allowing multiple subtractions to be chained + * @throws Exception If the provided argument is not appropriate for the operation + **/ + protected function subtractMatrix(Matrix $value) + { + $this->validateMatchingDimensions($value); + + for ($row = 0; $row < $this->rows; ++$row) { + for ($column = 0; $column < $this->columns; ++$column) { + $this->matrix[$row][$column] -= $value->getValue($row + 1, $column + 1); + } + } + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/adjoint.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/adjoint.php new file mode 100644 index 0000000..fc1e169 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/functions/adjoint.php @@ -0,0 +1,30 @@ + $matrixValues The matrices to add + * @return Matrix + * @throws Exception + */ +function add(...$matrixValues) +{ + if (count($matrixValues) < 2) { + throw new Exception('Addition operation requires at least 2 arguments'); + } + + $matrix = array_shift($matrixValues); + + if (is_array($matrix)) { + $matrix = new Matrix($matrix); + } + if (!$matrix instanceof Matrix) { + throw new Exception('Addition arguments must be Matrix or array'); + } + + $result = new Addition($matrix); + + foreach ($matrixValues as $matrix) { + $result->execute($matrix); + } + + return $result->result(); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/directsum.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/directsum.php new file mode 100644 index 0000000..9d15b89 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/directsum.php @@ -0,0 +1,44 @@ + $matrixValues The matrices to add + * @return Matrix + * @throws Exception + */ +function directsum(...$matrixValues) +{ + if (count($matrixValues) < 2) { + throw new Exception('DirectSum operation requires at least 2 arguments'); + } + + $matrix = array_shift($matrixValues); + + if (is_array($matrix)) { + $matrix = new Matrix($matrix); + } + if (!$matrix instanceof Matrix) { + throw new Exception('DirectSum arguments must be Matrix or array'); + } + + $result = new DirectSum($matrix); + + foreach ($matrixValues as $matrix) { + $result->execute($matrix); + } + + return $result->result(); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/divideby.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/divideby.php new file mode 100644 index 0000000..767d03a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/divideby.php @@ -0,0 +1,44 @@ + $matrixValues The matrices to divide + * @return Matrix + * @throws Exception + */ +function divideby(...$matrixValues) +{ + if (count($matrixValues) < 2) { + throw new Exception('Division operation requires at least 2 arguments'); + } + + $matrix = array_shift($matrixValues); + + if (is_array($matrix)) { + $matrix = new Matrix($matrix); + } + if (!$matrix instanceof Matrix) { + throw new Exception('Division arguments must be Matrix or array'); + } + + $result = new Division($matrix); + + foreach ($matrixValues as $matrix) { + $result->execute($matrix); + } + + return $result->result(); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/divideinto.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/divideinto.php new file mode 100644 index 0000000..f5cb8dc --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/divideinto.php @@ -0,0 +1,44 @@ + $matrixValues The numbers to divide + * @return Matrix + * @throws Exception + */ +function divideinto(...$matrixValues) +{ + if (count($matrixValues) < 2) { + throw new Exception('Division operation requires at least 2 arguments'); + } + + $matrix = array_shift($matrixValues); + + if (is_array($matrix)) { + $matrix = new Matrix($matrix); + } + if (!$matrix instanceof Matrix) { + throw new Exception('Division arguments must be Matrix or array'); + } + + $result = new Division($matrix); + + foreach ($matrixValues as $matrix) { + $result->execute($matrix); + } + + return $result->result(); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/multiply.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/multiply.php new file mode 100644 index 0000000..1428f09 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/multiply.php @@ -0,0 +1,44 @@ + $matrixValues The matrices to multiply + * @return Matrix + * @throws Exception + */ +function multiply(...$matrixValues) +{ + if (count($matrixValues) < 2) { + throw new Exception('Multiplication operation requires at least 2 arguments'); + } + + $matrix = array_shift($matrixValues); + + if (is_array($matrix)) { + $matrix = new Matrix($matrix); + } + if (!$matrix instanceof Matrix) { + throw new Exception('Multiplication arguments must be Matrix or array'); + } + + $result = new Multiplication($matrix); + + foreach ($matrixValues as $matrix) { + $result->execute($matrix); + } + + return $result->result(); +} diff --git a/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/subtract.php b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/subtract.php new file mode 100644 index 0000000..3123b61 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/markbaker/matrix/classes/src/operations/subtract.php @@ -0,0 +1,44 @@ + $matrixValues The matrices to subtract + * @return Matrix + * @throws Exception + */ +function subtract(...$matrixValues) +{ + if (count($matrixValues) < 2) { + throw new Exception('Subtraction operation requires at least 2 arguments'); + } + + $matrix = array_shift($matrixValues); + + if (is_array($matrix)) { + $matrix = new Matrix($matrix); + } + if (!$matrix instanceof Matrix) { + throw new Exception('Subtraction arguments must be Matrix or array'); + } + + $result = new Subtraction($matrix); + + foreach ($matrixValues as $matrix) { + $result->execute($matrix); + } + + return $result->result(); +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel new file mode 100644 index 0000000..51c60d4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel @@ -0,0 +1,8 @@ +#!/usr/bin/env php +migrate(); diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/bin/pre-commit b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/bin/pre-commit new file mode 100644 index 0000000..8d93f8a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/bin/pre-commit @@ -0,0 +1,33 @@ +#!/bin/bash + +pass=true + +files=$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(php|phtml)$') +if [ "$files" != "" ]; then + + # Run php syntax check before commit + while read -r file; do + php -l "$file" + if [ $? -ne 0 ]; then + pass=false + fi + done <<< "$files" + + # Run php-cs-fixer validation before commit + echo "$files" | xargs ./vendor/bin/php-cs-fixer fix --diff --config .php_cs.dist + if [ $? -ne 0 ]; then + pass=false + fi + + # Automatically add files that may have been fixed by php-cs-fixer + echo "$files" | xargs git add +fi + +if $pass; then + exit 0 +else + echo "" + echo "PRE-COMMIT HOOK FAILED:" + echo "Code style validation failed. Please fix errors and try committing again." + exit 1 +fi diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/Bootstrap.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/Bootstrap.php new file mode 100644 index 0000000..f15de26 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/Bootstrap.php @@ -0,0 +1,22 @@ +=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?\b([a-z]{1,3})\$?(\d{1,7})(?![\w.])'; + // Named Range of cells + const CALCULATION_REGEXP_NAMEDRANGE = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)'; + // Error + const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?'; + + /** constants */ + const RETURN_ARRAY_AS_ERROR = 'error'; + const RETURN_ARRAY_AS_VALUE = 'value'; + const RETURN_ARRAY_AS_ARRAY = 'array'; + + private static $returnArrayAsType = self::RETURN_ARRAY_AS_VALUE; + + /** + * Instance of this class. + * + * @var Calculation + */ + private static $instance; + + /** + * Instance of the spreadsheet this Calculation Engine is using. + * + * @var Spreadsheet + */ + private $spreadsheet; + + /** + * Calculation cache. + * + * @var array + */ + private $calculationCache = []; + + /** + * Calculation cache enabled. + * + * @var bool + */ + private $calculationCacheEnabled = true; + + /** + * Used to generate unique store keys. + * + * @var int + */ + private $branchStoreKeyCounter = 0; + + private $branchPruningEnabled = true; + + /** + * List of operators that can be used within formulae + * The true/false value indicates whether it is a binary operator or a unary operator. + * + * @var array + */ + private static $operators = [ + '+' => true, '-' => true, '*' => true, '/' => true, + '^' => true, '&' => true, '%' => false, '~' => false, + '>' => true, '<' => true, '=' => true, '>=' => true, + '<=' => true, '<>' => true, '|' => true, ':' => true, + ]; + + /** + * List of binary operators (those that expect two operands). + * + * @var array + */ + private static $binaryOperators = [ + '+' => true, '-' => true, '*' => true, '/' => true, + '^' => true, '&' => true, '>' => true, '<' => true, + '=' => true, '>=' => true, '<=' => true, '<>' => true, + '|' => true, ':' => true, + ]; + + /** + * The debug log generated by the calculation engine. + * + * @var Logger + */ + private $debugLog; + + /** + * Flag to determine how formula errors should be handled + * If true, then a user error will be triggered + * If false, then an exception will be thrown. + * + * @var bool + */ + public $suppressFormulaErrors = false; + + /** + * Error message for any error that was raised/thrown by the calculation engine. + * + * @var string + */ + public $formulaError; + + /** + * An array of the nested cell references accessed by the calculation engine, used for the debug log. + * + * @var CyclicReferenceStack + */ + private $cyclicReferenceStack; + + private $cellStack = []; + + /** + * Current iteration counter for cyclic formulae + * If the value is 0 (or less) then cyclic formulae will throw an exception, + * otherwise they will iterate to the limit defined here before returning a result. + * + * @var int + */ + private $cyclicFormulaCounter = 1; + + private $cyclicFormulaCell = ''; + + /** + * Number of iterations for cyclic formulae. + * + * @var int + */ + public $cyclicFormulaCount = 1; + + /** + * Epsilon Precision used for comparisons in calculations. + * + * @var float + */ + private $delta = 0.1e-12; + + /** + * The current locale setting. + * + * @var string + */ + private static $localeLanguage = 'en_us'; // US English (default locale) + + /** + * List of available locale settings + * Note that this is read for the locale subdirectory only when requested. + * + * @var string[] + */ + private static $validLocaleLanguages = [ + 'en', // English (default language) + ]; + + /** + * Locale-specific argument separator for function arguments. + * + * @var string + */ + private static $localeArgumentSeparator = ','; + + private static $localeFunctions = []; + + /** + * Locale-specific translations for Excel constants (True, False and Null). + * + * @var string[] + */ + public static $localeBoolean = [ + 'TRUE' => 'TRUE', + 'FALSE' => 'FALSE', + 'NULL' => 'NULL', + ]; + + /** + * Excel constant string translations to their PHP equivalents + * Constant conversion from text name/value to actual (datatyped) value. + * + * @var string[] + */ + private static $excelConstants = [ + 'TRUE' => true, + 'FALSE' => false, + 'NULL' => null, + ]; + + // PhpSpreadsheet functions + private static $phpSpreadsheetFunctions = [ + 'ABS' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'abs', + 'argumentCount' => '1', + ], + 'ACCRINT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'ACCRINT'], + 'argumentCount' => '4-7', + ], + 'ACCRINTM' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'ACCRINTM'], + 'argumentCount' => '3-5', + ], + 'ACOS' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'acos', + 'argumentCount' => '1', + ], + 'ACOSH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'acosh', + 'argumentCount' => '1', + ], + 'ACOT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'ACOT'], + 'argumentCount' => '1', + ], + 'ACOTH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'ACOTH'], + 'argumentCount' => '1', + ], + 'ADDRESS' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'cellAddress'], + 'argumentCount' => '2-5', + ], + 'AMORDEGRC' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'AMORDEGRC'], + 'argumentCount' => '6,7', + ], + 'AMORLINC' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'AMORLINC'], + 'argumentCount' => '6,7', + ], + 'AND' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'logicalAnd'], + 'argumentCount' => '1+', + ], + 'ARABIC' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'ARABIC'], + 'argumentCount' => '1', + ], + 'AREAS' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1', + ], + 'ASC' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1', + ], + 'ASIN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'asin', + 'argumentCount' => '1', + ], + 'ASINH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'asinh', + 'argumentCount' => '1', + ], + 'ATAN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'atan', + 'argumentCount' => '1', + ], + 'ATAN2' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'ATAN2'], + 'argumentCount' => '2', + ], + 'ATANH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'atanh', + 'argumentCount' => '1', + ], + 'AVEDEV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'AVEDEV'], + 'argumentCount' => '1+', + ], + 'AVERAGE' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'AVERAGE'], + 'argumentCount' => '1+', + ], + 'AVERAGEA' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'AVERAGEA'], + 'argumentCount' => '1+', + ], + 'AVERAGEIF' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'AVERAGEIF'], + 'argumentCount' => '2,3', + ], + 'AVERAGEIFS' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '3+', + ], + 'BAHTTEXT' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1', + ], + 'BASE' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'BASE'], + 'argumentCount' => '2,3', + ], + 'BESSELI' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BESSELI'], + 'argumentCount' => '2', + ], + 'BESSELJ' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BESSELJ'], + 'argumentCount' => '2', + ], + 'BESSELK' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BESSELK'], + 'argumentCount' => '2', + ], + 'BESSELY' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BESSELY'], + 'argumentCount' => '2', + ], + 'BETADIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'BETADIST'], + 'argumentCount' => '3-5', + ], + 'BETAINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'BETAINV'], + 'argumentCount' => '3-5', + ], + 'BIN2DEC' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BINTODEC'], + 'argumentCount' => '1', + ], + 'BIN2HEX' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BINTOHEX'], + 'argumentCount' => '1,2', + ], + 'BIN2OCT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BINTOOCT'], + 'argumentCount' => '1,2', + ], + 'BINOMDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'BINOMDIST'], + 'argumentCount' => '4', + ], + 'BITAND' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BITAND'], + 'argumentCount' => '2', + ], + 'BITOR' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BITOR'], + 'argumentCount' => '2', + ], + 'BITXOR' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BITOR'], + 'argumentCount' => '2', + ], + 'BITLSHIFT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BITLSHIFT'], + 'argumentCount' => '2', + ], + 'BITRSHIFT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'BITRSHIFT'], + 'argumentCount' => '2', + ], + 'CEILING' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'CEILING'], + 'argumentCount' => '2', + ], + 'CELL' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1,2', + ], + 'CHAR' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'CHARACTER'], + 'argumentCount' => '1', + ], + 'CHIDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'CHIDIST'], + 'argumentCount' => '2', + ], + 'CHIINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'CHIINV'], + 'argumentCount' => '2', + ], + 'CHITEST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '2', + ], + 'CHOOSE' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'CHOOSE'], + 'argumentCount' => '2+', + ], + 'CLEAN' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'TRIMNONPRINTABLE'], + 'argumentCount' => '1', + ], + 'CODE' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'ASCIICODE'], + 'argumentCount' => '1', + ], + 'COLUMN' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'COLUMN'], + 'argumentCount' => '-1', + 'passByReference' => [true], + ], + 'COLUMNS' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'COLUMNS'], + 'argumentCount' => '1', + ], + 'COMBIN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'COMBIN'], + 'argumentCount' => '2', + ], + 'COMPLEX' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'COMPLEX'], + 'argumentCount' => '2,3', + ], + 'CONCAT' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'CONCATENATE'], + 'argumentCount' => '1+', + ], + 'CONCATENATE' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'CONCATENATE'], + 'argumentCount' => '1+', + ], + 'CONFIDENCE' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'CONFIDENCE'], + 'argumentCount' => '3', + ], + 'CONVERT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'CONVERTUOM'], + 'argumentCount' => '3', + ], + 'CORREL' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'CORREL'], + 'argumentCount' => '2', + ], + 'COS' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'cos', + 'argumentCount' => '1', + ], + 'COSH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'cosh', + 'argumentCount' => '1', + ], + 'COT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'COT'], + 'argumentCount' => '1', + ], + 'COTH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'COTH'], + 'argumentCount' => '1', + ], + 'COUNT' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'COUNT'], + 'argumentCount' => '1+', + ], + 'COUNTA' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'COUNTA'], + 'argumentCount' => '1+', + ], + 'COUNTBLANK' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'COUNTBLANK'], + 'argumentCount' => '1', + ], + 'COUNTIF' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'COUNTIF'], + 'argumentCount' => '2', + ], + 'COUNTIFS' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'COUNTIFS'], + 'argumentCount' => '2+', + ], + 'COUPDAYBS' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'COUPDAYBS'], + 'argumentCount' => '3,4', + ], + 'COUPDAYS' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'COUPDAYS'], + 'argumentCount' => '3,4', + ], + 'COUPDAYSNC' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'COUPDAYSNC'], + 'argumentCount' => '3,4', + ], + 'COUPNCD' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'COUPNCD'], + 'argumentCount' => '3,4', + ], + 'COUPNUM' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'COUPNUM'], + 'argumentCount' => '3,4', + ], + 'COUPPCD' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'COUPPCD'], + 'argumentCount' => '3,4', + ], + 'COVAR' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'COVAR'], + 'argumentCount' => '2', + ], + 'CRITBINOM' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'CRITBINOM'], + 'argumentCount' => '3', + ], + 'CSC' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'CSC'], + 'argumentCount' => '1', + ], + 'CSCH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'CSCH'], + 'argumentCount' => '1', + ], + 'CUBEKPIMEMBER' => [ + 'category' => Category::CATEGORY_CUBE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '?', + ], + 'CUBEMEMBER' => [ + 'category' => Category::CATEGORY_CUBE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '?', + ], + 'CUBEMEMBERPROPERTY' => [ + 'category' => Category::CATEGORY_CUBE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '?', + ], + 'CUBERANKEDMEMBER' => [ + 'category' => Category::CATEGORY_CUBE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '?', + ], + 'CUBESET' => [ + 'category' => Category::CATEGORY_CUBE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '?', + ], + 'CUBESETCOUNT' => [ + 'category' => Category::CATEGORY_CUBE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '?', + ], + 'CUBEVALUE' => [ + 'category' => Category::CATEGORY_CUBE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '?', + ], + 'CUMIPMT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'CUMIPMT'], + 'argumentCount' => '6', + ], + 'CUMPRINC' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'CUMPRINC'], + 'argumentCount' => '6', + ], + 'DATE' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'DATE'], + 'argumentCount' => '3', + ], + 'DATEDIF' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'DATEDIF'], + 'argumentCount' => '2,3', + ], + 'DATEVALUE' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'DATEVALUE'], + 'argumentCount' => '1', + ], + 'DAVERAGE' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DAVERAGE'], + 'argumentCount' => '3', + ], + 'DAY' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'DAYOFMONTH'], + 'argumentCount' => '1', + ], + 'DAYS' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'DAYS'], + 'argumentCount' => '2', + ], + 'DAYS360' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'DAYS360'], + 'argumentCount' => '2,3', + ], + 'DB' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'DB'], + 'argumentCount' => '4,5', + ], + 'DCOUNT' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DCOUNT'], + 'argumentCount' => '3', + ], + 'DCOUNTA' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DCOUNTA'], + 'argumentCount' => '3', + ], + 'DDB' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'DDB'], + 'argumentCount' => '4,5', + ], + 'DEC2BIN' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'DECTOBIN'], + 'argumentCount' => '1,2', + ], + 'DEC2HEX' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'DECTOHEX'], + 'argumentCount' => '1,2', + ], + 'DEC2OCT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'DECTOOCT'], + 'argumentCount' => '1,2', + ], + 'DEGREES' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'rad2deg', + 'argumentCount' => '1', + ], + 'DELTA' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'DELTA'], + 'argumentCount' => '1,2', + ], + 'DEVSQ' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'DEVSQ'], + 'argumentCount' => '1+', + ], + 'DGET' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DGET'], + 'argumentCount' => '3', + ], + 'DISC' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'DISC'], + 'argumentCount' => '4,5', + ], + 'DMAX' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DMAX'], + 'argumentCount' => '3', + ], + 'DMIN' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DMIN'], + 'argumentCount' => '3', + ], + 'DOLLAR' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'DOLLAR'], + 'argumentCount' => '1,2', + ], + 'DOLLARDE' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'DOLLARDE'], + 'argumentCount' => '2', + ], + 'DOLLARFR' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'DOLLARFR'], + 'argumentCount' => '2', + ], + 'DPRODUCT' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DPRODUCT'], + 'argumentCount' => '3', + ], + 'DSTDEV' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DSTDEV'], + 'argumentCount' => '3', + ], + 'DSTDEVP' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DSTDEVP'], + 'argumentCount' => '3', + ], + 'DSUM' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DSUM'], + 'argumentCount' => '3', + ], + 'DURATION' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '5,6', + ], + 'DVAR' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DVAR'], + 'argumentCount' => '3', + ], + 'DVARP' => [ + 'category' => Category::CATEGORY_DATABASE, + 'functionCall' => [Database::class, 'DVARP'], + 'argumentCount' => '3', + ], + 'EDATE' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'EDATE'], + 'argumentCount' => '2', + ], + 'EFFECT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'EFFECT'], + 'argumentCount' => '2', + ], + 'EOMONTH' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'EOMONTH'], + 'argumentCount' => '2', + ], + 'ERF' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'ERF'], + 'argumentCount' => '1,2', + ], + 'ERF.PRECISE' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'ERFPRECISE'], + 'argumentCount' => '1', + ], + 'ERFC' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'ERFC'], + 'argumentCount' => '1', + ], + 'ERFC.PRECISE' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'ERFC'], + 'argumentCount' => '1', + ], + 'ERROR.TYPE' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'errorType'], + 'argumentCount' => '1', + ], + 'EVEN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'EVEN'], + 'argumentCount' => '1', + ], + 'EXACT' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'EXACT'], + 'argumentCount' => '2', + ], + 'EXP' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'exp', + 'argumentCount' => '1', + ], + 'EXPONDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'EXPONDIST'], + 'argumentCount' => '3', + ], + 'FACT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'FACT'], + 'argumentCount' => '1', + ], + 'FACTDOUBLE' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'FACTDOUBLE'], + 'argumentCount' => '1', + ], + 'FALSE' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'FALSE'], + 'argumentCount' => '0', + ], + 'FDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '3', + ], + 'FIND' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'SEARCHSENSITIVE'], + 'argumentCount' => '2,3', + ], + 'FINDB' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'SEARCHSENSITIVE'], + 'argumentCount' => '2,3', + ], + 'FINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '3', + ], + 'FISHER' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'FISHER'], + 'argumentCount' => '1', + ], + 'FISHERINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'FISHERINV'], + 'argumentCount' => '1', + ], + 'FIXED' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'FIXEDFORMAT'], + 'argumentCount' => '1-3', + ], + 'FLOOR' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'FLOOR'], + 'argumentCount' => '2', + ], + 'FORECAST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'FORECAST'], + 'argumentCount' => '3', + ], + 'FORMULATEXT' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'FORMULATEXT'], + 'argumentCount' => '1', + 'passCellReference' => true, + 'passByReference' => [true], + ], + 'FREQUENCY' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '2', + ], + 'FTEST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '2', + ], + 'FV' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'FV'], + 'argumentCount' => '3-5', + ], + 'FVSCHEDULE' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'FVSCHEDULE'], + 'argumentCount' => '2', + ], + 'GAMMADIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'GAMMADIST'], + 'argumentCount' => '4', + ], + 'GAMMAINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'GAMMAINV'], + 'argumentCount' => '3', + ], + 'GAMMALN' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'GAMMALN'], + 'argumentCount' => '1', + ], + 'GCD' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'GCD'], + 'argumentCount' => '1+', + ], + 'GEOMEAN' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'GEOMEAN'], + 'argumentCount' => '1+', + ], + 'GESTEP' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'GESTEP'], + 'argumentCount' => '1,2', + ], + 'GETPIVOTDATA' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '2+', + ], + 'GROWTH' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'GROWTH'], + 'argumentCount' => '1-4', + ], + 'HARMEAN' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'HARMEAN'], + 'argumentCount' => '1+', + ], + 'HEX2BIN' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'HEXTOBIN'], + 'argumentCount' => '1,2', + ], + 'HEX2DEC' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'HEXTODEC'], + 'argumentCount' => '1', + ], + 'HEX2OCT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'HEXTOOCT'], + 'argumentCount' => '1,2', + ], + 'HLOOKUP' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'HLOOKUP'], + 'argumentCount' => '3,4', + ], + 'HOUR' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'HOUROFDAY'], + 'argumentCount' => '1', + ], + 'HYPERLINK' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'HYPERLINK'], + 'argumentCount' => '1,2', + 'passCellReference' => true, + ], + 'HYPGEOMDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'HYPGEOMDIST'], + 'argumentCount' => '4', + ], + 'IF' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'statementIf'], + 'argumentCount' => '1-3', + ], + 'IFERROR' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'IFERROR'], + 'argumentCount' => '2', + ], + 'IFNA' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'IFNA'], + 'argumentCount' => '2', + ], + 'IMABS' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMABS'], + 'argumentCount' => '1', + ], + 'IMAGINARY' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMAGINARY'], + 'argumentCount' => '1', + ], + 'IMARGUMENT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMARGUMENT'], + 'argumentCount' => '1', + ], + 'IMCONJUGATE' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMCONJUGATE'], + 'argumentCount' => '1', + ], + 'IMCOS' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMCOS'], + 'argumentCount' => '1', + ], + 'IMCOSH' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMCOSH'], + 'argumentCount' => '1', + ], + 'IMCOT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMCOT'], + 'argumentCount' => '1', + ], + 'IMCSC' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMCSC'], + 'argumentCount' => '1', + ], + 'IMCSCH' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMCSCH'], + 'argumentCount' => '1', + ], + 'IMDIV' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMDIV'], + 'argumentCount' => '2', + ], + 'IMEXP' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMEXP'], + 'argumentCount' => '1', + ], + 'IMLN' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMLN'], + 'argumentCount' => '1', + ], + 'IMLOG10' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMLOG10'], + 'argumentCount' => '1', + ], + 'IMLOG2' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMLOG2'], + 'argumentCount' => '1', + ], + 'IMPOWER' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMPOWER'], + 'argumentCount' => '2', + ], + 'IMPRODUCT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMPRODUCT'], + 'argumentCount' => '1+', + ], + 'IMREAL' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMREAL'], + 'argumentCount' => '1', + ], + 'IMSEC' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMSEC'], + 'argumentCount' => '1', + ], + 'IMSECH' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMSECH'], + 'argumentCount' => '1', + ], + 'IMSIN' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMSIN'], + 'argumentCount' => '1', + ], + 'IMSINH' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMSINH'], + 'argumentCount' => '1', + ], + 'IMSQRT' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMSQRT'], + 'argumentCount' => '1', + ], + 'IMSUB' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMSUB'], + 'argumentCount' => '2', + ], + 'IMSUM' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMSUM'], + 'argumentCount' => '1+', + ], + 'IMTAN' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'IMTAN'], + 'argumentCount' => '1', + ], + 'INDEX' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'INDEX'], + 'argumentCount' => '1-4', + ], + 'INDIRECT' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'INDIRECT'], + 'argumentCount' => '1,2', + 'passCellReference' => true, + ], + 'INFO' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1', + ], + 'INT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'INT'], + 'argumentCount' => '1', + ], + 'INTERCEPT' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'INTERCEPT'], + 'argumentCount' => '2', + ], + 'INTRATE' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'INTRATE'], + 'argumentCount' => '4,5', + ], + 'IPMT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'IPMT'], + 'argumentCount' => '4-6', + ], + 'IRR' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'IRR'], + 'argumentCount' => '1,2', + ], + 'ISBLANK' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isBlank'], + 'argumentCount' => '1', + ], + 'ISERR' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isErr'], + 'argumentCount' => '1', + ], + 'ISERROR' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isError'], + 'argumentCount' => '1', + ], + 'ISEVEN' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isEven'], + 'argumentCount' => '1', + ], + 'ISFORMULA' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isFormula'], + 'argumentCount' => '1', + 'passCellReference' => true, + 'passByReference' => [true], + ], + 'ISLOGICAL' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isLogical'], + 'argumentCount' => '1', + ], + 'ISNA' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isNa'], + 'argumentCount' => '1', + ], + 'ISNONTEXT' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isNonText'], + 'argumentCount' => '1', + ], + 'ISNUMBER' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isNumber'], + 'argumentCount' => '1', + ], + 'ISODD' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isOdd'], + 'argumentCount' => '1', + ], + 'ISOWEEKNUM' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'ISOWEEKNUM'], + 'argumentCount' => '1', + ], + 'ISPMT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'ISPMT'], + 'argumentCount' => '4', + ], + 'ISREF' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1', + ], + 'ISTEXT' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'isText'], + 'argumentCount' => '1', + ], + 'JIS' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1', + ], + 'KURT' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'KURT'], + 'argumentCount' => '1+', + ], + 'LARGE' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'LARGE'], + 'argumentCount' => '2', + ], + 'LCM' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'LCM'], + 'argumentCount' => '1+', + ], + 'LEFT' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'LEFT'], + 'argumentCount' => '1,2', + ], + 'LEFTB' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'LEFT'], + 'argumentCount' => '1,2', + ], + 'LEN' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'STRINGLENGTH'], + 'argumentCount' => '1', + ], + 'LENB' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'STRINGLENGTH'], + 'argumentCount' => '1', + ], + 'LINEST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'LINEST'], + 'argumentCount' => '1-4', + ], + 'LN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'log', + 'argumentCount' => '1', + ], + 'LOG' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'logBase'], + 'argumentCount' => '1,2', + ], + 'LOG10' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'log10', + 'argumentCount' => '1', + ], + 'LOGEST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'LOGEST'], + 'argumentCount' => '1-4', + ], + 'LOGINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'LOGINV'], + 'argumentCount' => '3', + ], + 'LOGNORMDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'LOGNORMDIST'], + 'argumentCount' => '3', + ], + 'LOOKUP' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'LOOKUP'], + 'argumentCount' => '2,3', + ], + 'LOWER' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'LOWERCASE'], + 'argumentCount' => '1', + ], + 'MATCH' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'MATCH'], + 'argumentCount' => '2,3', + ], + 'MAX' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MAX'], + 'argumentCount' => '1+', + ], + 'MAXA' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MAXA'], + 'argumentCount' => '1+', + ], + 'MAXIFS' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MAXIFS'], + 'argumentCount' => '3+', + ], + 'MDETERM' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'MDETERM'], + 'argumentCount' => '1', + ], + 'MDURATION' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '5,6', + ], + 'MEDIAN' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MEDIAN'], + 'argumentCount' => '1+', + ], + 'MEDIANIF' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '2+', + ], + 'MID' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'MID'], + 'argumentCount' => '3', + ], + 'MIDB' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'MID'], + 'argumentCount' => '3', + ], + 'MIN' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MIN'], + 'argumentCount' => '1+', + ], + 'MINA' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MINA'], + 'argumentCount' => '1+', + ], + 'MINIFS' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MINIFS'], + 'argumentCount' => '3+', + ], + 'MINUTE' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'MINUTE'], + 'argumentCount' => '1', + ], + 'MINVERSE' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'MINVERSE'], + 'argumentCount' => '1', + ], + 'MIRR' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'MIRR'], + 'argumentCount' => '3', + ], + 'MMULT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'MMULT'], + 'argumentCount' => '2', + ], + 'MOD' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'MOD'], + 'argumentCount' => '2', + ], + 'MODE' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MODE'], + 'argumentCount' => '1+', + ], + 'MODE.SNGL' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'MODE'], + 'argumentCount' => '1+', + ], + 'MONTH' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'MONTHOFYEAR'], + 'argumentCount' => '1', + ], + 'MROUND' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'MROUND'], + 'argumentCount' => '2', + ], + 'MULTINOMIAL' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'MULTINOMIAL'], + 'argumentCount' => '1+', + ], + 'N' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'n'], + 'argumentCount' => '1', + ], + 'NA' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'NA'], + 'argumentCount' => '0', + ], + 'NEGBINOMDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'NEGBINOMDIST'], + 'argumentCount' => '3', + ], + 'NETWORKDAYS' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'NETWORKDAYS'], + 'argumentCount' => '2+', + ], + 'NOMINAL' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'NOMINAL'], + 'argumentCount' => '2', + ], + 'NORMDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'NORMDIST'], + 'argumentCount' => '4', + ], + 'NORMINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'NORMINV'], + 'argumentCount' => '3', + ], + 'NORMSDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'NORMSDIST'], + 'argumentCount' => '1', + ], + 'NORMSINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'NORMSINV'], + 'argumentCount' => '1', + ], + 'NOT' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'NOT'], + 'argumentCount' => '1', + ], + 'NOW' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'DATETIMENOW'], + 'argumentCount' => '0', + ], + 'NPER' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'NPER'], + 'argumentCount' => '3-5', + ], + 'NPV' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'NPV'], + 'argumentCount' => '2+', + ], + 'NUMBERVALUE' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'NUMBERVALUE'], + 'argumentCount' => '1+', + ], + 'OCT2BIN' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'OCTTOBIN'], + 'argumentCount' => '1,2', + ], + 'OCT2DEC' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'OCTTODEC'], + 'argumentCount' => '1', + ], + 'OCT2HEX' => [ + 'category' => Category::CATEGORY_ENGINEERING, + 'functionCall' => [Engineering::class, 'OCTTOHEX'], + 'argumentCount' => '1,2', + ], + 'ODD' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'ODD'], + 'argumentCount' => '1', + ], + 'ODDFPRICE' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '8,9', + ], + 'ODDFYIELD' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '8,9', + ], + 'ODDLPRICE' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '7,8', + ], + 'ODDLYIELD' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '7,8', + ], + 'OFFSET' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'OFFSET'], + 'argumentCount' => '3-5', + 'passCellReference' => true, + 'passByReference' => [true], + ], + 'OR' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'logicalOr'], + 'argumentCount' => '1+', + ], + 'PDURATION' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'PDURATION'], + 'argumentCount' => '3', + ], + 'PEARSON' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'CORREL'], + 'argumentCount' => '2', + ], + 'PERCENTILE' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'PERCENTILE'], + 'argumentCount' => '2', + ], + 'PERCENTRANK' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'PERCENTRANK'], + 'argumentCount' => '2,3', + ], + 'PERMUT' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'PERMUT'], + 'argumentCount' => '2', + ], + 'PHONETIC' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1', + ], + 'PI' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'pi', + 'argumentCount' => '0', + ], + 'PMT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'PMT'], + 'argumentCount' => '3-5', + ], + 'POISSON' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'POISSON'], + 'argumentCount' => '3', + ], + 'POWER' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'POWER'], + 'argumentCount' => '2', + ], + 'PPMT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'PPMT'], + 'argumentCount' => '4-6', + ], + 'PRICE' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'PRICE'], + 'argumentCount' => '6,7', + ], + 'PRICEDISC' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'PRICEDISC'], + 'argumentCount' => '4,5', + ], + 'PRICEMAT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'PRICEMAT'], + 'argumentCount' => '5,6', + ], + 'PROB' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '3,4', + ], + 'PRODUCT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'PRODUCT'], + 'argumentCount' => '1+', + ], + 'PROPER' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'PROPERCASE'], + 'argumentCount' => '1', + ], + 'PV' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'PV'], + 'argumentCount' => '3-5', + ], + 'QUARTILE' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'QUARTILE'], + 'argumentCount' => '2', + ], + 'QUOTIENT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'QUOTIENT'], + 'argumentCount' => '2', + ], + 'RADIANS' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'deg2rad', + 'argumentCount' => '1', + ], + 'RAND' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'RAND'], + 'argumentCount' => '0', + ], + 'RANDBETWEEN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'RAND'], + 'argumentCount' => '2', + ], + 'RANK' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'RANK'], + 'argumentCount' => '2,3', + ], + 'RATE' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'RATE'], + 'argumentCount' => '3-6', + ], + 'RECEIVED' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'RECEIVED'], + 'argumentCount' => '4-5', + ], + 'REPLACE' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'REPLACE'], + 'argumentCount' => '4', + ], + 'REPLACEB' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'REPLACE'], + 'argumentCount' => '4', + ], + 'REPT' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => 'str_repeat', + 'argumentCount' => '2', + ], + 'RIGHT' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'RIGHT'], + 'argumentCount' => '1,2', + ], + 'RIGHTB' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'RIGHT'], + 'argumentCount' => '1,2', + ], + 'ROMAN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'ROMAN'], + 'argumentCount' => '1,2', + ], + 'ROUND' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'round', + 'argumentCount' => '2', + ], + 'ROUNDDOWN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'ROUNDDOWN'], + 'argumentCount' => '2', + ], + 'ROUNDUP' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'ROUNDUP'], + 'argumentCount' => '2', + ], + 'ROW' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'ROW'], + 'argumentCount' => '-1', + 'passByReference' => [true], + ], + 'ROWS' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'ROWS'], + 'argumentCount' => '1', + ], + 'RRI' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'RRI'], + 'argumentCount' => '3', + ], + 'RSQ' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'RSQ'], + 'argumentCount' => '2', + ], + 'RTD' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '1+', + ], + 'SEARCH' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'SEARCHINSENSITIVE'], + 'argumentCount' => '2,3', + ], + 'SEARCHB' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'SEARCHINSENSITIVE'], + 'argumentCount' => '2,3', + ], + 'SEC' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SEC'], + 'argumentCount' => '1', + ], + 'SECH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SECH'], + 'argumentCount' => '1', + ], + 'SECOND' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'SECOND'], + 'argumentCount' => '1', + ], + 'SERIESSUM' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SERIESSUM'], + 'argumentCount' => '4', + ], + 'SIGN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SIGN'], + 'argumentCount' => '1', + ], + 'SIN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'sin', + 'argumentCount' => '1', + ], + 'SINH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'sinh', + 'argumentCount' => '1', + ], + 'SKEW' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'SKEW'], + 'argumentCount' => '1+', + ], + 'SLN' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'SLN'], + 'argumentCount' => '3', + ], + 'SLOPE' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'SLOPE'], + 'argumentCount' => '2', + ], + 'SMALL' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'SMALL'], + 'argumentCount' => '2', + ], + 'SQRT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'sqrt', + 'argumentCount' => '1', + ], + 'SQRTPI' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SQRTPI'], + 'argumentCount' => '1', + ], + 'STANDARDIZE' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'STANDARDIZE'], + 'argumentCount' => '3', + ], + 'STDEV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'STDEV'], + 'argumentCount' => '1+', + ], + 'STDEV.S' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'STDEV'], + 'argumentCount' => '1+', + ], + 'STDEV.P' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'STDEVP'], + 'argumentCount' => '1+', + ], + 'STDEVA' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'STDEVA'], + 'argumentCount' => '1+', + ], + 'STDEVP' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'STDEVP'], + 'argumentCount' => '1+', + ], + 'STDEVPA' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'STDEVPA'], + 'argumentCount' => '1+', + ], + 'STEYX' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'STEYX'], + 'argumentCount' => '2', + ], + 'SUBSTITUTE' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'SUBSTITUTE'], + 'argumentCount' => '3,4', + ], + 'SUBTOTAL' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUBTOTAL'], + 'argumentCount' => '2+', + 'passCellReference' => true, + ], + 'SUM' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUM'], + 'argumentCount' => '1+', + ], + 'SUMIF' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUMIF'], + 'argumentCount' => '2,3', + ], + 'SUMIFS' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUMIFS'], + 'argumentCount' => '3+', + ], + 'SUMPRODUCT' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUMPRODUCT'], + 'argumentCount' => '1+', + ], + 'SUMSQ' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUMSQ'], + 'argumentCount' => '1+', + ], + 'SUMX2MY2' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUMX2MY2'], + 'argumentCount' => '2', + ], + 'SUMX2PY2' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUMX2PY2'], + 'argumentCount' => '2', + ], + 'SUMXMY2' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'SUMXMY2'], + 'argumentCount' => '2', + ], + 'SWITCH' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'statementSwitch'], + 'argumentCount' => '3+', + ], + 'SYD' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'SYD'], + 'argumentCount' => '4', + ], + 'T' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'RETURNSTRING'], + 'argumentCount' => '1', + ], + 'TAN' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'tan', + 'argumentCount' => '1', + ], + 'TANH' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => 'tanh', + 'argumentCount' => '1', + ], + 'TBILLEQ' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'TBILLEQ'], + 'argumentCount' => '3', + ], + 'TBILLPRICE' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'TBILLPRICE'], + 'argumentCount' => '3', + ], + 'TBILLYIELD' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'TBILLYIELD'], + 'argumentCount' => '3', + ], + 'TDIST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'TDIST'], + 'argumentCount' => '3', + ], + 'TEXT' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'TEXTFORMAT'], + 'argumentCount' => '2', + ], + 'TEXTJOIN' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'TEXTJOIN'], + 'argumentCount' => '3+', + ], + 'TIME' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'TIME'], + 'argumentCount' => '3', + ], + 'TIMEVALUE' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'TIMEVALUE'], + 'argumentCount' => '1', + ], + 'TINV' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'TINV'], + 'argumentCount' => '2', + ], + 'TODAY' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'DATENOW'], + 'argumentCount' => '0', + ], + 'TRANSPOSE' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'TRANSPOSE'], + 'argumentCount' => '1', + ], + 'TREND' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'TREND'], + 'argumentCount' => '1-4', + ], + 'TRIM' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'TRIMSPACES'], + 'argumentCount' => '1', + ], + 'TRIMMEAN' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'TRIMMEAN'], + 'argumentCount' => '2', + ], + 'TRUE' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'TRUE'], + 'argumentCount' => '0', + ], + 'TRUNC' => [ + 'category' => Category::CATEGORY_MATH_AND_TRIG, + 'functionCall' => [MathTrig::class, 'TRUNC'], + 'argumentCount' => '1,2', + ], + 'TTEST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '4', + ], + 'TYPE' => [ + 'category' => Category::CATEGORY_INFORMATION, + 'functionCall' => [Functions::class, 'TYPE'], + 'argumentCount' => '1', + ], + 'UNICHAR' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'CHARACTER'], + 'argumentCount' => '1', + ], + 'UNICODE' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'ASCIICODE'], + 'argumentCount' => '1', + ], + 'UPPER' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'UPPERCASE'], + 'argumentCount' => '1', + ], + 'USDOLLAR' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '2', + ], + 'VALUE' => [ + 'category' => Category::CATEGORY_TEXT_AND_DATA, + 'functionCall' => [TextData::class, 'VALUE'], + 'argumentCount' => '1', + ], + 'VAR' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'VARFunc'], + 'argumentCount' => '1+', + ], + 'VAR.P' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'VARP'], + 'argumentCount' => '1+', + ], + 'VAR.S' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'VARFunc'], + 'argumentCount' => '1+', + ], + 'VARA' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'VARA'], + 'argumentCount' => '1+', + ], + 'VARP' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'VARP'], + 'argumentCount' => '1+', + ], + 'VARPA' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'VARPA'], + 'argumentCount' => '1+', + ], + 'VDB' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '5-7', + ], + 'VLOOKUP' => [ + 'category' => Category::CATEGORY_LOOKUP_AND_REFERENCE, + 'functionCall' => [LookupRef::class, 'VLOOKUP'], + 'argumentCount' => '3,4', + ], + 'WEEKDAY' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'WEEKDAY'], + 'argumentCount' => '1,2', + ], + 'WEEKNUM' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'WEEKNUM'], + 'argumentCount' => '1,2', + ], + 'WEIBULL' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'WEIBULL'], + 'argumentCount' => '4', + ], + 'WORKDAY' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'WORKDAY'], + 'argumentCount' => '2+', + ], + 'XIRR' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'XIRR'], + 'argumentCount' => '2,3', + ], + 'XNPV' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'XNPV'], + 'argumentCount' => '3', + ], + 'XOR' => [ + 'category' => Category::CATEGORY_LOGICAL, + 'functionCall' => [Logical::class, 'logicalXor'], + 'argumentCount' => '1+', + ], + 'YEAR' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'YEAR'], + 'argumentCount' => '1', + ], + 'YEARFRAC' => [ + 'category' => Category::CATEGORY_DATE_AND_TIME, + 'functionCall' => [DateTime::class, 'YEARFRAC'], + 'argumentCount' => '2,3', + ], + 'YIELD' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Functions::class, 'DUMMY'], + 'argumentCount' => '6,7', + ], + 'YIELDDISC' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'YIELDDISC'], + 'argumentCount' => '4,5', + ], + 'YIELDMAT' => [ + 'category' => Category::CATEGORY_FINANCIAL, + 'functionCall' => [Financial::class, 'YIELDMAT'], + 'argumentCount' => '5,6', + ], + 'ZTEST' => [ + 'category' => Category::CATEGORY_STATISTICAL, + 'functionCall' => [Statistical::class, 'ZTEST'], + 'argumentCount' => '2-3', + ], + ]; + + // Internal functions used for special control purposes + private static $controlFunctions = [ + 'MKMATRIX' => [ + 'argumentCount' => '*', + 'functionCall' => 'self::mkMatrix', + ], + ]; + + public function __construct(Spreadsheet $spreadsheet = null) + { + $this->delta = 1 * pow(10, 0 - ini_get('precision')); + + $this->spreadsheet = $spreadsheet; + $this->cyclicReferenceStack = new CyclicReferenceStack(); + $this->debugLog = new Logger($this->cyclicReferenceStack); + } + + private static function loadLocales() + { + $localeFileDirectory = __DIR__ . '/locale/'; + foreach (glob($localeFileDirectory . '*', GLOB_ONLYDIR) as $filename) { + $filename = substr($filename, strlen($localeFileDirectory)); + if ($filename != 'en') { + self::$validLocaleLanguages[] = $filename; + } + } + } + + /** + * Get an instance of this class. + * + * @param Spreadsheet $spreadsheet Injected spreadsheet for working with a PhpSpreadsheet Spreadsheet object, + * or NULL to create a standalone claculation engine + * + * @return Calculation + */ + public static function getInstance(Spreadsheet $spreadsheet = null) + { + if ($spreadsheet !== null) { + $instance = $spreadsheet->getCalculationEngine(); + if (isset($instance)) { + return $instance; + } + } + + if (!isset(self::$instance) || (self::$instance === null)) { + self::$instance = new self(); + } + + return self::$instance; + } + + /** + * Flush the calculation cache for any existing instance of this class + * but only if a Calculation instance exists. + */ + public function flushInstance() + { + $this->clearCalculationCache(); + $this->clearBranchStore(); + } + + /** + * Get the Logger for this calculation engine instance. + * + * @return Logger + */ + public function getDebugLog() + { + return $this->debugLog; + } + + /** + * __clone implementation. Cloning should not be allowed in a Singleton! + * + * @throws Exception + */ + final public function __clone() + { + throw new Exception('Cloning the calculation engine is not allowed!'); + } + + /** + * Return the locale-specific translation of TRUE. + * + * @return string locale-specific translation of TRUE + */ + public static function getTRUE() + { + return self::$localeBoolean['TRUE']; + } + + /** + * Return the locale-specific translation of FALSE. + * + * @return string locale-specific translation of FALSE + */ + public static function getFALSE() + { + return self::$localeBoolean['FALSE']; + } + + /** + * Set the Array Return Type (Array or Value of first element in the array). + * + * @param string $returnType Array return type + * + * @return bool Success or failure + */ + public static function setArrayReturnType($returnType) + { + if (($returnType == self::RETURN_ARRAY_AS_VALUE) || + ($returnType == self::RETURN_ARRAY_AS_ERROR) || + ($returnType == self::RETURN_ARRAY_AS_ARRAY)) { + self::$returnArrayAsType = $returnType; + + return true; + } + + return false; + } + + /** + * Return the Array Return Type (Array or Value of first element in the array). + * + * @return string $returnType Array return type + */ + public static function getArrayReturnType() + { + return self::$returnArrayAsType; + } + + /** + * Is calculation caching enabled? + * + * @return bool + */ + public function getCalculationCacheEnabled() + { + return $this->calculationCacheEnabled; + } + + /** + * Enable/disable calculation cache. + * + * @param bool $pValue + */ + public function setCalculationCacheEnabled($pValue) + { + $this->calculationCacheEnabled = $pValue; + $this->clearCalculationCache(); + } + + /** + * Enable calculation cache. + */ + public function enableCalculationCache() + { + $this->setCalculationCacheEnabled(true); + } + + /** + * Disable calculation cache. + */ + public function disableCalculationCache() + { + $this->setCalculationCacheEnabled(false); + } + + /** + * Clear calculation cache. + */ + public function clearCalculationCache() + { + $this->calculationCache = []; + } + + /** + * Clear calculation cache for a specified worksheet. + * + * @param string $worksheetName + */ + public function clearCalculationCacheForWorksheet($worksheetName) + { + if (isset($this->calculationCache[$worksheetName])) { + unset($this->calculationCache[$worksheetName]); + } + } + + /** + * Rename calculation cache for a specified worksheet. + * + * @param string $fromWorksheetName + * @param string $toWorksheetName + */ + public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName) + { + if (isset($this->calculationCache[$fromWorksheetName])) { + $this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName]; + unset($this->calculationCache[$fromWorksheetName]); + } + } + + /** + * Enable/disable calculation cache. + * + * @param bool $pValue + * @param mixed $enabled + */ + public function setBranchPruningEnabled($enabled) + { + $this->branchPruningEnabled = $enabled; + } + + public function enableBranchPruning() + { + $this->setBranchPruningEnabled(true); + } + + public function disableBranchPruning() + { + $this->setBranchPruningEnabled(false); + } + + public function clearBranchStore() + { + $this->branchStoreKeyCounter = 0; + } + + /** + * Get the currently defined locale code. + * + * @return string + */ + public function getLocale() + { + return self::$localeLanguage; + } + + /** + * Set the locale code. + * + * @param string $locale The locale to use for formula translation, eg: 'en_us' + * + * @return bool + */ + public function setLocale($locale) + { + // Identify our locale and language + $language = $locale = strtolower($locale); + if (strpos($locale, '_') !== false) { + [$language] = explode('_', $locale); + } + if (count(self::$validLocaleLanguages) == 1) { + self::loadLocales(); + } + // Test whether we have any language data for this language (any locale) + if (in_array($language, self::$validLocaleLanguages)) { + // initialise language/locale settings + self::$localeFunctions = []; + self::$localeArgumentSeparator = ','; + self::$localeBoolean = ['TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL']; + // Default is English, if user isn't requesting english, then read the necessary data from the locale files + if ($locale != 'en_us') { + // Search for a file with a list of function names for locale + $functionNamesFile = __DIR__ . '/locale/' . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'functions'; + if (!file_exists($functionNamesFile)) { + // If there isn't a locale specific function file, look for a language specific function file + $functionNamesFile = __DIR__ . '/locale/' . $language . DIRECTORY_SEPARATOR . 'functions'; + if (!file_exists($functionNamesFile)) { + return false; + } + } + // Retrieve the list of locale or language specific function names + $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + foreach ($localeFunctions as $localeFunction) { + [$localeFunction] = explode('##', $localeFunction); // Strip out comments + if (strpos($localeFunction, '=') !== false) { + [$fName, $lfName] = explode('=', $localeFunction); + $fName = trim($fName); + $lfName = trim($lfName); + if ((isset(self::$phpSpreadsheetFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) { + self::$localeFunctions[$fName] = $lfName; + } + } + } + // Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions + if (isset(self::$localeFunctions['TRUE'])) { + self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE']; + } + if (isset(self::$localeFunctions['FALSE'])) { + self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE']; + } + + $configFile = __DIR__ . '/locale/' . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'config'; + if (!file_exists($configFile)) { + $configFile = __DIR__ . '/locale/' . $language . DIRECTORY_SEPARATOR . 'config'; + } + if (file_exists($configFile)) { + $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + foreach ($localeSettings as $localeSetting) { + [$localeSetting] = explode('##', $localeSetting); // Strip out comments + if (strpos($localeSetting, '=') !== false) { + [$settingName, $settingValue] = explode('=', $localeSetting); + $settingName = strtoupper(trim($settingName)); + switch ($settingName) { + case 'ARGUMENTSEPARATOR': + self::$localeArgumentSeparator = trim($settingValue); + + break; + } + } + } + } + } + + self::$functionReplaceFromExcel = self::$functionReplaceToExcel = + self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null; + self::$localeLanguage = $locale; + + return true; + } + + return false; + } + + /** + * @param string $fromSeparator + * @param string $toSeparator + * @param string $formula + * @param bool $inBraces + * + * @return string + */ + public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces) + { + $strlen = mb_strlen($formula); + for ($i = 0; $i < $strlen; ++$i) { + $chr = mb_substr($formula, $i, 1); + switch ($chr) { + case '{': + $inBraces = true; + + break; + case '}': + $inBraces = false; + + break; + case $fromSeparator: + if (!$inBraces) { + $formula = mb_substr($formula, 0, $i) . $toSeparator . mb_substr($formula, $i + 1); + } + } + } + + return $formula; + } + + /** + * @param string[] $from + * @param string[] $to + * @param string $formula + * @param string $fromSeparator + * @param string $toSeparator + * + * @return string + */ + private static function translateFormula(array $from, array $to, $formula, $fromSeparator, $toSeparator) + { + // Convert any Excel function names to the required language + if (self::$localeLanguage !== 'en_us') { + $inBraces = false; + // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators + if (strpos($formula, '"') !== false) { + // So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded + // the formula + $temp = explode('"', $formula); + $i = false; + foreach ($temp as &$value) { + // Only count/replace in alternating array entries + if ($i = !$i) { + $value = preg_replace($from, $to, $value); + $value = self::translateSeparator($fromSeparator, $toSeparator, $value, $inBraces); + } + } + unset($value); + // Then rebuild the formula string + $formula = implode('"', $temp); + } else { + // If there's no quoted strings, then we do a simple count/replace + $formula = preg_replace($from, $to, $formula); + $formula = self::translateSeparator($fromSeparator, $toSeparator, $formula, $inBraces); + } + } + + return $formula; + } + + private static $functionReplaceFromExcel = null; + + private static $functionReplaceToLocale = null; + + public function _translateFormulaToLocale($formula) + { + if (self::$functionReplaceFromExcel === null) { + self::$functionReplaceFromExcel = []; + foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelFunctionName, '/') . '([\s]*\()/Ui'; + } + foreach (array_keys(self::$localeBoolean) as $excelBoolean) { + self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/Ui'; + } + } + + if (self::$functionReplaceToLocale === null) { + self::$functionReplaceToLocale = []; + foreach (self::$localeFunctions as $localeFunctionName) { + self::$functionReplaceToLocale[] = '$1' . trim($localeFunctionName) . '$2'; + } + foreach (self::$localeBoolean as $localeBoolean) { + self::$functionReplaceToLocale[] = '$1' . trim($localeBoolean) . '$2'; + } + } + + return self::translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$localeArgumentSeparator); + } + + private static $functionReplaceFromLocale = null; + + private static $functionReplaceToExcel = null; + + public function _translateFormulaToEnglish($formula) + { + if (self::$functionReplaceFromLocale === null) { + self::$functionReplaceFromLocale = []; + foreach (self::$localeFunctions as $localeFunctionName) { + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName, '/') . '([\s]*\()/Ui'; + } + foreach (self::$localeBoolean as $excelBoolean) { + self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/Ui'; + } + } + + if (self::$functionReplaceToExcel === null) { + self::$functionReplaceToExcel = []; + foreach (array_keys(self::$localeFunctions) as $excelFunctionName) { + self::$functionReplaceToExcel[] = '$1' . trim($excelFunctionName) . '$2'; + } + foreach (array_keys(self::$localeBoolean) as $excelBoolean) { + self::$functionReplaceToExcel[] = '$1' . trim($excelBoolean) . '$2'; + } + } + + return self::translateFormula(self::$functionReplaceFromLocale, self::$functionReplaceToExcel, $formula, self::$localeArgumentSeparator, ','); + } + + public static function localeFunc($function) + { + if (self::$localeLanguage !== 'en_us') { + $functionName = trim($function, '('); + if (isset(self::$localeFunctions[$functionName])) { + $brace = ($functionName != $function); + $function = self::$localeFunctions[$functionName]; + if ($brace) { + $function .= '('; + } + } + } + + return $function; + } + + /** + * Wrap string values in quotes. + * + * @param mixed $value + * + * @return mixed + */ + public static function wrapResult($value) + { + if (is_string($value)) { + // Error values cannot be "wrapped" + if (preg_match('/^' . self::CALCULATION_REGEXP_ERROR . '$/i', $value, $match)) { + // Return Excel errors "as is" + return $value; + } + // Return strings wrapped in quotes + return '"' . $value . '"'; + // Convert numeric errors to NaN error + } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { + return Functions::NAN(); + } + + return $value; + } + + /** + * Remove quotes used as a wrapper to identify string values. + * + * @param mixed $value + * + * @return mixed + */ + public static function unwrapResult($value) + { + if (is_string($value)) { + if ((isset($value[0])) && ($value[0] == '"') && (substr($value, -1) == '"')) { + return substr($value, 1, -1); + } + // Convert numeric errors to NAN error + } elseif ((is_float($value)) && ((is_nan($value)) || (is_infinite($value)))) { + return Functions::NAN(); + } + + return $value; + } + + /** + * Calculate cell value (using formula from a cell ID) + * Retained for backward compatibility. + * + * @param Cell $pCell Cell to calculate + * + * @throws Exception + * + * @return mixed + */ + public function calculate(Cell $pCell = null) + { + try { + return $this->calculateCellValue($pCell); + } catch (\Exception $e) { + throw new Exception($e->getMessage()); + } + } + + /** + * Calculate the value of a cell formula. + * + * @param Cell $pCell Cell to calculate + * @param bool $resetLog Flag indicating whether the debug log should be reset or not + * + * @throws \PhpOffice\PhpSpreadsheet\Exception + * + * @return mixed + */ + public function calculateCellValue(Cell $pCell = null, $resetLog = true) + { + if ($pCell === null) { + return null; + } + + $returnArrayAsType = self::$returnArrayAsType; + if ($resetLog) { + // Initialise the logging settings if requested + $this->formulaError = null; + $this->debugLog->clearLog(); + $this->cyclicReferenceStack->clear(); + $this->cyclicFormulaCounter = 1; + + self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY; + } + + // Execute the calculation for the cell formula + $this->cellStack[] = [ + 'sheet' => $pCell->getWorksheet()->getTitle(), + 'cell' => $pCell->getCoordinate(), + ]; + + try { + $result = self::unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell)); + $cellAddress = array_pop($this->cellStack); + $this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); + } catch (\Exception $e) { + $cellAddress = array_pop($this->cellStack); + $this->spreadsheet->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']); + + throw new Exception($e->getMessage()); + } + + if ((is_array($result)) && (self::$returnArrayAsType != self::RETURN_ARRAY_AS_ARRAY)) { + self::$returnArrayAsType = $returnArrayAsType; + $testResult = Functions::flattenArray($result); + if (self::$returnArrayAsType == self::RETURN_ARRAY_AS_ERROR) { + return Functions::VALUE(); + } + // If there's only a single cell in the array, then we allow it + if (count($testResult) != 1) { + // If keys are numeric, then it's a matrix result rather than a cell range result, so we permit it + $r = array_keys($result); + $r = array_shift($r); + if (!is_numeric($r)) { + return Functions::VALUE(); + } + if (is_array($result[$r])) { + $c = array_keys($result[$r]); + $c = array_shift($c); + if (!is_numeric($c)) { + return Functions::VALUE(); + } + } + } + $result = array_shift($testResult); + } + self::$returnArrayAsType = $returnArrayAsType; + + if ($result === null && $pCell->getWorksheet()->getSheetView()->getShowZeros()) { + return 0; + } elseif ((is_float($result)) && ((is_nan($result)) || (is_infinite($result)))) { + return Functions::NAN(); + } + + return $result; + } + + /** + * Validate and parse a formula string. + * + * @param string $formula Formula to parse + * + * @return array|bool + */ + public function parseFormula($formula) + { + // Basic validation that this is indeed a formula + // We return an empty array if not + $formula = trim($formula); + if ((!isset($formula[0])) || ($formula[0] != '=')) { + return []; + } + $formula = ltrim(substr($formula, 1)); + if (!isset($formula[0])) { + return []; + } + + // Parse the formula and return the token stack + return $this->_parseFormula($formula); + } + + /** + * Calculate the value of a formula. + * + * @param string $formula Formula to parse + * @param string $cellID Address of the cell to calculate + * @param Cell $pCell Cell to calculate + * + * @throws \PhpOffice\PhpSpreadsheet\Exception + * + * @return mixed + */ + public function calculateFormula($formula, $cellID = null, Cell $pCell = null) + { + // Initialise the logging settings + $this->formulaError = null; + $this->debugLog->clearLog(); + $this->cyclicReferenceStack->clear(); + + $resetCache = $this->getCalculationCacheEnabled(); + if ($this->spreadsheet !== null && $cellID === null && $pCell === null) { + $cellID = 'A1'; + $pCell = $this->spreadsheet->getActiveSheet()->getCell($cellID); + } else { + // Disable calculation cacheing because it only applies to cell calculations, not straight formulae + // But don't actually flush any cache + $this->calculationCacheEnabled = false; + } + + // Execute the calculation + try { + $result = self::unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell)); + } catch (\Exception $e) { + throw new Exception($e->getMessage()); + } + + if ($this->spreadsheet === null) { + // Reset calculation cacheing to its previous state + $this->calculationCacheEnabled = $resetCache; + } + + return $result; + } + + /** + * @param string $cellReference + * @param mixed $cellValue + * + * @return bool + */ + public function getValueFromCache($cellReference, &$cellValue) + { + // Is calculation cacheing enabled? + // Is the value present in calculation cache? + $this->debugLog->writeDebugLog('Testing cache value for cell ', $cellReference); + if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) { + $this->debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache'); + // Return the cached result + + $cellValue = $this->calculationCache[$cellReference]; + + return true; + } + + return false; + } + + /** + * @param string $cellReference + * @param mixed $cellValue + */ + public function saveValueToCache($cellReference, $cellValue) + { + if ($this->calculationCacheEnabled) { + $this->calculationCache[$cellReference] = $cellValue; + } + } + + /** + * Parse a cell formula and calculate its value. + * + * @param string $formula The formula to parse and calculate + * @param string $cellID The ID (e.g. A3) of the cell that we are calculating + * @param Cell $pCell Cell to calculate + * + * @throws Exception + * + * @return mixed + */ + public function _calculateFormulaValue($formula, $cellID = null, Cell $pCell = null) + { + $cellValue = null; + + // Quote-Prefixed cell values cannot be formulae, but are treated as strings + if ($pCell !== null && $pCell->getStyle()->getQuotePrefix() === true) { + return self::wrapResult((string) $formula); + } + + if (preg_match('/^=\s*cmd\s*\|/miu', $formula) !== 0) { + return self::wrapResult($formula); + } + + // Basic validation that this is indeed a formula + // We simply return the cell value if not + $formula = trim($formula); + if ($formula[0] != '=') { + return self::wrapResult($formula); + } + $formula = ltrim(substr($formula, 1)); + if (!isset($formula[0])) { + return self::wrapResult($formula); + } + + $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; + $wsTitle = ($pCellParent !== null) ? $pCellParent->getTitle() : "\x00Wrk"; + $wsCellReference = $wsTitle . '!' . $cellID; + + if (($cellID !== null) && ($this->getValueFromCache($wsCellReference, $cellValue))) { + return $cellValue; + } + + if (($wsTitle[0] !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) { + if ($this->cyclicFormulaCount <= 0) { + $this->cyclicFormulaCell = ''; + + return $this->raiseFormulaError('Cyclic Reference in Formula'); + } elseif ($this->cyclicFormulaCell === $wsCellReference) { + ++$this->cyclicFormulaCounter; + if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) { + $this->cyclicFormulaCell = ''; + + return $cellValue; + } + } elseif ($this->cyclicFormulaCell == '') { + if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) { + return $cellValue; + } + $this->cyclicFormulaCell = $wsCellReference; + } + } + + // Parse the formula onto the token stack and calculate the value + $this->cyclicReferenceStack->push($wsCellReference); + $cellValue = $this->processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell); + $this->cyclicReferenceStack->pop(); + + // Save to calculation cache + if ($cellID !== null) { + $this->saveValueToCache($wsCellReference, $cellValue); + } + + // Return the calculated value + return $cellValue; + } + + /** + * Ensure that paired matrix operands are both matrices and of the same size. + * + * @param mixed &$operand1 First matrix operand + * @param mixed &$operand2 Second matrix operand + * @param int $resize Flag indicating whether the matrices should be resized to match + * and (if so), whether the smaller dimension should grow or the + * larger should shrink. + * 0 = no resize + * 1 = shrink to fit + * 2 = extend to fit + * + * @return array + */ + private static function checkMatrixOperands(&$operand1, &$operand2, $resize = 1) + { + // Examine each of the two operands, and turn them into an array if they aren't one already + // Note that this function should only be called if one or both of the operand is already an array + if (!is_array($operand1)) { + [$matrixRows, $matrixColumns] = self::getMatrixDimensions($operand2); + $operand1 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand1)); + $resize = 0; + } elseif (!is_array($operand2)) { + [$matrixRows, $matrixColumns] = self::getMatrixDimensions($operand1); + $operand2 = array_fill(0, $matrixRows, array_fill(0, $matrixColumns, $operand2)); + $resize = 0; + } + + [$matrix1Rows, $matrix1Columns] = self::getMatrixDimensions($operand1); + [$matrix2Rows, $matrix2Columns] = self::getMatrixDimensions($operand2); + if (($matrix1Rows == $matrix2Columns) && ($matrix2Rows == $matrix1Columns)) { + $resize = 1; + } + + if ($resize == 2) { + // Given two matrices of (potentially) unequal size, convert the smaller in each dimension to match the larger + self::resizeMatricesExtend($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns); + } elseif ($resize == 1) { + // Given two matrices of (potentially) unequal size, convert the larger in each dimension to match the smaller + self::resizeMatricesShrink($operand1, $operand2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns); + } + + return [$matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns]; + } + + /** + * Read the dimensions of a matrix, and re-index it with straight numeric keys starting from row 0, column 0. + * + * @param array &$matrix matrix operand + * + * @return int[] An array comprising the number of rows, and number of columns + */ + public static function getMatrixDimensions(array &$matrix) + { + $matrixRows = count($matrix); + $matrixColumns = 0; + foreach ($matrix as $rowKey => $rowValue) { + if (!is_array($rowValue)) { + $matrix[$rowKey] = [$rowValue]; + $matrixColumns = max(1, $matrixColumns); + } else { + $matrix[$rowKey] = array_values($rowValue); + $matrixColumns = max(count($rowValue), $matrixColumns); + } + } + $matrix = array_values($matrix); + + return [$matrixRows, $matrixColumns]; + } + + /** + * Ensure that paired matrix operands are both matrices of the same size. + * + * @param mixed &$matrix1 First matrix operand + * @param mixed &$matrix2 Second matrix operand + * @param int $matrix1Rows Row size of first matrix operand + * @param int $matrix1Columns Column size of first matrix operand + * @param int $matrix2Rows Row size of second matrix operand + * @param int $matrix2Columns Column size of second matrix operand + */ + private static function resizeMatricesShrink(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns) + { + if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { + if ($matrix2Rows < $matrix1Rows) { + for ($i = $matrix2Rows; $i < $matrix1Rows; ++$i) { + unset($matrix1[$i]); + } + } + if ($matrix2Columns < $matrix1Columns) { + for ($i = 0; $i < $matrix1Rows; ++$i) { + for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) { + unset($matrix1[$i][$j]); + } + } + } + } + + if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) { + if ($matrix1Rows < $matrix2Rows) { + for ($i = $matrix1Rows; $i < $matrix2Rows; ++$i) { + unset($matrix2[$i]); + } + } + if ($matrix1Columns < $matrix2Columns) { + for ($i = 0; $i < $matrix2Rows; ++$i) { + for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) { + unset($matrix2[$i][$j]); + } + } + } + } + } + + /** + * Ensure that paired matrix operands are both matrices of the same size. + * + * @param mixed &$matrix1 First matrix operand + * @param mixed &$matrix2 Second matrix operand + * @param int $matrix1Rows Row size of first matrix operand + * @param int $matrix1Columns Column size of first matrix operand + * @param int $matrix2Rows Row size of second matrix operand + * @param int $matrix2Columns Column size of second matrix operand + */ + private static function resizeMatricesExtend(&$matrix1, &$matrix2, $matrix1Rows, $matrix1Columns, $matrix2Rows, $matrix2Columns) + { + if (($matrix2Columns < $matrix1Columns) || ($matrix2Rows < $matrix1Rows)) { + if ($matrix2Columns < $matrix1Columns) { + for ($i = 0; $i < $matrix2Rows; ++$i) { + $x = $matrix2[$i][$matrix2Columns - 1]; + for ($j = $matrix2Columns; $j < $matrix1Columns; ++$j) { + $matrix2[$i][$j] = $x; + } + } + } + if ($matrix2Rows < $matrix1Rows) { + $x = $matrix2[$matrix2Rows - 1]; + for ($i = 0; $i < $matrix1Rows; ++$i) { + $matrix2[$i] = $x; + } + } + } + + if (($matrix1Columns < $matrix2Columns) || ($matrix1Rows < $matrix2Rows)) { + if ($matrix1Columns < $matrix2Columns) { + for ($i = 0; $i < $matrix1Rows; ++$i) { + $x = $matrix1[$i][$matrix1Columns - 1]; + for ($j = $matrix1Columns; $j < $matrix2Columns; ++$j) { + $matrix1[$i][$j] = $x; + } + } + } + if ($matrix1Rows < $matrix2Rows) { + $x = $matrix1[$matrix1Rows - 1]; + for ($i = 0; $i < $matrix2Rows; ++$i) { + $matrix1[$i] = $x; + } + } + } + } + + /** + * Format details of an operand for display in the log (based on operand type). + * + * @param mixed $value First matrix operand + * + * @return mixed + */ + private function showValue($value) + { + if ($this->debugLog->getWriteDebugLog()) { + $testArray = Functions::flattenArray($value); + if (count($testArray) == 1) { + $value = array_pop($testArray); + } + + if (is_array($value)) { + $returnMatrix = []; + $pad = $rpad = ', '; + foreach ($value as $row) { + if (is_array($row)) { + $returnMatrix[] = implode($pad, array_map([$this, 'showValue'], $row)); + $rpad = '; '; + } else { + $returnMatrix[] = $this->showValue($row); + } + } + + return '{ ' . implode($rpad, $returnMatrix) . ' }'; + } elseif (is_string($value) && (trim($value, '"') == $value)) { + return '"' . $value . '"'; + } elseif (is_bool($value)) { + return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE']; + } + } + + return Functions::flattenSingleValue($value); + } + + /** + * Format type and details of an operand for display in the log (based on operand type). + * + * @param mixed $value First matrix operand + * + * @return null|string + */ + private function showTypeDetails($value) + { + if ($this->debugLog->getWriteDebugLog()) { + $testArray = Functions::flattenArray($value); + if (count($testArray) == 1) { + $value = array_pop($testArray); + } + + if ($value === null) { + return 'a NULL value'; + } elseif (is_float($value)) { + $typeString = 'a floating point number'; + } elseif (is_int($value)) { + $typeString = 'an integer number'; + } elseif (is_bool($value)) { + $typeString = 'a boolean'; + } elseif (is_array($value)) { + $typeString = 'a matrix'; + } else { + if ($value == '') { + return 'an empty string'; + } elseif ($value[0] == '#') { + return 'a ' . $value . ' error'; + } + $typeString = 'a string'; + } + + return $typeString . ' with a value of ' . $this->showValue($value); + } + } + + /** + * @param string $formula + * + * @return false|string False indicates an error + */ + private function convertMatrixReferences($formula) + { + static $matrixReplaceFrom = ['{', ';', '}']; + static $matrixReplaceTo = ['MKMATRIX(MKMATRIX(', '),MKMATRIX(', '))']; + + // Convert any Excel matrix references to the MKMATRIX() function + if (strpos($formula, '{') !== false) { + // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators + if (strpos($formula, '"') !== false) { + // So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded + // the formula + $temp = explode('"', $formula); + // Open and Closed counts used for trapping mismatched braces in the formula + $openCount = $closeCount = 0; + $i = false; + foreach ($temp as &$value) { + // Only count/replace in alternating array entries + if ($i = !$i) { + $openCount += substr_count($value, '{'); + $closeCount += substr_count($value, '}'); + $value = str_replace($matrixReplaceFrom, $matrixReplaceTo, $value); + } + } + unset($value); + // Then rebuild the formula string + $formula = implode('"', $temp); + } else { + // If there's no quoted strings, then we do a simple count/replace + $openCount = substr_count($formula, '{'); + $closeCount = substr_count($formula, '}'); + $formula = str_replace($matrixReplaceFrom, $matrixReplaceTo, $formula); + } + // Trap for mismatched braces and trigger an appropriate error + if ($openCount < $closeCount) { + if ($openCount > 0) { + return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '}'"); + } + + return $this->raiseFormulaError("Formula Error: Unexpected '}' encountered"); + } elseif ($openCount > $closeCount) { + if ($closeCount > 0) { + return $this->raiseFormulaError("Formula Error: Mismatched matrix braces '{'"); + } + + return $this->raiseFormulaError("Formula Error: Unexpected '{' encountered"); + } + } + + return $formula; + } + + private static function mkMatrix(...$args) + { + return $args; + } + + // Binary Operators + // These operators always work on two values + // Array key is the operator, the value indicates whether this is a left or right associative operator + private static $operatorAssociativity = [ + '^' => 0, // Exponentiation + '*' => 0, '/' => 0, // Multiplication and Division + '+' => 0, '-' => 0, // Addition and Subtraction + '&' => 0, // Concatenation + '|' => 0, ':' => 0, // Intersect and Range + '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0, // Comparison + ]; + + // Comparison (Boolean) Operators + // These operators work on two values, but always return a boolean result + private static $comparisonOperators = ['>' => true, '<' => true, '=' => true, '>=' => true, '<=' => true, '<>' => true]; + + // Operator Precedence + // This list includes all valid operators, whether binary (including boolean) or unary (such as %) + // Array key is the operator, the value is its precedence + private static $operatorPrecedence = [ + ':' => 8, // Range + '|' => 7, // Intersect + '~' => 6, // Negation + '%' => 5, // Percentage + '^' => 4, // Exponentiation + '*' => 3, '/' => 3, // Multiplication and Division + '+' => 2, '-' => 2, // Addition and Subtraction + '&' => 1, // Concatenation + '>' => 0, '<' => 0, '=' => 0, '>=' => 0, '<=' => 0, '<>' => 0, // Comparison + ]; + + // Convert infix to postfix notation + + /** + * @param string $formula + * @param null|\PhpOffice\PhpSpreadsheet\Cell\Cell $pCell + * + * @return bool + */ + private function _parseFormula($formula, Cell $pCell = null) + { + if (($formula = $this->convertMatrixReferences(trim($formula))) === false) { + return false; + } + + // If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent worksheet), + // so we store the parent worksheet so that we can re-attach it when necessary + $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; + + $regexpMatchString = '/^(' . self::CALCULATION_REGEXP_FUNCTION . + '|' . self::CALCULATION_REGEXP_CELLREF . + '|' . self::CALCULATION_REGEXP_NUMBER . + '|' . self::CALCULATION_REGEXP_STRING . + '|' . self::CALCULATION_REGEXP_OPENBRACE . + '|' . self::CALCULATION_REGEXP_NAMEDRANGE . + '|' . self::CALCULATION_REGEXP_ERROR . + ')/si'; + + // Start with initialisation + $index = 0; + $stack = new Stack(); + $output = []; + $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a + // - is a negation or + is a positive operator rather than an operation + $expectingOperand = false; // We use this test in syntax-checking the expression to determine whether an operand + // should be null in a function call + + // IF branch pruning + // currently pending storeKey (last item of the storeKeysStack + $pendingStoreKey = null; + // stores a list of storeKeys (string[]) + $pendingStoreKeysStack = []; + $expectingConditionMap = []; // ['storeKey' => true, ...] + $expectingThenMap = []; // ['storeKey' => true, ...] + $expectingElseMap = []; // ['storeKey' => true, ...] + $parenthesisDepthMap = []; // ['storeKey' => 4, ...] + + // The guts of the lexical parser + // Loop through the formula extracting each operator and operand in turn + while (true) { + // Branch pruning: we adapt the output item to the context (it will + // be used to limit its computation) + $currentCondition = null; + $currentOnlyIf = null; + $currentOnlyIfNot = null; + $previousStoreKey = null; + $pendingStoreKey = end($pendingStoreKeysStack); + + if ($this->branchPruningEnabled) { + // this is a condition ? + if (isset($expectingConditionMap[$pendingStoreKey]) && $expectingConditionMap[$pendingStoreKey]) { + $currentCondition = $pendingStoreKey; + $stackDepth = count($pendingStoreKeysStack); + if ($stackDepth > 1) { // nested if + $previousStoreKey = $pendingStoreKeysStack[$stackDepth - 2]; + } + } + if (isset($expectingThenMap[$pendingStoreKey]) && $expectingThenMap[$pendingStoreKey]) { + $currentOnlyIf = $pendingStoreKey; + } elseif (isset($previousStoreKey)) { + if (isset($expectingThenMap[$previousStoreKey]) && $expectingThenMap[$previousStoreKey]) { + $currentOnlyIf = $previousStoreKey; + } + } + if (isset($expectingElseMap[$pendingStoreKey]) && $expectingElseMap[$pendingStoreKey]) { + $currentOnlyIfNot = $pendingStoreKey; + } elseif (isset($previousStoreKey)) { + if (isset($expectingElseMap[$previousStoreKey]) && $expectingElseMap[$previousStoreKey]) { + $currentOnlyIfNot = $previousStoreKey; + } + } + } + + $opCharacter = $formula[$index]; // Get the first character of the value at the current index position + if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula[$index + 1]]))) { + $opCharacter .= $formula[++$index]; + } + + // Find out if we're currently at the beginning of a number, variable, cell reference, function, parenthesis or operand + $isOperandOrFunction = preg_match($regexpMatchString, substr($formula, $index), $match); + + if ($opCharacter == '-' && !$expectingOperator) { // Is it a negation instead of a minus? + // Put a negation on the stack + $stack->push('Unary Operator', '~', null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + ++$index; // and drop the negation symbol + } elseif ($opCharacter == '%' && $expectingOperator) { + // Put a percentage on the stack + $stack->push('Unary Operator', '%', null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + ++$index; + } elseif ($opCharacter == '+' && !$expectingOperator) { // Positive (unary plus rather than binary operator plus) can be discarded? + ++$index; // Drop the redundant plus symbol + } elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal + return $this->raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression + } elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack? + while ($stack->count() > 0 && + ($o2 = $stack->last()) && + isset(self::$operators[$o2['value']]) && + @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) { + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output + } + + // Finally put our current operator onto the stack + $stack->push('Binary Operator', $opCharacter, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + + ++$index; + $expectingOperator = false; + } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? + $expectingOperand = false; + while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( + if ($o2 === null) { + return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"'); + } + $output[] = $o2; + } + $d = $stack->last(2); + + // Branch pruning we decrease the depth whether is it a function + // call or a parenthesis + if (!empty($pendingStoreKey)) { + $parenthesisDepthMap[$pendingStoreKey] -= 1; + } + + if (is_array($d) && preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? + if (!empty($pendingStoreKey) && $parenthesisDepthMap[$pendingStoreKey] == -1) { + // we are closing an IF( + if ($d['value'] != 'IF(') { + return $this->raiseFormulaError('Parser bug we should be in an "IF("'); + } + if ($expectingConditionMap[$pendingStoreKey]) { + return $this->raiseFormulaError('We should not be expecting a condition'); + } + $expectingThenMap[$pendingStoreKey] = false; + $expectingElseMap[$pendingStoreKey] = false; + $parenthesisDepthMap[$pendingStoreKey] -= 1; + array_pop($pendingStoreKeysStack); + unset($pendingStoreKey); + } + + $functionName = $matches[1]; // Get the function name + $d = $stack->pop(); + $argumentCount = $d['value']; // See how many arguments there were (argument count is the next value stored on the stack) + $output[] = $d; // Dump the argument count on the output + $output[] = $stack->pop(); // Pop the function and push onto the output + if (isset(self::$controlFunctions[$functionName])) { + $expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount']; + $functionCall = self::$controlFunctions[$functionName]['functionCall']; + } elseif (isset(self::$phpSpreadsheetFunctions[$functionName])) { + $expectedArgumentCount = self::$phpSpreadsheetFunctions[$functionName]['argumentCount']; + $functionCall = self::$phpSpreadsheetFunctions[$functionName]['functionCall']; + } else { // did we somehow push a non-function on the stack? this should never happen + return $this->raiseFormulaError('Formula Error: Internal error, non-function on stack'); + } + // Check the argument count + $argumentCountError = false; + if (is_numeric($expectedArgumentCount)) { + if ($expectedArgumentCount < 0) { + if ($argumentCount > abs($expectedArgumentCount)) { + $argumentCountError = true; + $expectedArgumentCountString = 'no more than ' . abs($expectedArgumentCount); + } + } else { + if ($argumentCount != $expectedArgumentCount) { + $argumentCountError = true; + $expectedArgumentCountString = $expectedArgumentCount; + } + } + } elseif ($expectedArgumentCount != '*') { + $isOperandOrFunction = preg_match('/(\d*)([-+,])(\d*)/', $expectedArgumentCount, $argMatch); + switch ($argMatch[2]) { + case '+': + if ($argumentCount < $argMatch[1]) { + $argumentCountError = true; + $expectedArgumentCountString = $argMatch[1] . ' or more '; + } + + break; + case '-': + if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) { + $argumentCountError = true; + $expectedArgumentCountString = 'between ' . $argMatch[1] . ' and ' . $argMatch[3]; + } + + break; + case ',': + if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) { + $argumentCountError = true; + $expectedArgumentCountString = 'either ' . $argMatch[1] . ' or ' . $argMatch[3]; + } + + break; + } + } + if ($argumentCountError) { + return $this->raiseFormulaError("Formula Error: Wrong number of arguments for $functionName() function: $argumentCount given, " . $expectedArgumentCountString . ' expected'); + } + } + ++$index; + } elseif ($opCharacter == ',') { // Is this the separator for function arguments? + if (!empty($pendingStoreKey) && + $parenthesisDepthMap[$pendingStoreKey] == 0 + ) { + // We must go to the IF next argument + if ($expectingConditionMap[$pendingStoreKey]) { + $expectingConditionMap[$pendingStoreKey] = false; + $expectingThenMap[$pendingStoreKey] = true; + } elseif ($expectingThenMap[$pendingStoreKey]) { + $expectingThenMap[$pendingStoreKey] = false; + $expectingElseMap[$pendingStoreKey] = true; + } elseif ($expectingElseMap[$pendingStoreKey]) { + return $this->raiseFormulaError('Reaching fourth argument of an IF'); + } + } + while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( + if ($o2 === null) { + return $this->raiseFormulaError('Formula Error: Unexpected ,'); + } + $output[] = $o2; // pop the argument expression stuff and push onto the output + } + // If we've a comma when we're expecting an operand, then what we actually have is a null operand; + // so push a null onto the stack + if (($expectingOperand) || (!$expectingOperator)) { + $output[] = ['type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null]; + } + // make sure there was a function + $d = $stack->last(2); + if (!preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { + return $this->raiseFormulaError('Formula Error: Unexpected ,'); + } + $d = $stack->pop(); + $itemStoreKey = $d['storeKey'] ?? null; + $itemOnlyIf = $d['onlyIf'] ?? null; + $itemOnlyIfNot = $d['onlyIfNot'] ?? null; + $stack->push($d['type'], ++$d['value'], $d['reference'], $itemStoreKey, $itemOnlyIf, $itemOnlyIfNot); // increment the argument count + $stack->push('Brace', '(', null, $itemStoreKey, $itemOnlyIf, $itemOnlyIfNot); // put the ( back on, we'll need to pop back to it again + $expectingOperator = false; + $expectingOperand = true; + ++$index; + } elseif ($opCharacter == '(' && !$expectingOperator) { + if (!empty($pendingStoreKey)) { // Branch pruning: we go deeper + $parenthesisDepthMap[$pendingStoreKey] += 1; + } + $stack->push('Brace', '(', null, $currentCondition, $currentOnlyIf, $currentOnlyIf); + ++$index; + } elseif ($isOperandOrFunction && !$expectingOperator) { // do we now have a function/variable/number? + $expectingOperator = true; + $expectingOperand = false; + $val = $match[1]; + $length = strlen($val); + + if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $val, $matches)) { + $val = preg_replace('/\s/u', '', $val); + if (isset(self::$phpSpreadsheetFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) { // it's a function + $valToUpper = strtoupper($val); + // here $matches[1] will contain values like "IF" + // and $val "IF(" + if ($this->branchPruningEnabled && ($valToUpper == 'IF(')) { // we handle a new if + $pendingStoreKey = $this->getUnusedBranchStoreKey(); + $pendingStoreKeysStack[] = $pendingStoreKey; + $expectingConditionMap[$pendingStoreKey] = true; + $parenthesisDepthMap[$pendingStoreKey] = 0; + } else { // this is not a if but we good deeper + if (!empty($pendingStoreKey) && array_key_exists($pendingStoreKey, $parenthesisDepthMap)) { + $parenthesisDepthMap[$pendingStoreKey] += 1; + } + } + + $stack->push('Function', $valToUpper, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + // tests if the function is closed right after opening + $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index + $length), $amatch); + if ($ax) { + $stack->push('Operand Count for Function ' . $valToUpper . ')', 0, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $expectingOperator = true; + } else { + $stack->push('Operand Count for Function ' . $valToUpper . ')', 1, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + $expectingOperator = false; + } + $stack->push('Brace', '('); + } else { // it's a var w/ implicit multiplication + $output[] = ['type' => 'Value', 'value' => $matches[1], 'reference' => null]; + } + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $val, $matches)) { + // Watch for this case-change when modifying to allow cell references in different worksheets... + // Should only be applied to the actual cell column, not the worksheet name + + // If the last entry on the stack was a : operator, then we have a cell range reference + $testPrevOp = $stack->last(1); + if ($testPrevOp !== null && $testPrevOp['value'] == ':') { + // If we have a worksheet reference, then we're playing with a 3D reference + if ($matches[2] == '') { + // Otherwise, we 'inherit' the worksheet reference from the start cell reference + // The start of the cell range reference should be the last entry in $output + $startCellRef = $output[count($output) - 1]['value']; + preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $startCellRef, $startMatches); + if ($startMatches[2] > '') { + $val = $startMatches[2] . '!' . $val; + } + } else { + return $this->raiseFormulaError('3D Range references are not yet supported'); + } + } + + $outputItem = $stack->getStackItem('Cell Reference', $val, $val, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + + $output[] = $outputItem; + } else { // it's a variable, constant, string, number or boolean + // If the last entry on the stack was a : operator, then we may have a row or column range reference + $testPrevOp = $stack->last(1); + if ($testPrevOp !== null && $testPrevOp['value'] === ':') { + $startRowColRef = $output[count($output) - 1]['value']; + [$rangeWS1, $startRowColRef] = Worksheet::extractSheetTitle($startRowColRef, true); + $rangeSheetRef = $rangeWS1; + if ($rangeWS1 != '') { + $rangeWS1 .= '!'; + } + [$rangeWS2, $val] = Worksheet::extractSheetTitle($val, true); + if ($rangeWS2 != '') { + $rangeWS2 .= '!'; + } else { + $rangeWS2 = $rangeWS1; + } + $refSheet = $pCellParent; + if ($pCellParent !== null && $rangeSheetRef !== $pCellParent->getTitle()) { + $refSheet = $pCellParent->getParent()->getSheetByName($rangeSheetRef); + } + if ((is_int($startRowColRef)) && (ctype_digit($val)) && + ($startRowColRef <= 1048576) && ($val <= 1048576)) { + // Row range + $endRowColRef = ($refSheet !== null) ? $refSheet->getHighestColumn() : 'XFD'; // Max 16,384 columns for Excel2007 + $output[count($output) - 1]['value'] = $rangeWS1 . 'A' . $startRowColRef; + $val = $rangeWS2 . $endRowColRef . $val; + } elseif ((ctype_alpha($startRowColRef)) && (ctype_alpha($val)) && + (strlen($startRowColRef) <= 3) && (strlen($val) <= 3)) { + // Column range + $endRowColRef = ($refSheet !== null) ? $refSheet->getHighestRow() : 1048576; // Max 1,048,576 rows for Excel2007 + $output[count($output) - 1]['value'] = $rangeWS1 . strtoupper($startRowColRef) . '1'; + $val = $rangeWS2 . $val . $endRowColRef; + } + } + + $localeConstant = false; + if ($opCharacter == '"') { + // UnEscape any quotes within the string + $val = self::wrapResult(str_replace('""', '"', self::unwrapResult($val))); + } elseif (is_numeric($val)) { + if ((strpos($val, '.') !== false) || (stripos($val, 'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) { + $val = (float) $val; + } else { + $val = (int) $val; + } + } elseif (isset(self::$excelConstants[trim(strtoupper($val))])) { + $excelConstant = trim(strtoupper($val)); + $val = self::$excelConstants[$excelConstant]; + } elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$localeBoolean)) !== false) { + $val = self::$excelConstants[$localeConstant]; + } + $details = $stack->getStackItem('Value', $val, null, $currentCondition, $currentOnlyIf, $currentOnlyIfNot); + if ($localeConstant) { + $details['localeValue'] = $localeConstant; + } + $output[] = $details; + } + $index += $length; + } elseif ($opCharacter == '$') { // absolute row or column range + ++$index; + } elseif ($opCharacter == ')') { // miscellaneous error checking + if ($expectingOperand) { + $output[] = ['type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null]; + $expectingOperand = false; + $expectingOperator = true; + } else { + return $this->raiseFormulaError("Formula Error: Unexpected ')'"); + } + } elseif (isset(self::$operators[$opCharacter]) && !$expectingOperator) { + return $this->raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'"); + } else { // I don't even want to know what you did to get here + return $this->raiseFormulaError('Formula Error: An unexpected error occured'); + } + // Test for end of formula string + if ($index == strlen($formula)) { + // Did we end with an operator?. + // Only valid for the % unary operator + if ((isset(self::$operators[$opCharacter])) && ($opCharacter != '%')) { + return $this->raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands"); + } + + break; + } + // Ignore white space + while (($formula[$index] == "\n") || ($formula[$index] == "\r")) { + ++$index; + } + if ($formula[$index] == ' ') { + while ($formula[$index] == ' ') { + ++$index; + } + // If we're expecting an operator, but only have a space between the previous and next operands (and both are + // Cell References) then we have an INTERSECTION operator + if (($expectingOperator) && (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '.*/Ui', substr($formula, $index), $match)) && + ($output[count($output) - 1]['type'] == 'Cell Reference')) { + while ($stack->count() > 0 && + ($o2 = $stack->last()) && + isset(self::$operators[$o2['value']]) && + @(self::$operatorAssociativity[$opCharacter] ? self::$operatorPrecedence[$opCharacter] < self::$operatorPrecedence[$o2['value']] : self::$operatorPrecedence[$opCharacter] <= self::$operatorPrecedence[$o2['value']])) { + $output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output + } + $stack->push('Binary Operator', '|'); // Put an Intersect Operator on the stack + $expectingOperator = false; + } + } + } + + while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output + if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { + return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced + } + $output[] = $op; + } + + return $output; + } + + private static function dataTestReference(&$operandData) + { + $operand = $operandData['value']; + if (($operandData['reference'] === null) && (is_array($operand))) { + $rKeys = array_keys($operand); + $rowKey = array_shift($rKeys); + $cKeys = array_keys(array_keys($operand[$rowKey])); + $colKey = array_shift($cKeys); + if (ctype_upper($colKey)) { + $operandData['reference'] = $colKey . $rowKey; + } + } + + return $operand; + } + + // evaluate postfix notation + + /** + * @param mixed $tokens + * @param null|string $cellID + * @param null|Cell $pCell + * + * @return bool + */ + private function processTokenStack($tokens, $cellID = null, Cell $pCell = null) + { + if ($tokens == false) { + return false; + } + + // If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent cell collection), + // so we store the parent cell collection so that we can re-attach it when necessary + $pCellWorksheet = ($pCell !== null) ? $pCell->getWorksheet() : null; + $pCellParent = ($pCell !== null) ? $pCell->getParent() : null; + $stack = new Stack(); + + // Stores branches that have been pruned + $fakedForBranchPruning = []; + // help us to know when pruning ['branchTestId' => true/false] + $branchStore = []; + + // Loop through each token in turn + foreach ($tokens as $tokenData) { + $token = $tokenData['value']; + + // Branch pruning: skip useless resolutions + $storeKey = $tokenData['storeKey'] ?? null; + if ($this->branchPruningEnabled && isset($tokenData['onlyIf'])) { + $onlyIfStoreKey = $tokenData['onlyIf']; + $storeValue = $branchStore[$onlyIfStoreKey] ?? null; + $storeValueAsBool = ($storeValue === null) ? + true : (bool) Functions::flattenSingleValue($storeValue); + if (is_array($storeValue)) { + $wrappedItem = end($storeValue); + $storeValue = end($wrappedItem); + } + + if (isset($storeValue) + && ( + !$storeValueAsBool + || Functions::isError($storeValue) + || ($storeValue === 'Pruned branch') + ) + ) { + // If branching value is not true, we don't need to compute + if (!isset($fakedForBranchPruning['onlyIf-' . $onlyIfStoreKey])) { + $stack->push('Value', 'Pruned branch (only if ' . $onlyIfStoreKey . ') ' . $token); + $fakedForBranchPruning['onlyIf-' . $onlyIfStoreKey] = true; + } + + if (isset($storeKey)) { + // We are processing an if condition + // We cascade the pruning to the depending branches + $branchStore[$storeKey] = 'Pruned branch'; + $fakedForBranchPruning['onlyIfNot-' . $storeKey] = true; + $fakedForBranchPruning['onlyIf-' . $storeKey] = true; + } + + continue; + } + } + + if ($this->branchPruningEnabled && isset($tokenData['onlyIfNot'])) { + $onlyIfNotStoreKey = $tokenData['onlyIfNot']; + $storeValue = $branchStore[$onlyIfNotStoreKey] ?? null; + $storeValueAsBool = ($storeValue === null) ? + true : (bool) Functions::flattenSingleValue($storeValue); + if (is_array($storeValue)) { + $wrappedItem = end($storeValue); + $storeValue = end($wrappedItem); + } + if (isset($storeValue) + && ( + $storeValueAsBool + || Functions::isError($storeValue) + || ($storeValue === 'Pruned branch')) + ) { + // If branching value is true, we don't need to compute + if (!isset($fakedForBranchPruning['onlyIfNot-' . $onlyIfNotStoreKey])) { + $stack->push('Value', 'Pruned branch (only if not ' . $onlyIfNotStoreKey . ') ' . $token); + $fakedForBranchPruning['onlyIfNot-' . $onlyIfNotStoreKey] = true; + } + + if (isset($storeKey)) { + // We are processing an if condition + // We cascade the pruning to the depending branches + $branchStore[$storeKey] = 'Pruned branch'; + $fakedForBranchPruning['onlyIfNot-' . $storeKey] = true; + $fakedForBranchPruning['onlyIf-' . $storeKey] = true; + } + + continue; + } + } + + // if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack + if (isset(self::$binaryOperators[$token])) { + // We must have two operands, error if we don't + if (($operand2Data = $stack->pop()) === null) { + return $this->raiseFormulaError('Internal error - Operand value missing from stack'); + } + if (($operand1Data = $stack->pop()) === null) { + return $this->raiseFormulaError('Internal error - Operand value missing from stack'); + } + + $operand1 = self::dataTestReference($operand1Data); + $operand2 = self::dataTestReference($operand2Data); + + // Log what we're doing + if ($token == ':') { + $this->debugLog->writeDebugLog('Evaluating Range ', $this->showValue($operand1Data['reference']), ' ', $token, ' ', $this->showValue($operand2Data['reference'])); + } else { + $this->debugLog->writeDebugLog('Evaluating ', $this->showValue($operand1), ' ', $token, ' ', $this->showValue($operand2)); + } + + // Process the operation in the appropriate manner + switch ($token) { + // Comparison (Boolean) Operators + case '>': // Greater than + case '<': // Less than + case '>=': // Greater than or Equal to + case '<=': // Less than or Equal to + case '=': // Equality + case '<>': // Inequality + $result = $this->executeBinaryComparisonOperation($cellID, $operand1, $operand2, $token, $stack); + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + + break; + // Binary Operators + case ':': // Range + if (strpos($operand1Data['reference'], '!') !== false) { + [$sheet1, $operand1Data['reference']] = Worksheet::extractSheetTitle($operand1Data['reference'], true); + } else { + $sheet1 = ($pCellParent !== null) ? $pCellWorksheet->getTitle() : ''; + } + + [$sheet2, $operand2Data['reference']] = Worksheet::extractSheetTitle($operand2Data['reference'], true); + if (empty($sheet2)) { + $sheet2 = $sheet1; + } + + if ($sheet1 == $sheet2) { + if ($operand1Data['reference'] === null) { + if ((trim($operand1Data['value']) != '') && (is_numeric($operand1Data['value']))) { + $operand1Data['reference'] = $pCell->getColumn() . $operand1Data['value']; + } elseif (trim($operand1Data['reference']) == '') { + $operand1Data['reference'] = $pCell->getCoordinate(); + } else { + $operand1Data['reference'] = $operand1Data['value'] . $pCell->getRow(); + } + } + if ($operand2Data['reference'] === null) { + if ((trim($operand2Data['value']) != '') && (is_numeric($operand2Data['value']))) { + $operand2Data['reference'] = $pCell->getColumn() . $operand2Data['value']; + } elseif (trim($operand2Data['reference']) == '') { + $operand2Data['reference'] = $pCell->getCoordinate(); + } else { + $operand2Data['reference'] = $operand2Data['value'] . $pCell->getRow(); + } + } + + $oData = array_merge(explode(':', $operand1Data['reference']), explode(':', $operand2Data['reference'])); + $oCol = $oRow = []; + foreach ($oData as $oDatum) { + $oCR = Coordinate::coordinateFromString($oDatum); + $oCol[] = Coordinate::columnIndexFromString($oCR[0]) - 1; + $oRow[] = $oCR[1]; + } + $cellRef = Coordinate::stringFromColumnIndex(min($oCol) + 1) . min($oRow) . ':' . Coordinate::stringFromColumnIndex(max($oCol) + 1) . max($oRow); + if ($pCellParent !== null) { + $cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($sheet1), false); + } else { + return $this->raiseFormulaError('Unable to access Cell Reference'); + } + $stack->push('Cell Reference', $cellValue, $cellRef); + } else { + $stack->push('Error', Functions::REF(), null); + } + + break; + case '+': // Addition + $result = $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'plusEquals', $stack); + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + + break; + case '-': // Subtraction + $result = $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'minusEquals', $stack); + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + + break; + case '*': // Multiplication + $result = $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'arrayTimesEquals', $stack); + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + + break; + case '/': // Division + $result = $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'arrayRightDivide', $stack); + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + + break; + case '^': // Exponential + $result = $this->executeNumericBinaryOperation($operand1, $operand2, $token, 'power', $stack); + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + + break; + case '&': // Concatenation + // If either of the operands is a matrix, we need to treat them both as matrices + // (converting the other operand to a matrix if need be); then perform the required + // matrix operation + if (is_bool($operand1)) { + $operand1 = ($operand1) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE']; + } + if (is_bool($operand2)) { + $operand2 = ($operand2) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE']; + } + if ((is_array($operand1)) || (is_array($operand2))) { + // Ensure that both operands are arrays/matrices + self::checkMatrixOperands($operand1, $operand2, 2); + + try { + // Convert operand 1 from a PHP array to a matrix + $matrix = new Shared\JAMA\Matrix($operand1); + // Perform the required operation against the operand 1 matrix, passing in operand 2 + $matrixResult = $matrix->concat($operand2); + $result = $matrixResult->getArray(); + } catch (\Exception $ex) { + $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); + $result = '#VALUE!'; + } + } else { + $result = '"' . str_replace('""', '"', self::unwrapResult($operand1) . self::unwrapResult($operand2)) . '"'; + } + $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); + $stack->push('Value', $result); + + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + + break; + case '|': // Intersect + $rowIntersect = array_intersect_key($operand1, $operand2); + $cellIntersect = $oCol = $oRow = []; + foreach (array_keys($rowIntersect) as $row) { + $oRow[] = $row; + foreach ($rowIntersect[$row] as $col => $data) { + $oCol[] = Coordinate::columnIndexFromString($col) - 1; + $cellIntersect[$row] = array_intersect_key($operand1[$row], $operand2[$row]); + } + } + $cellRef = Coordinate::stringFromColumnIndex(min($oCol) + 1) . min($oRow) . ':' . Coordinate::stringFromColumnIndex(max($oCol) + 1) . max($oRow); + $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($cellIntersect)); + $stack->push('Value', $cellIntersect, $cellRef); + + break; + } + + // if the token is a unary operator, pop one value off the stack, do the operation, and push it back on + } elseif (($token === '~') || ($token === '%')) { + if (($arg = $stack->pop()) === null) { + return $this->raiseFormulaError('Internal error - Operand value missing from stack'); + } + $arg = $arg['value']; + if ($token === '~') { + $this->debugLog->writeDebugLog('Evaluating Negation of ', $this->showValue($arg)); + $multiplier = -1; + } else { + $this->debugLog->writeDebugLog('Evaluating Percentile of ', $this->showValue($arg)); + $multiplier = 0.01; + } + if (is_array($arg)) { + self::checkMatrixOperands($arg, $multiplier, 2); + + try { + $matrix1 = new Shared\JAMA\Matrix($arg); + $matrixResult = $matrix1->arrayTimesEquals($multiplier); + $result = $matrixResult->getArray(); + } catch (\Exception $ex) { + $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); + $result = '#VALUE!'; + } + $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); + $stack->push('Value', $result); + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + } else { + $this->executeNumericBinaryOperation($multiplier, $arg, '*', 'arrayTimesEquals', $stack); + } + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) { + $cellRef = null; + if (isset($matches[8])) { + if ($pCell === null) { + // We can't access the range, so return a REF error + $cellValue = Functions::REF(); + } else { + $cellRef = $matches[6] . $matches[7] . ':' . $matches[9] . $matches[10]; + if ($matches[2] > '') { + $matches[2] = trim($matches[2], "\"'"); + if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) { + // It's a Reference to an external spreadsheet (not currently supported) + return $this->raiseFormulaError('Unable to access External Workbook'); + } + $matches[2] = trim($matches[2], "\"'"); + $this->debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]); + if ($pCellParent !== null) { + $cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($matches[2]), false); + } else { + return $this->raiseFormulaError('Unable to access Cell Reference'); + } + $this->debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue)); + } else { + $this->debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet'); + if ($pCellParent !== null) { + $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false); + } else { + return $this->raiseFormulaError('Unable to access Cell Reference'); + } + $this->debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' is ', $this->showTypeDetails($cellValue)); + } + } + } else { + if ($pCell === null) { + // We can't access the cell, so return a REF error + $cellValue = Functions::REF(); + } else { + $cellRef = $matches[6] . $matches[7]; + if ($matches[2] > '') { + $matches[2] = trim($matches[2], "\"'"); + if ((strpos($matches[2], '[') !== false) || (strpos($matches[2], ']') !== false)) { + // It's a Reference to an external spreadsheet (not currently supported) + return $this->raiseFormulaError('Unable to access External Workbook'); + } + $this->debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]); + if ($pCellParent !== null) { + $cellSheet = $this->spreadsheet->getSheetByName($matches[2]); + if ($cellSheet && $cellSheet->cellExists($cellRef)) { + $cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($matches[2]), false); + $pCell->attach($pCellParent); + } else { + $cellValue = null; + } + } else { + return $this->raiseFormulaError('Unable to access Cell Reference'); + } + $this->debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->showTypeDetails($cellValue)); + } else { + $this->debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet'); + if ($pCellParent->has($cellRef)) { + $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, false); + $pCell->attach($pCellParent); + } else { + $cellValue = null; + } + $this->debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' is ', $this->showTypeDetails($cellValue)); + } + } + } + $stack->push('Value', $cellValue, $cellRef); + if (isset($storeKey)) { + $branchStore[$storeKey] = $cellValue; + } + + // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $token, $matches)) { + if ($pCellParent) { + $pCell->attach($pCellParent); + } + + $functionName = $matches[1]; + $argCount = $stack->pop(); + $argCount = $argCount['value']; + if ($functionName != 'MKMATRIX') { + $this->debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's')); + } + if ((isset(self::$phpSpreadsheetFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) { // function + if (isset(self::$phpSpreadsheetFunctions[$functionName])) { + $functionCall = self::$phpSpreadsheetFunctions[$functionName]['functionCall']; + $passByReference = isset(self::$phpSpreadsheetFunctions[$functionName]['passByReference']); + $passCellReference = isset(self::$phpSpreadsheetFunctions[$functionName]['passCellReference']); + } elseif (isset(self::$controlFunctions[$functionName])) { + $functionCall = self::$controlFunctions[$functionName]['functionCall']; + $passByReference = isset(self::$controlFunctions[$functionName]['passByReference']); + $passCellReference = isset(self::$controlFunctions[$functionName]['passCellReference']); + } + // get the arguments for this function + $args = $argArrayVals = []; + for ($i = 0; $i < $argCount; ++$i) { + $arg = $stack->pop(); + $a = $argCount - $i - 1; + if (($passByReference) && + (isset(self::$phpSpreadsheetFunctions[$functionName]['passByReference'][$a])) && + (self::$phpSpreadsheetFunctions[$functionName]['passByReference'][$a])) { + if ($arg['reference'] === null) { + $args[] = $cellID; + if ($functionName != 'MKMATRIX') { + $argArrayVals[] = $this->showValue($cellID); + } + } else { + $args[] = $arg['reference']; + if ($functionName != 'MKMATRIX') { + $argArrayVals[] = $this->showValue($arg['reference']); + } + } + } else { + $args[] = self::unwrapResult($arg['value']); + if ($functionName != 'MKMATRIX') { + $argArrayVals[] = $this->showValue($arg['value']); + } + } + } + + // Reverse the order of the arguments + krsort($args); + + if (($passByReference) && ($argCount == 0)) { + $args[] = $cellID; + $argArrayVals[] = $this->showValue($cellID); + } + + if ($functionName != 'MKMATRIX') { + if ($this->debugLog->getWriteDebugLog()) { + krsort($argArrayVals); + $this->debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator . ' ', Functions::flattenArray($argArrayVals)), ' )'); + } + } + + // Process the argument with the appropriate function call + $args = $this->addCellReference($args, $passCellReference, $functionCall, $pCell); + + if (!is_array($functionCall)) { + foreach ($args as &$arg) { + $arg = Functions::flattenSingleValue($arg); + } + unset($arg); + } + + $result = call_user_func_array($functionCall, $args); + + if ($functionName != 'MKMATRIX') { + $this->debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->showTypeDetails($result)); + } + $stack->push('Value', self::wrapResult($result)); + if (isset($storeKey)) { + $branchStore[$storeKey] = $result; + } + } + } else { + // if the token is a number, boolean, string or an Excel error, push it onto the stack + if (isset(self::$excelConstants[strtoupper($token)])) { + $excelConstant = strtoupper($token); + $stack->push('Constant Value', self::$excelConstants[$excelConstant]); + if (isset($storeKey)) { + $branchStore[$storeKey] = self::$excelConstants[$excelConstant]; + } + $this->debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant])); + } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) { + $stack->push('Value', $token); + if (isset($storeKey)) { + $branchStore[$storeKey] = $token; + } + // if the token is a named range, push the named range name onto the stack + } elseif (preg_match('/^' . self::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $token, $matches)) { + $namedRange = $matches[6]; + $this->debugLog->writeDebugLog('Evaluating Named Range ', $namedRange); + + $cellValue = $this->extractNamedRange($namedRange, ((null !== $pCell) ? $pCellWorksheet : null), false); + $pCell->attach($pCellParent); + $this->debugLog->writeDebugLog('Evaluation Result for named range ', $namedRange, ' is ', $this->showTypeDetails($cellValue)); + $stack->push('Named Range', $cellValue, $namedRange); + if (isset($storeKey)) { + $branchStore[$storeKey] = $cellValue; + } + } else { + return $this->raiseFormulaError("undefined variable '$token'"); + } + } + } + // when we're out of tokens, the stack should have a single element, the final result + if ($stack->count() != 1) { + return $this->raiseFormulaError('internal error'); + } + $output = $stack->pop(); + $output = $output['value']; + + return $output; + } + + private function validateBinaryOperand(&$operand, &$stack) + { + if (is_array($operand)) { + if ((count($operand, COUNT_RECURSIVE) - count($operand)) == 1) { + do { + $operand = array_pop($operand); + } while (is_array($operand)); + } + } + // Numbers, matrices and booleans can pass straight through, as they're already valid + if (is_string($operand)) { + // We only need special validations for the operand if it is a string + // Start by stripping off the quotation marks we use to identify true excel string values internally + if ($operand > '' && $operand[0] == '"') { + $operand = self::unwrapResult($operand); + } + // If the string is a numeric value, we treat it as a numeric, so no further testing + if (!is_numeric($operand)) { + // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations + if ($operand > '' && $operand[0] == '#') { + $stack->push('Value', $operand); + $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand)); + + return false; + } elseif (!Shared\StringHelper::convertToNumberIfFraction($operand)) { + // If not a numeric or a fraction, then it's a text string, and so can't be used in mathematical binary operations + $stack->push('Value', '#VALUE!'); + $this->debugLog->writeDebugLog('Evaluation Result is a ', $this->showTypeDetails('#VALUE!')); + + return false; + } + } + } + + // return a true if the value of the operand is one that we can use in normal binary operations + return true; + } + + /** + * @param null|string $cellID + * @param mixed $operand1 + * @param mixed $operand2 + * @param string $operation + * @param Stack $stack + * @param bool $recursingArrays + * + * @return mixed + */ + private function executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, Stack &$stack, $recursingArrays = false) + { + // If we're dealing with matrix operations, we want a matrix result + if ((is_array($operand1)) || (is_array($operand2))) { + $result = []; + if ((is_array($operand1)) && (!is_array($operand2))) { + foreach ($operand1 as $x => $operandData) { + $this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2)); + $this->executeBinaryComparisonOperation($cellID, $operandData, $operand2, $operation, $stack); + $r = $stack->pop(); + $result[$x] = $r['value']; + } + } elseif ((!is_array($operand1)) && (is_array($operand2))) { + foreach ($operand2 as $x => $operandData) { + $this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operand1), ' ', $operation, ' ', $this->showValue($operandData)); + $this->executeBinaryComparisonOperation($cellID, $operand1, $operandData, $operation, $stack); + $r = $stack->pop(); + $result[$x] = $r['value']; + } + } else { + if (!$recursingArrays) { + self::checkMatrixOperands($operand1, $operand2, 2); + } + foreach ($operand1 as $x => $operandData) { + $this->debugLog->writeDebugLog('Evaluating Comparison ', $this->showValue($operandData), ' ', $operation, ' ', $this->showValue($operand2[$x])); + $this->executeBinaryComparisonOperation($cellID, $operandData, $operand2[$x], $operation, $stack, true); + $r = $stack->pop(); + $result[$x] = $r['value']; + } + } + // Log the result details + $this->debugLog->writeDebugLog('Comparison Evaluation Result is ', $this->showTypeDetails($result)); + // And push the result onto the stack + $stack->push('Array', $result); + + return $result; + } + + // Simple validate the two operands if they are string values + if (is_string($operand1) && $operand1 > '' && $operand1[0] == '"') { + $operand1 = self::unwrapResult($operand1); + } + if (is_string($operand2) && $operand2 > '' && $operand2[0] == '"') { + $operand2 = self::unwrapResult($operand2); + } + + // Use case insensitive comparaison if not OpenOffice mode + if (Functions::getCompatibilityMode() != Functions::COMPATIBILITY_OPENOFFICE) { + if (is_string($operand1)) { + $operand1 = strtoupper($operand1); + } + if (is_string($operand2)) { + $operand2 = strtoupper($operand2); + } + } + + $useLowercaseFirstComparison = is_string($operand1) && is_string($operand2) && Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE; + + // execute the necessary operation + switch ($operation) { + // Greater than + case '>': + if ($useLowercaseFirstComparison) { + $result = $this->strcmpLowercaseFirst($operand1, $operand2) > 0; + } else { + $result = ($operand1 > $operand2); + } + + break; + // Less than + case '<': + if ($useLowercaseFirstComparison) { + $result = $this->strcmpLowercaseFirst($operand1, $operand2) < 0; + } else { + $result = ($operand1 < $operand2); + } + + break; + // Equality + case '=': + if (is_numeric($operand1) && is_numeric($operand2)) { + $result = (abs($operand1 - $operand2) < $this->delta); + } else { + $result = strcmp($operand1, $operand2) == 0; + } + + break; + // Greater than or equal + case '>=': + if (is_numeric($operand1) && is_numeric($operand2)) { + $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 > $operand2)); + } elseif ($useLowercaseFirstComparison) { + $result = $this->strcmpLowercaseFirst($operand1, $operand2) >= 0; + } else { + $result = strcmp($operand1, $operand2) >= 0; + } + + break; + // Less than or equal + case '<=': + if (is_numeric($operand1) && is_numeric($operand2)) { + $result = ((abs($operand1 - $operand2) < $this->delta) || ($operand1 < $operand2)); + } elseif ($useLowercaseFirstComparison) { + $result = $this->strcmpLowercaseFirst($operand1, $operand2) <= 0; + } else { + $result = strcmp($operand1, $operand2) <= 0; + } + + break; + // Inequality + case '<>': + if (is_numeric($operand1) && is_numeric($operand2)) { + $result = (abs($operand1 - $operand2) > 1E-14); + } else { + $result = strcmp($operand1, $operand2) != 0; + } + + break; + } + + // Log the result details + $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); + // And push the result onto the stack + $stack->push('Value', $result); + + return $result; + } + + /** + * Compare two strings in the same way as strcmp() except that lowercase come before uppercase letters. + * + * @param string $str1 First string value for the comparison + * @param string $str2 Second string value for the comparison + * + * @return int + */ + private function strcmpLowercaseFirst($str1, $str2) + { + $inversedStr1 = Shared\StringHelper::strCaseReverse($str1); + $inversedStr2 = Shared\StringHelper::strCaseReverse($str2); + + return strcmp($inversedStr1, $inversedStr2); + } + + /** + * @param mixed $operand1 + * @param mixed $operand2 + * @param mixed $operation + * @param string $matrixFunction + * @param mixed $stack + * + * @return bool|mixed + */ + private function executeNumericBinaryOperation($operand1, $operand2, $operation, $matrixFunction, &$stack) + { + // Validate the two operands + if (!$this->validateBinaryOperand($operand1, $stack)) { + return false; + } + if (!$this->validateBinaryOperand($operand2, $stack)) { + return false; + } + + // If either of the operands is a matrix, we need to treat them both as matrices + // (converting the other operand to a matrix if need be); then perform the required + // matrix operation + if ((is_array($operand1)) || (is_array($operand2))) { + // Ensure that both operands are arrays/matrices of the same size + self::checkMatrixOperands($operand1, $operand2, 2); + + try { + // Convert operand 1 from a PHP array to a matrix + $matrix = new Shared\JAMA\Matrix($operand1); + // Perform the required operation against the operand 1 matrix, passing in operand 2 + $matrixResult = $matrix->$matrixFunction($operand2); + $result = $matrixResult->getArray(); + } catch (\Exception $ex) { + $this->debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage()); + $result = '#VALUE!'; + } + } else { + if ((Functions::getCompatibilityMode() != Functions::COMPATIBILITY_OPENOFFICE) && + ((is_string($operand1) && !is_numeric($operand1) && strlen($operand1) > 0) || + (is_string($operand2) && !is_numeric($operand2) && strlen($operand2) > 0))) { + $result = Functions::VALUE(); + } else { + // If we're dealing with non-matrix operations, execute the necessary operation + switch ($operation) { + // Addition + case '+': + $result = $operand1 + $operand2; + + break; + // Subtraction + case '-': + $result = $operand1 - $operand2; + + break; + // Multiplication + case '*': + $result = $operand1 * $operand2; + + break; + // Division + case '/': + if ($operand2 == 0) { + // Trap for Divide by Zero error + $stack->push('Value', '#DIV/0!'); + $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails('#DIV/0!')); + + return false; + } + $result = $operand1 / $operand2; + + break; + // Power + case '^': + $result = pow($operand1, $operand2); + + break; + } + } + } + + // Log the result details + $this->debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($result)); + // And push the result onto the stack + $stack->push('Value', $result); + + return $result; + } + + // trigger an error, but nicely, if need be + protected function raiseFormulaError($errorMessage) + { + $this->formulaError = $errorMessage; + $this->cyclicReferenceStack->clear(); + if (!$this->suppressFormulaErrors) { + throw new Exception($errorMessage); + } + trigger_error($errorMessage, E_USER_ERROR); + + return false; + } + + /** + * Extract range values. + * + * @param string &$pRange String based range representation + * @param Worksheet $pSheet Worksheet + * @param bool $resetLog Flag indicating whether calculation log should be reset or not + * + * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. + */ + public function extractCellRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) + { + // Return value + $returnValue = []; + + if ($pSheet !== null) { + $pSheetName = $pSheet->getTitle(); + if (strpos($pRange, '!') !== false) { + [$pSheetName, $pRange] = Worksheet::extractSheetTitle($pRange, true); + $pSheet = $this->spreadsheet->getSheetByName($pSheetName); + } + + // Extract range + $aReferences = Coordinate::extractAllCellReferencesInRange($pRange); + $pRange = $pSheetName . '!' . $pRange; + if (!isset($aReferences[1])) { + $currentCol = ''; + $currentRow = 0; + // Single cell in range + sscanf($aReferences[0], '%[A-Z]%d', $currentCol, $currentRow); + if ($pSheet->cellExists($aReferences[0])) { + $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); + } else { + $returnValue[$currentRow][$currentCol] = null; + } + } else { + // Extract cell data for all cells in the range + foreach ($aReferences as $reference) { + $currentCol = ''; + $currentRow = 0; + // Extract range + sscanf($reference, '%[A-Z]%d', $currentCol, $currentRow); + if ($pSheet->cellExists($reference)) { + $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); + } else { + $returnValue[$currentRow][$currentCol] = null; + } + } + } + } + + return $returnValue; + } + + /** + * Extract range values. + * + * @param string &$pRange String based range representation + * @param Worksheet $pSheet Worksheet + * @param bool $resetLog Flag indicating whether calculation log should be reset or not + * + * @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned. + */ + public function extractNamedRange(&$pRange = 'A1', Worksheet $pSheet = null, $resetLog = true) + { + // Return value + $returnValue = []; + + if ($pSheet !== null) { + $pSheetName = $pSheet->getTitle(); + if (strpos($pRange, '!') !== false) { + [$pSheetName, $pRange] = Worksheet::extractSheetTitle($pRange, true); + $pSheet = $this->spreadsheet->getSheetByName($pSheetName); + } + + // Named range? + $namedRange = NamedRange::resolveRange($pRange, $pSheet); + if ($namedRange !== null) { + $pSheet = $namedRange->getWorksheet(); + $pRange = $namedRange->getRange(); + $splitRange = Coordinate::splitRange($pRange); + // Convert row and column references + if (ctype_alpha($splitRange[0][0])) { + $pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow(); + } elseif (ctype_digit($splitRange[0][0])) { + $pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1]; + } + } else { + return Functions::REF(); + } + + // Extract range + $aReferences = Coordinate::extractAllCellReferencesInRange($pRange); + if (!isset($aReferences[1])) { + // Single cell (or single column or row) in range + [$currentCol, $currentRow] = Coordinate::coordinateFromString($aReferences[0]); + if ($pSheet->cellExists($aReferences[0])) { + $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); + } else { + $returnValue[$currentRow][$currentCol] = null; + } + } else { + // Extract cell data for all cells in the range + foreach ($aReferences as $reference) { + // Extract range + [$currentCol, $currentRow] = Coordinate::coordinateFromString($reference); + if ($pSheet->cellExists($reference)) { + $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); + } else { + $returnValue[$currentRow][$currentCol] = null; + } + } + } + } + + return $returnValue; + } + + /** + * Is a specific function implemented? + * + * @param string $pFunction Function Name + * + * @return bool + */ + public function isImplemented($pFunction) + { + $pFunction = strtoupper($pFunction); + $notImplemented = !isset(self::$phpSpreadsheetFunctions[$pFunction]) || (is_array(self::$phpSpreadsheetFunctions[$pFunction]['functionCall']) && self::$phpSpreadsheetFunctions[$pFunction]['functionCall'][1] === 'DUMMY'); + + return !$notImplemented; + } + + /** + * Get a list of all implemented functions as an array of function objects. + * + * @return array of Category + */ + public function getFunctions() + { + return self::$phpSpreadsheetFunctions; + } + + /** + * Get a list of implemented Excel function names. + * + * @return array + */ + public function getImplementedFunctionNames() + { + $returnValue = []; + foreach (self::$phpSpreadsheetFunctions as $functionName => $function) { + if ($this->isImplemented($functionName)) { + $returnValue[] = $functionName; + } + } + + return $returnValue; + } + + /** + * Add cell reference if needed while making sure that it is the last argument. + * + * @param array $args + * @param bool $passCellReference + * @param array|string $functionCall + * @param null|Cell $pCell + * + * @return array + */ + private function addCellReference(array $args, $passCellReference, $functionCall, Cell $pCell = null) + { + if ($passCellReference) { + if (is_array($functionCall)) { + $className = $functionCall[0]; + $methodName = $functionCall[1]; + + $reflectionMethod = new \ReflectionMethod($className, $methodName); + $argumentCount = count($reflectionMethod->getParameters()); + while (count($args) < $argumentCount - 1) { + $args[] = null; + } + } + + $args[] = $pCell; + } + + return $args; + } + + private function getUnusedBranchStoreKey() + { + $storeKeyValue = 'storeKey-' . $this->branchStoreKeyCounter; + ++$this->branchStoreKeyCounter; + + return $storeKeyValue; + } + + private function getTokensAsString($tokens) + { + $tokensStr = array_map(function ($token) { + $value = $token['value'] ?? 'no value'; + while (is_array($value)) { + $value = array_pop($value); + } + + return $value; + }, $tokens); + + return '[ ' . implode(' | ', $tokensStr) . ' ]'; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Category.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Category.php new file mode 100644 index 0000000..7574cb4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Category.php @@ -0,0 +1,19 @@ + $criteriaName) { + $testCondition = []; + $testConditionCount = 0; + foreach ($criteria as $row => $criterion) { + if ($criterion[$key] > '') { + $testCondition[] = '[:' . $criteriaName . ']' . Functions::ifCondition($criterion[$key]); + ++$testConditionCount; + } + } + if ($testConditionCount > 1) { + $testConditions[] = 'OR(' . implode(',', $testCondition) . ')'; + ++$testConditionsCount; + } elseif ($testConditionCount == 1) { + $testConditions[] = $testCondition[0]; + ++$testConditionsCount; + } + } + + if ($testConditionsCount > 1) { + $testConditionSet = 'AND(' . implode(',', $testConditions) . ')'; + } elseif ($testConditionsCount == 1) { + $testConditionSet = $testConditions[0]; + } + + // Loop through each row of the database + foreach ($database as $dataRow => $dataValues) { + // Substitute actual values from the database row for our [:placeholders] + $testConditionList = $testConditionSet; + foreach ($criteriaNames as $key => $criteriaName) { + $k = array_search($criteriaName, $fieldNames); + if (isset($dataValues[$k])) { + $dataValue = $dataValues[$k]; + $dataValue = (is_string($dataValue)) ? Calculation::wrapResult(strtoupper($dataValue)) : $dataValue; + $testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList); + } + } + // evaluate the criteria against the row data + $result = Calculation::getInstance()->_calculateFormulaValue('=' . $testConditionList); + // If the row failed to meet the criteria, remove it from the database + if (!$result) { + unset($database[$dataRow]); + } + } + + return $database; + } + + private static function getFilteredColumn($database, $field, $criteria) + { + // reduce the database to a set of rows that match all the criteria + $database = self::filter($database, $criteria); + // extract an array of values for the requested column + $colData = []; + foreach ($database as $row) { + $colData[] = $row[$field]; + } + + return $colData; + } + + /** + * DAVERAGE. + * + * Averages the values in a column of a list or database that match conditions you specify. + * + * Excel Function: + * DAVERAGE(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float|string + */ + public static function DAVERAGE($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return Statistical::AVERAGE( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DCOUNT. + * + * Counts the cells that contain numbers in a column of a list or database that match conditions + * that you specify. + * + * Excel Function: + * DCOUNT(database,[field],criteria) + * + * Excel Function: + * DAVERAGE(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return int + * + * @TODO The field argument is optional. If field is omitted, DCOUNT counts all records in the + * database that match the criteria. + */ + public static function DCOUNT($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return Statistical::COUNT( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DCOUNTA. + * + * Counts the nonblank cells in a column of a list or database that match conditions that you specify. + * + * Excel Function: + * DCOUNTA(database,[field],criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return int + * + * @TODO The field argument is optional. If field is omitted, DCOUNTA counts all records in the + * database that match the criteria. + */ + public static function DCOUNTA($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // reduce the database to a set of rows that match all the criteria + $database = self::filter($database, $criteria); + // extract an array of values for the requested column + $colData = []; + foreach ($database as $row) { + $colData[] = $row[$field]; + } + + // Return + return Statistical::COUNTA( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DGET. + * + * Extracts a single value from a column of a list or database that matches conditions that you + * specify. + * + * Excel Function: + * DGET(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return mixed + */ + public static function DGET($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + $colData = self::getFilteredColumn($database, $field, $criteria); + if (count($colData) > 1) { + return Functions::NAN(); + } + + return $colData[0]; + } + + /** + * DMAX. + * + * Returns the largest number in a column of a list or database that matches conditions you that + * specify. + * + * Excel Function: + * DMAX(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float + */ + public static function DMAX($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return Statistical::MAX( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DMIN. + * + * Returns the smallest number in a column of a list or database that matches conditions you that + * specify. + * + * Excel Function: + * DMIN(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float + */ + public static function DMIN($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return Statistical::MIN( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DPRODUCT. + * + * Multiplies the values in a column of a list or database that match conditions that you specify. + * + * Excel Function: + * DPRODUCT(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float + */ + public static function DPRODUCT($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return MathTrig::PRODUCT( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DSTDEV. + * + * Estimates the standard deviation of a population based on a sample by using the numbers in a + * column of a list or database that match conditions that you specify. + * + * Excel Function: + * DSTDEV(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float|string + */ + public static function DSTDEV($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return Statistical::STDEV( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DSTDEVP. + * + * Calculates the standard deviation of a population based on the entire population by using the + * numbers in a column of a list or database that match conditions that you specify. + * + * Excel Function: + * DSTDEVP(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float|string + */ + public static function DSTDEVP($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return Statistical::STDEVP( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DSUM. + * + * Adds the numbers in a column of a list or database that match conditions that you specify. + * + * Excel Function: + * DSUM(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float + */ + public static function DSUM($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return MathTrig::SUM( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DVAR. + * + * Estimates the variance of a population based on a sample by using the numbers in a column + * of a list or database that match conditions that you specify. + * + * Excel Function: + * DVAR(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float + */ + public static function DVAR($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return Statistical::VARFunc( + self::getFilteredColumn($database, $field, $criteria) + ); + } + + /** + * DVARP. + * + * Calculates the variance of a population based on the entire population by using the numbers + * in a column of a list or database that match conditions that you specify. + * + * Excel Function: + * DVARP(database,field,criteria) + * + * @category Database Functions + * + * @param mixed[] $database The range of cells that makes up the list or database. + * A database is a list of related data in which rows of related + * information are records, and columns of data are fields. The + * first row of the list contains labels for each column. + * @param int|string $field Indicates which column is used in the function. Enter the + * column label enclosed between double quotation marks, such as + * "Age" or "Yield," or a number (without quotation marks) that + * represents the position of the column within the list: 1 for + * the first column, 2 for the second column, and so on. + * @param mixed[] $criteria The range of cells that contains the conditions you specify. + * You can use any range for the criteria argument, as long as it + * includes at least one column label and at least one cell below + * the column label in which you specify a condition for the + * column. + * + * @return float + */ + public static function DVARP($database, $field, $criteria) + { + $field = self::fieldExtract($database, $field); + if ($field === null) { + return null; + } + + // Return + return Statistical::VARP( + self::getFilteredColumn($database, $field, $criteria) + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php new file mode 100644 index 0000000..4f85ede --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php @@ -0,0 +1,1691 @@ +format('m'); + $oYear = (int) $PHPDateObject->format('Y'); + + $adjustmentMonthsString = (string) $adjustmentMonths; + if ($adjustmentMonths > 0) { + $adjustmentMonthsString = '+' . $adjustmentMonths; + } + if ($adjustmentMonths != 0) { + $PHPDateObject->modify($adjustmentMonthsString . ' months'); + } + $nMonth = (int) $PHPDateObject->format('m'); + $nYear = (int) $PHPDateObject->format('Y'); + + $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12); + if ($monthDiff != $adjustmentMonths) { + $adjustDays = (int) $PHPDateObject->format('d'); + $adjustDaysString = '-' . $adjustDays . ' days'; + $PHPDateObject->modify($adjustDaysString); + } + + return $PHPDateObject; + } + + /** + * DATETIMENOW. + * + * Returns the current date and time. + * The NOW function is useful when you need to display the current date and time on a worksheet or + * calculate a value based on the current date and time, and have that value updated each time you + * open the worksheet. + * + * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date + * and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. + * + * Excel Function: + * NOW() + * + * @category Date/Time Functions + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function DATETIMENOW() + { + $saveTimeZone = date_default_timezone_get(); + date_default_timezone_set('UTC'); + $retValue = false; + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + $retValue = (float) Date::PHPToExcel(time()); + + break; + case Functions::RETURNDATE_UNIX_TIMESTAMP: + $retValue = (int) time(); + + break; + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + $retValue = new \DateTime(); + + break; + } + date_default_timezone_set($saveTimeZone); + + return $retValue; + } + + /** + * DATENOW. + * + * Returns the current date. + * The NOW function is useful when you need to display the current date and time on a worksheet or + * calculate a value based on the current date and time, and have that value updated each time you + * open the worksheet. + * + * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date + * and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. + * + * Excel Function: + * TODAY() + * + * @category Date/Time Functions + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function DATENOW() + { + $saveTimeZone = date_default_timezone_get(); + date_default_timezone_set('UTC'); + $retValue = false; + $excelDateTime = floor(Date::PHPToExcel(time())); + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + $retValue = (float) $excelDateTime; + + break; + case Functions::RETURNDATE_UNIX_TIMESTAMP: + $retValue = (int) Date::excelToTimestamp($excelDateTime); + + break; + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + $retValue = Date::excelToDateTimeObject($excelDateTime); + + break; + } + date_default_timezone_set($saveTimeZone); + + return $retValue; + } + + /** + * DATE. + * + * The DATE function returns a value that represents a particular date. + * + * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date + * format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. + * + * Excel Function: + * DATE(year,month,day) + * + * PhpSpreadsheet is a lot more forgiving than MS Excel when passing non numeric values to this function. + * A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted, + * as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language. + * + * @category Date/Time Functions + * + * @param int $year The value of the year argument can include one to four digits. + * Excel interprets the year argument according to the configured + * date system: 1900 or 1904. + * If year is between 0 (zero) and 1899 (inclusive), Excel adds that + * value to 1900 to calculate the year. For example, DATE(108,1,2) + * returns January 2, 2008 (1900+108). + * If year is between 1900 and 9999 (inclusive), Excel uses that + * value as the year. For example, DATE(2008,1,2) returns January 2, + * 2008. + * If year is less than 0 or is 10000 or greater, Excel returns the + * #NUM! error value. + * @param int $month A positive or negative integer representing the month of the year + * from 1 to 12 (January to December). + * If month is greater than 12, month adds that number of months to + * the first month in the year specified. For example, DATE(2008,14,2) + * returns the serial number representing February 2, 2009. + * If month is less than 1, month subtracts the magnitude of that + * number of months, plus 1, from the first month in the year + * specified. For example, DATE(2008,-3,2) returns the serial number + * representing September 2, 2007. + * @param int $day A positive or negative integer representing the day of the month + * from 1 to 31. + * If day is greater than the number of days in the month specified, + * day adds that number of days to the first day in the month. For + * example, DATE(2008,1,35) returns the serial number representing + * February 4, 2008. + * If day is less than 1, day subtracts the magnitude that number of + * days, plus one, from the first day of the month specified. For + * example, DATE(2008,1,-15) returns the serial number representing + * December 16, 2007. + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function DATE($year = 0, $month = 1, $day = 1) + { + $year = Functions::flattenSingleValue($year); + $month = Functions::flattenSingleValue($month); + $day = Functions::flattenSingleValue($day); + + if (($month !== null) && (!is_numeric($month))) { + $month = Date::monthStringToNumber($month); + } + + if (($day !== null) && (!is_numeric($day))) { + $day = Date::dayStringToNumber($day); + } + + $year = ($year !== null) ? StringHelper::testStringAsNumeric($year) : 0; + $month = ($month !== null) ? StringHelper::testStringAsNumeric($month) : 0; + $day = ($day !== null) ? StringHelper::testStringAsNumeric($day) : 0; + if ((!is_numeric($year)) || + (!is_numeric($month)) || + (!is_numeric($day))) { + return Functions::VALUE(); + } + $year = (int) $year; + $month = (int) $month; + $day = (int) $day; + + $baseYear = Date::getExcelCalendar(); + // Validate parameters + if ($year < ($baseYear - 1900)) { + return Functions::NAN(); + } + if ((($baseYear - 1900) != 0) && ($year < $baseYear) && ($year >= 1900)) { + return Functions::NAN(); + } + + if (($year < $baseYear) && ($year >= ($baseYear - 1900))) { + $year += 1900; + } + + if ($month < 1) { + // Handle year/month adjustment if month < 1 + --$month; + $year += ceil($month / 12) - 1; + $month = 13 - abs($month % 12); + } elseif ($month > 12) { + // Handle year/month adjustment if month > 12 + $year += floor($month / 12); + $month = ($month % 12); + } + + // Re-validate the year parameter after adjustments + if (($year < $baseYear) || ($year >= 10000)) { + return Functions::NAN(); + } + + // Execute function + $excelDateValue = Date::formattedPHPToExcel($year, $month, $day); + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + return (float) $excelDateValue; + case Functions::RETURNDATE_UNIX_TIMESTAMP: + return (int) Date::excelToTimestamp($excelDateValue); + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + return Date::excelToDateTimeObject($excelDateValue); + } + } + + /** + * TIME. + * + * The TIME function returns a value that represents a particular time. + * + * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time + * format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. + * + * Excel Function: + * TIME(hour,minute,second) + * + * @category Date/Time Functions + * + * @param int $hour A number from 0 (zero) to 32767 representing the hour. + * Any value greater than 23 will be divided by 24 and the remainder + * will be treated as the hour value. For example, TIME(27,0,0) = + * TIME(3,0,0) = .125 or 3:00 AM. + * @param int $minute A number from 0 to 32767 representing the minute. + * Any value greater than 59 will be converted to hours and minutes. + * For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM. + * @param int $second A number from 0 to 32767 representing the second. + * Any value greater than 59 will be converted to hours, minutes, + * and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 + * or 12:33:20 AM + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function TIME($hour = 0, $minute = 0, $second = 0) + { + $hour = Functions::flattenSingleValue($hour); + $minute = Functions::flattenSingleValue($minute); + $second = Functions::flattenSingleValue($second); + + if ($hour == '') { + $hour = 0; + } + if ($minute == '') { + $minute = 0; + } + if ($second == '') { + $second = 0; + } + + if ((!is_numeric($hour)) || (!is_numeric($minute)) || (!is_numeric($second))) { + return Functions::VALUE(); + } + $hour = (int) $hour; + $minute = (int) $minute; + $second = (int) $second; + + if ($second < 0) { + $minute += floor($second / 60); + $second = 60 - abs($second % 60); + if ($second == 60) { + $second = 0; + } + } elseif ($second >= 60) { + $minute += floor($second / 60); + $second = $second % 60; + } + if ($minute < 0) { + $hour += floor($minute / 60); + $minute = 60 - abs($minute % 60); + if ($minute == 60) { + $minute = 0; + } + } elseif ($minute >= 60) { + $hour += floor($minute / 60); + $minute = $minute % 60; + } + + if ($hour > 23) { + $hour = $hour % 24; + } elseif ($hour < 0) { + return Functions::NAN(); + } + + // Execute function + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + $date = 0; + $calendar = Date::getExcelCalendar(); + if ($calendar != Date::CALENDAR_WINDOWS_1900) { + $date = 1; + } + + return (float) Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second); + case Functions::RETURNDATE_UNIX_TIMESTAMP: + return (int) Date::excelToTimestamp(Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; // -2147472000 + 3600 + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + $dayAdjust = 0; + if ($hour < 0) { + $dayAdjust = floor($hour / 24); + $hour = 24 - abs($hour % 24); + if ($hour == 24) { + $hour = 0; + } + } elseif ($hour >= 24) { + $dayAdjust = floor($hour / 24); + $hour = $hour % 24; + } + $phpDateObject = new \DateTime('1900-01-01 ' . $hour . ':' . $minute . ':' . $second); + if ($dayAdjust != 0) { + $phpDateObject->modify($dayAdjust . ' days'); + } + + return $phpDateObject; + } + } + + /** + * DATEVALUE. + * + * Returns a value that represents a particular date. + * Use DATEVALUE to convert a date represented by a text string to an Excel or PHP date/time stamp + * value. + * + * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date + * format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. + * + * Excel Function: + * DATEVALUE(dateValue) + * + * @category Date/Time Functions + * + * @param string $dateValue Text that represents a date in a Microsoft Excel date format. + * For example, "1/30/2008" or "30-Jan-2008" are text strings within + * quotation marks that represent dates. Using the default date + * system in Excel for Windows, date_text must represent a date from + * January 1, 1900, to December 31, 9999. Using the default date + * system in Excel for the Macintosh, date_text must represent a date + * from January 1, 1904, to December 31, 9999. DATEVALUE returns the + * #VALUE! error value if date_text is out of this range. + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function DATEVALUE($dateValue = 1) + { + $dateValue = trim(Functions::flattenSingleValue($dateValue), '"'); + // Strip any ordinals because they're allowed in Excel (English only) + $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue); + // Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany) + $dateValue = str_replace(['/', '.', '-', ' '], ' ', $dateValue); + + $yearFound = false; + $t1 = explode(' ', $dateValue); + foreach ($t1 as &$t) { + if ((is_numeric($t)) && ($t > 31)) { + if ($yearFound) { + return Functions::VALUE(); + } + if ($t < 100) { + $t += 1900; + } + $yearFound = true; + } + } + if ((count($t1) == 1) && (strpos($t, ':') !== false)) { + // We've been fed a time value without any date + return 0.0; + } elseif (count($t1) == 2) { + // We only have two parts of the date: either day/month or month/year + if ($yearFound) { + array_unshift($t1, 1); + } else { + if ($t1[1] > 29) { + $t1[1] += 1900; + array_unshift($t1, 1); + } else { + $t1[] = date('Y'); + } + } + } + unset($t); + $dateValue = implode(' ', $t1); + + $PHPDateArray = date_parse($dateValue); + if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { + $testVal1 = strtok($dateValue, '- '); + if ($testVal1 !== false) { + $testVal2 = strtok('- '); + if ($testVal2 !== false) { + $testVal3 = strtok('- '); + if ($testVal3 === false) { + $testVal3 = strftime('%Y'); + } + } else { + return Functions::VALUE(); + } + } else { + return Functions::VALUE(); + } + if ($testVal1 < 31 && $testVal2 < 12 && $testVal3 < 12 && strlen($testVal3) == 2) { + $testVal3 += 2000; + } + $PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3); + if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { + $PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3); + if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { + return Functions::VALUE(); + } + } + } + + if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) { + // Execute function + if ($PHPDateArray['year'] == '') { + $PHPDateArray['year'] = strftime('%Y'); + } + if ($PHPDateArray['year'] < 1900) { + return Functions::VALUE(); + } + if ($PHPDateArray['month'] == '') { + $PHPDateArray['month'] = strftime('%m'); + } + if ($PHPDateArray['day'] == '') { + $PHPDateArray['day'] = strftime('%d'); + } + if (!checkdate($PHPDateArray['month'], $PHPDateArray['day'], $PHPDateArray['year'])) { + return Functions::VALUE(); + } + $excelDateValue = floor( + Date::formattedPHPToExcel( + $PHPDateArray['year'], + $PHPDateArray['month'], + $PHPDateArray['day'], + $PHPDateArray['hour'], + $PHPDateArray['minute'], + $PHPDateArray['second'] + ) + ); + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + return (float) $excelDateValue; + case Functions::RETURNDATE_UNIX_TIMESTAMP: + return (int) Date::excelToTimestamp($excelDateValue); + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00'); + } + } + + return Functions::VALUE(); + } + + /** + * TIMEVALUE. + * + * Returns a value that represents a particular time. + * Use TIMEVALUE to convert a time represented by a text string to an Excel or PHP date/time stamp + * value. + * + * NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time + * format of your regional settings. PhpSpreadsheet does not change cell formatting in this way. + * + * Excel Function: + * TIMEVALUE(timeValue) + * + * @category Date/Time Functions + * + * @param string $timeValue A text string that represents a time in any one of the Microsoft + * Excel time formats; for example, "6:45 PM" and "18:45" text strings + * within quotation marks that represent time. + * Date information in time_text is ignored. + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function TIMEVALUE($timeValue) + { + $timeValue = trim(Functions::flattenSingleValue($timeValue), '"'); + $timeValue = str_replace(['/', '.'], '-', $timeValue); + + $arraySplit = preg_split('/[\/:\-\s]/', $timeValue); + if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) { + $arraySplit[0] = ($arraySplit[0] % 24); + $timeValue = implode(':', $arraySplit); + } + + $PHPDateArray = date_parse($timeValue); + if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + $excelDateValue = Date::formattedPHPToExcel( + $PHPDateArray['year'], + $PHPDateArray['month'], + $PHPDateArray['day'], + $PHPDateArray['hour'], + $PHPDateArray['minute'], + $PHPDateArray['second'] + ); + } else { + $excelDateValue = Date::formattedPHPToExcel(1900, 1, 1, $PHPDateArray['hour'], $PHPDateArray['minute'], $PHPDateArray['second']) - 1; + } + + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + return (float) $excelDateValue; + case Functions::RETURNDATE_UNIX_TIMESTAMP: + return (int) $phpDateValue = Date::excelToTimestamp($excelDateValue + 25569) - 3600; + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']); + } + } + + return Functions::VALUE(); + } + + /** + * DATEDIF. + * + * @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object + * or a standard date string + * @param mixed $endDate Excel date serial value, PHP date/time stamp, PHP DateTime object + * or a standard date string + * @param string $unit + * + * @return int|string Interval between the dates + */ + public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D') + { + $startDate = Functions::flattenSingleValue($startDate); + $endDate = Functions::flattenSingleValue($endDate); + $unit = strtoupper(Functions::flattenSingleValue($unit)); + + if (is_string($startDate = self::getDateValue($startDate))) { + return Functions::VALUE(); + } + if (is_string($endDate = self::getDateValue($endDate))) { + return Functions::VALUE(); + } + + // Validate parameters + if ($startDate > $endDate) { + return Functions::NAN(); + } + + // Execute function + $difference = $endDate - $startDate; + + $PHPStartDateObject = Date::excelToDateTimeObject($startDate); + $startDays = $PHPStartDateObject->format('j'); + $startMonths = $PHPStartDateObject->format('n'); + $startYears = $PHPStartDateObject->format('Y'); + + $PHPEndDateObject = Date::excelToDateTimeObject($endDate); + $endDays = $PHPEndDateObject->format('j'); + $endMonths = $PHPEndDateObject->format('n'); + $endYears = $PHPEndDateObject->format('Y'); + + switch ($unit) { + case 'D': + $retVal = (int) $difference; + + break; + case 'M': + $retVal = (int) ($endMonths - $startMonths) + ((int) ($endYears - $startYears) * 12); + // We're only interested in full months + if ($endDays < $startDays) { + --$retVal; + } + + break; + case 'Y': + $retVal = (int) ($endYears - $startYears); + // We're only interested in full months + if ($endMonths < $startMonths) { + --$retVal; + } elseif (($endMonths == $startMonths) && ($endDays < $startDays)) { + // Remove start month + --$retVal; + // Remove end month + --$retVal; + } + + break; + case 'MD': + if ($endDays < $startDays) { + $retVal = $endDays; + $PHPEndDateObject->modify('-' . $endDays . ' days'); + $adjustDays = $PHPEndDateObject->format('j'); + $retVal += ($adjustDays - $startDays); + } else { + $retVal = $endDays - $startDays; + } + + break; + case 'YM': + $retVal = (int) ($endMonths - $startMonths); + if ($retVal < 0) { + $retVal += 12; + } + // We're only interested in full months + if ($endDays < $startDays) { + --$retVal; + } + + break; + case 'YD': + $retVal = (int) $difference; + if ($endYears > $startYears) { + $isLeapStartYear = $PHPStartDateObject->format('L'); + $wasLeapEndYear = $PHPEndDateObject->format('L'); + + // Adjust end year to be as close as possible as start year + while ($PHPEndDateObject >= $PHPStartDateObject) { + $PHPEndDateObject->modify('-1 year'); + $endYears = $PHPEndDateObject->format('Y'); + } + $PHPEndDateObject->modify('+1 year'); + + // Get the result + $retVal = $PHPEndDateObject->diff($PHPStartDateObject)->days; + + // Adjust for leap years cases + $isLeapEndYear = $PHPEndDateObject->format('L'); + $limit = new \DateTime($PHPEndDateObject->format('Y-02-29')); + if (!$isLeapStartYear && !$wasLeapEndYear && $isLeapEndYear && $PHPEndDateObject >= $limit) { + --$retVal; + } + } + + break; + default: + $retVal = Functions::VALUE(); + } + + return $retVal; + } + + /** + * DAYS. + * + * Returns the number of days between two dates + * + * Excel Function: + * DAYS(endDate, startDate) + * + * @category Date/Time Functions + * + * @param \DateTimeImmutable|float|int|string $endDate Excel date serial value (float), + * PHP date timestamp (integer), PHP DateTime object, or a standard date string + * @param \DateTimeImmutable|float|int|string $startDate Excel date serial value (float), + * PHP date timestamp (integer), PHP DateTime object, or a standard date string + * + * @return int|string Number of days between start date and end date or an error + */ + public static function DAYS($endDate = 0, $startDate = 0) + { + $startDate = Functions::flattenSingleValue($startDate); + $endDate = Functions::flattenSingleValue($endDate); + + $startDate = self::getDateValue($startDate); + if (is_string($startDate)) { + return Functions::VALUE(); + } + + $endDate = self::getDateValue($endDate); + if (is_string($endDate)) { + return Functions::VALUE(); + } + + // Execute function + $PHPStartDateObject = Date::excelToDateTimeObject($startDate); + $PHPEndDateObject = Date::excelToDateTimeObject($endDate); + + $diff = $PHPStartDateObject->diff($PHPEndDateObject); + $days = $diff->days; + + if ($diff->invert) { + $days = -$days; + } + + return $days; + } + + /** + * DAYS360. + * + * Returns the number of days between two dates based on a 360-day year (twelve 30-day months), + * which is used in some accounting calculations. Use this function to help compute payments if + * your accounting system is based on twelve 30-day months. + * + * Excel Function: + * DAYS360(startDate,endDate[,method]) + * + * @category Date/Time Functions + * + * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param bool $method US or European Method + * FALSE or omitted: U.S. (NASD) method. If the starting date is + * the last day of a month, it becomes equal to the 30th of the + * same month. If the ending date is the last day of a month and + * the starting date is earlier than the 30th of a month, the + * ending date becomes equal to the 1st of the next month; + * otherwise the ending date becomes equal to the 30th of the + * same month. + * TRUE: European method. Starting dates and ending dates that + * occur on the 31st of a month become equal to the 30th of the + * same month. + * + * @return int|string Number of days between start date and end date + */ + public static function DAYS360($startDate = 0, $endDate = 0, $method = false) + { + $startDate = Functions::flattenSingleValue($startDate); + $endDate = Functions::flattenSingleValue($endDate); + + if (is_string($startDate = self::getDateValue($startDate))) { + return Functions::VALUE(); + } + if (is_string($endDate = self::getDateValue($endDate))) { + return Functions::VALUE(); + } + + if (!is_bool($method)) { + return Functions::VALUE(); + } + + // Execute function + $PHPStartDateObject = Date::excelToDateTimeObject($startDate); + $startDay = $PHPStartDateObject->format('j'); + $startMonth = $PHPStartDateObject->format('n'); + $startYear = $PHPStartDateObject->format('Y'); + + $PHPEndDateObject = Date::excelToDateTimeObject($endDate); + $endDay = $PHPEndDateObject->format('j'); + $endMonth = $PHPEndDateObject->format('n'); + $endYear = $PHPEndDateObject->format('Y'); + + return self::dateDiff360($startDay, $startMonth, $startYear, $endDay, $endMonth, $endYear, !$method); + } + + /** + * YEARFRAC. + * + * Calculates the fraction of the year represented by the number of whole days between two dates + * (the start_date and the end_date). + * Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or + * obligations to assign to a specific term. + * + * Excel Function: + * YEARFRAC(startDate,endDate[,method]) + * See https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html + * for description of algorithm used in Excel + * + * @category Date/Time Functions + * + * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param int $method Method used for the calculation + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string fraction of the year, or a string containing an error + */ + public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0) + { + $startDate = Functions::flattenSingleValue($startDate); + $endDate = Functions::flattenSingleValue($endDate); + $method = Functions::flattenSingleValue($method); + + if (is_string($startDate = self::getDateValue($startDate))) { + return Functions::VALUE(); + } + if (is_string($endDate = self::getDateValue($endDate))) { + return Functions::VALUE(); + } + if ($startDate > $endDate) { + $temp = $startDate; + $startDate = $endDate; + $endDate = $temp; + } + + if (((is_numeric($method)) && (!is_string($method))) || ($method == '')) { + switch ($method) { + case 0: + return self::DAYS360($startDate, $endDate) / 360; + case 1: + $days = self::DATEDIF($startDate, $endDate); + $startYear = self::YEAR($startDate); + $endYear = self::YEAR($endDate); + $years = $endYear - $startYear + 1; + $startMonth = self::MONTHOFYEAR($startDate); + $startDay = self::DAYOFMONTH($startDate); + $endMonth = self::MONTHOFYEAR($endDate); + $endDay = self::DAYOFMONTH($endDate); + $startMonthDay = 100 * $startMonth + $startDay; + $endMonthDay = 100 * $endMonth + $endDay; + if ($years == 1) { + if (self::isLeapYear($endYear)) { + $tmpCalcAnnualBasis = 366; + } else { + $tmpCalcAnnualBasis = 365; + } + } elseif ($years == 2 && $startMonthDay >= $endMonthDay) { + if (self::isLeapYear($startYear)) { + if ($startMonthDay <= 229) { + $tmpCalcAnnualBasis = 366; + } else { + $tmpCalcAnnualBasis = 365; + } + } elseif (self::isLeapYear($endYear)) { + if ($endMonthDay >= 229) { + $tmpCalcAnnualBasis = 366; + } else { + $tmpCalcAnnualBasis = 365; + } + } else { + $tmpCalcAnnualBasis = 365; + } + } else { + $tmpCalcAnnualBasis = 0; + for ($year = $startYear; $year <= $endYear; ++$year) { + $tmpCalcAnnualBasis += self::isLeapYear($year) ? 366 : 365; + } + $tmpCalcAnnualBasis /= $years; + } + + return $days / $tmpCalcAnnualBasis; + case 2: + return self::DATEDIF($startDate, $endDate) / 360; + case 3: + return self::DATEDIF($startDate, $endDate) / 365; + case 4: + return self::DAYS360($startDate, $endDate, true) / 360; + } + } + + return Functions::VALUE(); + } + + /** + * NETWORKDAYS. + * + * Returns the number of whole working days between start_date and end_date. Working days + * exclude weekends and any dates identified in holidays. + * Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days + * worked during a specific term. + * + * Excel Function: + * NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]]) + * + * @category Date/Time Functions + * + * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * + * @return int|string Interval between the dates + */ + public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs) + { + // Retrieve the mandatory start and end date that are referenced in the function definition + $startDate = Functions::flattenSingleValue($startDate); + $endDate = Functions::flattenSingleValue($endDate); + // Get the optional days + $dateArgs = Functions::flattenArray($dateArgs); + + // Validate the start and end dates + if (is_string($startDate = $sDate = self::getDateValue($startDate))) { + return Functions::VALUE(); + } + $startDate = (float) floor($startDate); + if (is_string($endDate = $eDate = self::getDateValue($endDate))) { + return Functions::VALUE(); + } + $endDate = (float) floor($endDate); + + if ($sDate > $eDate) { + $startDate = $eDate; + $endDate = $sDate; + } + + // Execute function + $startDoW = 6 - self::WEEKDAY($startDate, 2); + if ($startDoW < 0) { + $startDoW = 0; + } + $endDoW = self::WEEKDAY($endDate, 2); + if ($endDoW >= 6) { + $endDoW = 0; + } + + $wholeWeekDays = floor(($endDate - $startDate) / 7) * 5; + $partWeekDays = $endDoW + $startDoW; + if ($partWeekDays > 5) { + $partWeekDays -= 5; + } + + // Test any extra holiday parameters + $holidayCountedArray = []; + foreach ($dateArgs as $holidayDate) { + if (is_string($holidayDate = self::getDateValue($holidayDate))) { + return Functions::VALUE(); + } + if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) { + if ((self::WEEKDAY($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) { + --$partWeekDays; + $holidayCountedArray[] = $holidayDate; + } + } + } + + if ($sDate > $eDate) { + return 0 - ($wholeWeekDays + $partWeekDays); + } + + return $wholeWeekDays + $partWeekDays; + } + + /** + * WORKDAY. + * + * Returns the date that is the indicated number of working days before or after a date (the + * starting date). Working days exclude weekends and any dates identified as holidays. + * Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected + * delivery times, or the number of days of work performed. + * + * Excel Function: + * WORKDAY(startDate,endDays[,holidays[,holiday[,...]]]) + * + * @category Date/Time Functions + * + * @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param int $endDays The number of nonweekend and nonholiday days before or after + * startDate. A positive value for days yields a future date; a + * negative value yields a past date. + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function WORKDAY($startDate, $endDays, ...$dateArgs) + { + // Retrieve the mandatory start date and days that are referenced in the function definition + $startDate = Functions::flattenSingleValue($startDate); + $endDays = Functions::flattenSingleValue($endDays); + // Get the optional days + $dateArgs = Functions::flattenArray($dateArgs); + + if ((is_string($startDate = self::getDateValue($startDate))) || (!is_numeric($endDays))) { + return Functions::VALUE(); + } + $startDate = (float) floor($startDate); + $endDays = (int) floor($endDays); + // If endDays is 0, we always return startDate + if ($endDays == 0) { + return $startDate; + } + + $decrementing = $endDays < 0; + + // Adjust the start date if it falls over a weekend + + $startDoW = self::WEEKDAY($startDate, 3); + if (self::WEEKDAY($startDate, 3) >= 5) { + $startDate += ($decrementing) ? -$startDoW + 4 : 7 - $startDoW; + ($decrementing) ? $endDays++ : $endDays--; + } + + // Add endDays + $endDate = (float) $startDate + ((int) ($endDays / 5) * 7) + ($endDays % 5); + + // Adjust the calculated end date if it falls over a weekend + $endDoW = self::WEEKDAY($endDate, 3); + if ($endDoW >= 5) { + $endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW; + } + + // Test any extra holiday parameters + if (!empty($dateArgs)) { + $holidayCountedArray = $holidayDates = []; + foreach ($dateArgs as $holidayDate) { + if (($holidayDate !== null) && (trim($holidayDate) > '')) { + if (is_string($holidayDate = self::getDateValue($holidayDate))) { + return Functions::VALUE(); + } + if (self::WEEKDAY($holidayDate, 3) < 5) { + $holidayDates[] = $holidayDate; + } + } + } + if ($decrementing) { + rsort($holidayDates, SORT_NUMERIC); + } else { + sort($holidayDates, SORT_NUMERIC); + } + foreach ($holidayDates as $holidayDate) { + if ($decrementing) { + if (($holidayDate <= $startDate) && ($holidayDate >= $endDate)) { + if (!in_array($holidayDate, $holidayCountedArray)) { + --$endDate; + $holidayCountedArray[] = $holidayDate; + } + } + } else { + if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) { + if (!in_array($holidayDate, $holidayCountedArray)) { + ++$endDate; + $holidayCountedArray[] = $holidayDate; + } + } + } + // Adjust the calculated end date if it falls over a weekend + $endDoW = self::WEEKDAY($endDate, 3); + if ($endDoW >= 5) { + $endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW; + } + } + } + + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + return (float) $endDate; + case Functions::RETURNDATE_UNIX_TIMESTAMP: + return (int) Date::excelToTimestamp($endDate); + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + return Date::excelToDateTimeObject($endDate); + } + } + + /** + * DAYOFMONTH. + * + * Returns the day of the month, for a specified date. The day is given as an integer + * ranging from 1 to 31. + * + * Excel Function: + * DAY(dateValue) + * + * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * + * @return int|string Day of the month + */ + public static function DAYOFMONTH($dateValue = 1) + { + $dateValue = Functions::flattenSingleValue($dateValue); + + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::getDateValue($dateValue))) { + return Functions::VALUE(); + } + + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) { + if ($dateValue < 0.0) { + return Functions::NAN(); + } elseif ($dateValue < 1.0) { + return 0; + } + } + + // Execute function + $PHPDateObject = Date::excelToDateTimeObject($dateValue); + + return (int) $PHPDateObject->format('j'); + } + + /** + * WEEKDAY. + * + * Returns the day of the week for a specified date. The day is given as an integer + * ranging from 0 to 7 (dependent on the requested style). + * + * Excel Function: + * WEEKDAY(dateValue[,style]) + * + * @param int $dateValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param int $style A number that determines the type of return value + * 1 or omitted Numbers 1 (Sunday) through 7 (Saturday). + * 2 Numbers 1 (Monday) through 7 (Sunday). + * 3 Numbers 0 (Monday) through 6 (Sunday). + * + * @return int|string Day of the week value + */ + public static function WEEKDAY($dateValue = 1, $style = 1) + { + $dateValue = Functions::flattenSingleValue($dateValue); + $style = Functions::flattenSingleValue($style); + + if (!is_numeric($style)) { + return Functions::VALUE(); + } elseif (($style < 1) || ($style > 3)) { + return Functions::NAN(); + } + $style = floor($style); + + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::getDateValue($dateValue))) { + return Functions::VALUE(); + } elseif ($dateValue < 0.0) { + return Functions::NAN(); + } + + // Execute function + $PHPDateObject = Date::excelToDateTimeObject($dateValue); + $DoW = (int) $PHPDateObject->format('w'); + + $firstDay = 1; + switch ($style) { + case 1: + ++$DoW; + + break; + case 2: + if ($DoW === 0) { + $DoW = 7; + } + + break; + case 3: + if ($DoW === 0) { + $DoW = 7; + } + $firstDay = 0; + --$DoW; + + break; + } + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) { + // Test for Excel's 1900 leap year, and introduce the error as required + if (($PHPDateObject->format('Y') == 1900) && ($PHPDateObject->format('n') <= 2)) { + --$DoW; + if ($DoW < $firstDay) { + $DoW += 7; + } + } + } + + return $DoW; + } + + const STARTWEEK_SUNDAY = 1; + const STARTWEEK_MONDAY = 2; + const STARTWEEK_MONDAY_ALT = 11; + const STARTWEEK_TUESDAY = 12; + const STARTWEEK_WEDNESDAY = 13; + const STARTWEEK_THURSDAY = 14; + const STARTWEEK_FRIDAY = 15; + const STARTWEEK_SATURDAY = 16; + const STARTWEEK_SUNDAY_ALT = 17; + const DOW_SUNDAY = 1; + const DOW_MONDAY = 2; + const DOW_TUESDAY = 3; + const DOW_WEDNESDAY = 4; + const DOW_THURSDAY = 5; + const DOW_FRIDAY = 6; + const DOW_SATURDAY = 7; + const STARTWEEK_MONDAY_ISO = 21; + const METHODARR = [ + self::STARTWEEK_SUNDAY => self::DOW_SUNDAY, + self::DOW_MONDAY, + self::STARTWEEK_MONDAY_ALT => self::DOW_MONDAY, + self::DOW_TUESDAY, + self::DOW_WEDNESDAY, + self::DOW_THURSDAY, + self::DOW_FRIDAY, + self::DOW_SATURDAY, + self::DOW_SUNDAY, + self::STARTWEEK_MONDAY_ISO => self::STARTWEEK_MONDAY_ISO, + ]; + + /** + * WEEKNUM. + * + * Returns the week of the year for a specified date. + * The WEEKNUM function considers the week containing January 1 to be the first week of the year. + * However, there is a European standard that defines the first week as the one with the majority + * of days (four or more) falling in the new year. This means that for years in which there are + * three days or less in the first week of January, the WEEKNUM function returns week numbers + * that are incorrect according to the European standard. + * + * Excel Function: + * WEEKNUM(dateValue[,style]) + * + * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param int $method Week begins on Sunday or Monday + * 1 or omitted Week begins on Sunday. + * 2 Week begins on Monday. + * 11 Week begins on Monday. + * 12 Week begins on Tuesday. + * 13 Week begins on Wednesday. + * 14 Week begins on Thursday. + * 15 Week begins on Friday. + * 16 Week begins on Saturday. + * 17 Week begins on Sunday. + * 21 ISO (Jan. 4 is week 1, begins on Monday). + * + * @return int|string Week Number + */ + public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY) + { + $dateValue = Functions::flattenSingleValue($dateValue); + $method = Functions::flattenSingleValue($method); + + if (!is_numeric($method)) { + return Functions::VALUE(); + } + $method = (int) $method; + if (!array_key_exists($method, self::METHODARR)) { + return Functions::NaN(); + } + $method = self::METHODARR[$method]; + + $dateValue = self::getDateValue($dateValue); + if (is_string($dateValue)) { + return Functions::VALUE(); + } + if ($dateValue < 0.0) { + return Functions::NAN(); + } + + // Execute function + $PHPDateObject = Date::excelToDateTimeObject($dateValue); + if ($method == self::STARTWEEK_MONDAY_ISO) { + return (int) $PHPDateObject->format('W'); + } + $dayOfYear = $PHPDateObject->format('z'); + $PHPDateObject->modify('-' . $dayOfYear . ' days'); + $firstDayOfFirstWeek = $PHPDateObject->format('w'); + $daysInFirstWeek = (6 - $firstDayOfFirstWeek + $method) % 7; + $daysInFirstWeek += 7 * !$daysInFirstWeek; + $endFirstWeek = $daysInFirstWeek - 1; + $weekOfYear = floor(($dayOfYear - $endFirstWeek + 13) / 7); + + return (int) $weekOfYear; + } + + /** + * ISOWEEKNUM. + * + * Returns the ISO 8601 week number of the year for a specified date. + * + * Excel Function: + * ISOWEEKNUM(dateValue) + * + * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * + * @return int|string Week Number + */ + public static function ISOWEEKNUM($dateValue = 1) + { + $dateValue = Functions::flattenSingleValue($dateValue); + + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::getDateValue($dateValue))) { + return Functions::VALUE(); + } elseif ($dateValue < 0.0) { + return Functions::NAN(); + } + + // Execute function + $PHPDateObject = Date::excelToDateTimeObject($dateValue); + + return (int) $PHPDateObject->format('W'); + } + + /** + * MONTHOFYEAR. + * + * Returns the month of a date represented by a serial number. + * The month is given as an integer, ranging from 1 (January) to 12 (December). + * + * Excel Function: + * MONTH(dateValue) + * + * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * + * @return int|string Month of the year + */ + public static function MONTHOFYEAR($dateValue = 1) + { + $dateValue = Functions::flattenSingleValue($dateValue); + + if (empty($dateValue)) { + $dateValue = 1; + } + if (is_string($dateValue = self::getDateValue($dateValue))) { + return Functions::VALUE(); + } elseif ($dateValue < 0.0) { + return Functions::NAN(); + } + + // Execute function + $PHPDateObject = Date::excelToDateTimeObject($dateValue); + + return (int) $PHPDateObject->format('n'); + } + + /** + * YEAR. + * + * Returns the year corresponding to a date. + * The year is returned as an integer in the range 1900-9999. + * + * Excel Function: + * YEAR(dateValue) + * + * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * + * @return int|string Year + */ + public static function YEAR($dateValue = 1) + { + $dateValue = Functions::flattenSingleValue($dateValue); + + if ($dateValue === null) { + $dateValue = 1; + } elseif (is_string($dateValue = self::getDateValue($dateValue))) { + return Functions::VALUE(); + } elseif ($dateValue < 0.0) { + return Functions::NAN(); + } + + // Execute function + $PHPDateObject = Date::excelToDateTimeObject($dateValue); + + return (int) $PHPDateObject->format('Y'); + } + + /** + * HOUROFDAY. + * + * Returns the hour of a time value. + * The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). + * + * Excel Function: + * HOUR(timeValue) + * + * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard time string + * + * @return int|string Hour + */ + public static function HOUROFDAY($timeValue = 0) + { + $timeValue = Functions::flattenSingleValue($timeValue); + + if (!is_numeric($timeValue)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + $testVal = strtok($timeValue, '/-: '); + if (strlen($testVal) < strlen($timeValue)) { + return Functions::VALUE(); + } + } + $timeValue = self::getTimeValue($timeValue); + if (is_string($timeValue)) { + return Functions::VALUE(); + } + } + // Execute function + if ($timeValue >= 1) { + $timeValue = fmod($timeValue, 1); + } elseif ($timeValue < 0.0) { + return Functions::NAN(); + } + $timeValue = Date::excelToTimestamp($timeValue); + + return (int) gmdate('G', $timeValue); + } + + /** + * MINUTE. + * + * Returns the minutes of a time value. + * The minute is given as an integer, ranging from 0 to 59. + * + * Excel Function: + * MINUTE(timeValue) + * + * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard time string + * + * @return int|string Minute + */ + public static function MINUTE($timeValue = 0) + { + $timeValue = $timeTester = Functions::flattenSingleValue($timeValue); + + if (!is_numeric($timeValue)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + $testVal = strtok($timeValue, '/-: '); + if (strlen($testVal) < strlen($timeValue)) { + return Functions::VALUE(); + } + } + $timeValue = self::getTimeValue($timeValue); + if (is_string($timeValue)) { + return Functions::VALUE(); + } + } + // Execute function + if ($timeValue >= 1) { + $timeValue = fmod($timeValue, 1); + } elseif ($timeValue < 0.0) { + return Functions::NAN(); + } + $timeValue = Date::excelToTimestamp($timeValue); + + return (int) gmdate('i', $timeValue); + } + + /** + * SECOND. + * + * Returns the seconds of a time value. + * The second is given as an integer in the range 0 (zero) to 59. + * + * Excel Function: + * SECOND(timeValue) + * + * @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard time string + * + * @return int|string Second + */ + public static function SECOND($timeValue = 0) + { + $timeValue = Functions::flattenSingleValue($timeValue); + + if (!is_numeric($timeValue)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + $testVal = strtok($timeValue, '/-: '); + if (strlen($testVal) < strlen($timeValue)) { + return Functions::VALUE(); + } + } + $timeValue = self::getTimeValue($timeValue); + if (is_string($timeValue)) { + return Functions::VALUE(); + } + } + // Execute function + if ($timeValue >= 1) { + $timeValue = fmod($timeValue, 1); + } elseif ($timeValue < 0.0) { + return Functions::NAN(); + } + $timeValue = Date::excelToTimestamp($timeValue); + + return (int) gmdate('s', $timeValue); + } + + /** + * EDATE. + * + * Returns the serial number that represents the date that is the indicated number of months + * before or after a specified date (the start_date). + * Use EDATE to calculate maturity dates or due dates that fall on the same day of the month + * as the date of issue. + * + * Excel Function: + * EDATE(dateValue,adjustmentMonths) + * + * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param int $adjustmentMonths The number of months before or after start_date. + * A positive value for months yields a future date; + * a negative value yields a past date. + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function EDATE($dateValue = 1, $adjustmentMonths = 0) + { + $dateValue = Functions::flattenSingleValue($dateValue); + $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); + + if (!is_numeric($adjustmentMonths)) { + return Functions::VALUE(); + } + $adjustmentMonths = floor($adjustmentMonths); + + if (is_string($dateValue = self::getDateValue($dateValue))) { + return Functions::VALUE(); + } + + // Execute function + $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths); + + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + return (float) Date::PHPToExcel($PHPDateObject); + case Functions::RETURNDATE_UNIX_TIMESTAMP: + return (int) Date::excelToTimestamp(Date::PHPToExcel($PHPDateObject)); + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + return $PHPDateObject; + } + } + + /** + * EOMONTH. + * + * Returns the date value for the last day of the month that is the indicated number of months + * before or after start_date. + * Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month. + * + * Excel Function: + * EOMONTH(dateValue,adjustmentMonths) + * + * @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer), + * PHP DateTime object, or a standard date string + * @param int $adjustmentMonths The number of months before or after start_date. + * A positive value for months yields a future date; + * a negative value yields a past date. + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0) + { + $dateValue = Functions::flattenSingleValue($dateValue); + $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths); + + if (!is_numeric($adjustmentMonths)) { + return Functions::VALUE(); + } + $adjustmentMonths = floor($adjustmentMonths); + + if (is_string($dateValue = self::getDateValue($dateValue))) { + return Functions::VALUE(); + } + + // Execute function + $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths + 1); + $adjustDays = (int) $PHPDateObject->format('d'); + $adjustDaysString = '-' . $adjustDays . ' days'; + $PHPDateObject->modify($adjustDaysString); + + switch (Functions::getReturnDateType()) { + case Functions::RETURNDATE_EXCEL: + return (float) Date::PHPToExcel($PHPDateObject); + case Functions::RETURNDATE_UNIX_TIMESTAMP: + return (int) Date::excelToTimestamp(Date::PHPToExcel($PHPDateObject)); + case Functions::RETURNDATE_PHP_DATETIME_OBJECT: + return $PHPDateObject; + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php new file mode 100644 index 0000000..5a54d83 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/CyclicReferenceStack.php @@ -0,0 +1,73 @@ +stack); + } + + /** + * Push a new entry onto the stack. + * + * @param mixed $value + */ + public function push($value) + { + $this->stack[$value] = $value; + } + + /** + * Pop the last entry from the stack. + * + * @return mixed + */ + public function pop() + { + return array_pop($this->stack); + } + + /** + * Test to see if a specified entry exists on the stack. + * + * @param mixed $value The value to test + * + * @return bool + */ + public function onStack($value) + { + return isset($this->stack[$value]); + } + + /** + * Clear the stack. + */ + public function clear() + { + $this->stack = []; + } + + /** + * Return an array of all entries on the stack. + * + * @return mixed[] + */ + public function showStack() + { + return $this->stack; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php new file mode 100644 index 0000000..6793dad --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engine/Logger.php @@ -0,0 +1,128 @@ +cellStack = $stack; + } + + /** + * Enable/Disable Calculation engine logging. + * + * @param bool $pValue + */ + public function setWriteDebugLog($pValue) + { + $this->writeDebugLog = $pValue; + } + + /** + * Return whether calculation engine logging is enabled or disabled. + * + * @return bool + */ + public function getWriteDebugLog() + { + return $this->writeDebugLog; + } + + /** + * Enable/Disable echoing of debug log information. + * + * @param bool $pValue + */ + public function setEchoDebugLog($pValue) + { + $this->echoDebugLog = $pValue; + } + + /** + * Return whether echoing of debug log information is enabled or disabled. + * + * @return bool + */ + public function getEchoDebugLog() + { + return $this->echoDebugLog; + } + + /** + * Write an entry to the calculation engine debug log. + */ + public function writeDebugLog(...$args) + { + // Only write the debug log if logging is enabled + if ($this->writeDebugLog) { + $message = implode($args); + $cellReference = implode(' -> ', $this->cellStack->showStack()); + if ($this->echoDebugLog) { + echo $cellReference, + ($this->cellStack->count() > 0 ? ' => ' : ''), + $message, + PHP_EOL; + } + $this->debugLog[] = $cellReference . + ($this->cellStack->count() > 0 ? ' => ' : '') . + $message; + } + } + + /** + * Clear the calculation engine debug log. + */ + public function clearLog() + { + $this->debugLog = []; + } + + /** + * Return the calculation engine debug log. + * + * @return string[] + */ + public function getLog() + { + return $this->debugLog; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php new file mode 100644 index 0000000..c3942b2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Engineering.php @@ -0,0 +1,2807 @@ + ['Group' => 'Mass', 'Unit Name' => 'Gram', 'AllowPrefix' => true], + 'sg' => ['Group' => 'Mass', 'Unit Name' => 'Slug', 'AllowPrefix' => false], + 'lbm' => ['Group' => 'Mass', 'Unit Name' => 'Pound mass (avoirdupois)', 'AllowPrefix' => false], + 'u' => ['Group' => 'Mass', 'Unit Name' => 'U (atomic mass unit)', 'AllowPrefix' => true], + 'ozm' => ['Group' => 'Mass', 'Unit Name' => 'Ounce mass (avoirdupois)', 'AllowPrefix' => false], + 'm' => ['Group' => 'Distance', 'Unit Name' => 'Meter', 'AllowPrefix' => true], + 'mi' => ['Group' => 'Distance', 'Unit Name' => 'Statute mile', 'AllowPrefix' => false], + 'Nmi' => ['Group' => 'Distance', 'Unit Name' => 'Nautical mile', 'AllowPrefix' => false], + 'in' => ['Group' => 'Distance', 'Unit Name' => 'Inch', 'AllowPrefix' => false], + 'ft' => ['Group' => 'Distance', 'Unit Name' => 'Foot', 'AllowPrefix' => false], + 'yd' => ['Group' => 'Distance', 'Unit Name' => 'Yard', 'AllowPrefix' => false], + 'ang' => ['Group' => 'Distance', 'Unit Name' => 'Angstrom', 'AllowPrefix' => true], + 'Pica' => ['Group' => 'Distance', 'Unit Name' => 'Pica (1/72 in)', 'AllowPrefix' => false], + 'yr' => ['Group' => 'Time', 'Unit Name' => 'Year', 'AllowPrefix' => false], + 'day' => ['Group' => 'Time', 'Unit Name' => 'Day', 'AllowPrefix' => false], + 'hr' => ['Group' => 'Time', 'Unit Name' => 'Hour', 'AllowPrefix' => false], + 'mn' => ['Group' => 'Time', 'Unit Name' => 'Minute', 'AllowPrefix' => false], + 'sec' => ['Group' => 'Time', 'Unit Name' => 'Second', 'AllowPrefix' => true], + 'Pa' => ['Group' => 'Pressure', 'Unit Name' => 'Pascal', 'AllowPrefix' => true], + 'p' => ['Group' => 'Pressure', 'Unit Name' => 'Pascal', 'AllowPrefix' => true], + 'atm' => ['Group' => 'Pressure', 'Unit Name' => 'Atmosphere', 'AllowPrefix' => true], + 'at' => ['Group' => 'Pressure', 'Unit Name' => 'Atmosphere', 'AllowPrefix' => true], + 'mmHg' => ['Group' => 'Pressure', 'Unit Name' => 'mm of Mercury', 'AllowPrefix' => true], + 'N' => ['Group' => 'Force', 'Unit Name' => 'Newton', 'AllowPrefix' => true], + 'dyn' => ['Group' => 'Force', 'Unit Name' => 'Dyne', 'AllowPrefix' => true], + 'dy' => ['Group' => 'Force', 'Unit Name' => 'Dyne', 'AllowPrefix' => true], + 'lbf' => ['Group' => 'Force', 'Unit Name' => 'Pound force', 'AllowPrefix' => false], + 'J' => ['Group' => 'Energy', 'Unit Name' => 'Joule', 'AllowPrefix' => true], + 'e' => ['Group' => 'Energy', 'Unit Name' => 'Erg', 'AllowPrefix' => true], + 'c' => ['Group' => 'Energy', 'Unit Name' => 'Thermodynamic calorie', 'AllowPrefix' => true], + 'cal' => ['Group' => 'Energy', 'Unit Name' => 'IT calorie', 'AllowPrefix' => true], + 'eV' => ['Group' => 'Energy', 'Unit Name' => 'Electron volt', 'AllowPrefix' => true], + 'ev' => ['Group' => 'Energy', 'Unit Name' => 'Electron volt', 'AllowPrefix' => true], + 'HPh' => ['Group' => 'Energy', 'Unit Name' => 'Horsepower-hour', 'AllowPrefix' => false], + 'hh' => ['Group' => 'Energy', 'Unit Name' => 'Horsepower-hour', 'AllowPrefix' => false], + 'Wh' => ['Group' => 'Energy', 'Unit Name' => 'Watt-hour', 'AllowPrefix' => true], + 'wh' => ['Group' => 'Energy', 'Unit Name' => 'Watt-hour', 'AllowPrefix' => true], + 'flb' => ['Group' => 'Energy', 'Unit Name' => 'Foot-pound', 'AllowPrefix' => false], + 'BTU' => ['Group' => 'Energy', 'Unit Name' => 'BTU', 'AllowPrefix' => false], + 'btu' => ['Group' => 'Energy', 'Unit Name' => 'BTU', 'AllowPrefix' => false], + 'HP' => ['Group' => 'Power', 'Unit Name' => 'Horsepower', 'AllowPrefix' => false], + 'h' => ['Group' => 'Power', 'Unit Name' => 'Horsepower', 'AllowPrefix' => false], + 'W' => ['Group' => 'Power', 'Unit Name' => 'Watt', 'AllowPrefix' => true], + 'w' => ['Group' => 'Power', 'Unit Name' => 'Watt', 'AllowPrefix' => true], + 'T' => ['Group' => 'Magnetism', 'Unit Name' => 'Tesla', 'AllowPrefix' => true], + 'ga' => ['Group' => 'Magnetism', 'Unit Name' => 'Gauss', 'AllowPrefix' => true], + 'C' => ['Group' => 'Temperature', 'Unit Name' => 'Celsius', 'AllowPrefix' => false], + 'cel' => ['Group' => 'Temperature', 'Unit Name' => 'Celsius', 'AllowPrefix' => false], + 'F' => ['Group' => 'Temperature', 'Unit Name' => 'Fahrenheit', 'AllowPrefix' => false], + 'fah' => ['Group' => 'Temperature', 'Unit Name' => 'Fahrenheit', 'AllowPrefix' => false], + 'K' => ['Group' => 'Temperature', 'Unit Name' => 'Kelvin', 'AllowPrefix' => false], + 'kel' => ['Group' => 'Temperature', 'Unit Name' => 'Kelvin', 'AllowPrefix' => false], + 'tsp' => ['Group' => 'Liquid', 'Unit Name' => 'Teaspoon', 'AllowPrefix' => false], + 'tbs' => ['Group' => 'Liquid', 'Unit Name' => 'Tablespoon', 'AllowPrefix' => false], + 'oz' => ['Group' => 'Liquid', 'Unit Name' => 'Fluid Ounce', 'AllowPrefix' => false], + 'cup' => ['Group' => 'Liquid', 'Unit Name' => 'Cup', 'AllowPrefix' => false], + 'pt' => ['Group' => 'Liquid', 'Unit Name' => 'U.S. Pint', 'AllowPrefix' => false], + 'us_pt' => ['Group' => 'Liquid', 'Unit Name' => 'U.S. Pint', 'AllowPrefix' => false], + 'uk_pt' => ['Group' => 'Liquid', 'Unit Name' => 'U.K. Pint', 'AllowPrefix' => false], + 'qt' => ['Group' => 'Liquid', 'Unit Name' => 'Quart', 'AllowPrefix' => false], + 'gal' => ['Group' => 'Liquid', 'Unit Name' => 'Gallon', 'AllowPrefix' => false], + 'l' => ['Group' => 'Liquid', 'Unit Name' => 'Litre', 'AllowPrefix' => true], + 'lt' => ['Group' => 'Liquid', 'Unit Name' => 'Litre', 'AllowPrefix' => true], + ]; + + /** + * Details of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM(). + * + * @var mixed[] + */ + private static $conversionMultipliers = [ + 'Y' => ['multiplier' => 1E24, 'name' => 'yotta'], + 'Z' => ['multiplier' => 1E21, 'name' => 'zetta'], + 'E' => ['multiplier' => 1E18, 'name' => 'exa'], + 'P' => ['multiplier' => 1E15, 'name' => 'peta'], + 'T' => ['multiplier' => 1E12, 'name' => 'tera'], + 'G' => ['multiplier' => 1E9, 'name' => 'giga'], + 'M' => ['multiplier' => 1E6, 'name' => 'mega'], + 'k' => ['multiplier' => 1E3, 'name' => 'kilo'], + 'h' => ['multiplier' => 1E2, 'name' => 'hecto'], + 'e' => ['multiplier' => 1E1, 'name' => 'deka'], + 'd' => ['multiplier' => 1E-1, 'name' => 'deci'], + 'c' => ['multiplier' => 1E-2, 'name' => 'centi'], + 'm' => ['multiplier' => 1E-3, 'name' => 'milli'], + 'u' => ['multiplier' => 1E-6, 'name' => 'micro'], + 'n' => ['multiplier' => 1E-9, 'name' => 'nano'], + 'p' => ['multiplier' => 1E-12, 'name' => 'pico'], + 'f' => ['multiplier' => 1E-15, 'name' => 'femto'], + 'a' => ['multiplier' => 1E-18, 'name' => 'atto'], + 'z' => ['multiplier' => 1E-21, 'name' => 'zepto'], + 'y' => ['multiplier' => 1E-24, 'name' => 'yocto'], + ]; + + /** + * Details of the Units of measure conversion factors, organised by group. + * + * @var mixed[] + */ + private static $unitConversions = [ + 'Mass' => [ + 'g' => [ + 'g' => 1.0, + 'sg' => 6.85220500053478E-05, + 'lbm' => 2.20462291469134E-03, + 'u' => 6.02217000000000E+23, + 'ozm' => 3.52739718003627E-02, + ], + 'sg' => [ + 'g' => 1.45938424189287E+04, + 'sg' => 1.0, + 'lbm' => 3.21739194101647E+01, + 'u' => 8.78866000000000E+27, + 'ozm' => 5.14782785944229E+02, + ], + 'lbm' => [ + 'g' => 4.5359230974881148E+02, + 'sg' => 3.10810749306493E-02, + 'lbm' => 1.0, + 'u' => 2.73161000000000E+26, + 'ozm' => 1.60000023429410E+01, + ], + 'u' => [ + 'g' => 1.66053100460465E-24, + 'sg' => 1.13782988532950E-28, + 'lbm' => 3.66084470330684E-27, + 'u' => 1.0, + 'ozm' => 5.85735238300524E-26, + ], + 'ozm' => [ + 'g' => 2.83495152079732E+01, + 'sg' => 1.94256689870811E-03, + 'lbm' => 6.24999908478882E-02, + 'u' => 1.70725600000000E+25, + 'ozm' => 1.0, + ], + ], + 'Distance' => [ + 'm' => [ + 'm' => 1.0, + 'mi' => 6.21371192237334E-04, + 'Nmi' => 5.39956803455724E-04, + 'in' => 3.93700787401575E+01, + 'ft' => 3.28083989501312E+00, + 'yd' => 1.09361329797891E+00, + 'ang' => 1.00000000000000E+10, + 'Pica' => 2.83464566929116E+03, + ], + 'mi' => [ + 'm' => 1.60934400000000E+03, + 'mi' => 1.0, + 'Nmi' => 8.68976241900648E-01, + 'in' => 6.33600000000000E+04, + 'ft' => 5.28000000000000E+03, + 'yd' => 1.76000000000000E+03, + 'ang' => 1.60934400000000E+13, + 'Pica' => 4.56191999999971E+06, + ], + 'Nmi' => [ + 'm' => 1.85200000000000E+03, + 'mi' => 1.15077944802354E+00, + 'Nmi' => 1.0, + 'in' => 7.29133858267717E+04, + 'ft' => 6.07611548556430E+03, + 'yd' => 2.02537182785694E+03, + 'ang' => 1.85200000000000E+13, + 'Pica' => 5.24976377952723E+06, + ], + 'in' => [ + 'm' => 2.54000000000000E-02, + 'mi' => 1.57828282828283E-05, + 'Nmi' => 1.37149028077754E-05, + 'in' => 1.0, + 'ft' => 8.33333333333333E-02, + 'yd' => 2.77777777686643E-02, + 'ang' => 2.54000000000000E+08, + 'Pica' => 7.19999999999955E+01, + ], + 'ft' => [ + 'm' => 3.04800000000000E-01, + 'mi' => 1.89393939393939E-04, + 'Nmi' => 1.64578833693305E-04, + 'in' => 1.20000000000000E+01, + 'ft' => 1.0, + 'yd' => 3.33333333223972E-01, + 'ang' => 3.04800000000000E+09, + 'Pica' => 8.63999999999946E+02, + ], + 'yd' => [ + 'm' => 9.14400000300000E-01, + 'mi' => 5.68181818368230E-04, + 'Nmi' => 4.93736501241901E-04, + 'in' => 3.60000000118110E+01, + 'ft' => 3.00000000000000E+00, + 'yd' => 1.0, + 'ang' => 9.14400000300000E+09, + 'Pica' => 2.59200000085023E+03, + ], + 'ang' => [ + 'm' => 1.00000000000000E-10, + 'mi' => 6.21371192237334E-14, + 'Nmi' => 5.39956803455724E-14, + 'in' => 3.93700787401575E-09, + 'ft' => 3.28083989501312E-10, + 'yd' => 1.09361329797891E-10, + 'ang' => 1.0, + 'Pica' => 2.83464566929116E-07, + ], + 'Pica' => [ + 'm' => 3.52777777777800E-04, + 'mi' => 2.19205948372629E-07, + 'Nmi' => 1.90484761219114E-07, + 'in' => 1.38888888888898E-02, + 'ft' => 1.15740740740748E-03, + 'yd' => 3.85802469009251E-04, + 'ang' => 3.52777777777800E+06, + 'Pica' => 1.0, + ], + ], + 'Time' => [ + 'yr' => [ + 'yr' => 1.0, + 'day' => 365.25, + 'hr' => 8766.0, + 'mn' => 525960.0, + 'sec' => 31557600.0, + ], + 'day' => [ + 'yr' => 2.73785078713210E-03, + 'day' => 1.0, + 'hr' => 24.0, + 'mn' => 1440.0, + 'sec' => 86400.0, + ], + 'hr' => [ + 'yr' => 1.14077116130504E-04, + 'day' => 4.16666666666667E-02, + 'hr' => 1.0, + 'mn' => 60.0, + 'sec' => 3600.0, + ], + 'mn' => [ + 'yr' => 1.90128526884174E-06, + 'day' => 6.94444444444444E-04, + 'hr' => 1.66666666666667E-02, + 'mn' => 1.0, + 'sec' => 60.0, + ], + 'sec' => [ + 'yr' => 3.16880878140289E-08, + 'day' => 1.15740740740741E-05, + 'hr' => 2.77777777777778E-04, + 'mn' => 1.66666666666667E-02, + 'sec' => 1.0, + ], + ], + 'Pressure' => [ + 'Pa' => [ + 'Pa' => 1.0, + 'p' => 1.0, + 'atm' => 9.86923299998193E-06, + 'at' => 9.86923299998193E-06, + 'mmHg' => 7.50061707998627E-03, + ], + 'p' => [ + 'Pa' => 1.0, + 'p' => 1.0, + 'atm' => 9.86923299998193E-06, + 'at' => 9.86923299998193E-06, + 'mmHg' => 7.50061707998627E-03, + ], + 'atm' => [ + 'Pa' => 1.01324996583000E+05, + 'p' => 1.01324996583000E+05, + 'atm' => 1.0, + 'at' => 1.0, + 'mmHg' => 760.0, + ], + 'at' => [ + 'Pa' => 1.01324996583000E+05, + 'p' => 1.01324996583000E+05, + 'atm' => 1.0, + 'at' => 1.0, + 'mmHg' => 760.0, + ], + 'mmHg' => [ + 'Pa' => 1.33322363925000E+02, + 'p' => 1.33322363925000E+02, + 'atm' => 1.31578947368421E-03, + 'at' => 1.31578947368421E-03, + 'mmHg' => 1.0, + ], + ], + 'Force' => [ + 'N' => [ + 'N' => 1.0, + 'dyn' => 1.0E+5, + 'dy' => 1.0E+5, + 'lbf' => 2.24808923655339E-01, + ], + 'dyn' => [ + 'N' => 1.0E-5, + 'dyn' => 1.0, + 'dy' => 1.0, + 'lbf' => 2.24808923655339E-06, + ], + 'dy' => [ + 'N' => 1.0E-5, + 'dyn' => 1.0, + 'dy' => 1.0, + 'lbf' => 2.24808923655339E-06, + ], + 'lbf' => [ + 'N' => 4.448222, + 'dyn' => 4.448222E+5, + 'dy' => 4.448222E+5, + 'lbf' => 1.0, + ], + ], + 'Energy' => [ + 'J' => [ + 'J' => 1.0, + 'e' => 9.99999519343231E+06, + 'c' => 2.39006249473467E-01, + 'cal' => 2.38846190642017E-01, + 'eV' => 6.24145700000000E+18, + 'ev' => 6.24145700000000E+18, + 'HPh' => 3.72506430801000E-07, + 'hh' => 3.72506430801000E-07, + 'Wh' => 2.77777916238711E-04, + 'wh' => 2.77777916238711E-04, + 'flb' => 2.37304222192651E+01, + 'BTU' => 9.47815067349015E-04, + 'btu' => 9.47815067349015E-04, + ], + 'e' => [ + 'J' => 1.00000048065700E-07, + 'e' => 1.0, + 'c' => 2.39006364353494E-08, + 'cal' => 2.38846305445111E-08, + 'eV' => 6.24146000000000E+11, + 'ev' => 6.24146000000000E+11, + 'HPh' => 3.72506609848824E-14, + 'hh' => 3.72506609848824E-14, + 'Wh' => 2.77778049754611E-11, + 'wh' => 2.77778049754611E-11, + 'flb' => 2.37304336254586E-06, + 'BTU' => 9.47815522922962E-11, + 'btu' => 9.47815522922962E-11, + ], + 'c' => [ + 'J' => 4.18399101363672E+00, + 'e' => 4.18398900257312E+07, + 'c' => 1.0, + 'cal' => 9.99330315287563E-01, + 'eV' => 2.61142000000000E+19, + 'ev' => 2.61142000000000E+19, + 'HPh' => 1.55856355899327E-06, + 'hh' => 1.55856355899327E-06, + 'Wh' => 1.16222030532950E-03, + 'wh' => 1.16222030532950E-03, + 'flb' => 9.92878733152102E+01, + 'BTU' => 3.96564972437776E-03, + 'btu' => 3.96564972437776E-03, + ], + 'cal' => [ + 'J' => 4.18679484613929E+00, + 'e' => 4.18679283372801E+07, + 'c' => 1.00067013349059E+00, + 'cal' => 1.0, + 'eV' => 2.61317000000000E+19, + 'ev' => 2.61317000000000E+19, + 'HPh' => 1.55960800463137E-06, + 'hh' => 1.55960800463137E-06, + 'Wh' => 1.16299914807955E-03, + 'wh' => 1.16299914807955E-03, + 'flb' => 9.93544094443283E+01, + 'BTU' => 3.96830723907002E-03, + 'btu' => 3.96830723907002E-03, + ], + 'eV' => [ + 'J' => 1.60219000146921E-19, + 'e' => 1.60218923136574E-12, + 'c' => 3.82933423195043E-20, + 'cal' => 3.82676978535648E-20, + 'eV' => 1.0, + 'ev' => 1.0, + 'HPh' => 5.96826078912344E-26, + 'hh' => 5.96826078912344E-26, + 'Wh' => 4.45053000026614E-23, + 'wh' => 4.45053000026614E-23, + 'flb' => 3.80206452103492E-18, + 'BTU' => 1.51857982414846E-22, + 'btu' => 1.51857982414846E-22, + ], + 'ev' => [ + 'J' => 1.60219000146921E-19, + 'e' => 1.60218923136574E-12, + 'c' => 3.82933423195043E-20, + 'cal' => 3.82676978535648E-20, + 'eV' => 1.0, + 'ev' => 1.0, + 'HPh' => 5.96826078912344E-26, + 'hh' => 5.96826078912344E-26, + 'Wh' => 4.45053000026614E-23, + 'wh' => 4.45053000026614E-23, + 'flb' => 3.80206452103492E-18, + 'BTU' => 1.51857982414846E-22, + 'btu' => 1.51857982414846E-22, + ], + 'HPh' => [ + 'J' => 2.68451741316170E+06, + 'e' => 2.68451612283024E+13, + 'c' => 6.41616438565991E+05, + 'cal' => 6.41186757845835E+05, + 'eV' => 1.67553000000000E+25, + 'ev' => 1.67553000000000E+25, + 'HPh' => 1.0, + 'hh' => 1.0, + 'Wh' => 7.45699653134593E+02, + 'wh' => 7.45699653134593E+02, + 'flb' => 6.37047316692964E+07, + 'BTU' => 2.54442605275546E+03, + 'btu' => 2.54442605275546E+03, + ], + 'hh' => [ + 'J' => 2.68451741316170E+06, + 'e' => 2.68451612283024E+13, + 'c' => 6.41616438565991E+05, + 'cal' => 6.41186757845835E+05, + 'eV' => 1.67553000000000E+25, + 'ev' => 1.67553000000000E+25, + 'HPh' => 1.0, + 'hh' => 1.0, + 'Wh' => 7.45699653134593E+02, + 'wh' => 7.45699653134593E+02, + 'flb' => 6.37047316692964E+07, + 'BTU' => 2.54442605275546E+03, + 'btu' => 2.54442605275546E+03, + ], + 'Wh' => [ + 'J' => 3.59999820554720E+03, + 'e' => 3.59999647518369E+10, + 'c' => 8.60422069219046E+02, + 'cal' => 8.59845857713046E+02, + 'eV' => 2.24692340000000E+22, + 'ev' => 2.24692340000000E+22, + 'HPh' => 1.34102248243839E-03, + 'hh' => 1.34102248243839E-03, + 'Wh' => 1.0, + 'wh' => 1.0, + 'flb' => 8.54294774062316E+04, + 'BTU' => 3.41213254164705E+00, + 'btu' => 3.41213254164705E+00, + ], + 'wh' => [ + 'J' => 3.59999820554720E+03, + 'e' => 3.59999647518369E+10, + 'c' => 8.60422069219046E+02, + 'cal' => 8.59845857713046E+02, + 'eV' => 2.24692340000000E+22, + 'ev' => 2.24692340000000E+22, + 'HPh' => 1.34102248243839E-03, + 'hh' => 1.34102248243839E-03, + 'Wh' => 1.0, + 'wh' => 1.0, + 'flb' => 8.54294774062316E+04, + 'BTU' => 3.41213254164705E+00, + 'btu' => 3.41213254164705E+00, + ], + 'flb' => [ + 'J' => 4.21400003236424E-02, + 'e' => 4.21399800687660E+05, + 'c' => 1.00717234301644E-02, + 'cal' => 1.00649785509554E-02, + 'eV' => 2.63015000000000E+17, + 'ev' => 2.63015000000000E+17, + 'HPh' => 1.56974211145130E-08, + 'hh' => 1.56974211145130E-08, + 'Wh' => 1.17055614802000E-05, + 'wh' => 1.17055614802000E-05, + 'flb' => 1.0, + 'BTU' => 3.99409272448406E-05, + 'btu' => 3.99409272448406E-05, + ], + 'BTU' => [ + 'J' => 1.05505813786749E+03, + 'e' => 1.05505763074665E+10, + 'c' => 2.52165488508168E+02, + 'cal' => 2.51996617135510E+02, + 'eV' => 6.58510000000000E+21, + 'ev' => 6.58510000000000E+21, + 'HPh' => 3.93015941224568E-04, + 'hh' => 3.93015941224568E-04, + 'Wh' => 2.93071851047526E-01, + 'wh' => 2.93071851047526E-01, + 'flb' => 2.50369750774671E+04, + 'BTU' => 1.0, + 'btu' => 1.0, + ], + 'btu' => [ + 'J' => 1.05505813786749E+03, + 'e' => 1.05505763074665E+10, + 'c' => 2.52165488508168E+02, + 'cal' => 2.51996617135510E+02, + 'eV' => 6.58510000000000E+21, + 'ev' => 6.58510000000000E+21, + 'HPh' => 3.93015941224568E-04, + 'hh' => 3.93015941224568E-04, + 'Wh' => 2.93071851047526E-01, + 'wh' => 2.93071851047526E-01, + 'flb' => 2.50369750774671E+04, + 'BTU' => 1.0, + 'btu' => 1.0, + ], + ], + 'Power' => [ + 'HP' => [ + 'HP' => 1.0, + 'h' => 1.0, + 'W' => 7.45701000000000E+02, + 'w' => 7.45701000000000E+02, + ], + 'h' => [ + 'HP' => 1.0, + 'h' => 1.0, + 'W' => 7.45701000000000E+02, + 'w' => 7.45701000000000E+02, + ], + 'W' => [ + 'HP' => 1.34102006031908E-03, + 'h' => 1.34102006031908E-03, + 'W' => 1.0, + 'w' => 1.0, + ], + 'w' => [ + 'HP' => 1.34102006031908E-03, + 'h' => 1.34102006031908E-03, + 'W' => 1.0, + 'w' => 1.0, + ], + ], + 'Magnetism' => [ + 'T' => [ + 'T' => 1.0, + 'ga' => 10000.0, + ], + 'ga' => [ + 'T' => 0.0001, + 'ga' => 1.0, + ], + ], + 'Liquid' => [ + 'tsp' => [ + 'tsp' => 1.0, + 'tbs' => 3.33333333333333E-01, + 'oz' => 1.66666666666667E-01, + 'cup' => 2.08333333333333E-02, + 'pt' => 1.04166666666667E-02, + 'us_pt' => 1.04166666666667E-02, + 'uk_pt' => 8.67558516821960E-03, + 'qt' => 5.20833333333333E-03, + 'gal' => 1.30208333333333E-03, + 'l' => 4.92999408400710E-03, + 'lt' => 4.92999408400710E-03, + ], + 'tbs' => [ + 'tsp' => 3.00000000000000E+00, + 'tbs' => 1.0, + 'oz' => 5.00000000000000E-01, + 'cup' => 6.25000000000000E-02, + 'pt' => 3.12500000000000E-02, + 'us_pt' => 3.12500000000000E-02, + 'uk_pt' => 2.60267555046588E-02, + 'qt' => 1.56250000000000E-02, + 'gal' => 3.90625000000000E-03, + 'l' => 1.47899822520213E-02, + 'lt' => 1.47899822520213E-02, + ], + 'oz' => [ + 'tsp' => 6.00000000000000E+00, + 'tbs' => 2.00000000000000E+00, + 'oz' => 1.0, + 'cup' => 1.25000000000000E-01, + 'pt' => 6.25000000000000E-02, + 'us_pt' => 6.25000000000000E-02, + 'uk_pt' => 5.20535110093176E-02, + 'qt' => 3.12500000000000E-02, + 'gal' => 7.81250000000000E-03, + 'l' => 2.95799645040426E-02, + 'lt' => 2.95799645040426E-02, + ], + 'cup' => [ + 'tsp' => 4.80000000000000E+01, + 'tbs' => 1.60000000000000E+01, + 'oz' => 8.00000000000000E+00, + 'cup' => 1.0, + 'pt' => 5.00000000000000E-01, + 'us_pt' => 5.00000000000000E-01, + 'uk_pt' => 4.16428088074541E-01, + 'qt' => 2.50000000000000E-01, + 'gal' => 6.25000000000000E-02, + 'l' => 2.36639716032341E-01, + 'lt' => 2.36639716032341E-01, + ], + 'pt' => [ + 'tsp' => 9.60000000000000E+01, + 'tbs' => 3.20000000000000E+01, + 'oz' => 1.60000000000000E+01, + 'cup' => 2.00000000000000E+00, + 'pt' => 1.0, + 'us_pt' => 1.0, + 'uk_pt' => 8.32856176149081E-01, + 'qt' => 5.00000000000000E-01, + 'gal' => 1.25000000000000E-01, + 'l' => 4.73279432064682E-01, + 'lt' => 4.73279432064682E-01, + ], + 'us_pt' => [ + 'tsp' => 9.60000000000000E+01, + 'tbs' => 3.20000000000000E+01, + 'oz' => 1.60000000000000E+01, + 'cup' => 2.00000000000000E+00, + 'pt' => 1.0, + 'us_pt' => 1.0, + 'uk_pt' => 8.32856176149081E-01, + 'qt' => 5.00000000000000E-01, + 'gal' => 1.25000000000000E-01, + 'l' => 4.73279432064682E-01, + 'lt' => 4.73279432064682E-01, + ], + 'uk_pt' => [ + 'tsp' => 1.15266000000000E+02, + 'tbs' => 3.84220000000000E+01, + 'oz' => 1.92110000000000E+01, + 'cup' => 2.40137500000000E+00, + 'pt' => 1.20068750000000E+00, + 'us_pt' => 1.20068750000000E+00, + 'uk_pt' => 1.0, + 'qt' => 6.00343750000000E-01, + 'gal' => 1.50085937500000E-01, + 'l' => 5.68260698087162E-01, + 'lt' => 5.68260698087162E-01, + ], + 'qt' => [ + 'tsp' => 1.92000000000000E+02, + 'tbs' => 6.40000000000000E+01, + 'oz' => 3.20000000000000E+01, + 'cup' => 4.00000000000000E+00, + 'pt' => 2.00000000000000E+00, + 'us_pt' => 2.00000000000000E+00, + 'uk_pt' => 1.66571235229816E+00, + 'qt' => 1.0, + 'gal' => 2.50000000000000E-01, + 'l' => 9.46558864129363E-01, + 'lt' => 9.46558864129363E-01, + ], + 'gal' => [ + 'tsp' => 7.68000000000000E+02, + 'tbs' => 2.56000000000000E+02, + 'oz' => 1.28000000000000E+02, + 'cup' => 1.60000000000000E+01, + 'pt' => 8.00000000000000E+00, + 'us_pt' => 8.00000000000000E+00, + 'uk_pt' => 6.66284940919265E+00, + 'qt' => 4.00000000000000E+00, + 'gal' => 1.0, + 'l' => 3.78623545651745E+00, + 'lt' => 3.78623545651745E+00, + ], + 'l' => [ + 'tsp' => 2.02840000000000E+02, + 'tbs' => 6.76133333333333E+01, + 'oz' => 3.38066666666667E+01, + 'cup' => 4.22583333333333E+00, + 'pt' => 2.11291666666667E+00, + 'us_pt' => 2.11291666666667E+00, + 'uk_pt' => 1.75975569552166E+00, + 'qt' => 1.05645833333333E+00, + 'gal' => 2.64114583333333E-01, + 'l' => 1.0, + 'lt' => 1.0, + ], + 'lt' => [ + 'tsp' => 2.02840000000000E+02, + 'tbs' => 6.76133333333333E+01, + 'oz' => 3.38066666666667E+01, + 'cup' => 4.22583333333333E+00, + 'pt' => 2.11291666666667E+00, + 'us_pt' => 2.11291666666667E+00, + 'uk_pt' => 1.75975569552166E+00, + 'qt' => 1.05645833333333E+00, + 'gal' => 2.64114583333333E-01, + 'l' => 1.0, + 'lt' => 1.0, + ], + ], + ]; + + /** + * parseComplex. + * + * Parses a complex number into its real and imaginary parts, and an I or J suffix + * + * @deprecated 2.0.0 No longer used by internal code. Please use the Complex\Complex class instead + * + * @param string $complexNumber The complex number + * + * @return mixed[] Indexed on "real", "imaginary" and "suffix" + */ + public static function parseComplex($complexNumber) + { + $complex = new Complex($complexNumber); + + return [ + 'real' => $complex->getReal(), + 'imaginary' => $complex->getImaginary(), + 'suffix' => $complex->getSuffix(), + ]; + } + + /** + * Formats a number base string value with leading zeroes. + * + * @param string $xVal The "number" to pad + * @param int $places The length that we want to pad this value + * + * @return string The padded "number" + */ + private static function nbrConversionFormat($xVal, $places) + { + if ($places !== null) { + if (is_numeric($places)) { + $places = (int) $places; + } else { + return Functions::VALUE(); + } + if ($places < 0) { + return Functions::NAN(); + } + if (strlen($xVal) <= $places) { + return substr(str_pad($xVal, $places, '0', STR_PAD_LEFT), -10); + } + + return Functions::NAN(); + } + + return substr($xVal, -10); + } + + /** + * BESSELI. + * + * Returns the modified Bessel function In(x), which is equivalent to the Bessel function evaluated + * for purely imaginary arguments + * + * Excel Function: + * BESSELI(x,ord) + * + * @category Engineering Functions + * + * @param float $x The value at which to evaluate the function. + * If x is nonnumeric, BESSELI returns the #VALUE! error value. + * @param int $ord The order of the Bessel function. + * If ord is not an integer, it is truncated. + * If $ord is nonnumeric, BESSELI returns the #VALUE! error value. + * If $ord < 0, BESSELI returns the #NUM! error value. + * + * @return float|string Result, or a string containing an error + */ + public static function BESSELI($x, $ord) + { + $x = ($x === null) ? 0.0 : Functions::flattenSingleValue($x); + $ord = ($ord === null) ? 0.0 : Functions::flattenSingleValue($ord); + + if ((is_numeric($x)) && (is_numeric($ord))) { + $ord = floor($ord); + if ($ord < 0) { + return Functions::NAN(); + } + + if (abs($x) <= 30) { + $fResult = $fTerm = pow($x / 2, $ord) / MathTrig::FACT($ord); + $ordK = 1; + $fSqrX = ($x * $x) / 4; + do { + $fTerm *= $fSqrX; + $fTerm /= ($ordK * ($ordK + $ord)); + $fResult += $fTerm; + } while ((abs($fTerm) > 1e-12) && (++$ordK < 100)); + } else { + $f_2_PI = 2 * M_PI; + + $fXAbs = abs($x); + $fResult = exp($fXAbs) / sqrt($f_2_PI * $fXAbs); + if (($ord & 1) && ($x < 0)) { + $fResult = -$fResult; + } + } + + return (is_nan($fResult)) ? Functions::NAN() : $fResult; + } + + return Functions::VALUE(); + } + + /** + * BESSELJ. + * + * Returns the Bessel function + * + * Excel Function: + * BESSELJ(x,ord) + * + * @category Engineering Functions + * + * @param float $x The value at which to evaluate the function. + * If x is nonnumeric, BESSELJ returns the #VALUE! error value. + * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. + * If $ord is nonnumeric, BESSELJ returns the #VALUE! error value. + * If $ord < 0, BESSELJ returns the #NUM! error value. + * + * @return float|string Result, or a string containing an error + */ + public static function BESSELJ($x, $ord) + { + $x = ($x === null) ? 0.0 : Functions::flattenSingleValue($x); + $ord = ($ord === null) ? 0.0 : Functions::flattenSingleValue($ord); + + if ((is_numeric($x)) && (is_numeric($ord))) { + $ord = floor($ord); + if ($ord < 0) { + return Functions::NAN(); + } + + $fResult = 0; + if (abs($x) <= 30) { + $fResult = $fTerm = pow($x / 2, $ord) / MathTrig::FACT($ord); + $ordK = 1; + $fSqrX = ($x * $x) / -4; + do { + $fTerm *= $fSqrX; + $fTerm /= ($ordK * ($ordK + $ord)); + $fResult += $fTerm; + } while ((abs($fTerm) > 1e-12) && (++$ordK < 100)); + } else { + $f_PI_DIV_2 = M_PI / 2; + $f_PI_DIV_4 = M_PI / 4; + + $fXAbs = abs($x); + $fResult = sqrt(Functions::M_2DIVPI / $fXAbs) * cos($fXAbs - $ord * $f_PI_DIV_2 - $f_PI_DIV_4); + if (($ord & 1) && ($x < 0)) { + $fResult = -$fResult; + } + } + + return (is_nan($fResult)) ? Functions::NAN() : $fResult; + } + + return Functions::VALUE(); + } + + private static function besselK0($fNum) + { + if ($fNum <= 2) { + $fNum2 = $fNum * 0.5; + $y = ($fNum2 * $fNum2); + $fRet = -log($fNum2) * self::BESSELI($fNum, 0) + + (-0.57721566 + $y * (0.42278420 + $y * (0.23069756 + $y * (0.3488590e-1 + $y * (0.262698e-2 + $y * + (0.10750e-3 + $y * 0.74e-5)))))); + } else { + $y = 2 / $fNum; + $fRet = exp(-$fNum) / sqrt($fNum) * + (1.25331414 + $y * (-0.7832358e-1 + $y * (0.2189568e-1 + $y * (-0.1062446e-1 + $y * + (0.587872e-2 + $y * (-0.251540e-2 + $y * 0.53208e-3)))))); + } + + return $fRet; + } + + private static function besselK1($fNum) + { + if ($fNum <= 2) { + $fNum2 = $fNum * 0.5; + $y = ($fNum2 * $fNum2); + $fRet = log($fNum2) * self::BESSELI($fNum, 1) + + (1 + $y * (0.15443144 + $y * (-0.67278579 + $y * (-0.18156897 + $y * (-0.1919402e-1 + $y * + (-0.110404e-2 + $y * (-0.4686e-4))))))) / $fNum; + } else { + $y = 2 / $fNum; + $fRet = exp(-$fNum) / sqrt($fNum) * + (1.25331414 + $y * (0.23498619 + $y * (-0.3655620e-1 + $y * (0.1504268e-1 + $y * (-0.780353e-2 + $y * + (0.325614e-2 + $y * (-0.68245e-3))))))); + } + + return $fRet; + } + + /** + * BESSELK. + * + * Returns the modified Bessel function Kn(x), which is equivalent to the Bessel functions evaluated + * for purely imaginary arguments. + * + * Excel Function: + * BESSELK(x,ord) + * + * @category Engineering Functions + * + * @param float $x The value at which to evaluate the function. + * If x is nonnumeric, BESSELK returns the #VALUE! error value. + * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. + * If $ord is nonnumeric, BESSELK returns the #VALUE! error value. + * If $ord < 0, BESSELK returns the #NUM! error value. + * + * @return float|string Result, or a string containing an error + */ + public static function BESSELK($x, $ord) + { + $x = ($x === null) ? 0.0 : Functions::flattenSingleValue($x); + $ord = ($ord === null) ? 0.0 : Functions::flattenSingleValue($ord); + + if ((is_numeric($x)) && (is_numeric($ord))) { + if (($ord < 0) || ($x == 0.0)) { + return Functions::NAN(); + } + + switch (floor($ord)) { + case 0: + $fBk = self::besselK0($x); + + break; + case 1: + $fBk = self::besselK1($x); + + break; + default: + $fTox = 2 / $x; + $fBkm = self::besselK0($x); + $fBk = self::besselK1($x); + for ($n = 1; $n < $ord; ++$n) { + $fBkp = $fBkm + $n * $fTox * $fBk; + $fBkm = $fBk; + $fBk = $fBkp; + } + } + + return (is_nan($fBk)) ? Functions::NAN() : $fBk; + } + + return Functions::VALUE(); + } + + private static function besselY0($fNum) + { + if ($fNum < 8.0) { + $y = ($fNum * $fNum); + $f1 = -2957821389.0 + $y * (7062834065.0 + $y * (-512359803.6 + $y * (10879881.29 + $y * (-86327.92757 + $y * 228.4622733)))); + $f2 = 40076544269.0 + $y * (745249964.8 + $y * (7189466.438 + $y * (47447.26470 + $y * (226.1030244 + $y)))); + $fRet = $f1 / $f2 + 0.636619772 * self::BESSELJ($fNum, 0) * log($fNum); + } else { + $z = 8.0 / $fNum; + $y = ($z * $z); + $xx = $fNum - 0.785398164; + $f1 = 1 + $y * (-0.1098628627e-2 + $y * (0.2734510407e-4 + $y * (-0.2073370639e-5 + $y * 0.2093887211e-6))); + $f2 = -0.1562499995e-1 + $y * (0.1430488765e-3 + $y * (-0.6911147651e-5 + $y * (0.7621095161e-6 + $y * (-0.934945152e-7)))); + $fRet = sqrt(0.636619772 / $fNum) * (sin($xx) * $f1 + $z * cos($xx) * $f2); + } + + return $fRet; + } + + private static function besselY1($fNum) + { + if ($fNum < 8.0) { + $y = ($fNum * $fNum); + $f1 = $fNum * (-0.4900604943e13 + $y * (0.1275274390e13 + $y * (-0.5153438139e11 + $y * (0.7349264551e9 + $y * + (-0.4237922726e7 + $y * 0.8511937935e4))))); + $f2 = 0.2499580570e14 + $y * (0.4244419664e12 + $y * (0.3733650367e10 + $y * (0.2245904002e8 + $y * + (0.1020426050e6 + $y * (0.3549632885e3 + $y))))); + $fRet = $f1 / $f2 + 0.636619772 * (self::BESSELJ($fNum, 1) * log($fNum) - 1 / $fNum); + } else { + $fRet = sqrt(0.636619772 / $fNum) * sin($fNum - 2.356194491); + } + + return $fRet; + } + + /** + * BESSELY. + * + * Returns the Bessel function, which is also called the Weber function or the Neumann function. + * + * Excel Function: + * BESSELY(x,ord) + * + * @category Engineering Functions + * + * @param float $x The value at which to evaluate the function. + * If x is nonnumeric, BESSELK returns the #VALUE! error value. + * @param int $ord The order of the Bessel function. If n is not an integer, it is truncated. + * If $ord is nonnumeric, BESSELK returns the #VALUE! error value. + * If $ord < 0, BESSELK returns the #NUM! error value. + * + * @return float|string Result, or a string containing an error + */ + public static function BESSELY($x, $ord) + { + $x = ($x === null) ? 0.0 : Functions::flattenSingleValue($x); + $ord = ($ord === null) ? 0.0 : Functions::flattenSingleValue($ord); + + if ((is_numeric($x)) && (is_numeric($ord))) { + if (($ord < 0) || ($x == 0.0)) { + return Functions::NAN(); + } + + switch (floor($ord)) { + case 0: + $fBy = self::besselY0($x); + + break; + case 1: + $fBy = self::besselY1($x); + + break; + default: + $fTox = 2 / $x; + $fBym = self::besselY0($x); + $fBy = self::besselY1($x); + for ($n = 1; $n < $ord; ++$n) { + $fByp = $n * $fTox * $fBy - $fBym; + $fBym = $fBy; + $fBy = $fByp; + } + } + + return (is_nan($fBy)) ? Functions::NAN() : $fBy; + } + + return Functions::VALUE(); + } + + /** + * BINTODEC. + * + * Return a binary value as decimal. + * + * Excel Function: + * BIN2DEC(x) + * + * @category Engineering Functions + * + * @param string $x The binary number (as a string) that you want to convert. The number + * cannot contain more than 10 characters (10 bits). The most significant + * bit of number is the sign bit. The remaining 9 bits are magnitude bits. + * Negative numbers are represented using two's-complement notation. + * If number is not a valid binary number, or if number contains more than + * 10 characters (10 bits), BIN2DEC returns the #NUM! error value. + * + * @return string + */ + public static function BINTODEC($x) + { + $x = Functions::flattenSingleValue($x); + + if (is_bool($x)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return Functions::VALUE(); + } + } + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + $x = floor($x); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { + return Functions::NAN(); + } + if (strlen($x) > 10) { + return Functions::NAN(); + } elseif (strlen($x) == 10) { + // Two's Complement + $x = substr($x, -9); + + return '-' . (512 - bindec($x)); + } + + return bindec($x); + } + + /** + * BINTOHEX. + * + * Return a binary value as hex. + * + * Excel Function: + * BIN2HEX(x[,places]) + * + * @category Engineering Functions + * + * @param string $x The binary number (as a string) that you want to convert. The number + * cannot contain more than 10 characters (10 bits). The most significant + * bit of number is the sign bit. The remaining 9 bits are magnitude bits. + * Negative numbers are represented using two's-complement notation. + * If number is not a valid binary number, or if number contains more than + * 10 characters (10 bits), BIN2HEX returns the #NUM! error value. + * @param int $places The number of characters to use. If places is omitted, BIN2HEX uses the + * minimum number of characters necessary. Places is useful for padding the + * return value with leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, BIN2HEX returns the #VALUE! error value. + * If places is negative, BIN2HEX returns the #NUM! error value. + * + * @return string + */ + public static function BINTOHEX($x, $places = null) + { + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + // Argument X + if (is_bool($x)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return Functions::VALUE(); + } + } + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + $x = floor($x); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { + return Functions::NAN(); + } + if (strlen($x) > 10) { + return Functions::NAN(); + } elseif (strlen($x) == 10) { + // Two's Complement + return str_repeat('F', 8) . substr(strtoupper(dechex(bindec(substr($x, -9)))), -2); + } + $hexVal = (string) strtoupper(dechex(bindec($x))); + + return self::nbrConversionFormat($hexVal, $places); + } + + /** + * BINTOOCT. + * + * Return a binary value as octal. + * + * Excel Function: + * BIN2OCT(x[,places]) + * + * @category Engineering Functions + * + * @param string $x The binary number (as a string) that you want to convert. The number + * cannot contain more than 10 characters (10 bits). The most significant + * bit of number is the sign bit. The remaining 9 bits are magnitude bits. + * Negative numbers are represented using two's-complement notation. + * If number is not a valid binary number, or if number contains more than + * 10 characters (10 bits), BIN2OCT returns the #NUM! error value. + * @param int $places The number of characters to use. If places is omitted, BIN2OCT uses the + * minimum number of characters necessary. Places is useful for padding the + * return value with leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, BIN2OCT returns the #VALUE! error value. + * If places is negative, BIN2OCT returns the #NUM! error value. + * + * @return string + */ + public static function BINTOOCT($x, $places = null) + { + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + if (is_bool($x)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return Functions::VALUE(); + } + } + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + $x = floor($x); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[01]/', $x, $out)) { + return Functions::NAN(); + } + if (strlen($x) > 10) { + return Functions::NAN(); + } elseif (strlen($x) == 10) { + // Two's Complement + return str_repeat('7', 7) . substr(strtoupper(decoct(bindec(substr($x, -9)))), -3); + } + $octVal = (string) decoct(bindec($x)); + + return self::nbrConversionFormat($octVal, $places); + } + + /** + * DECTOBIN. + * + * Return a decimal value as binary. + * + * Excel Function: + * DEC2BIN(x[,places]) + * + * @category Engineering Functions + * + * @param string $x The decimal integer you want to convert. If number is negative, + * valid place values are ignored and DEC2BIN returns a 10-character + * (10-bit) binary number in which the most significant bit is the sign + * bit. The remaining 9 bits are magnitude bits. Negative numbers are + * represented using two's-complement notation. + * If number < -512 or if number > 511, DEC2BIN returns the #NUM! error + * value. + * If number is nonnumeric, DEC2BIN returns the #VALUE! error value. + * If DEC2BIN requires more than places characters, it returns the #NUM! + * error value. + * @param int $places The number of characters to use. If places is omitted, DEC2BIN uses + * the minimum number of characters necessary. Places is useful for + * padding the return value with leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, DEC2BIN returns the #VALUE! error value. + * If places is zero or negative, DEC2BIN returns the #NUM! error value. + * + * @return string + */ + public static function DECTOBIN($x, $places = null) + { + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + if (is_bool($x)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return Functions::VALUE(); + } + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { + return Functions::VALUE(); + } + + $x = (string) floor($x); + if ($x < -512 || $x > 511) { + return Functions::NAN(); + } + + $r = decbin($x); + // Two's Complement + $r = substr($r, -10); + if (strlen($r) >= 11) { + return Functions::NAN(); + } + + return self::nbrConversionFormat($r, $places); + } + + /** + * DECTOHEX. + * + * Return a decimal value as hex. + * + * Excel Function: + * DEC2HEX(x[,places]) + * + * @category Engineering Functions + * + * @param string $x The decimal integer you want to convert. If number is negative, + * places is ignored and DEC2HEX returns a 10-character (40-bit) + * hexadecimal number in which the most significant bit is the sign + * bit. The remaining 39 bits are magnitude bits. Negative numbers + * are represented using two's-complement notation. + * If number < -549,755,813,888 or if number > 549,755,813,887, + * DEC2HEX returns the #NUM! error value. + * If number is nonnumeric, DEC2HEX returns the #VALUE! error value. + * If DEC2HEX requires more than places characters, it returns the + * #NUM! error value. + * @param int $places The number of characters to use. If places is omitted, DEC2HEX uses + * the minimum number of characters necessary. Places is useful for + * padding the return value with leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, DEC2HEX returns the #VALUE! error value. + * If places is zero or negative, DEC2HEX returns the #NUM! error value. + * + * @return string + */ + public static function DECTOHEX($x, $places = null) + { + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + if (is_bool($x)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return Functions::VALUE(); + } + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { + return Functions::VALUE(); + } + $x = (string) floor($x); + $r = strtoupper(dechex($x)); + if (strlen($r) == 8) { + // Two's Complement + $r = 'FF' . $r; + } + + return self::nbrConversionFormat($r, $places); + } + + /** + * DECTOOCT. + * + * Return an decimal value as octal. + * + * Excel Function: + * DEC2OCT(x[,places]) + * + * @category Engineering Functions + * + * @param string $x The decimal integer you want to convert. If number is negative, + * places is ignored and DEC2OCT returns a 10-character (30-bit) + * octal number in which the most significant bit is the sign bit. + * The remaining 29 bits are magnitude bits. Negative numbers are + * represented using two's-complement notation. + * If number < -536,870,912 or if number > 536,870,911, DEC2OCT + * returns the #NUM! error value. + * If number is nonnumeric, DEC2OCT returns the #VALUE! error value. + * If DEC2OCT requires more than places characters, it returns the + * #NUM! error value. + * @param int $places The number of characters to use. If places is omitted, DEC2OCT uses + * the minimum number of characters necessary. Places is useful for + * padding the return value with leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, DEC2OCT returns the #VALUE! error value. + * If places is zero or negative, DEC2OCT returns the #NUM! error value. + * + * @return string + */ + public static function DECTOOCT($x, $places = null) + { + $xorig = $x; + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + if (is_bool($x)) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + $x = (int) $x; + } else { + return Functions::VALUE(); + } + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[-0123456789.]/', $x, $out)) { + return Functions::VALUE(); + } + $x = (string) floor($x); + $r = decoct($x); + if (strlen($r) == 11) { + // Two's Complement + $r = substr($r, -10); + } + + return self::nbrConversionFormat($r, $places); + } + + /** + * HEXTOBIN. + * + * Return a hex value as binary. + * + * Excel Function: + * HEX2BIN(x[,places]) + * + * @category Engineering Functions + * + * @param string $x the hexadecimal number you want to convert. + * Number cannot contain more than 10 characters. + * The most significant bit of number is the sign bit (40th bit from the right). + * The remaining 9 bits are magnitude bits. + * Negative numbers are represented using two's-complement notation. + * If number is negative, HEX2BIN ignores places and returns a 10-character binary number. + * If number is negative, it cannot be less than FFFFFFFE00, + * and if number is positive, it cannot be greater than 1FF. + * If number is not a valid hexadecimal number, HEX2BIN returns the #NUM! error value. + * If HEX2BIN requires more than places characters, it returns the #NUM! error value. + * @param int $places The number of characters to use. If places is omitted, + * HEX2BIN uses the minimum number of characters necessary. Places + * is useful for padding the return value with leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, HEX2BIN returns the #VALUE! error value. + * If places is negative, HEX2BIN returns the #NUM! error value. + * + * @return string + */ + public static function HEXTOBIN($x, $places = null) + { + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + if (is_bool($x)) { + return Functions::VALUE(); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { + return Functions::NAN(); + } + + return self::DECTOBIN(self::HEXTODEC($x), $places); + } + + /** + * HEXTODEC. + * + * Return a hex value as decimal. + * + * Excel Function: + * HEX2DEC(x) + * + * @category Engineering Functions + * + * @param string $x The hexadecimal number you want to convert. This number cannot + * contain more than 10 characters (40 bits). The most significant + * bit of number is the sign bit. The remaining 39 bits are magnitude + * bits. Negative numbers are represented using two's-complement + * notation. + * If number is not a valid hexadecimal number, HEX2DEC returns the + * #NUM! error value. + * + * @return string + */ + public static function HEXTODEC($x) + { + $x = Functions::flattenSingleValue($x); + + if (is_bool($x)) { + return Functions::VALUE(); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { + return Functions::NAN(); + } + + if (strlen($x) > 10) { + return Functions::NAN(); + } + + $binX = ''; + foreach (str_split($x) as $char) { + $binX .= str_pad(base_convert($char, 16, 2), 4, '0', STR_PAD_LEFT); + } + if (strlen($binX) == 40 && $binX[0] == '1') { + for ($i = 0; $i < 40; ++$i) { + $binX[$i] = ($binX[$i] == '1' ? '0' : '1'); + } + + return (bindec($binX) + 1) * -1; + } + + return bindec($binX); + } + + /** + * HEXTOOCT. + * + * Return a hex value as octal. + * + * Excel Function: + * HEX2OCT(x[,places]) + * + * @category Engineering Functions + * + * @param string $x The hexadecimal number you want to convert. Number cannot + * contain more than 10 characters. The most significant bit of + * number is the sign bit. The remaining 39 bits are magnitude + * bits. Negative numbers are represented using two's-complement + * notation. + * If number is negative, HEX2OCT ignores places and returns a + * 10-character octal number. + * If number is negative, it cannot be less than FFE0000000, and + * if number is positive, it cannot be greater than 1FFFFFFF. + * If number is not a valid hexadecimal number, HEX2OCT returns + * the #NUM! error value. + * If HEX2OCT requires more than places characters, it returns + * the #NUM! error value. + * @param int $places The number of characters to use. If places is omitted, HEX2OCT + * uses the minimum number of characters necessary. Places is + * useful for padding the return value with leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, HEX2OCT returns the #VALUE! error + * value. + * If places is negative, HEX2OCT returns the #NUM! error value. + * + * @return string + */ + public static function HEXTOOCT($x, $places = null) + { + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + if (is_bool($x)) { + return Functions::VALUE(); + } + $x = (string) $x; + if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { + return Functions::NAN(); + } + + $decimal = self::HEXTODEC($x); + if ($decimal < -536870912 || $decimal > 536870911) { + return Functions::NAN(); + } + + return self::DECTOOCT($decimal, $places); + } + + /** + * OCTTOBIN. + * + * Return an octal value as binary. + * + * Excel Function: + * OCT2BIN(x[,places]) + * + * @category Engineering Functions + * + * @param string $x The octal number you want to convert. Number may not + * contain more than 10 characters. The most significant + * bit of number is the sign bit. The remaining 29 bits + * are magnitude bits. Negative numbers are represented + * using two's-complement notation. + * If number is negative, OCT2BIN ignores places and returns + * a 10-character binary number. + * If number is negative, it cannot be less than 7777777000, + * and if number is positive, it cannot be greater than 777. + * If number is not a valid octal number, OCT2BIN returns + * the #NUM! error value. + * If OCT2BIN requires more than places characters, it + * returns the #NUM! error value. + * @param int $places The number of characters to use. If places is omitted, + * OCT2BIN uses the minimum number of characters necessary. + * Places is useful for padding the return value with + * leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, OCT2BIN returns the #VALUE! + * error value. + * If places is negative, OCT2BIN returns the #NUM! error + * value. + * + * @return string + */ + public static function OCTTOBIN($x, $places = null) + { + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + if (is_bool($x)) { + return Functions::VALUE(); + } + $x = (string) $x; + if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { + return Functions::NAN(); + } + + return self::DECTOBIN(self::OCTTODEC($x), $places); + } + + /** + * OCTTODEC. + * + * Return an octal value as decimal. + * + * Excel Function: + * OCT2DEC(x) + * + * @category Engineering Functions + * + * @param string $x The octal number you want to convert. Number may not contain + * more than 10 octal characters (30 bits). The most significant + * bit of number is the sign bit. The remaining 29 bits are + * magnitude bits. Negative numbers are represented using + * two's-complement notation. + * If number is not a valid octal number, OCT2DEC returns the + * #NUM! error value. + * + * @return string + */ + public static function OCTTODEC($x) + { + $x = Functions::flattenSingleValue($x); + + if (is_bool($x)) { + return Functions::VALUE(); + } + $x = (string) $x; + if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { + return Functions::NAN(); + } + $binX = ''; + foreach (str_split($x) as $char) { + $binX .= str_pad(decbin((int) $char), 3, '0', STR_PAD_LEFT); + } + if (strlen($binX) == 30 && $binX[0] == '1') { + for ($i = 0; $i < 30; ++$i) { + $binX[$i] = ($binX[$i] == '1' ? '0' : '1'); + } + + return (bindec($binX) + 1) * -1; + } + + return bindec($binX); + } + + /** + * OCTTOHEX. + * + * Return an octal value as hex. + * + * Excel Function: + * OCT2HEX(x[,places]) + * + * @category Engineering Functions + * + * @param string $x The octal number you want to convert. Number may not contain + * more than 10 octal characters (30 bits). The most significant + * bit of number is the sign bit. The remaining 29 bits are + * magnitude bits. Negative numbers are represented using + * two's-complement notation. + * If number is negative, OCT2HEX ignores places and returns a + * 10-character hexadecimal number. + * If number is not a valid octal number, OCT2HEX returns the + * #NUM! error value. + * If OCT2HEX requires more than places characters, it returns + * the #NUM! error value. + * @param int $places The number of characters to use. If places is omitted, OCT2HEX + * uses the minimum number of characters necessary. Places is useful + * for padding the return value with leading 0s (zeros). + * If places is not an integer, it is truncated. + * If places is nonnumeric, OCT2HEX returns the #VALUE! error value. + * If places is negative, OCT2HEX returns the #NUM! error value. + * + * @return string + */ + public static function OCTTOHEX($x, $places = null) + { + $x = Functions::flattenSingleValue($x); + $places = Functions::flattenSingleValue($places); + + if (is_bool($x)) { + return Functions::VALUE(); + } + $x = (string) $x; + if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { + return Functions::NAN(); + } + $hexVal = strtoupper(dechex(self::OCTTODEC($x))); + + return self::nbrConversionFormat($hexVal, $places); + } + + /** + * COMPLEX. + * + * Converts real and imaginary coefficients into a complex number of the form x +/- yi or x +/- yj. + * + * Excel Function: + * COMPLEX(realNumber,imaginary[,suffix]) + * + * @category Engineering Functions + * + * @param float $realNumber the real coefficient of the complex number + * @param float $imaginary the imaginary coefficient of the complex number + * @param string $suffix The suffix for the imaginary component of the complex number. + * If omitted, the suffix is assumed to be "i". + * + * @return string + */ + public static function COMPLEX($realNumber = 0.0, $imaginary = 0.0, $suffix = 'i') + { + $realNumber = ($realNumber === null) ? 0.0 : Functions::flattenSingleValue($realNumber); + $imaginary = ($imaginary === null) ? 0.0 : Functions::flattenSingleValue($imaginary); + $suffix = ($suffix === null) ? 'i' : Functions::flattenSingleValue($suffix); + + if (((is_numeric($realNumber)) && (is_numeric($imaginary))) && + (($suffix == 'i') || ($suffix == 'j') || ($suffix == '')) + ) { + $complex = new Complex($realNumber, $imaginary, $suffix); + + return (string) $complex; + } + + return Functions::VALUE(); + } + + /** + * IMAGINARY. + * + * Returns the imaginary coefficient of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMAGINARY(complexNumber) + * + * @category Engineering Functions + * + * @param string $complexNumber the complex number for which you want the imaginary + * coefficient + * + * @return float + */ + public static function IMAGINARY($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (new Complex($complexNumber))->getImaginary(); + } + + /** + * IMREAL. + * + * Returns the real coefficient of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMREAL(complexNumber) + * + * @category Engineering Functions + * + * @param string $complexNumber the complex number for which you want the real coefficient + * + * @return float + */ + public static function IMREAL($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (new Complex($complexNumber))->getReal(); + } + + /** + * IMABS. + * + * Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMABS(complexNumber) + * + * @param string $complexNumber the complex number for which you want the absolute value + * + * @return float + */ + public static function IMABS($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (new Complex($complexNumber))->abs(); + } + + /** + * IMARGUMENT. + * + * Returns the argument theta of a complex number, i.e. the angle in radians from the real + * axis to the representation of the number in polar coordinates. + * + * Excel Function: + * IMARGUMENT(complexNumber) + * + * @param string $complexNumber the complex number for which you want the argument theta + * + * @return float|string + */ + public static function IMARGUMENT($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + $complex = new Complex($complexNumber); + if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return Functions::DIV0(); + } + + return $complex->argument(); + } + + /** + * IMCONJUGATE. + * + * Returns the complex conjugate of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMCONJUGATE(complexNumber) + * + * @param string $complexNumber the complex number for which you want the conjugate + * + * @return string + */ + public static function IMCONJUGATE($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->conjugate(); + } + + /** + * IMCOS. + * + * Returns the cosine of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMCOS(complexNumber) + * + * @param string $complexNumber the complex number for which you want the cosine + * + * @return float|string + */ + public static function IMCOS($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->cos(); + } + + /** + * IMCOSH. + * + * Returns the hyperbolic cosine of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMCOSH(complexNumber) + * + * @param string $complexNumber the complex number for which you want the hyperbolic cosine + * + * @return float|string + */ + public static function IMCOSH($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->cosh(); + } + + /** + * IMCOT. + * + * Returns the cotangent of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMCOT(complexNumber) + * + * @param string $complexNumber the complex number for which you want the cotangent + * + * @return float|string + */ + public static function IMCOT($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->cot(); + } + + /** + * IMCSC. + * + * Returns the cosecant of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMCSC(complexNumber) + * + * @param string $complexNumber the complex number for which you want the cosecant + * + * @return float|string + */ + public static function IMCSC($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->csc(); + } + + /** + * IMCSCH. + * + * Returns the hyperbolic cosecant of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMCSCH(complexNumber) + * + * @param string $complexNumber the complex number for which you want the hyperbolic cosecant + * + * @return float|string + */ + public static function IMCSCH($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->csch(); + } + + /** + * IMSIN. + * + * Returns the sine of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMSIN(complexNumber) + * + * @param string $complexNumber the complex number for which you want the sine + * + * @return float|string + */ + public static function IMSIN($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->sin(); + } + + /** + * IMSINH. + * + * Returns the hyperbolic sine of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMSINH(complexNumber) + * + * @param string $complexNumber the complex number for which you want the hyperbolic sine + * + * @return float|string + */ + public static function IMSINH($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->sinh(); + } + + /** + * IMSEC. + * + * Returns the secant of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMSEC(complexNumber) + * + * @param string $complexNumber the complex number for which you want the secant + * + * @return float|string + */ + public static function IMSEC($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->sec(); + } + + /** + * IMSECH. + * + * Returns the hyperbolic secant of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMSECH(complexNumber) + * + * @param string $complexNumber the complex number for which you want the hyperbolic secant + * + * @return float|string + */ + public static function IMSECH($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->sech(); + } + + /** + * IMTAN. + * + * Returns the tangent of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMTAN(complexNumber) + * + * @param string $complexNumber the complex number for which you want the tangent + * + * @return float|string + */ + public static function IMTAN($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->tan(); + } + + /** + * IMSQRT. + * + * Returns the square root of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMSQRT(complexNumber) + * + * @param string $complexNumber the complex number for which you want the square root + * + * @return string + */ + public static function IMSQRT($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + $theta = self::IMARGUMENT($complexNumber); + if ($theta === Functions::DIV0()) { + return '0'; + } + + return (string) (new Complex($complexNumber))->sqrt(); + } + + /** + * IMLN. + * + * Returns the natural logarithm of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMLN(complexNumber) + * + * @param string $complexNumber the complex number for which you want the natural logarithm + * + * @return string + */ + public static function IMLN($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + $complex = new Complex($complexNumber); + if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return Functions::NAN(); + } + + return (string) (new Complex($complexNumber))->ln(); + } + + /** + * IMLOG10. + * + * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMLOG10(complexNumber) + * + * @param string $complexNumber the complex number for which you want the common logarithm + * + * @return string + */ + public static function IMLOG10($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + $complex = new Complex($complexNumber); + if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return Functions::NAN(); + } + + return (string) (new Complex($complexNumber))->log10(); + } + + /** + * IMLOG2. + * + * Returns the base-2 logarithm of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMLOG2(complexNumber) + * + * @param string $complexNumber the complex number for which you want the base-2 logarithm + * + * @return string + */ + public static function IMLOG2($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + $complex = new Complex($complexNumber); + if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { + return Functions::NAN(); + } + + return (string) (new Complex($complexNumber))->log2(); + } + + /** + * IMEXP. + * + * Returns the exponential of a complex number in x + yi or x + yj text format. + * + * Excel Function: + * IMEXP(complexNumber) + * + * @param string $complexNumber the complex number for which you want the exponential + * + * @return string + */ + public static function IMEXP($complexNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + + return (string) (new Complex($complexNumber))->exp(); + } + + /** + * IMPOWER. + * + * Returns a complex number in x + yi or x + yj text format raised to a power. + * + * Excel Function: + * IMPOWER(complexNumber,realNumber) + * + * @param string $complexNumber the complex number you want to raise to a power + * @param float $realNumber the power to which you want to raise the complex number + * + * @return string + */ + public static function IMPOWER($complexNumber, $realNumber) + { + $complexNumber = Functions::flattenSingleValue($complexNumber); + $realNumber = Functions::flattenSingleValue($realNumber); + + if (!is_numeric($realNumber)) { + return Functions::VALUE(); + } + + return (string) (new Complex($complexNumber))->pow($realNumber); + } + + /** + * IMDIV. + * + * Returns the quotient of two complex numbers in x + yi or x + yj text format. + * + * Excel Function: + * IMDIV(complexDividend,complexDivisor) + * + * @param string $complexDividend the complex numerator or dividend + * @param string $complexDivisor the complex denominator or divisor + * + * @return string + */ + public static function IMDIV($complexDividend, $complexDivisor) + { + $complexDividend = Functions::flattenSingleValue($complexDividend); + $complexDivisor = Functions::flattenSingleValue($complexDivisor); + + try { + return (string) (new Complex($complexDividend))->divideby(new Complex($complexDivisor)); + } catch (ComplexException $e) { + return Functions::NAN(); + } + } + + /** + * IMSUB. + * + * Returns the difference of two complex numbers in x + yi or x + yj text format. + * + * Excel Function: + * IMSUB(complexNumber1,complexNumber2) + * + * @param string $complexNumber1 the complex number from which to subtract complexNumber2 + * @param string $complexNumber2 the complex number to subtract from complexNumber1 + * + * @return string + */ + public static function IMSUB($complexNumber1, $complexNumber2) + { + $complexNumber1 = Functions::flattenSingleValue($complexNumber1); + $complexNumber2 = Functions::flattenSingleValue($complexNumber2); + + try { + return (string) (new Complex($complexNumber1))->subtract(new Complex($complexNumber2)); + } catch (ComplexException $e) { + return Functions::NAN(); + } + } + + /** + * IMSUM. + * + * Returns the sum of two or more complex numbers in x + yi or x + yj text format. + * + * Excel Function: + * IMSUM(complexNumber[,complexNumber[,...]]) + * + * @param string ...$complexNumbers Series of complex numbers to add + * + * @return string + */ + public static function IMSUM(...$complexNumbers) + { + // Return value + $returnValue = new Complex(0.0); + $aArgs = Functions::flattenArray($complexNumbers); + + try { + // Loop through the arguments + foreach ($aArgs as $complex) { + $returnValue = $returnValue->add(new Complex($complex)); + } + } catch (ComplexException $e) { + return Functions::NAN(); + } + + return (string) $returnValue; + } + + /** + * IMPRODUCT. + * + * Returns the product of two or more complex numbers in x + yi or x + yj text format. + * + * Excel Function: + * IMPRODUCT(complexNumber[,complexNumber[,...]]) + * + * @param string ...$complexNumbers Series of complex numbers to multiply + * + * @return string + */ + public static function IMPRODUCT(...$complexNumbers) + { + // Return value + $returnValue = new Complex(1.0); + $aArgs = Functions::flattenArray($complexNumbers); + + try { + // Loop through the arguments + foreach ($aArgs as $complex) { + $returnValue = $returnValue->multiply(new Complex($complex)); + } + } catch (ComplexException $e) { + return Functions::NAN(); + } + + return (string) $returnValue; + } + + /** + * DELTA. + * + * Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise. + * Use this function to filter a set of values. For example, by summing several DELTA + * functions you calculate the count of equal pairs. This function is also known as the + * Kronecker Delta function. + * + * Excel Function: + * DELTA(a[,b]) + * + * @param float $a the first number + * @param float $b The second number. If omitted, b is assumed to be zero. + * + * @return int + */ + public static function DELTA($a, $b = 0) + { + $a = Functions::flattenSingleValue($a); + $b = Functions::flattenSingleValue($b); + + return (int) ($a == $b); + } + + /** + * GESTEP. + * + * Excel Function: + * GESTEP(number[,step]) + * + * Returns 1 if number >= step; returns 0 (zero) otherwise + * Use this function to filter a set of values. For example, by summing several GESTEP + * functions you calculate the count of values that exceed a threshold. + * + * @param float $number the value to test against step + * @param float $step The threshold value. + * If you omit a value for step, GESTEP uses zero. + * + * @return int + */ + public static function GESTEP($number, $step = 0) + { + $number = Functions::flattenSingleValue($number); + $step = Functions::flattenSingleValue($step); + + return (int) ($number >= $step); + } + + // + // Private method to calculate the erf value + // + private static $twoSqrtPi = 1.128379167095512574; + + public static function erfVal($x) + { + if (abs($x) > 2.2) { + return 1 - self::erfcVal($x); + } + $sum = $term = $x; + $xsqr = ($x * $x); + $j = 1; + do { + $term *= $xsqr / $j; + $sum -= $term / (2 * $j + 1); + ++$j; + $term *= $xsqr / $j; + $sum += $term / (2 * $j + 1); + ++$j; + if ($sum == 0.0) { + break; + } + } while (abs($term / $sum) > Functions::PRECISION); + + return self::$twoSqrtPi * $sum; + } + + /** + * Validate arguments passed to the bitwise functions. + * + * @param mixed $value + * + * @throws Exception + * + * @return int + */ + private static function validateBitwiseArgument($value) + { + $value = Functions::flattenSingleValue($value); + + if (is_int($value)) { + return $value; + } elseif (is_numeric($value)) { + if ($value == (int) ($value)) { + $value = (int) ($value); + if (($value > pow(2, 48) - 1) || ($value < 0)) { + throw new Exception(Functions::NAN()); + } + + return $value; + } + + throw new Exception(Functions::NAN()); + } + + throw new Exception(Functions::VALUE()); + } + + /** + * BITAND. + * + * Returns the bitwise AND of two integer values. + * + * Excel Function: + * BITAND(number1, number2) + * + * @category Engineering Functions + * + * @param int $number1 + * @param int $number2 + * + * @return int|string + */ + public static function BITAND($number1, $number2) + { + try { + $number1 = self::validateBitwiseArgument($number1); + $number2 = self::validateBitwiseArgument($number2); + } catch (Exception $e) { + return $e->getMessage(); + } + + return $number1 & $number2; + } + + /** + * BITOR. + * + * Returns the bitwise OR of two integer values. + * + * Excel Function: + * BITOR(number1, number2) + * + * @category Engineering Functions + * + * @param int $number1 + * @param int $number2 + * + * @return int|string + */ + public static function BITOR($number1, $number2) + { + try { + $number1 = self::validateBitwiseArgument($number1); + $number2 = self::validateBitwiseArgument($number2); + } catch (Exception $e) { + return $e->getMessage(); + } + + return $number1 | $number2; + } + + /** + * BITXOR. + * + * Returns the bitwise XOR of two integer values. + * + * Excel Function: + * BITXOR(number1, number2) + * + * @category Engineering Functions + * + * @param int $number1 + * @param int $number2 + * + * @return int|string + */ + public static function BITXOR($number1, $number2) + { + try { + $number1 = self::validateBitwiseArgument($number1); + $number2 = self::validateBitwiseArgument($number2); + } catch (Exception $e) { + return $e->getMessage(); + } + + return $number1 ^ $number2; + } + + /** + * BITLSHIFT. + * + * Returns the number value shifted left by shift_amount bits. + * + * Excel Function: + * BITLSHIFT(number, shift_amount) + * + * @category Engineering Functions + * + * @param int $number + * @param int $shiftAmount + * + * @return int|string + */ + public static function BITLSHIFT($number, $shiftAmount) + { + try { + $number = self::validateBitwiseArgument($number); + } catch (Exception $e) { + return $e->getMessage(); + } + + $shiftAmount = Functions::flattenSingleValue($shiftAmount); + + $result = $number << $shiftAmount; + if ($result > pow(2, 48) - 1) { + return Functions::NAN(); + } + + return $result; + } + + /** + * BITRSHIFT. + * + * Returns the number value shifted right by shift_amount bits. + * + * Excel Function: + * BITRSHIFT(number, shift_amount) + * + * @category Engineering Functions + * + * @param int $number + * @param int $shiftAmount + * + * @return int|string + */ + public static function BITRSHIFT($number, $shiftAmount) + { + try { + $number = self::validateBitwiseArgument($number); + } catch (Exception $e) { + return $e->getMessage(); + } + + $shiftAmount = Functions::flattenSingleValue($shiftAmount); + + return $number >> $shiftAmount; + } + + /** + * ERF. + * + * Returns the error function integrated between the lower and upper bound arguments. + * + * Note: In Excel 2007 or earlier, if you input a negative value for the upper or lower bound arguments, + * the function would return a #NUM! error. However, in Excel 2010, the function algorithm was + * improved, so that it can now calculate the function for both positive and negative ranges. + * PhpSpreadsheet follows Excel 2010 behaviour, and accepts negative arguments. + * + * Excel Function: + * ERF(lower[,upper]) + * + * @param float $lower lower bound for integrating ERF + * @param float $upper upper bound for integrating ERF. + * If omitted, ERF integrates between zero and lower_limit + * + * @return float|string + */ + public static function ERF($lower, $upper = null) + { + $lower = Functions::flattenSingleValue($lower); + $upper = Functions::flattenSingleValue($upper); + + if (is_numeric($lower)) { + if ($upper === null) { + return self::erfVal($lower); + } + if (is_numeric($upper)) { + return self::erfVal($upper) - self::erfVal($lower); + } + } + + return Functions::VALUE(); + } + + /** + * ERFPRECISE. + * + * Returns the error function integrated between the lower and upper bound arguments. + * + * Excel Function: + * ERF.PRECISE(limit) + * + * @param float $limit bound for integrating ERF + * + * @return float|string + */ + public static function ERFPRECISE($limit) + { + $limit = Functions::flattenSingleValue($limit); + + return self::ERF($limit); + } + + // + // Private method to calculate the erfc value + // + private static $oneSqrtPi = 0.564189583547756287; + + private static function erfcVal($x) + { + if (abs($x) < 2.2) { + return 1 - self::erfVal($x); + } + if ($x < 0) { + return 2 - self::ERFC(-$x); + } + $a = $n = 1; + $b = $c = $x; + $d = ($x * $x) + 0.5; + $q1 = $q2 = $b / $d; + $t = 0; + do { + $t = $a * $n + $b * $x; + $a = $b; + $b = $t; + $t = $c * $n + $d * $x; + $c = $d; + $d = $t; + $n += 0.5; + $q1 = $q2; + $q2 = $b / $d; + } while ((abs($q1 - $q2) / $q2) > Functions::PRECISION); + + return self::$oneSqrtPi * exp(-$x * $x) * $q2; + } + + /** + * ERFC. + * + * Returns the complementary ERF function integrated between x and infinity + * + * Note: In Excel 2007 or earlier, if you input a negative value for the lower bound argument, + * the function would return a #NUM! error. However, in Excel 2010, the function algorithm was + * improved, so that it can now calculate the function for both positive and negative x values. + * PhpSpreadsheet follows Excel 2010 behaviour, and accepts nagative arguments. + * + * Excel Function: + * ERFC(x) + * + * @param float $x The lower bound for integrating ERFC + * + * @return float|string + */ + public static function ERFC($x) + { + $x = Functions::flattenSingleValue($x); + + if (is_numeric($x)) { + return self::erfcVal($x); + } + + return Functions::VALUE(); + } + + /** + * getConversionGroups + * Returns a list of the different conversion groups for UOM conversions. + * + * @return array + */ + public static function getConversionGroups() + { + $conversionGroups = []; + foreach (self::$conversionUnits as $conversionUnit) { + $conversionGroups[] = $conversionUnit['Group']; + } + + return array_merge(array_unique($conversionGroups)); + } + + /** + * getConversionGroupUnits + * Returns an array of units of measure, for a specified conversion group, or for all groups. + * + * @param string $group The group whose units of measure you want to retrieve + * + * @return array + */ + public static function getConversionGroupUnits($group = null) + { + $conversionGroups = []; + foreach (self::$conversionUnits as $conversionUnit => $conversionGroup) { + if (($group === null) || ($conversionGroup['Group'] == $group)) { + $conversionGroups[$conversionGroup['Group']][] = $conversionUnit; + } + } + + return $conversionGroups; + } + + /** + * getConversionGroupUnitDetails. + * + * @param string $group The group whose units of measure you want to retrieve + * + * @return array + */ + public static function getConversionGroupUnitDetails($group = null) + { + $conversionGroups = []; + foreach (self::$conversionUnits as $conversionUnit => $conversionGroup) { + if (($group === null) || ($conversionGroup['Group'] == $group)) { + $conversionGroups[$conversionGroup['Group']][] = [ + 'unit' => $conversionUnit, + 'description' => $conversionGroup['Unit Name'], + ]; + } + } + + return $conversionGroups; + } + + /** + * getConversionMultipliers + * Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM(). + * + * @return array of mixed + */ + public static function getConversionMultipliers() + { + return self::$conversionMultipliers; + } + + /** + * CONVERTUOM. + * + * Converts a number from one measurement system to another. + * For example, CONVERT can translate a table of distances in miles to a table of distances + * in kilometers. + * + * Excel Function: + * CONVERT(value,fromUOM,toUOM) + * + * @param float $value the value in fromUOM to convert + * @param string $fromUOM the units for value + * @param string $toUOM the units for the result + * + * @return float|string + */ + public static function CONVERTUOM($value, $fromUOM, $toUOM) + { + $value = Functions::flattenSingleValue($value); + $fromUOM = Functions::flattenSingleValue($fromUOM); + $toUOM = Functions::flattenSingleValue($toUOM); + + if (!is_numeric($value)) { + return Functions::VALUE(); + } + $fromMultiplier = 1.0; + if (isset(self::$conversionUnits[$fromUOM])) { + $unitGroup1 = self::$conversionUnits[$fromUOM]['Group']; + } else { + $fromMultiplier = substr($fromUOM, 0, 1); + $fromUOM = substr($fromUOM, 1); + if (isset(self::$conversionMultipliers[$fromMultiplier])) { + $fromMultiplier = self::$conversionMultipliers[$fromMultiplier]['multiplier']; + } else { + return Functions::NA(); + } + if ((isset(self::$conversionUnits[$fromUOM])) && (self::$conversionUnits[$fromUOM]['AllowPrefix'])) { + $unitGroup1 = self::$conversionUnits[$fromUOM]['Group']; + } else { + return Functions::NA(); + } + } + $value *= $fromMultiplier; + + $toMultiplier = 1.0; + if (isset(self::$conversionUnits[$toUOM])) { + $unitGroup2 = self::$conversionUnits[$toUOM]['Group']; + } else { + $toMultiplier = substr($toUOM, 0, 1); + $toUOM = substr($toUOM, 1); + if (isset(self::$conversionMultipliers[$toMultiplier])) { + $toMultiplier = self::$conversionMultipliers[$toMultiplier]['multiplier']; + } else { + return Functions::NA(); + } + if ((isset(self::$conversionUnits[$toUOM])) && (self::$conversionUnits[$toUOM]['AllowPrefix'])) { + $unitGroup2 = self::$conversionUnits[$toUOM]['Group']; + } else { + return Functions::NA(); + } + } + if ($unitGroup1 != $unitGroup2) { + return Functions::NA(); + } + + if (($fromUOM == $toUOM) && ($fromMultiplier == $toMultiplier)) { + // We've already factored $fromMultiplier into the value, so we need + // to reverse it again + return $value / $fromMultiplier; + } elseif ($unitGroup1 == 'Temperature') { + if (($fromUOM == 'F') || ($fromUOM == 'fah')) { + if (($toUOM == 'F') || ($toUOM == 'fah')) { + return $value; + } + $value = (($value - 32) / 1.8); + if (($toUOM == 'K') || ($toUOM == 'kel')) { + $value += 273.15; + } + + return $value; + } elseif ((($fromUOM == 'K') || ($fromUOM == 'kel')) && + (($toUOM == 'K') || ($toUOM == 'kel')) + ) { + return $value; + } elseif ((($fromUOM == 'C') || ($fromUOM == 'cel')) && + (($toUOM == 'C') || ($toUOM == 'cel')) + ) { + return $value; + } + if (($toUOM == 'F') || ($toUOM == 'fah')) { + if (($fromUOM == 'K') || ($fromUOM == 'kel')) { + $value -= 273.15; + } + + return ($value * 1.8) + 32; + } + if (($toUOM == 'C') || ($toUOM == 'cel')) { + return $value - 273.15; + } + + return $value + 273.15; + } + + return ($value * self::$unitConversions[$unitGroup1][$fromUOM][$toUOM]) / $toMultiplier; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Exception.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Exception.php new file mode 100644 index 0000000..fccf0af --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Exception.php @@ -0,0 +1,26 @@ +line = $line; + $e->file = $file; + + throw $e; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ExceptionHandler.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ExceptionHandler.php new file mode 100644 index 0000000..41e51d4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/ExceptionHandler.php @@ -0,0 +1,22 @@ +format('d') == $testDate->format('t'); + } + + private static function couponFirstPeriodDate($settlement, $maturity, $frequency, $next) + { + $months = 12 / $frequency; + + $result = Date::excelToDateTimeObject($maturity); + $eom = self::isLastDayOfMonth($result); + + while ($settlement < Date::PHPToExcel($result)) { + $result->modify('-' . $months . ' months'); + } + if ($next) { + $result->modify('+' . $months . ' months'); + } + + if ($eom) { + $result->modify('-1 day'); + } + + return Date::PHPToExcel($result); + } + + private static function isValidFrequency($frequency) + { + if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) { + return true; + } + if ((Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) && + (($frequency == 6) || ($frequency == 12))) { + return true; + } + + return false; + } + + /** + * daysPerYear. + * + * Returns the number of days in a specified year, as defined by the "basis" value + * + * @param int|string $year The year against which we're testing + * @param int|string $basis The type of day count: + * 0 or omitted US (NASD) 360 + * 1 Actual (365 or 366 in a leap year) + * 2 360 + * 3 365 + * 4 European 360 + * + * @return int|string Result, or a string containing an error + */ + private static function daysPerYear($year, $basis = 0) + { + switch ($basis) { + case 0: + case 2: + case 4: + $daysPerYear = 360; + + break; + case 3: + $daysPerYear = 365; + + break; + case 1: + $daysPerYear = (DateTime::isLeapYear($year)) ? 366 : 365; + + break; + default: + return Functions::NAN(); + } + + return $daysPerYear; + } + + private static function interestAndPrincipal($rate = 0, $per = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0) + { + $pmt = self::PMT($rate, $nper, $pv, $fv, $type); + $capital = $pv; + for ($i = 1; $i <= $per; ++$i) { + $interest = ($type && $i == 1) ? 0 : -$capital * $rate; + $principal = $pmt - $interest; + $capital += $principal; + } + + return [$interest, $principal]; + } + + /** + * ACCRINT. + * + * Returns the accrued interest for a security that pays periodic interest. + * + * Excel Function: + * ACCRINT(issue,firstinterest,settlement,rate,par,frequency[,basis]) + * + * @category Financial Functions + * + * @param mixed $issue the security's issue date + * @param mixed $firstinterest the security's first interest date + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue date + * when the security is traded to the buyer. + * @param float $rate the security's annual coupon rate + * @param float $par The security's par value. + * If you omit par, ACCRINT uses $1,000. + * @param int $frequency the number of coupon payments per year. + * Valid frequency values are: + * 1 Annual + * 2 Semi-Annual + * 4 Quarterly + * If working in Gnumeric Mode, the following frequency options are + * also available + * 6 Bimonthly + * 12 Monthly + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string Result, or a string containing an error + */ + public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par = 1000, $frequency = 1, $basis = 0) + { + $issue = Functions::flattenSingleValue($issue); + $firstinterest = Functions::flattenSingleValue($firstinterest); + $settlement = Functions::flattenSingleValue($settlement); + $rate = Functions::flattenSingleValue($rate); + $par = ($par === null) ? 1000 : Functions::flattenSingleValue($par); + $frequency = ($frequency === null) ? 1 : Functions::flattenSingleValue($frequency); + $basis = ($basis === null) ? 0 : Functions::flattenSingleValue($basis); + + // Validate + if ((is_numeric($rate)) && (is_numeric($par))) { + $rate = (float) $rate; + $par = (float) $par; + if (($rate <= 0) || ($par <= 0)) { + return Functions::NAN(); + } + $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis); + if (!is_numeric($daysBetweenIssueAndSettlement)) { + // return date error + return $daysBetweenIssueAndSettlement; + } + + return $par * $rate * $daysBetweenIssueAndSettlement; + } + + return Functions::VALUE(); + } + + /** + * ACCRINTM. + * + * Returns the accrued interest for a security that pays interest at maturity. + * + * Excel Function: + * ACCRINTM(issue,settlement,rate[,par[,basis]]) + * + * @category Financial Functions + * + * @param mixed $issue The security's issue date + * @param mixed $settlement The security's settlement (or maturity) date + * @param float $rate The security's annual coupon rate + * @param float $par The security's par value. + * If you omit par, ACCRINT uses $1,000. + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string Result, or a string containing an error + */ + public static function ACCRINTM($issue, $settlement, $rate, $par = 1000, $basis = 0) + { + $issue = Functions::flattenSingleValue($issue); + $settlement = Functions::flattenSingleValue($settlement); + $rate = Functions::flattenSingleValue($rate); + $par = ($par === null) ? 1000 : Functions::flattenSingleValue($par); + $basis = ($basis === null) ? 0 : Functions::flattenSingleValue($basis); + + // Validate + if ((is_numeric($rate)) && (is_numeric($par))) { + $rate = (float) $rate; + $par = (float) $par; + if (($rate <= 0) || ($par <= 0)) { + return Functions::NAN(); + } + $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis); + if (!is_numeric($daysBetweenIssueAndSettlement)) { + // return date error + return $daysBetweenIssueAndSettlement; + } + + return $par * $rate * $daysBetweenIssueAndSettlement; + } + + return Functions::VALUE(); + } + + /** + * AMORDEGRC. + * + * Returns the depreciation for each accounting period. + * This function is provided for the French accounting system. If an asset is purchased in + * the middle of the accounting period, the prorated depreciation is taken into account. + * The function is similar to AMORLINC, except that a depreciation coefficient is applied in + * the calculation depending on the life of the assets. + * This function will return the depreciation until the last period of the life of the assets + * or until the cumulated value of depreciation is greater than the cost of the assets minus + * the salvage value. + * + * Excel Function: + * AMORDEGRC(cost,purchased,firstPeriod,salvage,period,rate[,basis]) + * + * @category Financial Functions + * + * @param float $cost The cost of the asset + * @param mixed $purchased Date of the purchase of the asset + * @param mixed $firstPeriod Date of the end of the first period + * @param mixed $salvage The salvage value at the end of the life of the asset + * @param float $period The period + * @param float $rate Rate of depreciation + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float + */ + public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0) + { + $cost = Functions::flattenSingleValue($cost); + $purchased = Functions::flattenSingleValue($purchased); + $firstPeriod = Functions::flattenSingleValue($firstPeriod); + $salvage = Functions::flattenSingleValue($salvage); + $period = floor(Functions::flattenSingleValue($period)); + $rate = Functions::flattenSingleValue($rate); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + // The depreciation coefficients are: + // Life of assets (1/rate) Depreciation coefficient + // Less than 3 years 1 + // Between 3 and 4 years 1.5 + // Between 5 and 6 years 2 + // More than 6 years 2.5 + $fUsePer = 1.0 / $rate; + if ($fUsePer < 3.0) { + $amortiseCoeff = 1.0; + } elseif ($fUsePer < 5.0) { + $amortiseCoeff = 1.5; + } elseif ($fUsePer <= 6.0) { + $amortiseCoeff = 2.0; + } else { + $amortiseCoeff = 2.5; + } + + $rate *= $amortiseCoeff; + $fNRate = round(DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost, 0); + $cost -= $fNRate; + $fRest = $cost - $salvage; + + for ($n = 0; $n < $period; ++$n) { + $fNRate = round($rate * $cost, 0); + $fRest -= $fNRate; + + if ($fRest < 0.0) { + switch ($period - $n) { + case 0: + case 1: + return round($cost * 0.5, 0); + default: + return 0.0; + } + } + $cost -= $fNRate; + } + + return $fNRate; + } + + /** + * AMORLINC. + * + * Returns the depreciation for each accounting period. + * This function is provided for the French accounting system. If an asset is purchased in + * the middle of the accounting period, the prorated depreciation is taken into account. + * + * Excel Function: + * AMORLINC(cost,purchased,firstPeriod,salvage,period,rate[,basis]) + * + * @category Financial Functions + * + * @param float $cost The cost of the asset + * @param mixed $purchased Date of the purchase of the asset + * @param mixed $firstPeriod Date of the end of the first period + * @param mixed $salvage The salvage value at the end of the life of the asset + * @param float $period The period + * @param float $rate Rate of depreciation + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float + */ + public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0) + { + $cost = Functions::flattenSingleValue($cost); + $purchased = Functions::flattenSingleValue($purchased); + $firstPeriod = Functions::flattenSingleValue($firstPeriod); + $salvage = Functions::flattenSingleValue($salvage); + $period = Functions::flattenSingleValue($period); + $rate = Functions::flattenSingleValue($rate); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + $fOneRate = $cost * $rate; + $fCostDelta = $cost - $salvage; + // Note, quirky variation for leap years on the YEARFRAC for this function + $purchasedYear = DateTime::YEAR($purchased); + $yearFrac = DateTime::YEARFRAC($purchased, $firstPeriod, $basis); + + if (($basis == 1) && ($yearFrac < 1) && (DateTime::isLeapYear($purchasedYear))) { + $yearFrac *= 365 / 366; + } + + $f0Rate = $yearFrac * $rate * $cost; + $nNumOfFullPeriods = (int) (($cost - $salvage - $f0Rate) / $fOneRate); + + if ($period == 0) { + return $f0Rate; + } elseif ($period <= $nNumOfFullPeriods) { + return $fOneRate; + } elseif ($period == ($nNumOfFullPeriods + 1)) { + return $fCostDelta - $fOneRate * $nNumOfFullPeriods - $f0Rate; + } + + return 0.0; + } + + /** + * COUPDAYBS. + * + * Returns the number of days from the beginning of the coupon period to the settlement date. + * + * Excel Function: + * COUPDAYBS(settlement,maturity,frequency[,basis]) + * + * @category Financial Functions + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue + * date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int $frequency the number of coupon payments per year. + * Valid frequency values are: + * 1 Annual + * 2 Semi-Annual + * 4 Quarterly + * If working in Gnumeric Mode, the following frequency options are + * also available + * 6 Bimonthly + * 12 Monthly + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string + */ + public static function COUPDAYBS($settlement, $maturity, $frequency, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $frequency = (int) Functions::flattenSingleValue($frequency); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + if (is_string($settlement = DateTime::getDateValue($settlement))) { + return Functions::VALUE(); + } + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + if (($settlement >= $maturity) || + (!self::isValidFrequency($frequency)) || + (($basis < 0) || ($basis > 4))) { + return Functions::NAN(); + } + + $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis); + $prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, false); + + return DateTime::YEARFRAC($prev, $settlement, $basis) * $daysPerYear; + } + + /** + * COUPDAYS. + * + * Returns the number of days in the coupon period that contains the settlement date. + * + * Excel Function: + * COUPDAYS(settlement,maturity,frequency[,basis]) + * + * @category Financial Functions + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue + * date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed $frequency the number of coupon payments per year. + * Valid frequency values are: + * 1 Annual + * 2 Semi-Annual + * 4 Quarterly + * If working in Gnumeric Mode, the following frequency options are + * also available + * 6 Bimonthly + * 12 Monthly + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string + */ + public static function COUPDAYS($settlement, $maturity, $frequency, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $frequency = (int) Functions::flattenSingleValue($frequency); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + if (is_string($settlement = DateTime::getDateValue($settlement))) { + return Functions::VALUE(); + } + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + if (($settlement >= $maturity) || + (!self::isValidFrequency($frequency)) || + (($basis < 0) || ($basis > 4))) { + return Functions::NAN(); + } + + switch ($basis) { + case 3: + // Actual/365 + return 365 / $frequency; + case 1: + // Actual/actual + if ($frequency == 1) { + $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis); + + return $daysPerYear / $frequency; + } + $prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, false); + $next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, true); + + return $next - $prev; + default: + // US (NASD) 30/360, Actual/360 or European 30/360 + return 360 / $frequency; + } + } + + /** + * COUPDAYSNC. + * + * Returns the number of days from the settlement date to the next coupon date. + * + * Excel Function: + * COUPDAYSNC(settlement,maturity,frequency[,basis]) + * + * @category Financial Functions + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue + * date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed $frequency the number of coupon payments per year. + * Valid frequency values are: + * 1 Annual + * 2 Semi-Annual + * 4 Quarterly + * If working in Gnumeric Mode, the following frequency options are + * also available + * 6 Bimonthly + * 12 Monthly + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string + */ + public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $frequency = (int) Functions::flattenSingleValue($frequency); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + if (is_string($settlement = DateTime::getDateValue($settlement))) { + return Functions::VALUE(); + } + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + if (($settlement >= $maturity) || + (!self::isValidFrequency($frequency)) || + (($basis < 0) || ($basis > 4))) { + return Functions::NAN(); + } + + $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis); + $next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, true); + + return DateTime::YEARFRAC($settlement, $next, $basis) * $daysPerYear; + } + + /** + * COUPNCD. + * + * Returns the next coupon date after the settlement date. + * + * Excel Function: + * COUPNCD(settlement,maturity,frequency[,basis]) + * + * @category Financial Functions + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue + * date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed $frequency the number of coupon payments per year. + * Valid frequency values are: + * 1 Annual + * 2 Semi-Annual + * 4 Quarterly + * If working in Gnumeric Mode, the following frequency options are + * also available + * 6 Bimonthly + * 12 Monthly + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function COUPNCD($settlement, $maturity, $frequency, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $frequency = (int) Functions::flattenSingleValue($frequency); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + if (is_string($settlement = DateTime::getDateValue($settlement))) { + return Functions::VALUE(); + } + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + if (($settlement >= $maturity) || + (!self::isValidFrequency($frequency)) || + (($basis < 0) || ($basis > 4))) { + return Functions::NAN(); + } + + return self::couponFirstPeriodDate($settlement, $maturity, $frequency, true); + } + + /** + * COUPNUM. + * + * Returns the number of coupons payable between the settlement date and maturity date, + * rounded up to the nearest whole coupon. + * + * Excel Function: + * COUPNUM(settlement,maturity,frequency[,basis]) + * + * @category Financial Functions + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue + * date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed $frequency the number of coupon payments per year. + * Valid frequency values are: + * 1 Annual + * 2 Semi-Annual + * 4 Quarterly + * If working in Gnumeric Mode, the following frequency options are + * also available + * 6 Bimonthly + * 12 Monthly + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return int|string + */ + public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $frequency = (int) Functions::flattenSingleValue($frequency); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + if (is_string($settlement = DateTime::getDateValue($settlement))) { + return Functions::VALUE(); + } + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + if (($settlement >= $maturity) || + (!self::isValidFrequency($frequency)) || + (($basis < 0) || ($basis > 4))) { + return Functions::NAN(); + } + + $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis); + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis) * $daysPerYear; + + switch ($frequency) { + case 1: // annual payments + case 2: // half-yearly + case 4: // quarterly + case 6: // bimonthly + case 12: // monthly + return ceil($daysBetweenSettlementAndMaturity / $daysPerYear * $frequency); + } + + return Functions::VALUE(); + } + + /** + * COUPPCD. + * + * Returns the previous coupon date before the settlement date. + * + * Excel Function: + * COUPPCD(settlement,maturity,frequency[,basis]) + * + * @category Financial Functions + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue + * date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed $frequency the number of coupon payments per year. + * Valid frequency values are: + * 1 Annual + * 2 Semi-Annual + * 4 Quarterly + * If working in Gnumeric Mode, the following frequency options are + * also available + * 6 Bimonthly + * 12 Monthly + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object, + * depending on the value of the ReturnDateType flag + */ + public static function COUPPCD($settlement, $maturity, $frequency, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $frequency = (int) Functions::flattenSingleValue($frequency); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + if (is_string($settlement = DateTime::getDateValue($settlement))) { + return Functions::VALUE(); + } + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + if (($settlement >= $maturity) || + (!self::isValidFrequency($frequency)) || + (($basis < 0) || ($basis > 4))) { + return Functions::NAN(); + } + + return self::couponFirstPeriodDate($settlement, $maturity, $frequency, false); + } + + /** + * CUMIPMT. + * + * Returns the cumulative interest paid on a loan between the start and end periods. + * + * Excel Function: + * CUMIPMT(rate,nper,pv,start,end[,type]) + * + * @category Financial Functions + * + * @param float $rate The Interest rate + * @param int $nper The total number of payment periods + * @param float $pv Present Value + * @param int $start The first period in the calculation. + * Payment periods are numbered beginning with 1. + * @param int $end the last period in the calculation + * @param int $type A number 0 or 1 and indicates when payments are due: + * 0 or omitted At the end of the period. + * 1 At the beginning of the period. + * + * @return float|string + */ + public static function CUMIPMT($rate, $nper, $pv, $start, $end, $type = 0) + { + $rate = Functions::flattenSingleValue($rate); + $nper = (int) Functions::flattenSingleValue($nper); + $pv = Functions::flattenSingleValue($pv); + $start = (int) Functions::flattenSingleValue($start); + $end = (int) Functions::flattenSingleValue($end); + $type = (int) Functions::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return Functions::NAN(); + } + if ($start < 1 || $start > $end) { + return Functions::VALUE(); + } + + // Calculate + $interest = 0; + for ($per = $start; $per <= $end; ++$per) { + $interest += self::IPMT($rate, $per, $nper, $pv, 0, $type); + } + + return $interest; + } + + /** + * CUMPRINC. + * + * Returns the cumulative principal paid on a loan between the start and end periods. + * + * Excel Function: + * CUMPRINC(rate,nper,pv,start,end[,type]) + * + * @category Financial Functions + * + * @param float $rate The Interest rate + * @param int $nper The total number of payment periods + * @param float $pv Present Value + * @param int $start The first period in the calculation. + * Payment periods are numbered beginning with 1. + * @param int $end the last period in the calculation + * @param int $type A number 0 or 1 and indicates when payments are due: + * 0 or omitted At the end of the period. + * 1 At the beginning of the period. + * + * @return float|string + */ + public static function CUMPRINC($rate, $nper, $pv, $start, $end, $type = 0) + { + $rate = Functions::flattenSingleValue($rate); + $nper = (int) Functions::flattenSingleValue($nper); + $pv = Functions::flattenSingleValue($pv); + $start = (int) Functions::flattenSingleValue($start); + $end = (int) Functions::flattenSingleValue($end); + $type = (int) Functions::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return Functions::NAN(); + } + if ($start < 1 || $start > $end) { + return Functions::VALUE(); + } + + // Calculate + $principal = 0; + for ($per = $start; $per <= $end; ++$per) { + $principal += self::PPMT($rate, $per, $nper, $pv, 0, $type); + } + + return $principal; + } + + /** + * DB. + * + * Returns the depreciation of an asset for a specified period using the + * fixed-declining balance method. + * This form of depreciation is used if you want to get a higher depreciation value + * at the beginning of the depreciation (as opposed to linear depreciation). The + * depreciation value is reduced with every depreciation period by the depreciation + * already deducted from the initial cost. + * + * Excel Function: + * DB(cost,salvage,life,period[,month]) + * + * @category Financial Functions + * + * @param float $cost Initial cost of the asset + * @param float $salvage Value at the end of the depreciation. + * (Sometimes called the salvage value of the asset) + * @param int $life Number of periods over which the asset is depreciated. + * (Sometimes called the useful life of the asset) + * @param int $period The period for which you want to calculate the + * depreciation. Period must use the same units as life. + * @param int $month Number of months in the first year. If month is omitted, + * it defaults to 12. + * + * @return float|string + */ + public static function DB($cost, $salvage, $life, $period, $month = 12) + { + $cost = Functions::flattenSingleValue($cost); + $salvage = Functions::flattenSingleValue($salvage); + $life = Functions::flattenSingleValue($life); + $period = Functions::flattenSingleValue($period); + $month = Functions::flattenSingleValue($month); + + // Validate + if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) { + $cost = (float) $cost; + $salvage = (float) $salvage; + $life = (int) $life; + $period = (int) $period; + $month = (int) $month; + if ($cost == 0) { + return 0.0; + } elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) { + return Functions::NAN(); + } + // Set Fixed Depreciation Rate + $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life)); + $fixedDepreciationRate = round($fixedDepreciationRate, 3); + + // Loop through each period calculating the depreciation + $previousDepreciation = 0; + for ($per = 1; $per <= $period; ++$per) { + if ($per == 1) { + $depreciation = $cost * $fixedDepreciationRate * $month / 12; + } elseif ($per == ($life + 1)) { + $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate * (12 - $month) / 12; + } else { + $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate; + } + $previousDepreciation += $depreciation; + } + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + $depreciation = round($depreciation, 2); + } + + return $depreciation; + } + + return Functions::VALUE(); + } + + /** + * DDB. + * + * Returns the depreciation of an asset for a specified period using the + * double-declining balance method or some other method you specify. + * + * Excel Function: + * DDB(cost,salvage,life,period[,factor]) + * + * @category Financial Functions + * + * @param float $cost Initial cost of the asset + * @param float $salvage Value at the end of the depreciation. + * (Sometimes called the salvage value of the asset) + * @param int $life Number of periods over which the asset is depreciated. + * (Sometimes called the useful life of the asset) + * @param int $period The period for which you want to calculate the + * depreciation. Period must use the same units as life. + * @param float $factor The rate at which the balance declines. + * If factor is omitted, it is assumed to be 2 (the + * double-declining balance method). + * + * @return float|string + */ + public static function DDB($cost, $salvage, $life, $period, $factor = 2.0) + { + $cost = Functions::flattenSingleValue($cost); + $salvage = Functions::flattenSingleValue($salvage); + $life = Functions::flattenSingleValue($life); + $period = Functions::flattenSingleValue($period); + $factor = Functions::flattenSingleValue($factor); + + // Validate + if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($factor))) { + $cost = (float) $cost; + $salvage = (float) $salvage; + $life = (int) $life; + $period = (int) $period; + $factor = (float) $factor; + if (($cost <= 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($factor <= 0.0) || ($period > $life)) { + return Functions::NAN(); + } + // Set Fixed Depreciation Rate + $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life)); + $fixedDepreciationRate = round($fixedDepreciationRate, 3); + + // Loop through each period calculating the depreciation + $previousDepreciation = 0; + for ($per = 1; $per <= $period; ++$per) { + $depreciation = min(($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation)); + $previousDepreciation += $depreciation; + } + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + $depreciation = round($depreciation, 2); + } + + return $depreciation; + } + + return Functions::VALUE(); + } + + /** + * DISC. + * + * Returns the discount rate for a security. + * + * Excel Function: + * DISC(settlement,maturity,price,redemption[,basis]) + * + * @category Financial Functions + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue + * date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int $price The security's price per $100 face value + * @param int $redemption The security's redemption value per $100 face value + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string + */ + public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $price = Functions::flattenSingleValue($price); + $redemption = Functions::flattenSingleValue($redemption); + $basis = Functions::flattenSingleValue($basis); + + // Validate + if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) { + $price = (float) $price; + $redemption = (float) $redemption; + $basis = (int) $basis; + if (($price <= 0) || ($redemption <= 0)) { + return Functions::NAN(); + } + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + + return (1 - $price / $redemption) / $daysBetweenSettlementAndMaturity; + } + + return Functions::VALUE(); + } + + /** + * DOLLARDE. + * + * Converts a dollar price expressed as an integer part and a fraction + * part into a dollar price expressed as a decimal number. + * Fractional dollar numbers are sometimes used for security prices. + * + * Excel Function: + * DOLLARDE(fractional_dollar,fraction) + * + * @category Financial Functions + * + * @param float $fractional_dollar Fractional Dollar + * @param int $fraction Fraction + * + * @return float|string + */ + public static function DOLLARDE($fractional_dollar = null, $fraction = 0) + { + $fractional_dollar = Functions::flattenSingleValue($fractional_dollar); + $fraction = (int) Functions::flattenSingleValue($fraction); + + // Validate parameters + if ($fractional_dollar === null || $fraction < 0) { + return Functions::NAN(); + } + if ($fraction == 0) { + return Functions::DIV0(); + } + + $dollars = floor($fractional_dollar); + $cents = fmod($fractional_dollar, 1); + $cents /= $fraction; + $cents *= pow(10, ceil(log10($fraction))); + + return $dollars + $cents; + } + + /** + * DOLLARFR. + * + * Converts a dollar price expressed as a decimal number into a dollar price + * expressed as a fraction. + * Fractional dollar numbers are sometimes used for security prices. + * + * Excel Function: + * DOLLARFR(decimal_dollar,fraction) + * + * @category Financial Functions + * + * @param float $decimal_dollar Decimal Dollar + * @param int $fraction Fraction + * + * @return float|string + */ + public static function DOLLARFR($decimal_dollar = null, $fraction = 0) + { + $decimal_dollar = Functions::flattenSingleValue($decimal_dollar); + $fraction = (int) Functions::flattenSingleValue($fraction); + + // Validate parameters + if ($decimal_dollar === null || $fraction < 0) { + return Functions::NAN(); + } + if ($fraction == 0) { + return Functions::DIV0(); + } + + $dollars = floor($decimal_dollar); + $cents = fmod($decimal_dollar, 1); + $cents *= $fraction; + $cents *= pow(10, -ceil(log10($fraction))); + + return $dollars + $cents; + } + + /** + * EFFECT. + * + * Returns the effective interest rate given the nominal rate and the number of + * compounding payments per year. + * + * Excel Function: + * EFFECT(nominal_rate,npery) + * + * @category Financial Functions + * + * @param float $nominal_rate Nominal interest rate + * @param int $npery Number of compounding payments per year + * + * @return float|string + */ + public static function EFFECT($nominal_rate = 0, $npery = 0) + { + $nominal_rate = Functions::flattenSingleValue($nominal_rate); + $npery = (int) Functions::flattenSingleValue($npery); + + // Validate parameters + if ($nominal_rate <= 0 || $npery < 1) { + return Functions::NAN(); + } + + return pow((1 + $nominal_rate / $npery), $npery) - 1; + } + + /** + * FV. + * + * Returns the Future Value of a cash flow with constant payments and interest rate (annuities). + * + * Excel Function: + * FV(rate,nper,pmt[,pv[,type]]) + * + * @category Financial Functions + * + * @param float $rate The interest rate per period + * @param int $nper Total number of payment periods in an annuity + * @param float $pmt The payment made each period: it cannot change over the + * life of the annuity. Typically, pmt contains principal + * and interest but no other fees or taxes. + * @param float $pv present Value, or the lump-sum amount that a series of + * future payments is worth right now + * @param int $type A number 0 or 1 and indicates when payments are due: + * 0 or omitted At the end of the period. + * 1 At the beginning of the period. + * + * @return float|string + */ + public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, $type = 0) + { + $rate = Functions::flattenSingleValue($rate); + $nper = Functions::flattenSingleValue($nper); + $pmt = Functions::flattenSingleValue($pmt); + $pv = Functions::flattenSingleValue($pv); + $type = Functions::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return Functions::NAN(); + } + + // Calculate + if ($rate !== null && $rate != 0) { + return -$pv * pow(1 + $rate, $nper) - $pmt * (1 + $rate * $type) * (pow(1 + $rate, $nper) - 1) / $rate; + } + + return -$pv - $pmt * $nper; + } + + /** + * FVSCHEDULE. + * + * Returns the future value of an initial principal after applying a series of compound interest rates. + * Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate. + * + * Excel Function: + * FVSCHEDULE(principal,schedule) + * + * @param float $principal the present value + * @param float[] $schedule an array of interest rates to apply + * + * @return float + */ + public static function FVSCHEDULE($principal, $schedule) + { + $principal = Functions::flattenSingleValue($principal); + $schedule = Functions::flattenArray($schedule); + + foreach ($schedule as $rate) { + $principal *= 1 + $rate; + } + + return $principal; + } + + /** + * INTRATE. + * + * Returns the interest rate for a fully invested security. + * + * Excel Function: + * INTRATE(settlement,maturity,investment,redemption[,basis]) + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int $investment the amount invested in the security + * @param int $redemption the amount to be received at maturity + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string + */ + public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $investment = Functions::flattenSingleValue($investment); + $redemption = Functions::flattenSingleValue($redemption); + $basis = Functions::flattenSingleValue($basis); + + // Validate + if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) { + $investment = (float) $investment; + $redemption = (float) $redemption; + $basis = (int) $basis; + if (($investment <= 0) || ($redemption <= 0)) { + return Functions::NAN(); + } + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + + return (($redemption / $investment) - 1) / ($daysBetweenSettlementAndMaturity); + } + + return Functions::VALUE(); + } + + /** + * IPMT. + * + * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. + * + * Excel Function: + * IPMT(rate,per,nper,pv[,fv][,type]) + * + * @param float $rate Interest rate per period + * @param int $per Period for which we want to find the interest + * @param int $nper Number of periods + * @param float $pv Present Value + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * + * @return float|string + */ + public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) + { + $rate = Functions::flattenSingleValue($rate); + $per = (int) Functions::flattenSingleValue($per); + $nper = (int) Functions::flattenSingleValue($nper); + $pv = Functions::flattenSingleValue($pv); + $fv = Functions::flattenSingleValue($fv); + $type = (int) Functions::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return Functions::NAN(); + } + if ($per <= 0 || $per > $nper) { + return Functions::VALUE(); + } + + // Calculate + $interestAndPrincipal = self::interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type); + + return $interestAndPrincipal[0]; + } + + /** + * IRR. + * + * Returns the internal rate of return for a series of cash flows represented by the numbers in values. + * These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur + * at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received + * for an investment consisting of payments (negative values) and income (positive values) that occur at regular + * periods. + * + * Excel Function: + * IRR(values[,guess]) + * + * @param float[] $values An array or a reference to cells that contain numbers for which you want + * to calculate the internal rate of return. + * Values must contain at least one positive value and one negative value to + * calculate the internal rate of return. + * @param float $guess A number that you guess is close to the result of IRR + * + * @return float|string + */ + public static function IRR($values, $guess = 0.1) + { + if (!is_array($values)) { + return Functions::VALUE(); + } + $values = Functions::flattenArray($values); + $guess = Functions::flattenSingleValue($guess); + + // create an initial range, with a root somewhere between 0 and guess + $x1 = 0.0; + $x2 = $guess; + $f1 = self::NPV($x1, $values); + $f2 = self::NPV($x2, $values); + for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { + if (($f1 * $f2) < 0.0) { + break; + } + if (abs($f1) < abs($f2)) { + $f1 = self::NPV($x1 += 1.6 * ($x1 - $x2), $values); + } else { + $f2 = self::NPV($x2 += 1.6 * ($x2 - $x1), $values); + } + } + if (($f1 * $f2) > 0.0) { + return Functions::VALUE(); + } + + $f = self::NPV($x1, $values); + if ($f < 0.0) { + $rtb = $x1; + $dx = $x2 - $x1; + } else { + $rtb = $x2; + $dx = $x1 - $x2; + } + + for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { + $dx *= 0.5; + $x_mid = $rtb + $dx; + $f_mid = self::NPV($x_mid, $values); + if ($f_mid <= 0.0) { + $rtb = $x_mid; + } + if ((abs($f_mid) < self::FINANCIAL_PRECISION) || (abs($dx) < self::FINANCIAL_PRECISION)) { + return $x_mid; + } + } + + return Functions::VALUE(); + } + + /** + * ISPMT. + * + * Returns the interest payment for an investment based on an interest rate and a constant payment schedule. + * + * Excel Function: + * =ISPMT(interest_rate, period, number_payments, PV) + * + * interest_rate is the interest rate for the investment + * + * period is the period to calculate the interest rate. It must be betweeen 1 and number_payments. + * + * number_payments is the number of payments for the annuity + * + * PV is the loan amount or present value of the payments + */ + public static function ISPMT(...$args) + { + // Return value + $returnValue = 0; + + // Get the parameters + $aArgs = Functions::flattenArray($args); + $interestRate = array_shift($aArgs); + $period = array_shift($aArgs); + $numberPeriods = array_shift($aArgs); + $principleRemaining = array_shift($aArgs); + + // Calculate + $principlePayment = ($principleRemaining * 1.0) / ($numberPeriods * 1.0); + for ($i = 0; $i <= $period; ++$i) { + $returnValue = $interestRate * $principleRemaining * -1; + $principleRemaining -= $principlePayment; + // principle needs to be 0 after the last payment, don't let floating point screw it up + if ($i == $numberPeriods) { + $returnValue = 0; + } + } + + return $returnValue; + } + + /** + * MIRR. + * + * Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both + * the cost of the investment and the interest received on reinvestment of cash. + * + * Excel Function: + * MIRR(values,finance_rate, reinvestment_rate) + * + * @param float[] $values An array or a reference to cells that contain a series of payments and + * income occurring at regular intervals. + * Payments are negative value, income is positive values. + * @param float $finance_rate The interest rate you pay on the money used in the cash flows + * @param float $reinvestment_rate The interest rate you receive on the cash flows as you reinvest them + * + * @return float|string Result, or a string containing an error + */ + public static function MIRR($values, $finance_rate, $reinvestment_rate) + { + if (!is_array($values)) { + return Functions::VALUE(); + } + $values = Functions::flattenArray($values); + $finance_rate = Functions::flattenSingleValue($finance_rate); + $reinvestment_rate = Functions::flattenSingleValue($reinvestment_rate); + $n = count($values); + + $rr = 1.0 + $reinvestment_rate; + $fr = 1.0 + $finance_rate; + + $npv_pos = $npv_neg = 0.0; + foreach ($values as $i => $v) { + if ($v >= 0) { + $npv_pos += $v / pow($rr, $i); + } else { + $npv_neg += $v / pow($fr, $i); + } + } + + if (($npv_neg == 0) || ($npv_pos == 0) || ($reinvestment_rate <= -1)) { + return Functions::VALUE(); + } + + $mirr = pow((-$npv_pos * pow($rr, $n)) + / ($npv_neg * ($rr)), (1.0 / ($n - 1))) - 1.0; + + return is_finite($mirr) ? $mirr : Functions::VALUE(); + } + + /** + * NOMINAL. + * + * Returns the nominal interest rate given the effective rate and the number of compounding payments per year. + * + * @param float $effect_rate Effective interest rate + * @param int $npery Number of compounding payments per year + * + * @return float|string Result, or a string containing an error + */ + public static function NOMINAL($effect_rate = 0, $npery = 0) + { + $effect_rate = Functions::flattenSingleValue($effect_rate); + $npery = (int) Functions::flattenSingleValue($npery); + + // Validate parameters + if ($effect_rate <= 0 || $npery < 1) { + return Functions::NAN(); + } + + // Calculate + return $npery * (pow($effect_rate + 1, 1 / $npery) - 1); + } + + /** + * NPER. + * + * Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate. + * + * @param float $rate Interest rate per period + * @param int $pmt Periodic payment (annuity) + * @param float $pv Present Value + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * + * @return float|string Result, or a string containing an error + */ + public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0) + { + $rate = Functions::flattenSingleValue($rate); + $pmt = Functions::flattenSingleValue($pmt); + $pv = Functions::flattenSingleValue($pv); + $fv = Functions::flattenSingleValue($fv); + $type = Functions::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return Functions::NAN(); + } + + // Calculate + if ($rate !== null && $rate != 0) { + if ($pmt == 0 && $pv == 0) { + return Functions::NAN(); + } + + return log(($pmt * (1 + $rate * $type) / $rate - $fv) / ($pv + $pmt * (1 + $rate * $type) / $rate)) / log(1 + $rate); + } + if ($pmt == 0) { + return Functions::NAN(); + } + + return (-$pv - $fv) / $pmt; + } + + /** + * NPV. + * + * Returns the Net Present Value of a cash flow series given a discount rate. + * + * @return float + */ + public static function NPV(...$args) + { + // Return value + $returnValue = 0; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + + // Calculate + $rate = array_shift($aArgs); + $countArgs = count($aArgs); + for ($i = 1; $i <= $countArgs; ++$i) { + // Is it a numeric value? + if (is_numeric($aArgs[$i - 1])) { + $returnValue += $aArgs[$i - 1] / pow(1 + $rate, $i); + } + } + + // Return + return $returnValue; + } + + /** + * PDURATION. + * + * Calculates the number of periods required for an investment to reach a specified value. + * + * @param float $rate Interest rate per period + * @param float $pv Present Value + * @param float $fv Future Value + * + * @return float|string Result, or a string containing an error + */ + public static function PDURATION($rate = 0, $pv = 0, $fv = 0) + { + $rate = Functions::flattenSingleValue($rate); + $pv = Functions::flattenSingleValue($pv); + $fv = Functions::flattenSingleValue($fv); + + // Validate parameters + if (!is_numeric($rate) || !is_numeric($pv) || !is_numeric($fv)) { + return Functions::VALUE(); + } elseif ($rate <= 0.0 || $pv <= 0.0 || $fv <= 0.0) { + return Functions::NAN(); + } + + return (log($fv) - log($pv)) / log(1 + $rate); + } + + /** + * PMT. + * + * Returns the constant payment (annuity) for a cash flow with a constant interest rate. + * + * @param float $rate Interest rate per period + * @param int $nper Number of periods + * @param float $pv Present Value + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * + * @return float|string Result, or a string containing an error + */ + public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0) + { + $rate = Functions::flattenSingleValue($rate); + $nper = Functions::flattenSingleValue($nper); + $pv = Functions::flattenSingleValue($pv); + $fv = Functions::flattenSingleValue($fv); + $type = Functions::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return Functions::NAN(); + } + + // Calculate + if ($rate !== null && $rate != 0) { + return (-$fv - $pv * pow(1 + $rate, $nper)) / (1 + $rate * $type) / ((pow(1 + $rate, $nper) - 1) / $rate); + } + + return (-$pv - $fv) / $nper; + } + + /** + * PPMT. + * + * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. + * + * @param float $rate Interest rate per period + * @param int $per Period for which we want to find the interest + * @param int $nper Number of periods + * @param float $pv Present Value + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * + * @return float|string Result, or a string containing an error + */ + public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) + { + $rate = Functions::flattenSingleValue($rate); + $per = (int) Functions::flattenSingleValue($per); + $nper = (int) Functions::flattenSingleValue($nper); + $pv = Functions::flattenSingleValue($pv); + $fv = Functions::flattenSingleValue($fv); + $type = (int) Functions::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return Functions::NAN(); + } + if ($per <= 0 || $per > $nper) { + return Functions::VALUE(); + } + + // Calculate + $interestAndPrincipal = self::interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type); + + return $interestAndPrincipal[1]; + } + + public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $rate = (float) Functions::flattenSingleValue($rate); + $yield = (float) Functions::flattenSingleValue($yield); + $redemption = (float) Functions::flattenSingleValue($redemption); + $frequency = (int) Functions::flattenSingleValue($frequency); + $basis = ($basis === null) ? 0 : (int) Functions::flattenSingleValue($basis); + + if (is_string($settlement = DateTime::getDateValue($settlement))) { + return Functions::VALUE(); + } + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + if (($settlement > $maturity) || + (!self::isValidFrequency($frequency)) || + (($basis < 0) || ($basis > 4))) { + return Functions::NAN(); + } + + $dsc = self::COUPDAYSNC($settlement, $maturity, $frequency, $basis); + $e = self::COUPDAYS($settlement, $maturity, $frequency, $basis); + $n = self::COUPNUM($settlement, $maturity, $frequency, $basis); + $a = self::COUPDAYBS($settlement, $maturity, $frequency, $basis); + + $baseYF = 1.0 + ($yield / $frequency); + $rfp = 100 * ($rate / $frequency); + $de = $dsc / $e; + + $result = $redemption / pow($baseYF, (--$n + $de)); + for ($k = 0; $k <= $n; ++$k) { + $result += $rfp / (pow($baseYF, ($k + $de))); + } + $result -= $rfp * ($a / $e); + + return $result; + } + + /** + * PRICEDISC. + * + * Returns the price per $100 face value of a discounted security. + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int $discount The security's discount rate + * @param int $redemption The security's redemption value per $100 face value + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string Result, or a string containing an error + */ + public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $discount = (float) Functions::flattenSingleValue($discount); + $redemption = (float) Functions::flattenSingleValue($redemption); + $basis = (int) Functions::flattenSingleValue($basis); + + // Validate + if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) { + if (($discount <= 0) || ($redemption <= 0)) { + return Functions::NAN(); + } + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + + return $redemption * (1 - $discount * $daysBetweenSettlementAndMaturity); + } + + return Functions::VALUE(); + } + + /** + * PRICEMAT. + * + * Returns the price per $100 face value of a security that pays interest at maturity. + * + * @param mixed $settlement The security's settlement date. + * The security's settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed $issue The security's issue date + * @param int $rate The security's interest rate at date of issue + * @param int $yield The security's annual yield + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string Result, or a string containing an error + */ + public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $issue = Functions::flattenSingleValue($issue); + $rate = Functions::flattenSingleValue($rate); + $yield = Functions::flattenSingleValue($yield); + $basis = (int) Functions::flattenSingleValue($basis); + + // Validate + if (is_numeric($rate) && is_numeric($yield)) { + if (($rate <= 0) || ($yield <= 0)) { + return Functions::NAN(); + } + $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis); + if (!is_numeric($daysPerYear)) { + return $daysPerYear; + } + $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis); + if (!is_numeric($daysBetweenIssueAndSettlement)) { + // return date error + return $daysBetweenIssueAndSettlement; + } + $daysBetweenIssueAndSettlement *= $daysPerYear; + $daysBetweenIssueAndMaturity = DateTime::YEARFRAC($issue, $maturity, $basis); + if (!is_numeric($daysBetweenIssueAndMaturity)) { + // return date error + return $daysBetweenIssueAndMaturity; + } + $daysBetweenIssueAndMaturity *= $daysPerYear; + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + $daysBetweenSettlementAndMaturity *= $daysPerYear; + + return (100 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate * 100)) / + (1 + (($daysBetweenSettlementAndMaturity / $daysPerYear) * $yield)) - + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate * 100); + } + + return Functions::VALUE(); + } + + /** + * PV. + * + * Returns the Present Value of a cash flow with constant payments and interest rate (annuities). + * + * @param float $rate Interest rate per period + * @param int $nper Number of periods + * @param float $pmt Periodic payment (annuity) + * @param float $fv Future Value + * @param int $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period + * + * @return float|string Result, or a string containing an error + */ + public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, $type = 0) + { + $rate = Functions::flattenSingleValue($rate); + $nper = Functions::flattenSingleValue($nper); + $pmt = Functions::flattenSingleValue($pmt); + $fv = Functions::flattenSingleValue($fv); + $type = Functions::flattenSingleValue($type); + + // Validate parameters + if ($type != 0 && $type != 1) { + return Functions::NAN(); + } + + // Calculate + if ($rate !== null && $rate != 0) { + return (-$pmt * (1 + $rate * $type) * ((pow(1 + $rate, $nper) - 1) / $rate) - $fv) / pow(1 + $rate, $nper); + } + + return -$fv - $pmt * $nper; + } + + /** + * RATE. + * + * Returns the interest rate per period of an annuity. + * RATE is calculated by iteration and can have zero or more solutions. + * If the successive results of RATE do not converge to within 0.0000001 after 20 iterations, + * RATE returns the #NUM! error value. + * + * Excel Function: + * RATE(nper,pmt,pv[,fv[,type[,guess]]]) + * + * @category Financial Functions + * + * @param float $nper The total number of payment periods in an annuity + * @param float $pmt The payment made each period and cannot change over the life + * of the annuity. + * Typically, pmt includes principal and interest but no other + * fees or taxes. + * @param float $pv The present value - the total amount that a series of future + * payments is worth now + * @param float $fv The future value, or a cash balance you want to attain after + * the last payment is made. If fv is omitted, it is assumed + * to be 0 (the future value of a loan, for example, is 0). + * @param int $type A number 0 or 1 and indicates when payments are due: + * 0 or omitted At the end of the period. + * 1 At the beginning of the period. + * @param float $guess Your guess for what the rate will be. + * If you omit guess, it is assumed to be 10 percent. + * + * @return float + */ + public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1) + { + $nper = (int) Functions::flattenSingleValue($nper); + $pmt = Functions::flattenSingleValue($pmt); + $pv = Functions::flattenSingleValue($pv); + $fv = ($fv === null) ? 0.0 : Functions::flattenSingleValue($fv); + $type = ($type === null) ? 0 : (int) Functions::flattenSingleValue($type); + $guess = ($guess === null) ? 0.1 : Functions::flattenSingleValue($guess); + + $rate = $guess; + if (abs($rate) < self::FINANCIAL_PRECISION) { + $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv; + } else { + $f = exp($nper * log(1 + $rate)); + $y = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv; + } + $y0 = $pv + $pmt * $nper + $fv; + $y1 = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv; + + // find root by secant method + $i = $x0 = 0.0; + $x1 = $rate; + while ((abs($y0 - $y1) > self::FINANCIAL_PRECISION) && ($i < self::FINANCIAL_MAX_ITERATIONS)) { + $rate = ($y1 * $x0 - $y0 * $x1) / ($y1 - $y0); + $x0 = $x1; + $x1 = $rate; + if (($nper * abs($pmt)) > ($pv - $fv)) { + $x1 = abs($x1); + } + if (abs($rate) < self::FINANCIAL_PRECISION) { + $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv; + } else { + $f = exp($nper * log(1 + $rate)); + $y = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv; + } + + $y0 = $y1; + $y1 = $y; + ++$i; + } + + return $rate; + } + + /** + * RECEIVED. + * + * Returns the price per $100 face value of a discounted security. + * + * @param mixed $settlement The security's settlement date. + * The security settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int $investment The amount invested in the security + * @param int $discount The security's discount rate + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string Result, or a string containing an error + */ + public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $investment = (float) Functions::flattenSingleValue($investment); + $discount = (float) Functions::flattenSingleValue($discount); + $basis = (int) Functions::flattenSingleValue($basis); + + // Validate + if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) { + if (($investment <= 0) || ($discount <= 0)) { + return Functions::NAN(); + } + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + + return $investment / (1 - ($discount * $daysBetweenSettlementAndMaturity)); + } + + return Functions::VALUE(); + } + + /** + * RRI. + * + * Calculates the interest rate required for an investment to grow to a specified future value . + * + * @param float $nper The number of periods over which the investment is made + * @param float $pv Present Value + * @param float $fv Future Value + * + * @return float|string Result, or a string containing an error + */ + public static function RRI($nper = 0, $pv = 0, $fv = 0) + { + $nper = Functions::flattenSingleValue($nper); + $pv = Functions::flattenSingleValue($pv); + $fv = Functions::flattenSingleValue($fv); + + // Validate parameters + if (!is_numeric($nper) || !is_numeric($pv) || !is_numeric($fv)) { + return Functions::VALUE(); + } elseif ($nper <= 0.0 || $pv <= 0.0 || $fv < 0.0) { + return Functions::NAN(); + } + + return pow($fv / $pv, 1 / $nper) - 1; + } + + /** + * SLN. + * + * Returns the straight-line depreciation of an asset for one period + * + * @param mixed $cost Initial cost of the asset + * @param mixed $salvage Value at the end of the depreciation + * @param mixed $life Number of periods over which the asset is depreciated + * + * @return float|string Result, or a string containing an error + */ + public static function SLN($cost, $salvage, $life) + { + $cost = Functions::flattenSingleValue($cost); + $salvage = Functions::flattenSingleValue($salvage); + $life = Functions::flattenSingleValue($life); + + // Calculate + if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) { + if ($life < 0) { + return Functions::NAN(); + } + + return ($cost - $salvage) / $life; + } + + return Functions::VALUE(); + } + + /** + * SYD. + * + * Returns the sum-of-years' digits depreciation of an asset for a specified period. + * + * @param mixed $cost Initial cost of the asset + * @param mixed $salvage Value at the end of the depreciation + * @param mixed $life Number of periods over which the asset is depreciated + * @param mixed $period Period + * + * @return float|string Result, or a string containing an error + */ + public static function SYD($cost, $salvage, $life, $period) + { + $cost = Functions::flattenSingleValue($cost); + $salvage = Functions::flattenSingleValue($salvage); + $life = Functions::flattenSingleValue($life); + $period = Functions::flattenSingleValue($period); + + // Calculate + if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) { + if (($life < 1) || ($period > $life)) { + return Functions::NAN(); + } + + return (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1)); + } + + return Functions::VALUE(); + } + + /** + * TBILLEQ. + * + * Returns the bond-equivalent yield for a Treasury bill. + * + * @param mixed $settlement The Treasury bill's settlement date. + * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. + * @param mixed $maturity The Treasury bill's maturity date. + * The maturity date is the date when the Treasury bill expires. + * @param int $discount The Treasury bill's discount rate + * + * @return float|string Result, or a string containing an error + */ + public static function TBILLEQ($settlement, $maturity, $discount) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $discount = Functions::flattenSingleValue($discount); + + // Use TBILLPRICE for validation + $testValue = self::TBILLPRICE($settlement, $maturity, $discount); + if (is_string($testValue)) { + return $testValue; + } + + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + ++$maturity; + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity) * 360; + } else { + $daysBetweenSettlementAndMaturity = (DateTime::getDateValue($maturity) - DateTime::getDateValue($settlement)); + } + + return (365 * $discount) / (360 - $discount * $daysBetweenSettlementAndMaturity); + } + + /** + * TBILLPRICE. + * + * Returns the yield for a Treasury bill. + * + * @param mixed $settlement The Treasury bill's settlement date. + * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. + * @param mixed $maturity The Treasury bill's maturity date. + * The maturity date is the date when the Treasury bill expires. + * @param int $discount The Treasury bill's discount rate + * + * @return float|string Result, or a string containing an error + */ + public static function TBILLPRICE($settlement, $maturity, $discount) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $discount = Functions::flattenSingleValue($discount); + + if (is_string($maturity = DateTime::getDateValue($maturity))) { + return Functions::VALUE(); + } + + // Validate + if (is_numeric($discount)) { + if ($discount <= 0) { + return Functions::NAN(); + } + + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + ++$maturity; + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity) * 360; + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + } else { + $daysBetweenSettlementAndMaturity = (DateTime::getDateValue($maturity) - DateTime::getDateValue($settlement)); + } + + if ($daysBetweenSettlementAndMaturity > 360) { + return Functions::NAN(); + } + + $price = 100 * (1 - (($discount * $daysBetweenSettlementAndMaturity) / 360)); + if ($price <= 0) { + return Functions::NAN(); + } + + return $price; + } + + return Functions::VALUE(); + } + + /** + * TBILLYIELD. + * + * Returns the yield for a Treasury bill. + * + * @param mixed $settlement The Treasury bill's settlement date. + * The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer. + * @param mixed $maturity The Treasury bill's maturity date. + * The maturity date is the date when the Treasury bill expires. + * @param int $price The Treasury bill's price per $100 face value + * + * @return float|mixed|string + */ + public static function TBILLYIELD($settlement, $maturity, $price) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $price = Functions::flattenSingleValue($price); + + // Validate + if (is_numeric($price)) { + if ($price <= 0) { + return Functions::NAN(); + } + + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { + ++$maturity; + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity) * 360; + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + } else { + $daysBetweenSettlementAndMaturity = (DateTime::getDateValue($maturity) - DateTime::getDateValue($settlement)); + } + + if ($daysBetweenSettlementAndMaturity > 360) { + return Functions::NAN(); + } + + return ((100 - $price) / $price) * (360 / $daysBetweenSettlementAndMaturity); + } + + return Functions::VALUE(); + } + + /** + * XIRR. + * + * Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic. + * + * Excel Function: + * =XIRR(values,dates,guess) + * + * @param float[] $values A series of cash flow payments + * The series of values must contain at least one positive value & one negative value + * @param mixed[] $dates A series of payment dates + * The first payment date indicates the beginning of the schedule of payments + * All other dates must be later than this date, but they may occur in any order + * @param float $guess An optional guess at the expected answer + * + * @return float|mixed|string + */ + public static function XIRR($values, $dates, $guess = 0.1) + { + if ((!is_array($values)) && (!is_array($dates))) { + return Functions::VALUE(); + } + $values = Functions::flattenArray($values); + $dates = Functions::flattenArray($dates); + $guess = Functions::flattenSingleValue($guess); + if (count($values) != count($dates)) { + return Functions::NAN(); + } + + $datesCount = count($dates); + for ($i = 0; $i < $datesCount; ++$i) { + $dates[$i] = DateTime::getDateValue($dates[$i]); + if (!is_numeric($dates[$i])) { + return Functions::VALUE(); + } + } + if (min($dates) != $dates[0]) { + return Functions::NAN(); + } + + // create an initial range, with a root somewhere between 0 and guess + $x1 = 0.0; + $x2 = $guess; + $f1 = self::XNPV($x1, $values, $dates); + if (!is_numeric($f1)) { + return $f1; + } + $f2 = self::XNPV($x2, $values, $dates); + if (!is_numeric($f2)) { + return $f2; + } + for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { + if (($f1 * $f2) < 0.0) { + break; + } elseif (abs($f1) < abs($f2)) { + $f1 = self::XNPV($x1 += 1.6 * ($x1 - $x2), $values, $dates); + } else { + $f2 = self::XNPV($x2 += 1.6 * ($x2 - $x1), $values, $dates); + } + } + if (($f1 * $f2) > 0.0) { + return Functions::NAN(); + } + + $f = self::XNPV($x1, $values, $dates); + if ($f < 0.0) { + $rtb = $x1; + $dx = $x2 - $x1; + } else { + $rtb = $x2; + $dx = $x1 - $x2; + } + + for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { + $dx *= 0.5; + $x_mid = $rtb + $dx; + $f_mid = self::XNPV($x_mid, $values, $dates); + if ($f_mid <= 0.0) { + $rtb = $x_mid; + } + if ((abs($f_mid) < self::FINANCIAL_PRECISION) || (abs($dx) < self::FINANCIAL_PRECISION)) { + return $x_mid; + } + } + + return Functions::VALUE(); + } + + /** + * XNPV. + * + * Returns the net present value for a schedule of cash flows that is not necessarily periodic. + * To calculate the net present value for a series of cash flows that is periodic, use the NPV function. + * + * Excel Function: + * =XNPV(rate,values,dates) + * + * @param float $rate the discount rate to apply to the cash flows + * @param float[] $values A series of cash flows that corresponds to a schedule of payments in dates. + * The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment. + * If the first value is a cost or payment, it must be a negative value. All succeeding payments are discounted based on a 365-day year. + * The series of values must contain at least one positive value and one negative value. + * @param mixed[] $dates A schedule of payment dates that corresponds to the cash flow payments. + * The first payment date indicates the beginning of the schedule of payments. + * All other dates must be later than this date, but they may occur in any order. + * + * @return float|mixed|string + */ + public static function XNPV($rate, $values, $dates) + { + $rate = Functions::flattenSingleValue($rate); + if (!is_numeric($rate)) { + return Functions::VALUE(); + } + if ((!is_array($values)) || (!is_array($dates))) { + return Functions::VALUE(); + } + $values = Functions::flattenArray($values); + $dates = Functions::flattenArray($dates); + $valCount = count($values); + if ($valCount != count($dates)) { + return Functions::NAN(); + } + if ((min($values) > 0) || (max($values) < 0)) { + return Functions::NAN(); + } + + $xnpv = 0.0; + for ($i = 0; $i < $valCount; ++$i) { + if (!is_numeric($values[$i])) { + return Functions::VALUE(); + } + $xnpv += $values[$i] / pow(1 + $rate, DateTime::DATEDIF($dates[0], $dates[$i], 'd') / 365); + } + + return (is_finite($xnpv)) ? $xnpv : Functions::VALUE(); + } + + /** + * YIELDDISC. + * + * Returns the annual yield of a security that pays interest at maturity. + * + * @param mixed $settlement The security's settlement date. + * The security's settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param int $price The security's price per $100 face value + * @param int $redemption The security's redemption value per $100 face value + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string Result, or a string containing an error + */ + public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $price = Functions::flattenSingleValue($price); + $redemption = Functions::flattenSingleValue($redemption); + $basis = (int) Functions::flattenSingleValue($basis); + + // Validate + if (is_numeric($price) && is_numeric($redemption)) { + if (($price <= 0) || ($redemption <= 0)) { + return Functions::NAN(); + } + $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis); + if (!is_numeric($daysPerYear)) { + return $daysPerYear; + } + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + $daysBetweenSettlementAndMaturity *= $daysPerYear; + + return (($redemption - $price) / $price) * ($daysPerYear / $daysBetweenSettlementAndMaturity); + } + + return Functions::VALUE(); + } + + /** + * YIELDMAT. + * + * Returns the annual yield of a security that pays interest at maturity. + * + * @param mixed $settlement The security's settlement date. + * The security's settlement date is the date after the issue date when the security is traded to the buyer. + * @param mixed $maturity The security's maturity date. + * The maturity date is the date when the security expires. + * @param mixed $issue The security's issue date + * @param int $rate The security's interest rate at date of issue + * @param int $price The security's price per $100 face value + * @param int $basis The type of day count to use. + * 0 or omitted US (NASD) 30/360 + * 1 Actual/actual + * 2 Actual/360 + * 3 Actual/365 + * 4 European 30/360 + * + * @return float|string Result, or a string containing an error + */ + public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0) + { + $settlement = Functions::flattenSingleValue($settlement); + $maturity = Functions::flattenSingleValue($maturity); + $issue = Functions::flattenSingleValue($issue); + $rate = Functions::flattenSingleValue($rate); + $price = Functions::flattenSingleValue($price); + $basis = (int) Functions::flattenSingleValue($basis); + + // Validate + if (is_numeric($rate) && is_numeric($price)) { + if (($rate <= 0) || ($price <= 0)) { + return Functions::NAN(); + } + $daysPerYear = self::daysPerYear(DateTime::YEAR($settlement), $basis); + if (!is_numeric($daysPerYear)) { + return $daysPerYear; + } + $daysBetweenIssueAndSettlement = DateTime::YEARFRAC($issue, $settlement, $basis); + if (!is_numeric($daysBetweenIssueAndSettlement)) { + // return date error + return $daysBetweenIssueAndSettlement; + } + $daysBetweenIssueAndSettlement *= $daysPerYear; + $daysBetweenIssueAndMaturity = DateTime::YEARFRAC($issue, $maturity, $basis); + if (!is_numeric($daysBetweenIssueAndMaturity)) { + // return date error + return $daysBetweenIssueAndMaturity; + } + $daysBetweenIssueAndMaturity *= $daysPerYear; + $daysBetweenSettlementAndMaturity = DateTime::YEARFRAC($settlement, $maturity, $basis); + if (!is_numeric($daysBetweenSettlementAndMaturity)) { + // return date error + return $daysBetweenSettlementAndMaturity; + } + $daysBetweenSettlementAndMaturity *= $daysPerYear; + + return ((1 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate) - (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) / + (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) * + ($daysPerYear / $daysBetweenSettlementAndMaturity); + } + + return Functions::VALUE(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaParser.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaParser.php new file mode 100644 index 0000000..9b3c66e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaParser.php @@ -0,0 +1,623 @@ +<'; + const OPERATORS_POSTFIX = '%'; + + /** + * Formula. + * + * @var string + */ + private $formula; + + /** + * Tokens. + * + * @var FormulaToken[] + */ + private $tokens = []; + + /** + * Create a new FormulaParser. + * + * @param string $pFormula Formula to parse + * + * @throws Exception + */ + public function __construct($pFormula = '') + { + // Check parameters + if ($pFormula === null) { + throw new Exception('Invalid parameter passed: formula'); + } + + // Initialise values + $this->formula = trim($pFormula); + // Parse! + $this->parseToTokens(); + } + + /** + * Get Formula. + * + * @return string + */ + public function getFormula() + { + return $this->formula; + } + + /** + * Get Token. + * + * @param int $pId Token id + * + * @throws Exception + * + * @return string + */ + public function getToken($pId = 0) + { + if (isset($this->tokens[$pId])) { + return $this->tokens[$pId]; + } + + throw new Exception("Token with id $pId does not exist."); + } + + /** + * Get Token count. + * + * @return int + */ + public function getTokenCount() + { + return count($this->tokens); + } + + /** + * Get Tokens. + * + * @return FormulaToken[] + */ + public function getTokens() + { + return $this->tokens; + } + + /** + * Parse to tokens. + */ + private function parseToTokens() + { + // No attempt is made to verify formulas; assumes formulas are derived from Excel, where + // they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions. + + // Check if the formula has a valid starting = + $formulaLength = strlen($this->formula); + if ($formulaLength < 2 || $this->formula[0] != '=') { + return; + } + + // Helper variables + $tokens1 = $tokens2 = $stack = []; + $inString = $inPath = $inRange = $inError = false; + $token = $previousToken = $nextToken = null; + + $index = 1; + $value = ''; + + $ERRORS = ['#NULL!', '#DIV/0!', '#VALUE!', '#REF!', '#NAME?', '#NUM!', '#N/A']; + $COMPARATORS_MULTI = ['>=', '<=', '<>']; + + while ($index < $formulaLength) { + // state-dependent character evaluation (order is important) + + // double-quoted strings + // embeds are doubled + // end marks token + if ($inString) { + if ($this->formula[$index] == self::QUOTE_DOUBLE) { + if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == self::QUOTE_DOUBLE)) { + $value .= self::QUOTE_DOUBLE; + ++$index; + } else { + $inString = false; + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND, FormulaToken::TOKEN_SUBTYPE_TEXT); + $value = ''; + } + } else { + $value .= $this->formula[$index]; + } + ++$index; + + continue; + } + + // single-quoted strings (links) + // embeds are double + // end does not mark a token + if ($inPath) { + if ($this->formula[$index] == self::QUOTE_SINGLE) { + if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == self::QUOTE_SINGLE)) { + $value .= self::QUOTE_SINGLE; + ++$index; + } else { + $inPath = false; + } + } else { + $value .= $this->formula[$index]; + } + ++$index; + + continue; + } + + // bracked strings (R1C1 range index or linked workbook name) + // no embeds (changed to "()" by Excel) + // end does not mark a token + if ($inRange) { + if ($this->formula[$index] == self::BRACKET_CLOSE) { + $inRange = false; + } + $value .= $this->formula[$index]; + ++$index; + + continue; + } + + // error values + // end marks a token, determined from absolute list of values + if ($inError) { + $value .= $this->formula[$index]; + ++$index; + if (in_array($value, $ERRORS)) { + $inError = false; + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND, FormulaToken::TOKEN_SUBTYPE_ERROR); + $value = ''; + } + + continue; + } + + // scientific notation check + if (strpos(self::OPERATORS_SN, $this->formula[$index]) !== false) { + if (strlen($value) > 1) { + if (preg_match('/^[1-9]{1}(\\.\\d+)?E{1}$/', $this->formula[$index]) != 0) { + $value .= $this->formula[$index]; + ++$index; + + continue; + } + } + } + + // independent character evaluation (order not important) + + // establish state-dependent character evaluations + if ($this->formula[$index] == self::QUOTE_DOUBLE) { + if (strlen($value) > 0) { + // unexpected + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN); + $value = ''; + } + $inString = true; + ++$index; + + continue; + } + + if ($this->formula[$index] == self::QUOTE_SINGLE) { + if (strlen($value) > 0) { + // unexpected + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN); + $value = ''; + } + $inPath = true; + ++$index; + + continue; + } + + if ($this->formula[$index] == self::BRACKET_OPEN) { + $inRange = true; + $value .= self::BRACKET_OPEN; + ++$index; + + continue; + } + + if ($this->formula[$index] == self::ERROR_START) { + if (strlen($value) > 0) { + // unexpected + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN); + $value = ''; + } + $inError = true; + $value .= self::ERROR_START; + ++$index; + + continue; + } + + // mark start and end of arrays and array rows + if ($this->formula[$index] == self::BRACE_OPEN) { + if (strlen($value) > 0) { + // unexpected + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_UNKNOWN); + $value = ''; + } + + $tmp = new FormulaToken('ARRAY', FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + + $tmp = new FormulaToken('ARRAYROW', FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + + ++$index; + + continue; + } + + if ($this->formula[$index] == self::SEMICOLON) { + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + $value = ''; + } + + $tmp = array_pop($stack); + $tmp->setValue(''); + $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP); + $tokens1[] = $tmp; + + $tmp = new FormulaToken(',', FormulaToken::TOKEN_TYPE_ARGUMENT); + $tokens1[] = $tmp; + + $tmp = new FormulaToken('ARRAYROW', FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + + ++$index; + + continue; + } + + if ($this->formula[$index] == self::BRACE_CLOSE) { + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + $value = ''; + } + + $tmp = array_pop($stack); + $tmp->setValue(''); + $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP); + $tokens1[] = $tmp; + + $tmp = array_pop($stack); + $tmp->setValue(''); + $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP); + $tokens1[] = $tmp; + + ++$index; + + continue; + } + + // trim white-space + if ($this->formula[$index] == self::WHITESPACE) { + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + $value = ''; + } + $tokens1[] = new FormulaToken('', FormulaToken::TOKEN_TYPE_WHITESPACE); + ++$index; + while (($this->formula[$index] == self::WHITESPACE) && ($index < $formulaLength)) { + ++$index; + } + + continue; + } + + // multi-character comparators + if (($index + 2) <= $formulaLength) { + if (in_array(substr($this->formula, $index, 2), $COMPARATORS_MULTI)) { + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + $value = ''; + } + $tokens1[] = new FormulaToken(substr($this->formula, $index, 2), FormulaToken::TOKEN_TYPE_OPERATORINFIX, FormulaToken::TOKEN_SUBTYPE_LOGICAL); + $index += 2; + + continue; + } + } + + // standard infix operators + if (strpos(self::OPERATORS_INFIX, $this->formula[$index]) !== false) { + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + $value = ''; + } + $tokens1[] = new FormulaToken($this->formula[$index], FormulaToken::TOKEN_TYPE_OPERATORINFIX); + ++$index; + + continue; + } + + // standard postfix operators (only one) + if (strpos(self::OPERATORS_POSTFIX, $this->formula[$index]) !== false) { + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + $value = ''; + } + $tokens1[] = new FormulaToken($this->formula[$index], FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX); + ++$index; + + continue; + } + + // start subexpression or function + if ($this->formula[$index] == self::PAREN_OPEN) { + if (strlen($value) > 0) { + $tmp = new FormulaToken($value, FormulaToken::TOKEN_TYPE_FUNCTION, FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + $value = ''; + } else { + $tmp = new FormulaToken('', FormulaToken::TOKEN_TYPE_SUBEXPRESSION, FormulaToken::TOKEN_SUBTYPE_START); + $tokens1[] = $tmp; + $stack[] = clone $tmp; + } + ++$index; + + continue; + } + + // function, subexpression, or array parameters, or operand unions + if ($this->formula[$index] == self::COMMA) { + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + $value = ''; + } + + $tmp = array_pop($stack); + $tmp->setValue(''); + $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP); + $stack[] = $tmp; + + if ($tmp->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) { + $tokens1[] = new FormulaToken(',', FormulaToken::TOKEN_TYPE_OPERATORINFIX, FormulaToken::TOKEN_SUBTYPE_UNION); + } else { + $tokens1[] = new FormulaToken(',', FormulaToken::TOKEN_TYPE_ARGUMENT); + } + ++$index; + + continue; + } + + // stop subexpression + if ($this->formula[$index] == self::PAREN_CLOSE) { + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + $value = ''; + } + + $tmp = array_pop($stack); + $tmp->setValue(''); + $tmp->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_STOP); + $tokens1[] = $tmp; + + ++$index; + + continue; + } + + // token accumulation + $value .= $this->formula[$index]; + ++$index; + } + + // dump remaining accumulation + if (strlen($value) > 0) { + $tokens1[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERAND); + } + + // move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections + $tokenCount = count($tokens1); + for ($i = 0; $i < $tokenCount; ++$i) { + $token = $tokens1[$i]; + if (isset($tokens1[$i - 1])) { + $previousToken = $tokens1[$i - 1]; + } else { + $previousToken = null; + } + if (isset($tokens1[$i + 1])) { + $nextToken = $tokens1[$i + 1]; + } else { + $nextToken = null; + } + + if ($token === null) { + continue; + } + + if ($token->getTokenType() != FormulaToken::TOKEN_TYPE_WHITESPACE) { + $tokens2[] = $token; + + continue; + } + + if ($previousToken === null) { + continue; + } + + if (!( + (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) + )) { + continue; + } + + if ($nextToken === null) { + continue; + } + + if (!( + (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) || + (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) || + ($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) + )) { + continue; + } + + $tokens2[] = new FormulaToken($value, FormulaToken::TOKEN_TYPE_OPERATORINFIX, FormulaToken::TOKEN_SUBTYPE_INTERSECTION); + } + + // move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators + // to noop when appropriate, identifying operand and infix-operator subtypes, and pulling "@" from function names + $this->tokens = []; + + $tokenCount = count($tokens2); + for ($i = 0; $i < $tokenCount; ++$i) { + $token = $tokens2[$i]; + if (isset($tokens2[$i - 1])) { + $previousToken = $tokens2[$i - 1]; + } else { + $previousToken = null; + } + if (isset($tokens2[$i + 1])) { + $nextToken = $tokens2[$i + 1]; + } else { + $nextToken = null; + } + + if ($token === null) { + continue; + } + + if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == '-') { + if ($i == 0) { + $token->setTokenType(FormulaToken::TOKEN_TYPE_OPERATORPREFIX); + } elseif ((($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && + ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && + ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || + ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)) { + $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH); + } else { + $token->setTokenType(FormulaToken::TOKEN_TYPE_OPERATORPREFIX); + } + + $this->tokens[] = $token; + + continue; + } + + if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == '+') { + if ($i == 0) { + continue; + } elseif ((($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && + ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || + (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && + ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || + ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) || + ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND)) { + $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH); + } else { + continue; + } + + $this->tokens[] = $token; + + continue; + } + + if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORINFIX && + $token->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_NOTHING) { + if (strpos('<>=', substr($token->getValue(), 0, 1)) !== false) { + $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_LOGICAL); + } elseif ($token->getValue() == '&') { + $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_CONCATENATION); + } else { + $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH); + } + + $this->tokens[] = $token; + + continue; + } + + if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND && + $token->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_NOTHING) { + if (!is_numeric($token->getValue())) { + if (strtoupper($token->getValue()) == 'TRUE' || strtoupper($token->getValue()) == 'FALSE') { + $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_LOGICAL); + } else { + $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_RANGE); + } + } else { + $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_NUMBER); + } + + $this->tokens[] = $token; + + continue; + } + + if ($token->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) { + if (strlen($token->getValue()) > 0) { + if (substr($token->getValue(), 0, 1) == '@') { + $token->setValue(substr($token->getValue(), 1)); + } + } + } + + $this->tokens[] = $token; + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaToken.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaToken.php new file mode 100644 index 0000000..66618d4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/FormulaToken.php @@ -0,0 +1,150 @@ +value = $pValue; + $this->tokenType = $pTokenType; + $this->tokenSubType = $pTokenSubType; + } + + /** + * Get Value. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Set Value. + * + * @param string $value + */ + public function setValue($value) + { + $this->value = $value; + } + + /** + * Get Token Type (represented by TOKEN_TYPE_*). + * + * @return string + */ + public function getTokenType() + { + return $this->tokenType; + } + + /** + * Set Token Type (represented by TOKEN_TYPE_*). + * + * @param string $value + */ + public function setTokenType($value) + { + $this->tokenType = $value; + } + + /** + * Get Token SubType (represented by TOKEN_SUBTYPE_*). + * + * @return string + */ + public function getTokenSubType() + { + return $this->tokenSubType; + } + + /** + * Set Token SubType (represented by TOKEN_SUBTYPE_*). + * + * @param string $value + */ + public function setTokenSubType($value) + { + $this->tokenSubType = $value; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php new file mode 100644 index 0000000..bb2170b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Functions.php @@ -0,0 +1,680 @@ + '#NULL!', + 'divisionbyzero' => '#DIV/0!', + 'value' => '#VALUE!', + 'reference' => '#REF!', + 'name' => '#NAME?', + 'num' => '#NUM!', + 'na' => '#N/A', + 'gettingdata' => '#GETTING_DATA', + ]; + + /** + * Set the Compatibility Mode. + * + * @category Function Configuration + * + * @param string $compatibilityMode Compatibility Mode + * Permitted values are: + * Functions::COMPATIBILITY_EXCEL 'Excel' + * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' + * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + * + * @return bool (Success or Failure) + */ + public static function setCompatibilityMode($compatibilityMode) + { + if (($compatibilityMode == self::COMPATIBILITY_EXCEL) || + ($compatibilityMode == self::COMPATIBILITY_GNUMERIC) || + ($compatibilityMode == self::COMPATIBILITY_OPENOFFICE) + ) { + self::$compatibilityMode = $compatibilityMode; + + return true; + } + + return false; + } + + /** + * Return the current Compatibility Mode. + * + * @category Function Configuration + * + * @return string Compatibility Mode + * Possible Return values are: + * Functions::COMPATIBILITY_EXCEL 'Excel' + * Functions::COMPATIBILITY_GNUMERIC 'Gnumeric' + * Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc' + */ + public static function getCompatibilityMode() + { + return self::$compatibilityMode; + } + + /** + * Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object). + * + * @category Function Configuration + * + * @param string $returnDateType Return Date Format + * Permitted values are: + * Functions::RETURNDATE_UNIX_TIMESTAMP 'P' + * Functions::RETURNDATE_PHP_DATETIME_OBJECT 'O' + * Functions::RETURNDATE_EXCEL 'E' + * + * @return bool Success or failure + */ + public static function setReturnDateType($returnDateType) + { + if (($returnDateType == self::RETURNDATE_UNIX_TIMESTAMP) || + ($returnDateType == self::RETURNDATE_PHP_DATETIME_OBJECT) || + ($returnDateType == self::RETURNDATE_EXCEL) + ) { + self::$returnDateType = $returnDateType; + + return true; + } + + return false; + } + + /** + * Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object). + * + * @category Function Configuration + * + * @return string Return Date Format + * Possible Return values are: + * Functions::RETURNDATE_UNIX_TIMESTAMP 'P' + * Functions::RETURNDATE_PHP_DATETIME_OBJECT 'O' + * Functions::RETURNDATE_EXCEL 'E' + */ + public static function getReturnDateType() + { + return self::$returnDateType; + } + + /** + * DUMMY. + * + * @category Error Returns + * + * @return string #Not Yet Implemented + */ + public static function DUMMY() + { + return '#Not Yet Implemented'; + } + + /** + * DIV0. + * + * @category Error Returns + * + * @return string #Not Yet Implemented + */ + public static function DIV0() + { + return self::$errorCodes['divisionbyzero']; + } + + /** + * NA. + * + * Excel Function: + * =NA() + * + * Returns the error value #N/A + * #N/A is the error value that means "no value is available." + * + * @category Logical Functions + * + * @return string #N/A! + */ + public static function NA() + { + return self::$errorCodes['na']; + } + + /** + * NaN. + * + * Returns the error value #NUM! + * + * @category Error Returns + * + * @return string #NUM! + */ + public static function NAN() + { + return self::$errorCodes['num']; + } + + /** + * NAME. + * + * Returns the error value #NAME? + * + * @category Error Returns + * + * @return string #NAME? + */ + public static function NAME() + { + return self::$errorCodes['name']; + } + + /** + * REF. + * + * Returns the error value #REF! + * + * @category Error Returns + * + * @return string #REF! + */ + public static function REF() + { + return self::$errorCodes['reference']; + } + + /** + * NULL. + * + * Returns the error value #NULL! + * + * @category Error Returns + * + * @return string #NULL! + */ + public static function null() + { + return self::$errorCodes['null']; + } + + /** + * VALUE. + * + * Returns the error value #VALUE! + * + * @category Error Returns + * + * @return string #VALUE! + */ + public static function VALUE() + { + return self::$errorCodes['value']; + } + + public static function isMatrixValue($idx) + { + return (substr_count($idx, '.') <= 1) || (preg_match('/\.[A-Z]/', $idx) > 0); + } + + public static function isValue($idx) + { + return substr_count($idx, '.') == 0; + } + + public static function isCellValue($idx) + { + return substr_count($idx, '.') > 1; + } + + public static function ifCondition($condition) + { + $condition = self::flattenSingleValue($condition); + + if ($condition === '') { + $condition = '=""'; + } + + if (!is_string($condition) || !in_array($condition[0], ['>', '<', '='])) { + if (!is_numeric($condition)) { + $condition = Calculation::wrapResult(strtoupper($condition)); + } + + return str_replace('""""', '""', '=' . $condition); + } + preg_match('/(=|<[>=]?|>=?)(.*)/', $condition, $matches); + [, $operator, $operand] = $matches; + + if (is_numeric(trim($operand, '"'))) { + $operand = trim($operand, '"'); + } elseif (!is_numeric($operand)) { + $operand = str_replace('"', '""', $operand); + $operand = Calculation::wrapResult(strtoupper($operand)); + } + + return str_replace('""""', '""', $operator . $operand); + } + + /** + * ERROR_TYPE. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function errorType($value = '') + { + $value = self::flattenSingleValue($value); + + $i = 1; + foreach (self::$errorCodes as $errorCode) { + if ($value === $errorCode) { + return $i; + } + ++$i; + } + + return self::NA(); + } + + /** + * IS_BLANK. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function isBlank($value = null) + { + if ($value !== null) { + $value = self::flattenSingleValue($value); + } + + return $value === null; + } + + /** + * IS_ERR. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function isErr($value = '') + { + $value = self::flattenSingleValue($value); + + return self::isError($value) && (!self::isNa(($value))); + } + + /** + * IS_ERROR. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function isError($value = '') + { + $value = self::flattenSingleValue($value); + + if (!is_string($value)) { + return false; + } + + return in_array($value, self::$errorCodes); + } + + /** + * IS_NA. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function isNa($value = '') + { + $value = self::flattenSingleValue($value); + + return $value === self::NA(); + } + + /** + * IS_EVEN. + * + * @param mixed $value Value to check + * + * @return bool|string + */ + public static function isEven($value = null) + { + $value = self::flattenSingleValue($value); + + if ($value === null) { + return self::NAME(); + } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { + return self::VALUE(); + } + + return $value % 2 == 0; + } + + /** + * IS_ODD. + * + * @param mixed $value Value to check + * + * @return bool|string + */ + public static function isOdd($value = null) + { + $value = self::flattenSingleValue($value); + + if ($value === null) { + return self::NAME(); + } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { + return self::VALUE(); + } + + return abs($value) % 2 == 1; + } + + /** + * IS_NUMBER. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function isNumber($value = null) + { + $value = self::flattenSingleValue($value); + + if (is_string($value)) { + return false; + } + + return is_numeric($value); + } + + /** + * IS_LOGICAL. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function isLogical($value = null) + { + $value = self::flattenSingleValue($value); + + return is_bool($value); + } + + /** + * IS_TEXT. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function isText($value = null) + { + $value = self::flattenSingleValue($value); + + return is_string($value) && !self::isError($value); + } + + /** + * IS_NONTEXT. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function isNonText($value = null) + { + return !self::isText($value); + } + + /** + * N. + * + * Returns a value converted to a number + * + * @param null|mixed $value The value you want converted + * + * @return number N converts values listed in the following table + * If value is or refers to N returns + * A number That number + * A date The serial number of that date + * TRUE 1 + * FALSE 0 + * An error value The error value + * Anything else 0 + */ + public static function n($value = null) + { + while (is_array($value)) { + $value = array_shift($value); + } + + switch (gettype($value)) { + case 'double': + case 'float': + case 'integer': + return $value; + case 'boolean': + return (int) $value; + case 'string': + // Errors + if ((strlen($value) > 0) && ($value[0] == '#')) { + return $value; + } + + break; + } + + return 0; + } + + /** + * TYPE. + * + * Returns a number that identifies the type of a value + * + * @param null|mixed $value The value you want tested + * + * @return number N converts values listed in the following table + * If value is or refers to N returns + * A number 1 + * Text 2 + * Logical Value 4 + * An error value 16 + * Array or Matrix 64 + */ + public static function TYPE($value = null) + { + $value = self::flattenArrayIndexed($value); + if (is_array($value) && (count($value) > 1)) { + end($value); + $a = key($value); + // Range of cells is an error + if (self::isCellValue($a)) { + return 16; + // Test for Matrix + } elseif (self::isMatrixValue($a)) { + return 64; + } + } elseif (empty($value)) { + // Empty Cell + return 1; + } + $value = self::flattenSingleValue($value); + + if (($value === null) || (is_float($value)) || (is_int($value))) { + return 1; + } elseif (is_bool($value)) { + return 4; + } elseif (is_array($value)) { + return 64; + } elseif (is_string($value)) { + // Errors + if ((strlen($value) > 0) && ($value[0] == '#')) { + return 16; + } + + return 2; + } + + return 0; + } + + /** + * Convert a multi-dimensional array to a simple 1-dimensional array. + * + * @param array $array Array to be flattened + * + * @return array Flattened array + */ + public static function flattenArray($array) + { + if (!is_array($array)) { + return (array) $array; + } + + $arrayValues = []; + foreach ($array as $value) { + if (is_array($value)) { + foreach ($value as $val) { + if (is_array($val)) { + foreach ($val as $v) { + $arrayValues[] = $v; + } + } else { + $arrayValues[] = $val; + } + } + } else { + $arrayValues[] = $value; + } + } + + return $arrayValues; + } + + /** + * Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing. + * + * @param array $array Array to be flattened + * + * @return array Flattened array + */ + public static function flattenArrayIndexed($array) + { + if (!is_array($array)) { + return (array) $array; + } + + $arrayValues = []; + foreach ($array as $k1 => $value) { + if (is_array($value)) { + foreach ($value as $k2 => $val) { + if (is_array($val)) { + foreach ($val as $k3 => $v) { + $arrayValues[$k1 . '.' . $k2 . '.' . $k3] = $v; + } + } else { + $arrayValues[$k1 . '.' . $k2] = $val; + } + } + } else { + $arrayValues[$k1] = $value; + } + } + + return $arrayValues; + } + + /** + * Convert an array to a single scalar value by extracting the first element. + * + * @param mixed $value Array or scalar value + * + * @return mixed + */ + public static function flattenSingleValue($value = '') + { + while (is_array($value)) { + $value = array_pop($value); + } + + return $value; + } + + /** + * ISFORMULA. + * + * @param mixed $cellReference The cell to check + * @param Cell $pCell The current cell (containing this formula) + * + * @return bool|string + */ + public static function isFormula($cellReference = '', Cell $pCell = null) + { + if ($pCell === null) { + return self::REF(); + } + + preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellReference, $matches); + + $cellReference = $matches[6] . $matches[7]; + $worksheetName = trim($matches[3], "'"); + + $worksheet = (!empty($worksheetName)) + ? $pCell->getWorksheet()->getParent()->getSheetByName($worksheetName) + : $pCell->getWorksheet(); + + return $worksheet->getCell($cellReference)->isFormula(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php new file mode 100644 index 0000000..416d119 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Logical.php @@ -0,0 +1,375 @@ + 0) && ($returnValue == $argCount); + } + + /** + * LOGICAL_OR. + * + * Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE. + * + * Excel Function: + * =OR(logical1[,logical2[, ...]]) + * + * The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays + * or references that contain logical values. + * + * Boolean arguments are treated as True or False as appropriate + * Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False + * If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds + * the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value + * + * @category Logical Functions + * + * @param mixed $args Data values + * + * @return bool|string the logical OR of the arguments + */ + public static function logicalOr(...$args) + { + $args = Functions::flattenArray($args); + + if (count($args) == 0) { + return Functions::VALUE(); + } + + $args = array_filter($args, function ($value) { + return $value !== null || (is_string($value) && trim($value) == ''); + }); + + $returnValue = self::countTrueValues($args); + if (is_string($returnValue)) { + return $returnValue; + } + + return $returnValue > 0; + } + + /** + * LOGICAL_XOR. + * + * Returns the Exclusive Or logical operation for one or more supplied conditions. + * i.e. the Xor function returns TRUE if an odd number of the supplied conditions evaluate to TRUE, and FALSE otherwise. + * + * Excel Function: + * =XOR(logical1[,logical2[, ...]]) + * + * The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays + * or references that contain logical values. + * + * Boolean arguments are treated as True or False as appropriate + * Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False + * If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds + * the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value + * + * @category Logical Functions + * + * @param mixed $args Data values + * + * @return bool|string the logical XOR of the arguments + */ + public static function logicalXor(...$args) + { + $args = Functions::flattenArray($args); + + if (count($args) == 0) { + return Functions::VALUE(); + } + + $args = array_filter($args, function ($value) { + return $value !== null || (is_string($value) && trim($value) == ''); + }); + + $returnValue = self::countTrueValues($args); + if (is_string($returnValue)) { + return $returnValue; + } + + return $returnValue % 2 == 1; + } + + /** + * NOT. + * + * Returns the boolean inverse of the argument. + * + * Excel Function: + * =NOT(logical) + * + * The argument must evaluate to a logical value such as TRUE or FALSE + * + * Boolean arguments are treated as True or False as appropriate + * Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False + * If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds + * the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value + * + * @category Logical Functions + * + * @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE + * + * @return bool|string the boolean inverse of the argument + */ + public static function NOT($logical = false) + { + $logical = Functions::flattenSingleValue($logical); + + if (is_string($logical)) { + $logical = strtoupper($logical); + if (($logical == 'TRUE') || ($logical == Calculation::getTRUE())) { + return false; + } elseif (($logical == 'FALSE') || ($logical == Calculation::getFALSE())) { + return true; + } + + return Functions::VALUE(); + } + + return !$logical; + } + + /** + * STATEMENT_IF. + * + * Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. + * + * Excel Function: + * =IF(condition[,returnIfTrue[,returnIfFalse]]) + * + * Condition is any value or expression that can be evaluated to TRUE or FALSE. + * For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100, + * the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE. + * This argument can use any comparison calculation operator. + * ReturnIfTrue is the value that is returned if condition evaluates to TRUE. + * For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE, + * then the IF function returns the text "Within budget" + * If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use + * the logical value TRUE for this argument. + * ReturnIfTrue can be another formula. + * ReturnIfFalse is the value that is returned if condition evaluates to FALSE. + * For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE, + * then the IF function returns the text "Over budget". + * If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned. + * If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned. + * ReturnIfFalse can be another formula. + * + * @category Logical Functions + * + * @param mixed $condition Condition to evaluate + * @param mixed $returnIfTrue Value to return when condition is true + * @param mixed $returnIfFalse Optional value to return when condition is false + * + * @return mixed The value of returnIfTrue or returnIfFalse determined by condition + */ + public static function statementIf($condition = true, $returnIfTrue = 0, $returnIfFalse = false) + { + if (Functions::isError($condition)) { + return $condition; + } + + $condition = ($condition === null) ? true : (bool) Functions::flattenSingleValue($condition); + $returnIfTrue = ($returnIfTrue === null) ? 0 : Functions::flattenSingleValue($returnIfTrue); + $returnIfFalse = ($returnIfFalse === null) ? false : Functions::flattenSingleValue($returnIfFalse); + + return ($condition) ? $returnIfTrue : $returnIfFalse; + } + + /** + * STATEMENT_SWITCH. + * + * Returns corresponding with first match (any data type such as a string, numeric, date, etc). + * + * Excel Function: + * =SWITCH (expression, value1, result1, value2, result2, ... value_n, result_n [, default]) + * + * Expression + * The expression to compare to a list of values. + * value1, value2, ... value_n + * A list of values that are compared to expression. The SWITCH function is looking for the first value that matches the expression. + * result1, result2, ... result_n + * A list of results. The SWITCH function returns the corresponding result when a value matches expression. + * default + * Optional. It is the default to return if expression does not match any of the values (value1, value2, ... value_n). + * + * @category Logical Functions + * + * @param mixed $arguments Statement arguments + * + * @return mixed The value of matched expression + */ + public static function statementSwitch(...$arguments) + { + $result = Functions::VALUE(); + + if (count($arguments) > 0) { + $targetValue = Functions::flattenSingleValue($arguments[0]); + $argc = count($arguments) - 1; + $switchCount = floor($argc / 2); + $switchSatisfied = false; + $hasDefaultClause = $argc % 2 !== 0; + $defaultClause = $argc % 2 === 0 ? null : $arguments[count($arguments) - 1]; + + if ($switchCount) { + for ($index = 0; $index < $switchCount; ++$index) { + if ($targetValue == $arguments[$index * 2 + 1]) { + $result = $arguments[$index * 2 + 2]; + $switchSatisfied = true; + + break; + } + } + } + + if (!$switchSatisfied) { + $result = $hasDefaultClause ? $defaultClause : Functions::NA(); + } + } + + return $result; + } + + /** + * IFERROR. + * + * Excel Function: + * =IFERROR(testValue,errorpart) + * + * @category Logical Functions + * + * @param mixed $testValue Value to check, is also the value returned when no error + * @param mixed $errorpart Value to return when testValue is an error condition + * + * @return mixed The value of errorpart or testValue determined by error condition + */ + public static function IFERROR($testValue = '', $errorpart = '') + { + $testValue = ($testValue === null) ? '' : Functions::flattenSingleValue($testValue); + $errorpart = ($errorpart === null) ? '' : Functions::flattenSingleValue($errorpart); + + return self::statementIf(Functions::isError($testValue), $errorpart, $testValue); + } + + /** + * IFNA. + * + * Excel Function: + * =IFNA(testValue,napart) + * + * @category Logical Functions + * + * @param mixed $testValue Value to check, is also the value returned when not an NA + * @param mixed $napart Value to return when testValue is an NA condition + * + * @return mixed The value of errorpart or testValue determined by error condition + */ + public static function IFNA($testValue = '', $napart = '') + { + $testValue = ($testValue === null) ? '' : Functions::flattenSingleValue($testValue); + $napart = ($napart === null) ? '' : Functions::flattenSingleValue($napart); + + return self::statementIf(Functions::isNa($testValue), $napart, $testValue); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php new file mode 100644 index 0000000..4843430 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php @@ -0,0 +1,968 @@ + '') { + if (strpos($sheetText, ' ') !== false) { + $sheetText = "'" . $sheetText . "'"; + } + $sheetText .= '!'; + } + if ((!is_bool($referenceStyle)) || $referenceStyle) { + $rowRelative = $columnRelative = '$'; + $column = Coordinate::stringFromColumnIndex($column); + if (($relativity == 2) || ($relativity == 4)) { + $columnRelative = ''; + } + if (($relativity == 3) || ($relativity == 4)) { + $rowRelative = ''; + } + + return $sheetText . $columnRelative . $column . $rowRelative . $row; + } + if (($relativity == 2) || ($relativity == 4)) { + $column = '[' . $column . ']'; + } + if (($relativity == 3) || ($relativity == 4)) { + $row = '[' . $row . ']'; + } + + return $sheetText . 'R' . $row . 'C' . $column; + } + + /** + * COLUMN. + * + * Returns the column number of the given cell reference + * If the cell reference is a range of cells, COLUMN returns the column numbers of each column in the reference as a horizontal array. + * If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the + * reference of the cell in which the COLUMN function appears; otherwise this function returns 0. + * + * Excel Function: + * =COLUMN([cellAddress]) + * + * @param null|array|string $cellAddress A reference to a range of cells for which you want the column numbers + * + * @return int|int[] + */ + public static function COLUMN($cellAddress = null) + { + if ($cellAddress === null || trim($cellAddress) === '') { + return 0; + } + + if (is_array($cellAddress)) { + foreach ($cellAddress as $columnKey => $value) { + $columnKey = preg_replace('/[^a-z]/i', '', $columnKey); + + return (int) Coordinate::columnIndexFromString($columnKey); + } + } else { + [$sheet, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true); + if (strpos($cellAddress, ':') !== false) { + [$startAddress, $endAddress] = explode(':', $cellAddress); + $startAddress = preg_replace('/[^a-z]/i', '', $startAddress); + $endAddress = preg_replace('/[^a-z]/i', '', $endAddress); + $returnValue = []; + do { + $returnValue[] = (int) Coordinate::columnIndexFromString($startAddress); + } while ($startAddress++ != $endAddress); + + return $returnValue; + } + $cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress); + + return (int) Coordinate::columnIndexFromString($cellAddress); + } + } + + /** + * COLUMNS. + * + * Returns the number of columns in an array or reference. + * + * Excel Function: + * =COLUMNS(cellAddress) + * + * @param null|array|string $cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns + * + * @return int The number of columns in cellAddress + */ + public static function COLUMNS($cellAddress = null) + { + if ($cellAddress === null || $cellAddress === '') { + return 1; + } elseif (!is_array($cellAddress)) { + return Functions::VALUE(); + } + + reset($cellAddress); + $isMatrix = (is_numeric(key($cellAddress))); + [$columns, $rows] = Calculation::getMatrixDimensions($cellAddress); + + if ($isMatrix) { + return $rows; + } + + return $columns; + } + + /** + * ROW. + * + * Returns the row number of the given cell reference + * If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array. + * If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the + * reference of the cell in which the ROW function appears; otherwise this function returns 0. + * + * Excel Function: + * =ROW([cellAddress]) + * + * @param null|array|string $cellAddress A reference to a range of cells for which you want the row numbers + * + * @return int or array of integer + */ + public static function ROW($cellAddress = null) + { + if ($cellAddress === null || trim($cellAddress) === '') { + return 0; + } + + if (is_array($cellAddress)) { + foreach ($cellAddress as $columnKey => $rowValue) { + foreach ($rowValue as $rowKey => $cellValue) { + return (int) preg_replace('/\D/', '', $rowKey); + } + } + } else { + [$sheet, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true); + if (strpos($cellAddress, ':') !== false) { + [$startAddress, $endAddress] = explode(':', $cellAddress); + $startAddress = preg_replace('/\D/', '', $startAddress); + $endAddress = preg_replace('/\D/', '', $endAddress); + $returnValue = []; + do { + $returnValue[][] = (int) $startAddress; + } while ($startAddress++ != $endAddress); + + return $returnValue; + } + [$cellAddress] = explode(':', $cellAddress); + + return (int) preg_replace('/\D/', '', $cellAddress); + } + } + + /** + * ROWS. + * + * Returns the number of rows in an array or reference. + * + * Excel Function: + * =ROWS(cellAddress) + * + * @param null|array|string $cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows + * + * @return int The number of rows in cellAddress + */ + public static function ROWS($cellAddress = null) + { + if ($cellAddress === null || $cellAddress === '') { + return 1; + } elseif (!is_array($cellAddress)) { + return Functions::VALUE(); + } + + reset($cellAddress); + $isMatrix = (is_numeric(key($cellAddress))); + [$columns, $rows] = Calculation::getMatrixDimensions($cellAddress); + + if ($isMatrix) { + return $columns; + } + + return $rows; + } + + /** + * HYPERLINK. + * + * Excel Function: + * =HYPERLINK(linkURL,displayName) + * + * @category Logical Functions + * + * @param string $linkURL Value to check, is also the value returned when no error + * @param string $displayName Value to return when testValue is an error condition + * @param Cell $pCell The cell to set the hyperlink in + * + * @return mixed The value of $displayName (or $linkURL if $displayName was blank) + */ + public static function HYPERLINK($linkURL = '', $displayName = null, Cell $pCell = null) + { + $linkURL = ($linkURL === null) ? '' : Functions::flattenSingleValue($linkURL); + $displayName = ($displayName === null) ? '' : Functions::flattenSingleValue($displayName); + + if ((!is_object($pCell)) || (trim($linkURL) == '')) { + return Functions::REF(); + } + + if ((is_object($displayName)) || trim($displayName) == '') { + $displayName = $linkURL; + } + + $pCell->getHyperlink()->setUrl($linkURL); + $pCell->getHyperlink()->setTooltip($displayName); + + return $displayName; + } + + /** + * INDIRECT. + * + * Returns the reference specified by a text string. + * References are immediately evaluated to display their contents. + * + * Excel Function: + * =INDIRECT(cellAddress) + * + * NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010 + * + * @param null|array|string $cellAddress $cellAddress The cell address of the current cell (containing this formula) + * @param Cell $pCell The current cell (containing this formula) + * + * @return mixed The cells referenced by cellAddress + * + * @todo Support for the optional a1 parameter introduced in Excel 2010 + */ + public static function INDIRECT($cellAddress = null, Cell $pCell = null) + { + $cellAddress = Functions::flattenSingleValue($cellAddress); + if ($cellAddress === null || $cellAddress === '') { + return Functions::REF(); + } + + $cellAddress1 = $cellAddress; + $cellAddress2 = null; + if (strpos($cellAddress, ':') !== false) { + [$cellAddress1, $cellAddress2] = explode(':', $cellAddress); + } + + if ((!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress1, $matches)) || + (($cellAddress2 !== null) && (!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress2, $matches)))) { + if (!preg_match('/^' . Calculation::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $cellAddress1, $matches)) { + return Functions::REF(); + } + + if (strpos($cellAddress, '!') !== false) { + [$sheetName, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true); + $sheetName = trim($sheetName, "'"); + $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName); + } else { + $pSheet = $pCell->getWorksheet(); + } + + return Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, false); + } + + if (strpos($cellAddress, '!') !== false) { + [$sheetName, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true); + $sheetName = trim($sheetName, "'"); + $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName); + } else { + $pSheet = $pCell->getWorksheet(); + } + + return Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false); + } + + /** + * OFFSET. + * + * Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells. + * The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and + * the number of columns to be returned. + * + * Excel Function: + * =OFFSET(cellAddress, rows, cols, [height], [width]) + * + * @param null|string $cellAddress The reference from which you want to base the offset. Reference must refer to a cell or + * range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value. + * @param mixed $rows The number of rows, up or down, that you want the upper-left cell to refer to. + * Using 5 as the rows argument specifies that the upper-left cell in the reference is + * five rows below reference. Rows can be positive (which means below the starting reference) + * or negative (which means above the starting reference). + * @param mixed $columns The number of columns, to the left or right, that you want the upper-left cell of the result + * to refer to. Using 5 as the cols argument specifies that the upper-left cell in the + * reference is five columns to the right of reference. Cols can be positive (which means + * to the right of the starting reference) or negative (which means to the left of the + * starting reference). + * @param mixed $height The height, in number of rows, that you want the returned reference to be. Height must be a positive number. + * @param mixed $width The width, in number of columns, that you want the returned reference to be. Width must be a positive number. + * @param null|Cell $pCell + * + * @return string A reference to a cell or range of cells + */ + public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null, Cell $pCell = null) + { + $rows = Functions::flattenSingleValue($rows); + $columns = Functions::flattenSingleValue($columns); + $height = Functions::flattenSingleValue($height); + $width = Functions::flattenSingleValue($width); + if ($cellAddress === null) { + return 0; + } + + if (!is_object($pCell)) { + return Functions::REF(); + } + + $sheetName = null; + if (strpos($cellAddress, '!')) { + [$sheetName, $cellAddress] = Worksheet::extractSheetTitle($cellAddress, true); + $sheetName = trim($sheetName, "'"); + } + if (strpos($cellAddress, ':')) { + [$startCell, $endCell] = explode(':', $cellAddress); + } else { + $startCell = $endCell = $cellAddress; + } + [$startCellColumn, $startCellRow] = Coordinate::coordinateFromString($startCell); + [$endCellColumn, $endCellRow] = Coordinate::coordinateFromString($endCell); + + $startCellRow += $rows; + $startCellColumn = Coordinate::columnIndexFromString($startCellColumn) - 1; + $startCellColumn += $columns; + + if (($startCellRow <= 0) || ($startCellColumn < 0)) { + return Functions::REF(); + } + $endCellColumn = Coordinate::columnIndexFromString($endCellColumn) - 1; + if (($width != null) && (!is_object($width))) { + $endCellColumn = $startCellColumn + $width - 1; + } else { + $endCellColumn += $columns; + } + $startCellColumn = Coordinate::stringFromColumnIndex($startCellColumn + 1); + + if (($height != null) && (!is_object($height))) { + $endCellRow = $startCellRow + $height - 1; + } else { + $endCellRow += $rows; + } + + if (($endCellRow <= 0) || ($endCellColumn < 0)) { + return Functions::REF(); + } + $endCellColumn = Coordinate::stringFromColumnIndex($endCellColumn + 1); + + $cellAddress = $startCellColumn . $startCellRow; + if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) { + $cellAddress .= ':' . $endCellColumn . $endCellRow; + } + + if ($sheetName !== null) { + $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName); + } else { + $pSheet = $pCell->getWorksheet(); + } + + return Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false); + } + + /** + * CHOOSE. + * + * Uses lookup_value to return a value from the list of value arguments. + * Use CHOOSE to select one of up to 254 values based on the lookup_value. + * + * Excel Function: + * =CHOOSE(index_num, value1, [value2], ...) + * + * @param mixed $index_num Specifies which value argument is selected. + * Index_num must be a number between 1 and 254, or a formula or reference to a cell containing a number + * between 1 and 254. + * @param mixed $value1 ... Value1 is required, subsequent values are optional. + * Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on + * index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or + * text. + * + * @return mixed The selected value + */ + public static function CHOOSE(...$chooseArgs) + { + $chosenEntry = Functions::flattenArray(array_shift($chooseArgs)); + $entryCount = count($chooseArgs) - 1; + + if (is_array($chosenEntry)) { + $chosenEntry = array_shift($chosenEntry); + } + if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) { + --$chosenEntry; + } else { + return Functions::VALUE(); + } + $chosenEntry = floor($chosenEntry); + if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) { + return Functions::VALUE(); + } + + if (is_array($chooseArgs[$chosenEntry])) { + return Functions::flattenArray($chooseArgs[$chosenEntry]); + } + + return $chooseArgs[$chosenEntry]; + } + + /** + * MATCH. + * + * The MATCH function searches for a specified item in a range of cells + * + * Excel Function: + * =MATCH(lookup_value, lookup_array, [match_type]) + * + * @param mixed $lookupValue The value that you want to match in lookup_array + * @param mixed $lookupArray The range of cells being searched + * @param mixed $matchType The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. + * If match_type is 1 or -1, the list has to be ordered. + * + * @return int|string The relative position of the found item + */ + public static function MATCH($lookupValue, $lookupArray, $matchType = 1) + { + $lookupArray = Functions::flattenArray($lookupArray); + $lookupValue = Functions::flattenSingleValue($lookupValue); + $matchType = ($matchType === null) ? 1 : (int) Functions::flattenSingleValue($matchType); + + // MATCH is not case sensitive, so we convert lookup value to be lower cased in case it's string type. + if (is_string($lookupValue)) { + $lookupValue = StringHelper::strToLower($lookupValue); + } + + // Lookup_value type has to be number, text, or logical values + if ((!is_numeric($lookupValue)) && (!is_string($lookupValue)) && (!is_bool($lookupValue))) { + return Functions::NA(); + } + + // Match_type is 0, 1 or -1 + if (($matchType !== 0) && ($matchType !== -1) && ($matchType !== 1)) { + return Functions::NA(); + } + + // Lookup_array should not be empty + $lookupArraySize = count($lookupArray); + if ($lookupArraySize <= 0) { + return Functions::NA(); + } + + // Lookup_array should contain only number, text, or logical values, or empty (null) cells + foreach ($lookupArray as $i => $lookupArrayValue) { + // check the type of the value + if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) && + (!is_bool($lookupArrayValue)) && ($lookupArrayValue !== null) + ) { + return Functions::NA(); + } + // Convert strings to lowercase for case-insensitive testing + if (is_string($lookupArrayValue)) { + $lookupArray[$i] = StringHelper::strToLower($lookupArrayValue); + } + if (($lookupArrayValue === null) && (($matchType == 1) || ($matchType == -1))) { + $lookupArray = array_slice($lookupArray, 0, $i - 1); + } + } + + if ($matchType == 1) { + // If match_type is 1 the list has to be processed from last to first + + $lookupArray = array_reverse($lookupArray); + $keySet = array_reverse(array_keys($lookupArray)); + } + + // ** + // find the match + // ** + + if ($matchType === 0 || $matchType === 1) { + foreach ($lookupArray as $i => $lookupArrayValue) { + $typeMatch = gettype($lookupValue) === gettype($lookupArrayValue); + $exactTypeMatch = $typeMatch && $lookupArrayValue === $lookupValue; + $nonOnlyNumericExactMatch = !$typeMatch && $lookupArrayValue === $lookupValue; + $exactMatch = $exactTypeMatch || $nonOnlyNumericExactMatch; + + if ($matchType === 0) { + if ($typeMatch && is_string($lookupValue) && (bool) preg_match('/([\?\*])/', $lookupValue)) { + $splitString = $lookupValue; + $chars = array_map(function ($i) use ($splitString) { + return mb_substr($splitString, $i, 1); + }, range(0, mb_strlen($splitString) - 1)); + + $length = count($chars); + $pattern = '/^'; + for ($j = 0; $j < $length; ++$j) { + if ($chars[$j] === '~') { + if (isset($chars[$j + 1])) { + if ($chars[$j + 1] === '*') { + $pattern .= preg_quote($chars[$j + 1], '/'); + ++$j; + } elseif ($chars[$j + 1] === '?') { + $pattern .= preg_quote($chars[$j + 1], '/'); + ++$j; + } + } else { + $pattern .= preg_quote($chars[$j], '/'); + } + } elseif ($chars[$j] === '*') { + $pattern .= '.*'; + } elseif ($chars[$j] === '?') { + $pattern .= '.{1}'; + } else { + $pattern .= preg_quote($chars[$j], '/'); + } + } + + $pattern .= '$/'; + if ((bool) preg_match($pattern, $lookupArrayValue)) { + // exact match + return $i + 1; + } + } elseif ($exactMatch) { + // exact match + return $i + 1; + } + } elseif (($matchType === 1) && $typeMatch && ($lookupArrayValue <= $lookupValue)) { + $i = array_search($i, $keySet); + + // The current value is the (first) match + return $i + 1; + } + } + } else { + $maxValueKey = null; + + // The basic algorithm is: + // Iterate and keep the highest match until the next element is smaller than the searched value. + // Return immediately if perfect match is found + foreach ($lookupArray as $i => $lookupArrayValue) { + $typeMatch = gettype($lookupValue) === gettype($lookupArrayValue); + $exactTypeMatch = $typeMatch && $lookupArrayValue === $lookupValue; + $nonOnlyNumericExactMatch = !$typeMatch && $lookupArrayValue === $lookupValue; + $exactMatch = $exactTypeMatch || $nonOnlyNumericExactMatch; + + if ($exactMatch) { + // Another "special" case. If a perfect match is found, + // the algorithm gives up immediately + return $i + 1; + } elseif ($typeMatch & $lookupArrayValue >= $lookupValue) { + $maxValueKey = $i + 1; + } elseif ($typeMatch & $lookupArrayValue < $lookupValue) { + //Excel algorithm gives up immediately if the first element is smaller than the searched value + break; + } + } + + if ($maxValueKey !== null) { + return $maxValueKey; + } + } + + // Unsuccessful in finding a match, return #N/A error value + return Functions::NA(); + } + + /** + * INDEX. + * + * Uses an index to choose a value from a reference or array + * + * Excel Function: + * =INDEX(range_array, row_num, [column_num]) + * + * @param mixed $arrayValues A range of cells or an array constant + * @param mixed $rowNum The row in array from which to return a value. If row_num is omitted, column_num is required. + * @param mixed $columnNum The column in array from which to return a value. If column_num is omitted, row_num is required. + * + * @return mixed the value of a specified cell or array of cells + */ + public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0) + { + $rowNum = Functions::flattenSingleValue($rowNum); + $columnNum = Functions::flattenSingleValue($columnNum); + + if (($rowNum < 0) || ($columnNum < 0)) { + return Functions::VALUE(); + } + + if (!is_array($arrayValues) || ($rowNum > count($arrayValues))) { + return Functions::REF(); + } + + $rowKeys = array_keys($arrayValues); + $columnKeys = @array_keys($arrayValues[$rowKeys[0]]); + + if ($columnNum > count($columnKeys)) { + return Functions::VALUE(); + } elseif ($columnNum == 0) { + if ($rowNum == 0) { + return $arrayValues; + } + $rowNum = $rowKeys[--$rowNum]; + $returnArray = []; + foreach ($arrayValues as $arrayColumn) { + if (is_array($arrayColumn)) { + if (isset($arrayColumn[$rowNum])) { + $returnArray[] = $arrayColumn[$rowNum]; + } else { + return [$rowNum => $arrayValues[$rowNum]]; + } + } else { + return $arrayValues[$rowNum]; + } + } + + return $returnArray; + } + $columnNum = $columnKeys[--$columnNum]; + if ($rowNum > count($rowKeys)) { + return Functions::VALUE(); + } elseif ($rowNum == 0) { + return $arrayValues[$columnNum]; + } + $rowNum = $rowKeys[--$rowNum]; + + return $arrayValues[$rowNum][$columnNum]; + } + + /** + * TRANSPOSE. + * + * @param array $matrixData A matrix of values + * + * @return array + * + * Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix + */ + public static function TRANSPOSE($matrixData) + { + $returnMatrix = []; + if (!is_array($matrixData)) { + $matrixData = [[$matrixData]]; + } + + $column = 0; + foreach ($matrixData as $matrixRow) { + $row = 0; + foreach ($matrixRow as $matrixCell) { + $returnMatrix[$row][$column] = $matrixCell; + ++$row; + } + ++$column; + } + + return $returnMatrix; + } + + private static function vlookupSort($a, $b) + { + reset($a); + $firstColumn = key($a); + $aLower = StringHelper::strToLower($a[$firstColumn]); + $bLower = StringHelper::strToLower($b[$firstColumn]); + if ($aLower == $bLower) { + return 0; + } + + return ($aLower < $bLower) ? -1 : 1; + } + + /** + * VLOOKUP + * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number. + * + * @param mixed $lookup_value The value that you want to match in lookup_array + * @param mixed $lookup_array The range of cells being searched + * @param mixed $index_number The column number in table_array from which the matching value must be returned. The first column is 1. + * @param mixed $not_exact_match determines if you are looking for an exact match based on lookup_value + * + * @return mixed The value of the found cell + */ + public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true) + { + $lookup_value = Functions::flattenSingleValue($lookup_value); + $index_number = Functions::flattenSingleValue($index_number); + $not_exact_match = Functions::flattenSingleValue($not_exact_match); + + // index_number must be greater than or equal to 1 + if ($index_number < 1) { + return Functions::VALUE(); + } + + // index_number must be less than or equal to the number of columns in lookup_array + if ((!is_array($lookup_array)) || (empty($lookup_array))) { + return Functions::REF(); + } + $f = array_keys($lookup_array); + $firstRow = array_pop($f); + if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) { + return Functions::REF(); + } + $columnKeys = array_keys($lookup_array[$firstRow]); + $returnColumn = $columnKeys[--$index_number]; + $firstColumn = array_shift($columnKeys); + + if (!$not_exact_match) { + uasort($lookup_array, ['self', 'vlookupSort']); + } + + $lookupLower = StringHelper::strToLower($lookup_value); + $rowNumber = $rowValue = false; + foreach ($lookup_array as $rowKey => $rowData) { + $firstLower = StringHelper::strToLower($rowData[$firstColumn]); + + // break if we have passed possible keys + if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn]) && ($rowData[$firstColumn] > $lookup_value)) || + (!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && ($firstLower > $lookupLower))) { + break; + } + // remember the last key, but only if datatypes match + if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn])) || + (!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]))) { + if ($not_exact_match) { + $rowNumber = $rowKey; + + continue; + } elseif (($firstLower == $lookupLower) + // Spreadsheets software returns first exact match, + // we have sorted and we might have broken key orders + // we want the first one (by its initial index) + && (($rowNumber == false) || ($rowKey < $rowNumber)) + ) { + $rowNumber = $rowKey; + } + } + } + + if ($rowNumber !== false) { + // return the appropriate value + return $lookup_array[$rowNumber][$returnColumn]; + } + + return Functions::NA(); + } + + /** + * HLOOKUP + * The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number. + * + * @param mixed $lookup_value The value that you want to match in lookup_array + * @param mixed $lookup_array The range of cells being searched + * @param mixed $index_number The row number in table_array from which the matching value must be returned. The first row is 1. + * @param mixed $not_exact_match determines if you are looking for an exact match based on lookup_value + * + * @return mixed The value of the found cell + */ + public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true) + { + $lookup_value = Functions::flattenSingleValue($lookup_value); + $index_number = Functions::flattenSingleValue($index_number); + $not_exact_match = Functions::flattenSingleValue($not_exact_match); + + // index_number must be greater than or equal to 1 + if ($index_number < 1) { + return Functions::VALUE(); + } + + // index_number must be less than or equal to the number of columns in lookup_array + if ((!is_array($lookup_array)) || (empty($lookup_array))) { + return Functions::REF(); + } + $f = array_keys($lookup_array); + $firstRow = array_pop($f); + if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array))) { + return Functions::REF(); + } + + $firstkey = $f[0] - 1; + $returnColumn = $firstkey + $index_number; + $firstColumn = array_shift($f); + $rowNumber = null; + foreach ($lookup_array[$firstColumn] as $rowKey => $rowData) { + // break if we have passed possible keys + $bothNumeric = is_numeric($lookup_value) && is_numeric($rowData); + $bothNotNumeric = !is_numeric($lookup_value) && !is_numeric($rowData); + $lookupLower = StringHelper::strToLower($lookup_value); + $rowDataLower = StringHelper::strToLower($rowData); + + if ($not_exact_match && ( + ($bothNumeric && $rowData > $lookup_value) || + ($bothNotNumeric && $rowDataLower > $lookupLower) + )) { + break; + } + + // Remember the last key, but only if datatypes match (as in VLOOKUP) + if ($bothNumeric || $bothNotNumeric) { + if ($not_exact_match) { + $rowNumber = $rowKey; + + continue; + } elseif ($rowDataLower === $lookupLower + && ($rowNumber === null || $rowKey < $rowNumber) + ) { + $rowNumber = $rowKey; + } + } + } + + if ($rowNumber !== null) { + // otherwise return the appropriate value + return $lookup_array[$returnColumn][$rowNumber]; + } + + return Functions::NA(); + } + + /** + * LOOKUP + * The LOOKUP function searches for value either from a one-row or one-column range or from an array. + * + * @param mixed $lookup_value The value that you want to match in lookup_array + * @param mixed $lookup_vector The range of cells being searched + * @param null|mixed $result_vector The column from which the matching value must be returned + * + * @return mixed The value of the found cell + */ + public static function LOOKUP($lookup_value, $lookup_vector, $result_vector = null) + { + $lookup_value = Functions::flattenSingleValue($lookup_value); + + if (!is_array($lookup_vector)) { + return Functions::NA(); + } + $hasResultVector = isset($result_vector); + $lookupRows = count($lookup_vector); + $l = array_keys($lookup_vector); + $l = array_shift($l); + $lookupColumns = count($lookup_vector[$l]); + // we correctly orient our results + if (($lookupRows === 1 && $lookupColumns > 1) || (!$hasResultVector && $lookupRows === 2 && $lookupColumns !== 2)) { + $lookup_vector = self::TRANSPOSE($lookup_vector); + $lookupRows = count($lookup_vector); + $l = array_keys($lookup_vector); + $lookupColumns = count($lookup_vector[array_shift($l)]); + } + + if ($result_vector === null) { + $result_vector = $lookup_vector; + } + $resultRows = count($result_vector); + $l = array_keys($result_vector); + $l = array_shift($l); + $resultColumns = count($result_vector[$l]); + // we correctly orient our results + if ($resultRows === 1 && $resultColumns > 1) { + $result_vector = self::TRANSPOSE($result_vector); + $resultRows = count($result_vector); + $r = array_keys($result_vector); + $resultColumns = count($result_vector[array_shift($r)]); + } + + if ($lookupRows === 2 && !$hasResultVector) { + $result_vector = array_pop($lookup_vector); + $lookup_vector = array_shift($lookup_vector); + } + + if ($lookupColumns !== 2) { + foreach ($lookup_vector as &$value) { + if (is_array($value)) { + $k = array_keys($value); + $key1 = $key2 = array_shift($k); + ++$key2; + $dataValue1 = $value[$key1]; + } else { + $key1 = 0; + $key2 = 1; + $dataValue1 = $value; + } + $dataValue2 = array_shift($result_vector); + if (is_array($dataValue2)) { + $dataValue2 = array_shift($dataValue2); + } + $value = [$key1 => $dataValue1, $key2 => $dataValue2]; + } + unset($value); + } + + return self::VLOOKUP($lookup_value, $lookup_vector, 2); + } + + /** + * FORMULATEXT. + * + * @param mixed $cellReference The cell to check + * @param Cell $pCell The current cell (containing this formula) + * + * @return string + */ + public static function FORMULATEXT($cellReference = '', Cell $pCell = null) + { + if ($pCell === null) { + return Functions::REF(); + } + + preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellReference, $matches); + + $cellReference = $matches[6] . $matches[7]; + $worksheetName = trim($matches[3], "'"); + $worksheet = (!empty($worksheetName)) + ? $pCell->getWorksheet()->getParent()->getSheetByName($worksheetName) + : $pCell->getWorksheet(); + + if (!$worksheet->getCell($cellReference)->isFormula()) { + return Functions::NA(); + } + + return $worksheet->getCell($cellReference)->getValue(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php new file mode 100644 index 0000000..33bfee1 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -0,0 +1,1752 @@ + 1; --$i) { + if (($value % $i) == 0) { + $factorArray = array_merge($factorArray, self::factors($value / $i)); + $factorArray = array_merge($factorArray, self::factors($i)); + if ($i <= sqrt($value)) { + break; + } + } + } + if (!empty($factorArray)) { + rsort($factorArray); + + return $factorArray; + } + + return [(int) $value]; + } + + private static function romanCut($num, $n) + { + return ($num - ($num % $n)) / $n; + } + + /** + * ARABIC. + * + * Converts a Roman numeral to an Arabic numeral. + * + * Excel Function: + * ARABIC(text) + * + * @category Mathematical and Trigonometric Functions + * + * @param string $roman + * + * @return int|string the arabic numberal contrived from the roman numeral + */ + public static function ARABIC($roman) + { + // An empty string should return 0 + $roman = substr(trim(strtoupper((string) Functions::flattenSingleValue($roman))), 0, 255); + if ($roman === '') { + return 0; + } + + // Convert the roman numeral to an arabic number + $lookup = [ + 'M' => 1000, 'CM' => 900, + 'D' => 500, 'CD' => 400, + 'C' => 100, 'XC' => 90, + 'L' => 50, 'XL' => 40, + 'X' => 10, 'IX' => 9, + 'V' => 5, 'IV' => 4, 'I' => 1, + ]; + + $negativeNumber = $roman[0] === '-'; + if ($negativeNumber) { + $roman = substr($roman, 1); + } + + $arabic = 0; + for ($i = 0; $i < strlen($roman); ++$i) { + if (!isset($lookup[$roman[$i]])) { + return Functions::VALUE(); // Invalid character detected + } + + if ($i < (strlen($roman) - 1) && isset($lookup[substr($roman, $i, 2)])) { + $arabic += $lookup[substr($roman, $i, 2)]; // Detected a match on the next 2 characters + ++$i; + } else { + $arabic += $lookup[$roman[$i]]; // Detected a match on one character only + } + } + + if ($negativeNumber) { + $arabic *= -1; // The number should be negative + } + + return $arabic; + } + + /** + * ATAN2. + * + * This function calculates the arc tangent of the two variables x and y. It is similar to + * calculating the arc tangent of y ÷ x, except that the signs of both arguments are used + * to determine the quadrant of the result. + * The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a + * point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between + * -pi and pi, excluding -pi. + * + * Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard + * PHP atan2() function, so we need to reverse them here before calling the PHP atan() function. + * + * Excel Function: + * ATAN2(xCoordinate,yCoordinate) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $xCoordinate the x-coordinate of the point + * @param float $yCoordinate the y-coordinate of the point + * + * @return float|string the inverse tangent of the specified x- and y-coordinates, or a string containing an error + */ + public static function ATAN2($xCoordinate = null, $yCoordinate = null) + { + $xCoordinate = Functions::flattenSingleValue($xCoordinate); + $yCoordinate = Functions::flattenSingleValue($yCoordinate); + + $xCoordinate = ($xCoordinate !== null) ? $xCoordinate : 0.0; + $yCoordinate = ($yCoordinate !== null) ? $yCoordinate : 0.0; + + if (((is_numeric($xCoordinate)) || (is_bool($xCoordinate))) && + ((is_numeric($yCoordinate))) || (is_bool($yCoordinate))) { + $xCoordinate = (float) $xCoordinate; + $yCoordinate = (float) $yCoordinate; + + if (($xCoordinate == 0) && ($yCoordinate == 0)) { + return Functions::DIV0(); + } + + return atan2($yCoordinate, $xCoordinate); + } + + return Functions::VALUE(); + } + + /** + * BASE. + * + * Converts a number into a text representation with the given radix (base). + * + * Excel Function: + * BASE(Number, Radix [Min_length]) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $number + * @param float $radix + * @param int $minLength + * + * @return string the text representation with the given radix (base) + */ + public static function BASE($number, $radix, $minLength = null) + { + $number = Functions::flattenSingleValue($number); + $radix = Functions::flattenSingleValue($radix); + $minLength = Functions::flattenSingleValue($minLength); + + if (is_numeric($number) && is_numeric($radix) && ($minLength === null || is_numeric($minLength))) { + // Truncate to an integer + $number = (int) $number; + $radix = (int) $radix; + $minLength = (int) $minLength; + + if ($number < 0 || $number >= 2 ** 53 || $radix < 2 || $radix > 36) { + return Functions::NAN(); // Numeric range constraints + } + + $outcome = strtoupper((string) base_convert($number, 10, $radix)); + if ($minLength !== null) { + $outcome = str_pad($outcome, $minLength, '0', STR_PAD_LEFT); // String padding + } + + return $outcome; + } + + return Functions::VALUE(); + } + + /** + * CEILING. + * + * Returns number rounded up, away from zero, to the nearest multiple of significance. + * For example, if you want to avoid using pennies in your prices and your product is + * priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the + * nearest nickel. + * + * Excel Function: + * CEILING(number[,significance]) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $number the number you want to round + * @param float $significance the multiple to which you want to round + * + * @return float|string Rounded Number, or a string containing an error + */ + public static function CEILING($number, $significance = null) + { + $number = Functions::flattenSingleValue($number); + $significance = Functions::flattenSingleValue($significance); + + if (($significance === null) && + (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) { + $significance = $number / abs($number); + } + + if ((is_numeric($number)) && (is_numeric($significance))) { + if (($number == 0.0) || ($significance == 0.0)) { + return 0.0; + } elseif (self::SIGN($number) == self::SIGN($significance)) { + return ceil($number / $significance) * $significance; + } + + return Functions::NAN(); + } + + return Functions::VALUE(); + } + + /** + * COMBIN. + * + * Returns the number of combinations for a given number of items. Use COMBIN to + * determine the total possible number of groups for a given number of items. + * + * Excel Function: + * COMBIN(numObjs,numInSet) + * + * @category Mathematical and Trigonometric Functions + * + * @param int $numObjs Number of different objects + * @param int $numInSet Number of objects in each combination + * + * @return int|string Number of combinations, or a string containing an error + */ + public static function COMBIN($numObjs, $numInSet) + { + $numObjs = Functions::flattenSingleValue($numObjs); + $numInSet = Functions::flattenSingleValue($numInSet); + + if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { + if ($numObjs < $numInSet) { + return Functions::NAN(); + } elseif ($numInSet < 0) { + return Functions::NAN(); + } + + return round(self::FACT($numObjs) / self::FACT($numObjs - $numInSet)) / self::FACT($numInSet); + } + + return Functions::VALUE(); + } + + /** + * EVEN. + * + * Returns number rounded up to the nearest even integer. + * You can use this function for processing items that come in twos. For example, + * a packing crate accepts rows of one or two items. The crate is full when + * the number of items, rounded up to the nearest two, matches the crate's + * capacity. + * + * Excel Function: + * EVEN(number) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $number Number to round + * + * @return int|string Rounded Number, or a string containing an error + */ + public static function EVEN($number) + { + $number = Functions::flattenSingleValue($number); + + if ($number === null) { + return 0; + } elseif (is_bool($number)) { + $number = (int) $number; + } + + if (is_numeric($number)) { + $significance = 2 * self::SIGN($number); + + return (int) self::CEILING($number, $significance); + } + + return Functions::VALUE(); + } + + /** + * FACT. + * + * Returns the factorial of a number. + * The factorial of a number is equal to 1*2*3*...* number. + * + * Excel Function: + * FACT(factVal) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $factVal Factorial Value + * + * @return int|string Factorial, or a string containing an error + */ + public static function FACT($factVal) + { + $factVal = Functions::flattenSingleValue($factVal); + + if (is_numeric($factVal)) { + if ($factVal < 0) { + return Functions::NAN(); + } + $factLoop = floor($factVal); + if ((Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) && + ($factVal > $factLoop)) { + return Functions::NAN(); + } + + $factorial = 1; + while ($factLoop > 1) { + $factorial *= $factLoop--; + } + + return $factorial; + } + + return Functions::VALUE(); + } + + /** + * FACTDOUBLE. + * + * Returns the double factorial of a number. + * + * Excel Function: + * FACTDOUBLE(factVal) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $factVal Factorial Value + * + * @return int|string Double Factorial, or a string containing an error + */ + public static function FACTDOUBLE($factVal) + { + $factLoop = Functions::flattenSingleValue($factVal); + + if (is_numeric($factLoop)) { + $factLoop = floor($factLoop); + if ($factVal < 0) { + return Functions::NAN(); + } + $factorial = 1; + while ($factLoop > 1) { + $factorial *= $factLoop--; + --$factLoop; + } + + return $factorial; + } + + return Functions::VALUE(); + } + + /** + * FLOOR. + * + * Rounds number down, toward zero, to the nearest multiple of significance. + * + * Excel Function: + * FLOOR(number[,significance]) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $number Number to round + * @param float $significance Significance + * + * @return float|string Rounded Number, or a string containing an error + */ + public static function FLOOR($number, $significance = null) + { + $number = Functions::flattenSingleValue($number); + $significance = Functions::flattenSingleValue($significance); + + if (($significance === null) && + (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) { + $significance = $number / abs($number); + } + + if ((is_numeric($number)) && (is_numeric($significance))) { + if ($significance == 0.0) { + return Functions::DIV0(); + } elseif ($number == 0.0) { + return 0.0; + } elseif (self::SIGN($significance) == 1) { + return floor($number / $significance) * $significance; + } elseif (self::SIGN($number) == -1 && self::SIGN($significance) == -1) { + return floor($number / $significance) * $significance; + } + + return Functions::NAN(); + } + + return Functions::VALUE(); + } + + private static function evaluateGCD($a, $b) + { + return $b ? self::evaluateGCD($b, $a % $b) : $a; + } + + /** + * GCD. + * + * Returns the greatest common divisor of a series of numbers. + * The greatest common divisor is the largest integer that divides both + * number1 and number2 without a remainder. + * + * Excel Function: + * GCD(number1[,number2[, ...]]) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed ...$args Data values + * + * @return int|mixed|string Greatest Common Divisor, or a string containing an error + */ + public static function GCD(...$args) + { + $args = Functions::flattenArray($args); + // Loop through arguments + foreach (Functions::flattenArray($args) as $value) { + if (!is_numeric($value)) { + return Functions::VALUE(); + } elseif ($value < 0) { + return Functions::NAN(); + } + } + + $gcd = (int) array_pop($args); + do { + $gcd = self::evaluateGCD($gcd, (int) array_pop($args)); + } while (!empty($args)); + + return $gcd; + } + + /** + * INT. + * + * Casts a floating point value to an integer + * + * Excel Function: + * INT(number) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $number Number to cast to an integer + * + * @return int|string Integer value, or a string containing an error + */ + public static function INT($number) + { + $number = Functions::flattenSingleValue($number); + + if ($number === null) { + return 0; + } elseif (is_bool($number)) { + return (int) $number; + } + if (is_numeric($number)) { + return (int) floor($number); + } + + return Functions::VALUE(); + } + + /** + * LCM. + * + * Returns the lowest common multiplier of a series of numbers + * The least common multiple is the smallest positive integer that is a multiple + * of all integer arguments number1, number2, and so on. Use LCM to add fractions + * with different denominators. + * + * Excel Function: + * LCM(number1[,number2[, ...]]) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed ...$args Data values + * + * @return int|string Lowest Common Multiplier, or a string containing an error + */ + public static function LCM(...$args) + { + $returnValue = 1; + $allPoweredFactors = []; + // Loop through arguments + foreach (Functions::flattenArray($args) as $value) { + if (!is_numeric($value)) { + return Functions::VALUE(); + } + if ($value == 0) { + return 0; + } elseif ($value < 0) { + return Functions::NAN(); + } + $myFactors = self::factors(floor($value)); + $myCountedFactors = array_count_values($myFactors); + $myPoweredFactors = []; + foreach ($myCountedFactors as $myCountedFactor => $myCountedPower) { + $myPoweredFactors[$myCountedFactor] = pow($myCountedFactor, $myCountedPower); + } + foreach ($myPoweredFactors as $myPoweredValue => $myPoweredFactor) { + if (isset($allPoweredFactors[$myPoweredValue])) { + if ($allPoweredFactors[$myPoweredValue] < $myPoweredFactor) { + $allPoweredFactors[$myPoweredValue] = $myPoweredFactor; + } + } else { + $allPoweredFactors[$myPoweredValue] = $myPoweredFactor; + } + } + } + foreach ($allPoweredFactors as $allPoweredFactor) { + $returnValue *= (int) $allPoweredFactor; + } + + return $returnValue; + } + + /** + * LOG_BASE. + * + * Returns the logarithm of a number to a specified base. The default base is 10. + * + * Excel Function: + * LOG(number[,base]) + * + * @category Mathematical and Trigonometric Functions + * + * @param float $number The positive real number for which you want the logarithm + * @param float $base The base of the logarithm. If base is omitted, it is assumed to be 10. + * + * @return float|string The result, or a string containing an error + */ + public static function logBase($number = null, $base = 10) + { + $number = Functions::flattenSingleValue($number); + $base = ($base === null) ? 10 : (float) Functions::flattenSingleValue($base); + + if ((!is_numeric($base)) || (!is_numeric($number))) { + return Functions::VALUE(); + } + if (($base <= 0) || ($number <= 0)) { + return Functions::NAN(); + } + + return log($number, $base); + } + + /** + * MDETERM. + * + * Returns the matrix determinant of an array. + * + * Excel Function: + * MDETERM(array) + * + * @category Mathematical and Trigonometric Functions + * + * @param array $matrixValues A matrix of values + * + * @return float|string The result, or a string containing an error + */ + public static function MDETERM($matrixValues) + { + $matrixData = []; + if (!is_array($matrixValues)) { + $matrixValues = [[$matrixValues]]; + } + + $row = $maxColumn = 0; + foreach ($matrixValues as $matrixRow) { + if (!is_array($matrixRow)) { + $matrixRow = [$matrixRow]; + } + $column = 0; + foreach ($matrixRow as $matrixCell) { + if ((is_string($matrixCell)) || ($matrixCell === null)) { + return Functions::VALUE(); + } + $matrixData[$row][$column] = $matrixCell; + ++$column; + } + if ($column > $maxColumn) { + $maxColumn = $column; + } + ++$row; + } + + $matrix = new Matrix($matrixData); + if (!$matrix->isSquare()) { + return Functions::VALUE(); + } + + try { + return $matrix->determinant(); + } catch (MatrixException $ex) { + return Functions::VALUE(); + } + } + + /** + * MINVERSE. + * + * Returns the inverse matrix for the matrix stored in an array. + * + * Excel Function: + * MINVERSE(array) + * + * @category Mathematical and Trigonometric Functions + * + * @param array $matrixValues A matrix of values + * + * @return array|string The result, or a string containing an error + */ + public static function MINVERSE($matrixValues) + { + $matrixData = []; + if (!is_array($matrixValues)) { + $matrixValues = [[$matrixValues]]; + } + + $row = $maxColumn = 0; + foreach ($matrixValues as $matrixRow) { + if (!is_array($matrixRow)) { + $matrixRow = [$matrixRow]; + } + $column = 0; + foreach ($matrixRow as $matrixCell) { + if ((is_string($matrixCell)) || ($matrixCell === null)) { + return Functions::VALUE(); + } + $matrixData[$row][$column] = $matrixCell; + ++$column; + } + if ($column > $maxColumn) { + $maxColumn = $column; + } + ++$row; + } + + $matrix = new Matrix($matrixData); + if (!$matrix->isSquare()) { + return Functions::VALUE(); + } + + if ($matrix->determinant() == 0.0) { + return Functions::NAN(); + } + + try { + return $matrix->inverse()->toArray(); + } catch (MatrixException $ex) { + return Functions::VALUE(); + } + } + + /** + * MMULT. + * + * @param array $matrixData1 A matrix of values + * @param array $matrixData2 A matrix of values + * + * @return array|string The result, or a string containing an error + */ + public static function MMULT($matrixData1, $matrixData2) + { + $matrixAData = $matrixBData = []; + if (!is_array($matrixData1)) { + $matrixData1 = [[$matrixData1]]; + } + if (!is_array($matrixData2)) { + $matrixData2 = [[$matrixData2]]; + } + + try { + $rowA = 0; + foreach ($matrixData1 as $matrixRow) { + if (!is_array($matrixRow)) { + $matrixRow = [$matrixRow]; + } + $columnA = 0; + foreach ($matrixRow as $matrixCell) { + if ((!is_numeric($matrixCell)) || ($matrixCell === null)) { + return Functions::VALUE(); + } + $matrixAData[$rowA][$columnA] = $matrixCell; + ++$columnA; + } + ++$rowA; + } + $matrixA = new Matrix($matrixAData); + $rowB = 0; + foreach ($matrixData2 as $matrixRow) { + if (!is_array($matrixRow)) { + $matrixRow = [$matrixRow]; + } + $columnB = 0; + foreach ($matrixRow as $matrixCell) { + if ((!is_numeric($matrixCell)) || ($matrixCell === null)) { + return Functions::VALUE(); + } + $matrixBData[$rowB][$columnB] = $matrixCell; + ++$columnB; + } + ++$rowB; + } + $matrixB = new Matrix($matrixBData); + + if ($columnA != $rowB) { + return Functions::VALUE(); + } + + return $matrixA->multiply($matrixB)->toArray(); + } catch (MatrixException $ex) { + return Functions::VALUE(); + } + } + + /** + * MOD. + * + * @param int $a Dividend + * @param int $b Divisor + * + * @return int|string Remainder, or a string containing an error + */ + public static function MOD($a = 1, $b = 1) + { + $a = (float) Functions::flattenSingleValue($a); + $b = (float) Functions::flattenSingleValue($b); + + if ($b == 0.0) { + return Functions::DIV0(); + } elseif (($a < 0.0) && ($b > 0.0)) { + return $b - fmod(abs($a), $b); + } elseif (($a > 0.0) && ($b < 0.0)) { + return $b + fmod($a, abs($b)); + } + + return fmod($a, $b); + } + + /** + * MROUND. + * + * Rounds a number to the nearest multiple of a specified value + * + * @param float $number Number to round + * @param int $multiple Multiple to which you want to round $number + * + * @return float|string Rounded Number, or a string containing an error + */ + public static function MROUND($number, $multiple) + { + $number = Functions::flattenSingleValue($number); + $multiple = Functions::flattenSingleValue($multiple); + + if ((is_numeric($number)) && (is_numeric($multiple))) { + if ($multiple == 0) { + return 0; + } + if ((self::SIGN($number)) == (self::SIGN($multiple))) { + $multiplier = 1 / $multiple; + + return round($number * $multiplier) / $multiplier; + } + + return Functions::NAN(); + } + + return Functions::VALUE(); + } + + /** + * MULTINOMIAL. + * + * Returns the ratio of the factorial of a sum of values to the product of factorials. + * + * @param array of mixed Data Series + * + * @return float|string The result, or a string containing an error + */ + public static function MULTINOMIAL(...$args) + { + $summer = 0; + $divisor = 1; + // Loop through arguments + foreach (Functions::flattenArray($args) as $arg) { + // Is it a numeric value? + if (is_numeric($arg)) { + if ($arg < 1) { + return Functions::NAN(); + } + $summer += floor($arg); + $divisor *= self::FACT($arg); + } else { + return Functions::VALUE(); + } + } + + // Return + if ($summer > 0) { + $summer = self::FACT($summer); + + return $summer / $divisor; + } + + return 0; + } + + /** + * ODD. + * + * Returns number rounded up to the nearest odd integer. + * + * @param float $number Number to round + * + * @return int|string Rounded Number, or a string containing an error + */ + public static function ODD($number) + { + $number = Functions::flattenSingleValue($number); + + if ($number === null) { + return 1; + } elseif (is_bool($number)) { + return 1; + } elseif (is_numeric($number)) { + $significance = self::SIGN($number); + if ($significance == 0) { + return 1; + } + + $result = self::CEILING($number, $significance); + if ($result == self::EVEN($result)) { + $result += $significance; + } + + return (int) $result; + } + + return Functions::VALUE(); + } + + /** + * POWER. + * + * Computes x raised to the power y. + * + * @param float $x + * @param float $y + * + * @return float|string The result, or a string containing an error + */ + public static function POWER($x = 0, $y = 2) + { + $x = Functions::flattenSingleValue($x); + $y = Functions::flattenSingleValue($y); + + // Validate parameters + if ($x == 0.0 && $y == 0.0) { + return Functions::NAN(); + } elseif ($x == 0.0 && $y < 0.0) { + return Functions::DIV0(); + } + + // Return + $result = pow($x, $y); + + return (!is_nan($result) && !is_infinite($result)) ? $result : Functions::NAN(); + } + + /** + * PRODUCT. + * + * PRODUCT returns the product of all the values and cells referenced in the argument list. + * + * Excel Function: + * PRODUCT(value1[,value2[, ...]]) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function PRODUCT(...$args) + { + // Return value + $returnValue = null; + + // Loop through arguments + foreach (Functions::flattenArray($args) as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if ($returnValue === null) { + $returnValue = $arg; + } else { + $returnValue *= $arg; + } + } + } + + // Return + if ($returnValue === null) { + return 0; + } + + return $returnValue; + } + + /** + * QUOTIENT. + * + * QUOTIENT function returns the integer portion of a division. Numerator is the divided number + * and denominator is the divisor. + * + * Excel Function: + * QUOTIENT(value1[,value2[, ...]]) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function QUOTIENT(...$args) + { + // Return value + $returnValue = null; + + // Loop through arguments + foreach (Functions::flattenArray($args) as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if ($returnValue === null) { + $returnValue = ($arg == 0) ? 0 : $arg; + } else { + if (($returnValue == 0) || ($arg == 0)) { + $returnValue = 0; + } else { + $returnValue /= $arg; + } + } + } + } + + // Return + return (int) $returnValue; + } + + /** + * RAND. + * + * @param int $min Minimal value + * @param int $max Maximal value + * + * @return int Random number + */ + public static function RAND($min = 0, $max = 0) + { + $min = Functions::flattenSingleValue($min); + $max = Functions::flattenSingleValue($max); + + if ($min == 0 && $max == 0) { + return (mt_rand(0, 10000000)) / 10000000; + } + + return mt_rand($min, $max); + } + + public static function ROMAN($aValue, $style = 0) + { + $aValue = Functions::flattenSingleValue($aValue); + $style = ($style === null) ? 0 : (int) Functions::flattenSingleValue($style); + if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) { + return Functions::VALUE(); + } + $aValue = (int) $aValue; + if ($aValue == 0) { + return ''; + } + + $mill = ['', 'M', 'MM', 'MMM', 'MMMM', 'MMMMM']; + $cent = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM']; + $tens = ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC']; + $ones = ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']; + + $roman = ''; + while ($aValue > 5999) { + $roman .= 'M'; + $aValue -= 1000; + } + $m = self::romanCut($aValue, 1000); + $aValue %= 1000; + $c = self::romanCut($aValue, 100); + $aValue %= 100; + $t = self::romanCut($aValue, 10); + $aValue %= 10; + + return $roman . $mill[$m] . $cent[$c] . $tens[$t] . $ones[$aValue]; + } + + /** + * ROUNDUP. + * + * Rounds a number up to a specified number of decimal places + * + * @param float $number Number to round + * @param int $digits Number of digits to which you want to round $number + * + * @return float|string Rounded Number, or a string containing an error + */ + public static function ROUNDUP($number, $digits) + { + $number = Functions::flattenSingleValue($number); + $digits = Functions::flattenSingleValue($digits); + + if ((is_numeric($number)) && (is_numeric($digits))) { + $significance = pow(10, (int) $digits); + if ($number < 0.0) { + return floor($number * $significance) / $significance; + } + + return ceil($number * $significance) / $significance; + } + + return Functions::VALUE(); + } + + /** + * ROUNDDOWN. + * + * Rounds a number down to a specified number of decimal places + * + * @param float $number Number to round + * @param int $digits Number of digits to which you want to round $number + * + * @return float|string Rounded Number, or a string containing an error + */ + public static function ROUNDDOWN($number, $digits) + { + $number = Functions::flattenSingleValue($number); + $digits = Functions::flattenSingleValue($digits); + + if ((is_numeric($number)) && (is_numeric($digits))) { + $significance = pow(10, (int) $digits); + if ($number < 0.0) { + return ceil($number * $significance) / $significance; + } + + return floor($number * $significance) / $significance; + } + + return Functions::VALUE(); + } + + /** + * SERIESSUM. + * + * Returns the sum of a power series + * + * @param float $x Input value to the power series + * @param float $n Initial power to which you want to raise $x + * @param float $m Step by which to increase $n for each term in the series + * @param array of mixed Data Series + * + * @return float|string The result, or a string containing an error + */ + public static function SERIESSUM(...$args) + { + $returnValue = 0; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + + $x = array_shift($aArgs); + $n = array_shift($aArgs); + $m = array_shift($aArgs); + + if ((is_numeric($x)) && (is_numeric($n)) && (is_numeric($m))) { + // Calculate + $i = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $returnValue += $arg * pow($x, $n + ($m * $i++)); + } else { + return Functions::VALUE(); + } + } + + return $returnValue; + } + + return Functions::VALUE(); + } + + /** + * SIGN. + * + * Determines the sign of a number. Returns 1 if the number is positive, zero (0) + * if the number is 0, and -1 if the number is negative. + * + * @param float $number Number to round + * + * @return int|string sign value, or a string containing an error + */ + public static function SIGN($number) + { + $number = Functions::flattenSingleValue($number); + + if (is_bool($number)) { + return (int) $number; + } + if (is_numeric($number)) { + if ($number == 0.0) { + return 0; + } + + return $number / abs($number); + } + + return Functions::VALUE(); + } + + /** + * SQRTPI. + * + * Returns the square root of (number * pi). + * + * @param float $number Number + * + * @return float|string Square Root of Number * Pi, or a string containing an error + */ + public static function SQRTPI($number) + { + $number = Functions::flattenSingleValue($number); + + if (is_numeric($number)) { + if ($number < 0) { + return Functions::NAN(); + } + + return sqrt($number * M_PI); + } + + return Functions::VALUE(); + } + + protected static function filterHiddenArgs($cellReference, $args) + { + return array_filter( + $args, + function ($index) use ($cellReference) { + [, $row, $column] = explode('.', $index); + + return $cellReference->getWorksheet()->getRowDimension($row)->getVisible() && + $cellReference->getWorksheet()->getColumnDimension($column)->getVisible(); + }, + ARRAY_FILTER_USE_KEY + ); + } + + protected static function filterFormulaArgs($cellReference, $args) + { + return array_filter( + $args, + function ($index) use ($cellReference) { + [, $row, $column] = explode('.', $index); + if ($cellReference->getWorksheet()->cellExists($column . $row)) { + //take this cell out if it contains the SUBTOTAL or AGGREGATE functions in a formula + $isFormula = $cellReference->getWorksheet()->getCell($column . $row)->isFormula(); + $cellFormula = !preg_match('/^=.*\b(SUBTOTAL|AGGREGATE)\s*\(/i', $cellReference->getWorksheet()->getCell($column . $row)->getValue()); + + return !$isFormula || $cellFormula; + } + + return true; + }, + ARRAY_FILTER_USE_KEY + ); + } + + /** + * SUBTOTAL. + * + * Returns a subtotal in a list or database. + * + * @param int the number 1 to 11 that specifies which function to + * use in calculating subtotals within a range + * list + * Numbers 101 to 111 shadow the functions of 1 to 11 + * but ignore any values in the range that are + * in hidden rows or columns + * @param array of mixed Data Series + * + * @return float|string + */ + public static function SUBTOTAL(...$args) + { + $cellReference = array_pop($args); + $aArgs = Functions::flattenArrayIndexed($args); + $subtotal = array_shift($aArgs); + + // Calculate + if ((is_numeric($subtotal)) && (!is_string($subtotal))) { + if ($subtotal > 100) { + $aArgs = self::filterHiddenArgs($cellReference, $aArgs); + $subtotal -= 100; + } + + $aArgs = self::filterFormulaArgs($cellReference, $aArgs); + switch ($subtotal) { + case 1: + return Statistical::AVERAGE($aArgs); + case 2: + return Statistical::COUNT($aArgs); + case 3: + return Statistical::COUNTA($aArgs); + case 4: + return Statistical::MAX($aArgs); + case 5: + return Statistical::MIN($aArgs); + case 6: + return self::PRODUCT($aArgs); + case 7: + return Statistical::STDEV($aArgs); + case 8: + return Statistical::STDEVP($aArgs); + case 9: + return self::SUM($aArgs); + case 10: + return Statistical::VARFunc($aArgs); + case 11: + return Statistical::VARP($aArgs); + } + } + + return Functions::VALUE(); + } + + /** + * SUM. + * + * SUM computes the sum of all the values and cells referenced in the argument list. + * + * Excel Function: + * SUM(value1[,value2[, ...]]) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function SUM(...$args) + { + $returnValue = 0; + + // Loop through the arguments + foreach (Functions::flattenArray($args) as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $returnValue += $arg; + } + } + + return $returnValue; + } + + /** + * SUMIF. + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * SUMIF(value1[,value2[, ...]],condition) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed $aArgs Data values + * @param string $condition the criteria that defines which cells will be summed + * @param mixed $sumArgs + * + * @return float + */ + public static function SUMIF($aArgs, $condition, $sumArgs = []) + { + $returnValue = 0; + + $aArgs = Functions::flattenArray($aArgs); + $sumArgs = Functions::flattenArray($sumArgs); + if (empty($sumArgs)) { + $sumArgs = $aArgs; + } + $condition = Functions::ifCondition($condition); + // Loop through arguments + foreach ($aArgs as $key => $arg) { + if (!is_numeric($arg)) { + $arg = str_replace('"', '""', $arg); + $arg = Calculation::wrapResult(strtoupper($arg)); + } + + $testCondition = '=' . $arg . $condition; + $sumValue = array_key_exists($key, $sumArgs) ? $sumArgs[$key] : 0; + + if (is_numeric($sumValue) && + Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + // Is it a value within our criteria and only numeric can be added to the result + $returnValue += $sumValue; + } + } + + return $returnValue; + } + + /** + * SUMIFS. + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * SUMIFS(value1[,value2[, ...]],condition) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed $args Data values + * @param string $condition the criteria that defines which cells will be summed + * + * @return float + */ + public static function SUMIFS(...$args) + { + $arrayList = $args; + + // Return value + $returnValue = 0; + + $sumArgs = Functions::flattenArray(array_shift($arrayList)); + $aArgsArray = []; + $conditions = []; + + while (count($arrayList) > 0) { + $aArgsArray[] = Functions::flattenArray(array_shift($arrayList)); + $conditions[] = Functions::ifCondition(array_shift($arrayList)); + } + + // Loop through each sum and see if arguments and conditions are true + foreach ($sumArgs as $index => $value) { + $valid = true; + + foreach ($conditions as $cidx => $condition) { + $arg = $aArgsArray[$cidx][$index]; + + // Loop through arguments + if (!is_numeric($arg)) { + $arg = Calculation::wrapResult(strtoupper($arg)); + } + $testCondition = '=' . $arg . $condition; + if (!Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + // Is not a value within our criteria + $valid = false; + + break; // if false found, don't need to check other conditions + } + } + + if ($valid) { + $returnValue += $value; + } + } + + // Return + return $returnValue; + } + + /** + * SUMPRODUCT. + * + * Excel Function: + * SUMPRODUCT(value1[,value2[, ...]]) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed ...$args Data values + * + * @return float|string The result, or a string containing an error + */ + public static function SUMPRODUCT(...$args) + { + $arrayList = $args; + + $wrkArray = Functions::flattenArray(array_shift($arrayList)); + $wrkCellCount = count($wrkArray); + + for ($i = 0; $i < $wrkCellCount; ++$i) { + if ((!is_numeric($wrkArray[$i])) || (is_string($wrkArray[$i]))) { + $wrkArray[$i] = 0; + } + } + + foreach ($arrayList as $matrixData) { + $array2 = Functions::flattenArray($matrixData); + $count = count($array2); + if ($wrkCellCount != $count) { + return Functions::VALUE(); + } + + foreach ($array2 as $i => $val) { + if ((!is_numeric($val)) || (is_string($val))) { + $val = 0; + } + $wrkArray[$i] *= $val; + } + } + + return array_sum($wrkArray); + } + + /** + * SUMSQ. + * + * SUMSQ returns the sum of the squares of the arguments + * + * Excel Function: + * SUMSQ(value1[,value2[, ...]]) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function SUMSQ(...$args) + { + $returnValue = 0; + + // Loop through arguments + foreach (Functions::flattenArray($args) as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $returnValue += ($arg * $arg); + } + } + + return $returnValue; + } + + /** + * SUMX2MY2. + * + * @param mixed[] $matrixData1 Matrix #1 + * @param mixed[] $matrixData2 Matrix #2 + * + * @return float + */ + public static function SUMX2MY2($matrixData1, $matrixData2) + { + $array1 = Functions::flattenArray($matrixData1); + $array2 = Functions::flattenArray($matrixData2); + $count = min(count($array1), count($array2)); + + $result = 0; + for ($i = 0; $i < $count; ++$i) { + if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) && + ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) { + $result += ($array1[$i] * $array1[$i]) - ($array2[$i] * $array2[$i]); + } + } + + return $result; + } + + /** + * SUMX2PY2. + * + * @param mixed[] $matrixData1 Matrix #1 + * @param mixed[] $matrixData2 Matrix #2 + * + * @return float + */ + public static function SUMX2PY2($matrixData1, $matrixData2) + { + $array1 = Functions::flattenArray($matrixData1); + $array2 = Functions::flattenArray($matrixData2); + $count = min(count($array1), count($array2)); + + $result = 0; + for ($i = 0; $i < $count; ++$i) { + if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) && + ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) { + $result += ($array1[$i] * $array1[$i]) + ($array2[$i] * $array2[$i]); + } + } + + return $result; + } + + /** + * SUMXMY2. + * + * @param mixed[] $matrixData1 Matrix #1 + * @param mixed[] $matrixData2 Matrix #2 + * + * @return float + */ + public static function SUMXMY2($matrixData1, $matrixData2) + { + $array1 = Functions::flattenArray($matrixData1); + $array2 = Functions::flattenArray($matrixData2); + $count = min(count($array1), count($array2)); + + $result = 0; + for ($i = 0; $i < $count; ++$i) { + if (((is_numeric($array1[$i])) && (!is_string($array1[$i]))) && + ((is_numeric($array2[$i])) && (!is_string($array2[$i])))) { + $result += ($array1[$i] - $array2[$i]) * ($array1[$i] - $array2[$i]); + } + } + + return $result; + } + + /** + * TRUNC. + * + * Truncates value to the number of fractional digits by number_digits. + * + * @param float $value + * @param int $digits + * + * @return float|string Truncated value, or a string containing an error + */ + public static function TRUNC($value = 0, $digits = 0) + { + $value = Functions::flattenSingleValue($value); + $digits = Functions::flattenSingleValue($digits); + + // Validate parameters + if ((!is_numeric($value)) || (!is_numeric($digits))) { + return Functions::VALUE(); + } + $digits = floor($digits); + + // Truncate + $adjust = pow(10, $digits); + + if (($digits > 0) && (rtrim((int) ((abs($value) - abs((int) $value)) * $adjust), '0') < $adjust / 10)) { + return $value; + } + + return ((int) ($value * $adjust)) / $adjust; + } + + /** + * SEC. + * + * Returns the secant of an angle. + * + * @param float $angle Number + * + * @return float|string The secant of the angle + */ + public static function SEC($angle) + { + $angle = Functions::flattenSingleValue($angle); + + if (!is_numeric($angle)) { + return Functions::VALUE(); + } + + $result = cos($angle); + + return ($result == 0.0) ? Functions::DIV0() : 1 / $result; + } + + /** + * SECH. + * + * Returns the hyperbolic secant of an angle. + * + * @param float $angle Number + * + * @return float|string The hyperbolic secant of the angle + */ + public static function SECH($angle) + { + $angle = Functions::flattenSingleValue($angle); + + if (!is_numeric($angle)) { + return Functions::VALUE(); + } + + $result = cosh($angle); + + return ($result == 0.0) ? Functions::DIV0() : 1 / $result; + } + + /** + * CSC. + * + * Returns the cosecant of an angle. + * + * @param float $angle Number + * + * @return float|string The cosecant of the angle + */ + public static function CSC($angle) + { + $angle = Functions::flattenSingleValue($angle); + + if (!is_numeric($angle)) { + return Functions::VALUE(); + } + + $result = sin($angle); + + return ($result == 0.0) ? Functions::DIV0() : 1 / $result; + } + + /** + * CSCH. + * + * Returns the hyperbolic cosecant of an angle. + * + * @param float $angle Number + * + * @return float|string The hyperbolic cosecant of the angle + */ + public static function CSCH($angle) + { + $angle = Functions::flattenSingleValue($angle); + + if (!is_numeric($angle)) { + return Functions::VALUE(); + } + + $result = sinh($angle); + + return ($result == 0.0) ? Functions::DIV0() : 1 / $result; + } + + /** + * COT. + * + * Returns the cotangent of an angle. + * + * @param float $angle Number + * + * @return float|string The cotangent of the angle + */ + public static function COT($angle) + { + $angle = Functions::flattenSingleValue($angle); + + if (!is_numeric($angle)) { + return Functions::VALUE(); + } + + $result = tan($angle); + + return ($result == 0.0) ? Functions::DIV0() : 1 / $result; + } + + /** + * COTH. + * + * Returns the hyperbolic cotangent of an angle. + * + * @param float $angle Number + * + * @return float|string The hyperbolic cotangent of the angle + */ + public static function COTH($angle) + { + $angle = Functions::flattenSingleValue($angle); + + if (!is_numeric($angle)) { + return Functions::VALUE(); + } + + $result = tanh($angle); + + return ($result == 0.0) ? Functions::DIV0() : 1 / $result; + } + + /** + * ACOT. + * + * Returns the arccotangent of a number. + * + * @param float $number Number + * + * @return float|string The arccotangent of the number + */ + public static function ACOT($number) + { + $number = Functions::flattenSingleValue($number); + + if (!is_numeric($number)) { + return Functions::VALUE(); + } + + return (M_PI / 2) - atan($number); + } + + /** + * ACOTH. + * + * Returns the hyperbolic arccotangent of a number. + * + * @param float $number Number + * + * @return float|string The hyperbolic arccotangent of the number + */ + public static function ACOTH($number) + { + $number = Functions::flattenSingleValue($number); + + if (!is_numeric($number)) { + return Functions::VALUE(); + } + + $result = log(($number + 1) / ($number - 1)) / 2; + + return is_nan($result) ? Functions::NAN() : $result; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php new file mode 100644 index 0000000..b1c7fb0 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Statistical.php @@ -0,0 +1,3773 @@ + $value) { + if ((is_bool($value)) || (is_string($value)) || ($value === null)) { + unset($array1[$key], $array2[$key]); + } + } + foreach ($array2 as $key => $value) { + if ((is_bool($value)) || (is_string($value)) || ($value === null)) { + unset($array1[$key], $array2[$key]); + } + } + $array1 = array_merge($array1); + $array2 = array_merge($array2); + + return true; + } + + /** + * Incomplete beta function. + * + * @author Jaco van Kooten + * @author Paul Meagher + * + * The computation is based on formulas from Numerical Recipes, Chapter 6.4 (W.H. Press et al, 1992). + * + * @param mixed $x require 0<=x<=1 + * @param mixed $p require p>0 + * @param mixed $q require q>0 + * + * @return float 0 if x<0, p<=0, q<=0 or p+q>2.55E305 and 1 if x>1 to avoid errors and over/underflow + */ + private static function incompleteBeta($x, $p, $q) + { + if ($x <= 0.0) { + return 0.0; + } elseif ($x >= 1.0) { + return 1.0; + } elseif (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > self::LOG_GAMMA_X_MAX_VALUE)) { + return 0.0; + } + $beta_gam = exp((0 - self::logBeta($p, $q)) + $p * log($x) + $q * log(1.0 - $x)); + if ($x < ($p + 1.0) / ($p + $q + 2.0)) { + return $beta_gam * self::betaFraction($x, $p, $q) / $p; + } + + return 1.0 - ($beta_gam * self::betaFraction(1 - $x, $q, $p) / $q); + } + + // Function cache for logBeta function + private static $logBetaCacheP = 0.0; + + private static $logBetaCacheQ = 0.0; + + private static $logBetaCacheResult = 0.0; + + /** + * The natural logarithm of the beta function. + * + * @param mixed $p require p>0 + * @param mixed $q require q>0 + * + * @return float 0 if p<=0, q<=0 or p+q>2.55E305 to avoid errors and over/underflow + * + * @author Jaco van Kooten + */ + private static function logBeta($p, $q) + { + if ($p != self::$logBetaCacheP || $q != self::$logBetaCacheQ) { + self::$logBetaCacheP = $p; + self::$logBetaCacheQ = $q; + if (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > self::LOG_GAMMA_X_MAX_VALUE)) { + self::$logBetaCacheResult = 0.0; + } else { + self::$logBetaCacheResult = self::logGamma($p) + self::logGamma($q) - self::logGamma($p + $q); + } + } + + return self::$logBetaCacheResult; + } + + /** + * Evaluates of continued fraction part of incomplete beta function. + * Based on an idea from Numerical Recipes (W.H. Press et al, 1992). + * + * @author Jaco van Kooten + * + * @param mixed $x + * @param mixed $p + * @param mixed $q + * + * @return float + */ + private static function betaFraction($x, $p, $q) + { + $c = 1.0; + $sum_pq = $p + $q; + $p_plus = $p + 1.0; + $p_minus = $p - 1.0; + $h = 1.0 - $sum_pq * $x / $p_plus; + if (abs($h) < self::XMININ) { + $h = self::XMININ; + } + $h = 1.0 / $h; + $frac = $h; + $m = 1; + $delta = 0.0; + while ($m <= self::MAX_ITERATIONS && abs($delta - 1.0) > Functions::PRECISION) { + $m2 = 2 * $m; + // even index for d + $d = $m * ($q - $m) * $x / (($p_minus + $m2) * ($p + $m2)); + $h = 1.0 + $d * $h; + if (abs($h) < self::XMININ) { + $h = self::XMININ; + } + $h = 1.0 / $h; + $c = 1.0 + $d / $c; + if (abs($c) < self::XMININ) { + $c = self::XMININ; + } + $frac *= $h * $c; + // odd index for d + $d = -($p + $m) * ($sum_pq + $m) * $x / (($p + $m2) * ($p_plus + $m2)); + $h = 1.0 + $d * $h; + if (abs($h) < self::XMININ) { + $h = self::XMININ; + } + $h = 1.0 / $h; + $c = 1.0 + $d / $c; + if (abs($c) < self::XMININ) { + $c = self::XMININ; + } + $delta = $h * $c; + $frac *= $delta; + ++$m; + } + + return $frac; + } + + /** + * logGamma function. + * + * @version 1.1 + * + * @author Jaco van Kooten + * + * Original author was Jaco van Kooten. Ported to PHP by Paul Meagher. + * + * The natural logarithm of the gamma function.
+ * Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz
+ * Applied Mathematics Division
+ * Argonne National Laboratory
+ * Argonne, IL 60439
+ *

+ * References: + *

    + *
  1. W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for the Natural + * Logarithm of the Gamma Function,' Math. Comp. 21, 1967, pp. 198-203.
  2. + *
  3. K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May, 1969.
  4. + *
  5. Hart, Et. Al., Computer Approximations, Wiley and sons, New York, 1968.
  6. + *
+ *

+ *

+ * From the original documentation: + *

+ *

+ * This routine calculates the LOG(GAMMA) function for a positive real argument X. + * Computation is based on an algorithm outlined in references 1 and 2. + * The program uses rational functions that theoretically approximate LOG(GAMMA) + * to at least 18 significant decimal digits. The approximation for X > 12 is from + * reference 3, while approximations for X < 12.0 are similar to those in reference + * 1, but are unpublished. The accuracy achieved depends on the arithmetic system, + * the compiler, the intrinsic functions, and proper selection of the + * machine-dependent constants. + *

+ *

+ * Error returns:
+ * The program returns the value XINF for X .LE. 0.0 or when overflow would occur. + * The computation is believed to be free of underflow and overflow. + *

+ * + * @return float MAX_VALUE for x < 0.0 or when overflow would occur, i.e. x > 2.55E305 + */ + + // Function cache for logGamma + private static $logGammaCacheResult = 0.0; + + private static $logGammaCacheX = 0.0; + + private static function logGamma($x) + { + // Log Gamma related constants + static $lg_d1 = -0.5772156649015328605195174; + static $lg_d2 = 0.4227843350984671393993777; + static $lg_d4 = 1.791759469228055000094023; + + static $lg_p1 = [ + 4.945235359296727046734888, + 201.8112620856775083915565, + 2290.838373831346393026739, + 11319.67205903380828685045, + 28557.24635671635335736389, + 38484.96228443793359990269, + 26377.48787624195437963534, + 7225.813979700288197698961, + ]; + static $lg_p2 = [ + 4.974607845568932035012064, + 542.4138599891070494101986, + 15506.93864978364947665077, + 184793.2904445632425417223, + 1088204.76946882876749847, + 3338152.967987029735917223, + 5106661.678927352456275255, + 3074109.054850539556250927, + ]; + static $lg_p4 = [ + 14745.02166059939948905062, + 2426813.369486704502836312, + 121475557.4045093227939592, + 2663432449.630976949898078, + 29403789566.34553899906876, + 170266573776.5398868392998, + 492612579337.743088758812, + 560625185622.3951465078242, + ]; + static $lg_q1 = [ + 67.48212550303777196073036, + 1113.332393857199323513008, + 7738.757056935398733233834, + 27639.87074403340708898585, + 54993.10206226157329794414, + 61611.22180066002127833352, + 36351.27591501940507276287, + 8785.536302431013170870835, + ]; + static $lg_q2 = [ + 183.0328399370592604055942, + 7765.049321445005871323047, + 133190.3827966074194402448, + 1136705.821321969608938755, + 5267964.117437946917577538, + 13467014.54311101692290052, + 17827365.30353274213975932, + 9533095.591844353613395747, + ]; + static $lg_q4 = [ + 2690.530175870899333379843, + 639388.5654300092398984238, + 41355999.30241388052042842, + 1120872109.61614794137657, + 14886137286.78813811542398, + 101680358627.2438228077304, + 341747634550.7377132798597, + 446315818741.9713286462081, + ]; + static $lg_c = [ + -0.001910444077728, + 8.4171387781295e-4, + -5.952379913043012e-4, + 7.93650793500350248e-4, + -0.002777777777777681622553, + 0.08333333333333333331554247, + 0.0057083835261, + ]; + + // Rough estimate of the fourth root of logGamma_xBig + static $lg_frtbig = 2.25e76; + static $pnt68 = 0.6796875; + + if ($x == self::$logGammaCacheX) { + return self::$logGammaCacheResult; + } + $y = $x; + if ($y > 0.0 && $y <= self::LOG_GAMMA_X_MAX_VALUE) { + if ($y <= self::EPS) { + $res = -log($y); + } elseif ($y <= 1.5) { + // --------------------- + // EPS .LT. X .LE. 1.5 + // --------------------- + if ($y < $pnt68) { + $corr = -log($y); + $xm1 = $y; + } else { + $corr = 0.0; + $xm1 = $y - 1.0; + } + if ($y <= 0.5 || $y >= $pnt68) { + $xden = 1.0; + $xnum = 0.0; + for ($i = 0; $i < 8; ++$i) { + $xnum = $xnum * $xm1 + $lg_p1[$i]; + $xden = $xden * $xm1 + $lg_q1[$i]; + } + $res = $corr + $xm1 * ($lg_d1 + $xm1 * ($xnum / $xden)); + } else { + $xm2 = $y - 1.0; + $xden = 1.0; + $xnum = 0.0; + for ($i = 0; $i < 8; ++$i) { + $xnum = $xnum * $xm2 + $lg_p2[$i]; + $xden = $xden * $xm2 + $lg_q2[$i]; + } + $res = $corr + $xm2 * ($lg_d2 + $xm2 * ($xnum / $xden)); + } + } elseif ($y <= 4.0) { + // --------------------- + // 1.5 .LT. X .LE. 4.0 + // --------------------- + $xm2 = $y - 2.0; + $xden = 1.0; + $xnum = 0.0; + for ($i = 0; $i < 8; ++$i) { + $xnum = $xnum * $xm2 + $lg_p2[$i]; + $xden = $xden * $xm2 + $lg_q2[$i]; + } + $res = $xm2 * ($lg_d2 + $xm2 * ($xnum / $xden)); + } elseif ($y <= 12.0) { + // ---------------------- + // 4.0 .LT. X .LE. 12.0 + // ---------------------- + $xm4 = $y - 4.0; + $xden = -1.0; + $xnum = 0.0; + for ($i = 0; $i < 8; ++$i) { + $xnum = $xnum * $xm4 + $lg_p4[$i]; + $xden = $xden * $xm4 + $lg_q4[$i]; + } + $res = $lg_d4 + $xm4 * ($xnum / $xden); + } else { + // --------------------------------- + // Evaluate for argument .GE. 12.0 + // --------------------------------- + $res = 0.0; + if ($y <= $lg_frtbig) { + $res = $lg_c[6]; + $ysq = $y * $y; + for ($i = 0; $i < 6; ++$i) { + $res = $res / $ysq + $lg_c[$i]; + } + $res /= $y; + $corr = log($y); + $res = $res + log(self::SQRT2PI) - 0.5 * $corr; + $res += $y * ($corr - 1.0); + } + } + } else { + // -------------------------- + // Return for bad arguments + // -------------------------- + $res = self::MAX_VALUE; + } + // ------------------------------ + // Final adjustments and return + // ------------------------------ + self::$logGammaCacheX = $x; + self::$logGammaCacheResult = $res; + + return $res; + } + + // + // Private implementation of the incomplete Gamma function + // + private static function incompleteGamma($a, $x) + { + static $max = 32; + $summer = 0; + for ($n = 0; $n <= $max; ++$n) { + $divisor = $a; + for ($i = 1; $i <= $n; ++$i) { + $divisor *= ($a + $i); + } + $summer += (pow($x, $n) / $divisor); + } + + return pow($x, $a) * exp(0 - $x) * $summer; + } + + // + // Private implementation of the Gamma function + // + private static function gamma($data) + { + if ($data == 0.0) { + return 0; + } + + static $p0 = 1.000000000190015; + static $p = [ + 1 => 76.18009172947146, + 2 => -86.50532032941677, + 3 => 24.01409824083091, + 4 => -1.231739572450155, + 5 => 1.208650973866179e-3, + 6 => -5.395239384953e-6, + ]; + + $y = $x = $data; + $tmp = $x + 5.5; + $tmp -= ($x + 0.5) * log($tmp); + + $summer = $p0; + for ($j = 1; $j <= 6; ++$j) { + $summer += ($p[$j] / ++$y); + } + + return exp(0 - $tmp + log(self::SQRT2PI * $summer / $x)); + } + + /* + * inverse_ncdf.php + * ------------------- + * begin : Friday, January 16, 2004 + * copyright : (C) 2004 Michael Nickerson + * email : nickersonm@yahoo.com + * + */ + private static function inverseNcdf($p) + { + // Inverse ncdf approximation by Peter J. Acklam, implementation adapted to + // PHP by Michael Nickerson, using Dr. Thomas Ziegler's C implementation as + // a guide. http://home.online.no/~pjacklam/notes/invnorm/index.html + // I have not checked the accuracy of this implementation. Be aware that PHP + // will truncate the coeficcients to 14 digits. + + // You have permission to use and distribute this function freely for + // whatever purpose you want, but please show common courtesy and give credit + // where credit is due. + + // Input paramater is $p - probability - where 0 < p < 1. + + // Coefficients in rational approximations + static $a = [ + 1 => -3.969683028665376e+01, + 2 => 2.209460984245205e+02, + 3 => -2.759285104469687e+02, + 4 => 1.383577518672690e+02, + 5 => -3.066479806614716e+01, + 6 => 2.506628277459239e+00, + ]; + + static $b = [ + 1 => -5.447609879822406e+01, + 2 => 1.615858368580409e+02, + 3 => -1.556989798598866e+02, + 4 => 6.680131188771972e+01, + 5 => -1.328068155288572e+01, + ]; + + static $c = [ + 1 => -7.784894002430293e-03, + 2 => -3.223964580411365e-01, + 3 => -2.400758277161838e+00, + 4 => -2.549732539343734e+00, + 5 => 4.374664141464968e+00, + 6 => 2.938163982698783e+00, + ]; + + static $d = [ + 1 => 7.784695709041462e-03, + 2 => 3.224671290700398e-01, + 3 => 2.445134137142996e+00, + 4 => 3.754408661907416e+00, + ]; + + // Define lower and upper region break-points. + $p_low = 0.02425; //Use lower region approx. below this + $p_high = 1 - $p_low; //Use upper region approx. above this + + if (0 < $p && $p < $p_low) { + // Rational approximation for lower region. + $q = sqrt(-2 * log($p)); + + return ((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) * $q + $c[6]) / + (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1); + } elseif ($p_low <= $p && $p <= $p_high) { + // Rational approximation for central region. + $q = $p - 0.5; + $r = $q * $q; + + return ((((($a[1] * $r + $a[2]) * $r + $a[3]) * $r + $a[4]) * $r + $a[5]) * $r + $a[6]) * $q / + ((((($b[1] * $r + $b[2]) * $r + $b[3]) * $r + $b[4]) * $r + $b[5]) * $r + 1); + } elseif ($p_high < $p && $p < 1) { + // Rational approximation for upper region. + $q = sqrt(-2 * log(1 - $p)); + + return -((((($c[1] * $q + $c[2]) * $q + $c[3]) * $q + $c[4]) * $q + $c[5]) * $q + $c[6]) / + (((($d[1] * $q + $d[2]) * $q + $d[3]) * $q + $d[4]) * $q + 1); + } + // If 0 < p < 1, return a null value + return Functions::NULL(); + } + + /** + * MS Excel does not count Booleans if passed as cell values, but they are counted if passed as literals. + * OpenOffice Calc always counts Booleans. + * Gnumeric never counts Booleans. + * + * @param mixed $arg + * @param mixed $k + * + * @return int|mixed + */ + private static function testAcceptedBoolean($arg, $k) + { + if ((is_bool($arg)) && + ((!Functions::isCellValue($k) && (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_EXCEL)) || + (Functions::getCompatibilityMode() === Functions::COMPATIBILITY_OPENOFFICE))) { + $arg = (int) $arg; + } + + return $arg; + } + + /** + * @param mixed $arg + * @param mixed $k + * + * @return bool + */ + private static function isAcceptedCountable($arg, $k) + { + if (((is_numeric($arg)) && (!is_string($arg))) || + ((is_numeric($arg)) && (!Functions::isCellValue($k)) && + (Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_GNUMERIC))) { + return true; + } + + return false; + } + + /** + * AVEDEV. + * + * Returns the average of the absolute deviations of data points from their mean. + * AVEDEV is a measure of the variability in a data set. + * + * Excel Function: + * AVEDEV(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function AVEDEV(...$args) + { + $aArgs = Functions::flattenArrayIndexed($args); + + // Return value + $returnValue = 0; + + $aMean = self::AVERAGE(...$args); + if ($aMean === Functions::DIV0()) { + return Functions::NAN(); + } elseif ($aMean === Functions::VALUE()) { + return Functions::VALUE(); + } + + $aCount = 0; + foreach ($aArgs as $k => $arg) { + $arg = self::testAcceptedBoolean($arg, $k); + // Is it a numeric value? + // Strings containing numeric values are only counted if they are string literals (not cell values) + // and then only in MS Excel and in Open Office, not in Gnumeric + if ((is_string($arg)) && (!is_numeric($arg)) && (!Functions::isCellValue($k))) { + return Functions::VALUE(); + } + if (self::isAcceptedCountable($arg, $k)) { + $returnValue += abs($arg - $aMean); + ++$aCount; + } + } + + // Return + if ($aCount === 0) { + return Functions::DIV0(); + } + + return $returnValue / $aCount; + } + + /** + * AVERAGE. + * + * Returns the average (arithmetic mean) of the arguments + * + * Excel Function: + * AVERAGE(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function AVERAGE(...$args) + { + $returnValue = $aCount = 0; + + // Loop through arguments + foreach (Functions::flattenArrayIndexed($args) as $k => $arg) { + $arg = self::testAcceptedBoolean($arg, $k); + // Is it a numeric value? + // Strings containing numeric values are only counted if they are string literals (not cell values) + // and then only in MS Excel and in Open Office, not in Gnumeric + if ((is_string($arg)) && (!is_numeric($arg)) && (!Functions::isCellValue($k))) { + return Functions::VALUE(); + } + if (self::isAcceptedCountable($arg, $k)) { + $returnValue += $arg; + ++$aCount; + } + } + + // Return + if ($aCount > 0) { + return $returnValue / $aCount; + } + + return Functions::DIV0(); + } + + /** + * AVERAGEA. + * + * Returns the average of its arguments, including numbers, text, and logical values + * + * Excel Function: + * AVERAGEA(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function AVERAGEA(...$args) + { + $returnValue = null; + + $aCount = 0; + // Loop through arguments + foreach (Functions::flattenArrayIndexed($args) as $k => $arg) { + if ((is_bool($arg)) && + (!Functions::isMatrixValue($k))) { + } else { + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { + if (is_bool($arg)) { + $arg = (int) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + $returnValue += $arg; + ++$aCount; + } + } + } + + if ($aCount > 0) { + return $returnValue / $aCount; + } + + return Functions::DIV0(); + } + + /** + * AVERAGEIF. + * + * Returns the average value from a range of cells that contain numbers within the list of arguments + * + * Excel Function: + * AVERAGEIF(value1[,value2[, ...]],condition) + * + * @category Mathematical and Trigonometric Functions + * + * @param mixed $aArgs Data values + * @param string $condition the criteria that defines which cells will be checked + * @param mixed[] $averageArgs Data values + * + * @return float|string + */ + public static function AVERAGEIF($aArgs, $condition, $averageArgs = []) + { + $returnValue = 0; + + $aArgs = Functions::flattenArray($aArgs); + $averageArgs = Functions::flattenArray($averageArgs); + if (empty($averageArgs)) { + $averageArgs = $aArgs; + } + $condition = Functions::ifCondition($condition); + $conditionIsNumeric = strpos($condition, '"') === false; + + // Loop through arguments + $aCount = 0; + foreach ($aArgs as $key => $arg) { + if (!is_numeric($arg)) { + if ($conditionIsNumeric) { + continue; + } + $arg = Calculation::wrapResult(strtoupper($arg)); + } elseif (!$conditionIsNumeric) { + continue; + } + $testCondition = '=' . $arg . $condition; + if (Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + $returnValue += $averageArgs[$key]; + ++$aCount; + } + } + + if ($aCount > 0) { + return $returnValue / $aCount; + } + + return Functions::DIV0(); + } + + /** + * BETADIST. + * + * Returns the beta distribution. + * + * @param float $value Value at which you want to evaluate the distribution + * @param float $alpha Parameter to the distribution + * @param float $beta Parameter to the distribution + * @param mixed $rMin + * @param mixed $rMax + * + * @return float|string + */ + public static function BETADIST($value, $alpha, $beta, $rMin = 0, $rMax = 1) + { + $value = Functions::flattenSingleValue($value); + $alpha = Functions::flattenSingleValue($alpha); + $beta = Functions::flattenSingleValue($beta); + $rMin = Functions::flattenSingleValue($rMin); + $rMax = Functions::flattenSingleValue($rMax); + + if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) { + if (($value < $rMin) || ($value > $rMax) || ($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax)) { + return Functions::NAN(); + } + if ($rMin > $rMax) { + $tmp = $rMin; + $rMin = $rMax; + $rMax = $tmp; + } + $value -= $rMin; + $value /= ($rMax - $rMin); + + return self::incompleteBeta($value, $alpha, $beta); + } + + return Functions::VALUE(); + } + + /** + * BETAINV. + * + * Returns the inverse of the beta distribution. + * + * @param float $probability Probability at which you want to evaluate the distribution + * @param float $alpha Parameter to the distribution + * @param float $beta Parameter to the distribution + * @param float $rMin Minimum value + * @param float $rMax Maximum value + * + * @return float|string + */ + public static function BETAINV($probability, $alpha, $beta, $rMin = 0, $rMax = 1) + { + $probability = Functions::flattenSingleValue($probability); + $alpha = Functions::flattenSingleValue($alpha); + $beta = Functions::flattenSingleValue($beta); + $rMin = Functions::flattenSingleValue($rMin); + $rMax = Functions::flattenSingleValue($rMax); + + if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta)) && (is_numeric($rMin)) && (is_numeric($rMax))) { + if (($alpha <= 0) || ($beta <= 0) || ($rMin == $rMax) || ($probability <= 0) || ($probability > 1)) { + return Functions::NAN(); + } + if ($rMin > $rMax) { + $tmp = $rMin; + $rMin = $rMax; + $rMax = $tmp; + } + $a = 0; + $b = 2; + + $i = 0; + while ((($b - $a) > Functions::PRECISION) && ($i++ < self::MAX_ITERATIONS)) { + $guess = ($a + $b) / 2; + $result = self::BETADIST($guess, $alpha, $beta); + if (($result == $probability) || ($result == 0)) { + $b = $a; + } elseif ($result > $probability) { + $b = $guess; + } else { + $a = $guess; + } + } + if ($i == self::MAX_ITERATIONS) { + return Functions::NA(); + } + + return round($rMin + $guess * ($rMax - $rMin), 12); + } + + return Functions::VALUE(); + } + + /** + * BINOMDIST. + * + * Returns the individual term binomial distribution probability. Use BINOMDIST in problems with + * a fixed number of tests or trials, when the outcomes of any trial are only success or failure, + * when trials are independent, and when the probability of success is constant throughout the + * experiment. For example, BINOMDIST can calculate the probability that two of the next three + * babies born are male. + * + * @param float $value Number of successes in trials + * @param float $trials Number of trials + * @param float $probability Probability of success on each trial + * @param bool $cumulative + * + * @return float|string + */ + public static function BINOMDIST($value, $trials, $probability, $cumulative) + { + $value = Functions::flattenSingleValue($value); + $trials = Functions::flattenSingleValue($trials); + $probability = Functions::flattenSingleValue($probability); + + if ((is_numeric($value)) && (is_numeric($trials)) && (is_numeric($probability))) { + $value = floor($value); + $trials = floor($trials); + if (($value < 0) || ($value > $trials)) { + return Functions::NAN(); + } + if (($probability < 0) || ($probability > 1)) { + return Functions::NAN(); + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + $summer = 0; + for ($i = 0; $i <= $value; ++$i) { + $summer += MathTrig::COMBIN($trials, $i) * pow($probability, $i) * pow(1 - $probability, $trials - $i); + } + + return $summer; + } + + return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value); + } + } + + return Functions::VALUE(); + } + + /** + * CHIDIST. + * + * Returns the one-tailed probability of the chi-squared distribution. + * + * @param float $value Value for the function + * @param float $degrees degrees of freedom + * + * @return float|string + */ + public static function CHIDIST($value, $degrees) + { + $value = Functions::flattenSingleValue($value); + $degrees = Functions::flattenSingleValue($degrees); + + if ((is_numeric($value)) && (is_numeric($degrees))) { + $degrees = floor($degrees); + if ($degrees < 1) { + return Functions::NAN(); + } + if ($value < 0) { + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + return 1; + } + + return Functions::NAN(); + } + + return 1 - (self::incompleteGamma($degrees / 2, $value / 2) / self::gamma($degrees / 2)); + } + + return Functions::VALUE(); + } + + /** + * CHIINV. + * + * Returns the one-tailed probability of the chi-squared distribution. + * + * @param float $probability Probability for the function + * @param float $degrees degrees of freedom + * + * @return float|string + */ + public static function CHIINV($probability, $degrees) + { + $probability = Functions::flattenSingleValue($probability); + $degrees = Functions::flattenSingleValue($degrees); + + if ((is_numeric($probability)) && (is_numeric($degrees))) { + $degrees = floor($degrees); + + $xLo = 100; + $xHi = 0; + + $x = $xNew = 1; + $dx = 1; + $i = 0; + + while ((abs($dx) > Functions::PRECISION) && ($i++ < self::MAX_ITERATIONS)) { + // Apply Newton-Raphson step + $result = 1 - (self::incompleteGamma($degrees / 2, $x / 2) / self::gamma($degrees / 2)); + $error = $result - $probability; + if ($error == 0.0) { + $dx = 0; + } elseif ($error < 0.0) { + $xLo = $x; + } else { + $xHi = $x; + } + // Avoid division by zero + if ($result != 0.0) { + $dx = $error / $result; + $xNew = $x - $dx; + } + // If the NR fails to converge (which for example may be the + // case if the initial guess is too rough) we apply a bisection + // step to determine a more narrow interval around the root. + if (($xNew < $xLo) || ($xNew > $xHi) || ($result == 0.0)) { + $xNew = ($xLo + $xHi) / 2; + $dx = $xNew - $x; + } + $x = $xNew; + } + if ($i == self::MAX_ITERATIONS) { + return Functions::NA(); + } + + return round($x, 12); + } + + return Functions::VALUE(); + } + + /** + * CONFIDENCE. + * + * Returns the confidence interval for a population mean + * + * @param float $alpha + * @param float $stdDev Standard Deviation + * @param float $size + * + * @return float|string + */ + public static function CONFIDENCE($alpha, $stdDev, $size) + { + $alpha = Functions::flattenSingleValue($alpha); + $stdDev = Functions::flattenSingleValue($stdDev); + $size = Functions::flattenSingleValue($size); + + if ((is_numeric($alpha)) && (is_numeric($stdDev)) && (is_numeric($size))) { + $size = floor($size); + if (($alpha <= 0) || ($alpha >= 1)) { + return Functions::NAN(); + } + if (($stdDev <= 0) || ($size < 1)) { + return Functions::NAN(); + } + + return self::NORMSINV(1 - $alpha / 2) * $stdDev / sqrt($size); + } + + return Functions::VALUE(); + } + + /** + * CORREL. + * + * Returns covariance, the average of the products of deviations for each data point pair. + * + * @param mixed $yValues array of mixed Data Series Y + * @param null|mixed $xValues array of mixed Data Series X + * + * @return float|string + */ + public static function CORREL($yValues, $xValues = null) + { + if (($xValues === null) || (!is_array($yValues)) || (!is_array($xValues))) { + return Functions::VALUE(); + } + if (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return Functions::DIV0(); + } + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues); + + return $bestFitLinear->getCorrelation(); + } + + /** + * COUNT. + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * COUNT(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return int + */ + public static function COUNT(...$args) + { + $returnValue = 0; + + // Loop through arguments + $aArgs = Functions::flattenArrayIndexed($args); + foreach ($aArgs as $k => $arg) { + $arg = self::testAcceptedBoolean($arg, $k); + // Is it a numeric value? + // Strings containing numeric values are only counted if they are string literals (not cell values) + // and then only in MS Excel and in Open Office, not in Gnumeric + if (self::isAcceptedCountable($arg, $k)) { + ++$returnValue; + } + } + + return $returnValue; + } + + /** + * COUNTA. + * + * Counts the number of cells that are not empty within the list of arguments + * + * Excel Function: + * COUNTA(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return int + */ + public static function COUNTA(...$args) + { + $returnValue = 0; + + // Loop through arguments + $aArgs = Functions::flattenArrayIndexed($args); + foreach ($aArgs as $k => $arg) { + // Nulls are counted if literals, but not if cell values + if ($arg !== null || (!Functions::isCellValue($k))) { + ++$returnValue; + } + } + + return $returnValue; + } + + /** + * COUNTBLANK. + * + * Counts the number of empty cells within the list of arguments + * + * Excel Function: + * COUNTBLANK(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return int + */ + public static function COUNTBLANK(...$args) + { + $returnValue = 0; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + foreach ($aArgs as $arg) { + // Is it a blank cell? + if (($arg === null) || ((is_string($arg)) && ($arg == ''))) { + ++$returnValue; + } + } + + return $returnValue; + } + + /** + * COUNTIF. + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * COUNTIF(value1[,value2[, ...]],condition) + * + * @category Statistical Functions + * + * @param mixed $aArgs Data values + * @param string $condition the criteria that defines which cells will be counted + * + * @return int + */ + public static function COUNTIF($aArgs, $condition) + { + $returnValue = 0; + + $aArgs = Functions::flattenArray($aArgs); + $condition = Functions::ifCondition($condition); + $conditionIsNumeric = strpos($condition, '"') === false; + // Loop through arguments + foreach ($aArgs as $arg) { + if (!is_numeric($arg)) { + if ($conditionIsNumeric) { + continue; + } + $arg = Calculation::wrapResult(strtoupper($arg)); + } elseif (!$conditionIsNumeric) { + continue; + } + $testCondition = '=' . $arg . $condition; + if (Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + // Is it a value within our criteria + ++$returnValue; + } + } + + return $returnValue; + } + + /** + * COUNTIFS. + * + * Counts the number of cells that contain numbers within the list of arguments + * + * Excel Function: + * COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…) + * + * @category Statistical Functions + * + * @param mixed $args Criterias + * + * @return int + */ + public static function COUNTIFS(...$args) + { + $arrayList = $args; + + // Return value + $returnValue = 0; + + if (empty($arrayList)) { + return $returnValue; + } + + $aArgsArray = []; + $conditions = []; + + while (count($arrayList) > 0) { + $aArgsArray[] = Functions::flattenArray(array_shift($arrayList)); + $conditions[] = Functions::ifCondition(array_shift($arrayList)); + } + + // Loop through each arg and see if arguments and conditions are true + foreach (array_keys($aArgsArray[0]) as $index) { + $valid = true; + + foreach ($conditions as $cidx => $condition) { + $conditionIsNumeric = strpos($condition, '"') === false; + $arg = $aArgsArray[$cidx][$index]; + + // Loop through arguments + if (!is_numeric($arg)) { + if ($conditionIsNumeric) { + $valid = false; + + break; // if false found, don't need to check other conditions + } + $arg = Calculation::wrapResult(strtoupper($arg)); + } elseif (!$conditionIsNumeric) { + $valid = false; + + break; // if false found, don't need to check other conditions + } + $testCondition = '=' . $arg . $condition; + if (!Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + // Is not a value within our criteria + $valid = false; + + break; // if false found, don't need to check other conditions + } + } + + if ($valid) { + ++$returnValue; + } + } + + // Return + return $returnValue; + } + + /** + * COVAR. + * + * Returns covariance, the average of the products of deviations for each data point pair. + * + * @param mixed $yValues array of mixed Data Series Y + * @param mixed $xValues array of mixed Data Series X + * + * @return float|string + */ + public static function COVAR($yValues, $xValues) + { + if (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return Functions::DIV0(); + } + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues); + + return $bestFitLinear->getCovariance(); + } + + /** + * CRITBINOM. + * + * Returns the smallest value for which the cumulative binomial distribution is greater + * than or equal to a criterion value + * + * See https://support.microsoft.com/en-us/help/828117/ for details of the algorithm used + * + * @param float $trials number of Bernoulli trials + * @param float $probability probability of a success on each trial + * @param float $alpha criterion value + * + * @return int|string + * + * @todo Warning. This implementation differs from the algorithm detailed on the MS + * web site in that $CumPGuessMinus1 = $CumPGuess - 1 rather than $CumPGuess - $PGuess + * This eliminates a potential endless loop error, but may have an adverse affect on the + * accuracy of the function (although all my tests have so far returned correct results). + */ + public static function CRITBINOM($trials, $probability, $alpha) + { + $trials = floor(Functions::flattenSingleValue($trials)); + $probability = Functions::flattenSingleValue($probability); + $alpha = Functions::flattenSingleValue($alpha); + + if ((is_numeric($trials)) && (is_numeric($probability)) && (is_numeric($alpha))) { + $trials = (int) $trials; + if ($trials < 0) { + return Functions::NAN(); + } elseif (($probability < 0.0) || ($probability > 1.0)) { + return Functions::NAN(); + } elseif (($alpha < 0.0) || ($alpha > 1.0)) { + return Functions::NAN(); + } + + if ($alpha <= 0.5) { + $t = sqrt(log(1 / ($alpha * $alpha))); + $trialsApprox = 0 - ($t + (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t)); + } else { + $t = sqrt(log(1 / pow(1 - $alpha, 2))); + $trialsApprox = $t - (2.515517 + 0.802853 * $t + 0.010328 * $t * $t) / (1 + 1.432788 * $t + 0.189269 * $t * $t + 0.001308 * $t * $t * $t); + } + + $Guess = floor($trials * $probability + $trialsApprox * sqrt($trials * $probability * (1 - $probability))); + if ($Guess < 0) { + $Guess = 0; + } elseif ($Guess > $trials) { + $Guess = $trials; + } + + $TotalUnscaledProbability = $UnscaledPGuess = $UnscaledCumPGuess = 0.0; + $EssentiallyZero = 10e-12; + + $m = floor($trials * $probability); + ++$TotalUnscaledProbability; + if ($m == $Guess) { + ++$UnscaledPGuess; + } + if ($m <= $Guess) { + ++$UnscaledCumPGuess; + } + + $PreviousValue = 1; + $Done = false; + $k = $m + 1; + while ((!$Done) && ($k <= $trials)) { + $CurrentValue = $PreviousValue * ($trials - $k + 1) * $probability / ($k * (1 - $probability)); + $TotalUnscaledProbability += $CurrentValue; + if ($k == $Guess) { + $UnscaledPGuess += $CurrentValue; + } + if ($k <= $Guess) { + $UnscaledCumPGuess += $CurrentValue; + } + if ($CurrentValue <= $EssentiallyZero) { + $Done = true; + } + $PreviousValue = $CurrentValue; + ++$k; + } + + $PreviousValue = 1; + $Done = false; + $k = $m - 1; + while ((!$Done) && ($k >= 0)) { + $CurrentValue = $PreviousValue * $k + 1 * (1 - $probability) / (($trials - $k) * $probability); + $TotalUnscaledProbability += $CurrentValue; + if ($k == $Guess) { + $UnscaledPGuess += $CurrentValue; + } + if ($k <= $Guess) { + $UnscaledCumPGuess += $CurrentValue; + } + if ($CurrentValue <= $EssentiallyZero) { + $Done = true; + } + $PreviousValue = $CurrentValue; + --$k; + } + + $PGuess = $UnscaledPGuess / $TotalUnscaledProbability; + $CumPGuess = $UnscaledCumPGuess / $TotalUnscaledProbability; + + $CumPGuessMinus1 = $CumPGuess - 1; + + while (true) { + if (($CumPGuessMinus1 < $alpha) && ($CumPGuess >= $alpha)) { + return $Guess; + } elseif (($CumPGuessMinus1 < $alpha) && ($CumPGuess < $alpha)) { + $PGuessPlus1 = $PGuess * ($trials - $Guess) * $probability / $Guess / (1 - $probability); + $CumPGuessMinus1 = $CumPGuess; + $CumPGuess = $CumPGuess + $PGuessPlus1; + $PGuess = $PGuessPlus1; + ++$Guess; + } elseif (($CumPGuessMinus1 >= $alpha) && ($CumPGuess >= $alpha)) { + $PGuessMinus1 = $PGuess * $Guess * (1 - $probability) / ($trials - $Guess + 1) / $probability; + $CumPGuess = $CumPGuessMinus1; + $CumPGuessMinus1 = $CumPGuessMinus1 - $PGuess; + $PGuess = $PGuessMinus1; + --$Guess; + } + } + } + + return Functions::VALUE(); + } + + /** + * DEVSQ. + * + * Returns the sum of squares of deviations of data points from their sample mean. + * + * Excel Function: + * DEVSQ(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function DEVSQ(...$args) + { + $aArgs = Functions::flattenArrayIndexed($args); + + // Return value + $returnValue = null; + + $aMean = self::AVERAGE($aArgs); + if ($aMean != Functions::DIV0()) { + $aCount = -1; + foreach ($aArgs as $k => $arg) { + // Is it a numeric value? + if ((is_bool($arg)) && + ((!Functions::isCellValue($k)) || + (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { + $arg = (int) $arg; + } + if ((is_numeric($arg)) && (!is_string($arg))) { + if ($returnValue === null) { + $returnValue = pow(($arg - $aMean), 2); + } else { + $returnValue += pow(($arg - $aMean), 2); + } + ++$aCount; + } + } + + // Return + if ($returnValue === null) { + return Functions::NAN(); + } + + return $returnValue; + } + + return self::NA(); + } + + /** + * EXPONDIST. + * + * Returns the exponential distribution. Use EXPONDIST to model the time between events, + * such as how long an automated bank teller takes to deliver cash. For example, you can + * use EXPONDIST to determine the probability that the process takes at most 1 minute. + * + * @param float $value Value of the function + * @param float $lambda The parameter value + * @param bool $cumulative + * + * @return float|string + */ + public static function EXPONDIST($value, $lambda, $cumulative) + { + $value = Functions::flattenSingleValue($value); + $lambda = Functions::flattenSingleValue($lambda); + $cumulative = Functions::flattenSingleValue($cumulative); + + if ((is_numeric($value)) && (is_numeric($lambda))) { + if (($value < 0) || ($lambda < 0)) { + return Functions::NAN(); + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + return 1 - exp(0 - $value * $lambda); + } + + return $lambda * exp(0 - $value * $lambda); + } + } + + return Functions::VALUE(); + } + + /** + * FISHER. + * + * Returns the Fisher transformation at x. This transformation produces a function that + * is normally distributed rather than skewed. Use this function to perform hypothesis + * testing on the correlation coefficient. + * + * @param float $value + * + * @return float|string + */ + public static function FISHER($value) + { + $value = Functions::flattenSingleValue($value); + + if (is_numeric($value)) { + if (($value <= -1) || ($value >= 1)) { + return Functions::NAN(); + } + + return 0.5 * log((1 + $value) / (1 - $value)); + } + + return Functions::VALUE(); + } + + /** + * FISHERINV. + * + * Returns the inverse of the Fisher transformation. Use this transformation when + * analyzing correlations between ranges or arrays of data. If y = FISHER(x), then + * FISHERINV(y) = x. + * + * @param float $value + * + * @return float|string + */ + public static function FISHERINV($value) + { + $value = Functions::flattenSingleValue($value); + + if (is_numeric($value)) { + return (exp(2 * $value) - 1) / (exp(2 * $value) + 1); + } + + return Functions::VALUE(); + } + + /** + * FORECAST. + * + * Calculates, or predicts, a future value by using existing values. The predicted value is a y-value for a given x-value. + * + * @param float $xValue Value of X for which we want to find Y + * @param mixed $yValues array of mixed Data Series Y + * @param mixed $xValues of mixed Data Series X + * + * @return bool|float|string + */ + public static function FORECAST($xValue, $yValues, $xValues) + { + $xValue = Functions::flattenSingleValue($xValue); + if (!is_numeric($xValue)) { + return Functions::VALUE(); + } elseif (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return Functions::DIV0(); + } + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues); + + return $bestFitLinear->getValueOfYForX($xValue); + } + + /** + * GAMMADIST. + * + * Returns the gamma distribution. + * + * @param float $value Value at which you want to evaluate the distribution + * @param float $a Parameter to the distribution + * @param float $b Parameter to the distribution + * @param bool $cumulative + * + * @return float|string + */ + public static function GAMMADIST($value, $a, $b, $cumulative) + { + $value = Functions::flattenSingleValue($value); + $a = Functions::flattenSingleValue($a); + $b = Functions::flattenSingleValue($b); + + if ((is_numeric($value)) && (is_numeric($a)) && (is_numeric($b))) { + if (($value < 0) || ($a <= 0) || ($b <= 0)) { + return Functions::NAN(); + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + return self::incompleteGamma($a, $value / $b) / self::gamma($a); + } + + return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a - 1) * exp(0 - ($value / $b)); + } + } + + return Functions::VALUE(); + } + + /** + * GAMMAINV. + * + * Returns the inverse of the beta distribution. + * + * @param float $probability Probability at which you want to evaluate the distribution + * @param float $alpha Parameter to the distribution + * @param float $beta Parameter to the distribution + * + * @return float|string + */ + public static function GAMMAINV($probability, $alpha, $beta) + { + $probability = Functions::flattenSingleValue($probability); + $alpha = Functions::flattenSingleValue($alpha); + $beta = Functions::flattenSingleValue($beta); + + if ((is_numeric($probability)) && (is_numeric($alpha)) && (is_numeric($beta))) { + if (($alpha <= 0) || ($beta <= 0) || ($probability < 0) || ($probability > 1)) { + return Functions::NAN(); + } + + $xLo = 0; + $xHi = $alpha * $beta * 5; + + $x = $xNew = 1; + $error = $pdf = 0; + $dx = 1024; + $i = 0; + + while ((abs($dx) > Functions::PRECISION) && ($i++ < self::MAX_ITERATIONS)) { + // Apply Newton-Raphson step + $error = self::GAMMADIST($x, $alpha, $beta, true) - $probability; + if ($error < 0.0) { + $xLo = $x; + } else { + $xHi = $x; + } + $pdf = self::GAMMADIST($x, $alpha, $beta, false); + // Avoid division by zero + if ($pdf != 0.0) { + $dx = $error / $pdf; + $xNew = $x - $dx; + } + // If the NR fails to converge (which for example may be the + // case if the initial guess is too rough) we apply a bisection + // step to determine a more narrow interval around the root. + if (($xNew < $xLo) || ($xNew > $xHi) || ($pdf == 0.0)) { + $xNew = ($xLo + $xHi) / 2; + $dx = $xNew - $x; + } + $x = $xNew; + } + if ($i == self::MAX_ITERATIONS) { + return Functions::NA(); + } + + return $x; + } + + return Functions::VALUE(); + } + + /** + * GAMMALN. + * + * Returns the natural logarithm of the gamma function. + * + * @param float $value + * + * @return float|string + */ + public static function GAMMALN($value) + { + $value = Functions::flattenSingleValue($value); + + if (is_numeric($value)) { + if ($value <= 0) { + return Functions::NAN(); + } + + return log(self::gamma($value)); + } + + return Functions::VALUE(); + } + + /** + * GEOMEAN. + * + * Returns the geometric mean of an array or range of positive data. For example, you + * can use GEOMEAN to calculate average growth rate given compound interest with + * variable rates. + * + * Excel Function: + * GEOMEAN(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function GEOMEAN(...$args) + { + $aArgs = Functions::flattenArray($args); + + $aMean = MathTrig::PRODUCT($aArgs); + if (is_numeric($aMean) && ($aMean > 0)) { + $aCount = self::COUNT($aArgs); + if (self::MIN($aArgs) > 0) { + return pow($aMean, (1 / $aCount)); + } + } + + return Functions::NAN(); + } + + /** + * GROWTH. + * + * Returns values along a predicted exponential Trend + * + * @param mixed[] $yValues Data Series Y + * @param mixed[] $xValues Data Series X + * @param mixed[] $newValues Values of X for which we want to find Y + * @param bool $const a logical value specifying whether to force the intersect to equal 0 + * + * @return array of float + */ + public static function GROWTH($yValues, $xValues = [], $newValues = [], $const = true) + { + $yValues = Functions::flattenArray($yValues); + $xValues = Functions::flattenArray($xValues); + $newValues = Functions::flattenArray($newValues); + $const = ($const === null) ? true : (bool) Functions::flattenSingleValue($const); + + $bestFitExponential = Trend::calculate(Trend::TREND_EXPONENTIAL, $yValues, $xValues, $const); + if (empty($newValues)) { + $newValues = $bestFitExponential->getXValues(); + } + + $returnArray = []; + foreach ($newValues as $xValue) { + $returnArray[0][] = $bestFitExponential->getValueOfYForX($xValue); + } + + return $returnArray; + } + + /** + * HARMEAN. + * + * Returns the harmonic mean of a data set. The harmonic mean is the reciprocal of the + * arithmetic mean of reciprocals. + * + * Excel Function: + * HARMEAN(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function HARMEAN(...$args) + { + // Return value + $returnValue = 0; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + if (self::MIN($aArgs) < 0) { + return Functions::NAN(); + } + $aCount = 0; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if ($arg <= 0) { + return Functions::NAN(); + } + $returnValue += (1 / $arg); + ++$aCount; + } + } + + // Return + if ($aCount > 0) { + return 1 / ($returnValue / $aCount); + } + + return Functions::NA(); + } + + /** + * HYPGEOMDIST. + * + * Returns the hypergeometric distribution. HYPGEOMDIST returns the probability of a given number of + * sample successes, given the sample size, population successes, and population size. + * + * @param float $sampleSuccesses Number of successes in the sample + * @param float $sampleNumber Size of the sample + * @param float $populationSuccesses Number of successes in the population + * @param float $populationNumber Population size + * + * @return float|string + */ + public static function HYPGEOMDIST($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber) + { + $sampleSuccesses = floor(Functions::flattenSingleValue($sampleSuccesses)); + $sampleNumber = floor(Functions::flattenSingleValue($sampleNumber)); + $populationSuccesses = floor(Functions::flattenSingleValue($populationSuccesses)); + $populationNumber = floor(Functions::flattenSingleValue($populationNumber)); + + if ((is_numeric($sampleSuccesses)) && (is_numeric($sampleNumber)) && (is_numeric($populationSuccesses)) && (is_numeric($populationNumber))) { + if (($sampleSuccesses < 0) || ($sampleSuccesses > $sampleNumber) || ($sampleSuccesses > $populationSuccesses)) { + return Functions::NAN(); + } + if (($sampleNumber <= 0) || ($sampleNumber > $populationNumber)) { + return Functions::NAN(); + } + if (($populationSuccesses <= 0) || ($populationSuccesses > $populationNumber)) { + return Functions::NAN(); + } + + return MathTrig::COMBIN($populationSuccesses, $sampleSuccesses) * + MathTrig::COMBIN($populationNumber - $populationSuccesses, $sampleNumber - $sampleSuccesses) / + MathTrig::COMBIN($populationNumber, $sampleNumber); + } + + return Functions::VALUE(); + } + + /** + * INTERCEPT. + * + * Calculates the point at which a line will intersect the y-axis by using existing x-values and y-values. + * + * @param mixed[] $yValues Data Series Y + * @param mixed[] $xValues Data Series X + * + * @return float|string + */ + public static function INTERCEPT($yValues, $xValues) + { + if (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return Functions::DIV0(); + } + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues); + + return $bestFitLinear->getIntersect(); + } + + /** + * KURT. + * + * Returns the kurtosis of a data set. Kurtosis characterizes the relative peakedness + * or flatness of a distribution compared with the normal distribution. Positive + * kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a + * relatively flat distribution. + * + * @param array ...$args Data Series + * + * @return float|string + */ + public static function KURT(...$args) + { + $aArgs = Functions::flattenArrayIndexed($args); + $mean = self::AVERAGE($aArgs); + $stdDev = self::STDEV($aArgs); + + if ($stdDev > 0) { + $count = $summer = 0; + // Loop through arguments + foreach ($aArgs as $k => $arg) { + if ((is_bool($arg)) && + (!Functions::isMatrixValue($k))) { + } else { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $summer += pow((($arg - $mean) / $stdDev), 4); + ++$count; + } + } + } + + // Return + if ($count > 3) { + return $summer * ($count * ($count + 1) / (($count - 1) * ($count - 2) * ($count - 3))) - (3 * pow($count - 1, 2) / (($count - 2) * ($count - 3))); + } + } + + return Functions::DIV0(); + } + + /** + * LARGE. + * + * Returns the nth largest value in a data set. You can use this function to + * select a value based on its relative standing. + * + * Excel Function: + * LARGE(value1[,value2[, ...]],entry) + * + * @category Statistical Functions + * + * @param mixed $args Data values + * @param int $entry Position (ordered from the largest) in the array or range of data to return + * + * @return float|string The result, or a string containing an error + */ + public static function LARGE(...$args) + { + $aArgs = Functions::flattenArray($args); + + // Calculate + $entry = floor(array_pop($aArgs)); + + if ((is_numeric($entry)) && (!is_string($entry))) { + $mArgs = []; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + $count = self::COUNT($mArgs); + $entry = floor(--$entry); + if (($entry < 0) || ($entry >= $count) || ($count == 0)) { + return Functions::NAN(); + } + rsort($mArgs); + + return $mArgs[$entry]; + } + + return Functions::VALUE(); + } + + /** + * LINEST. + * + * Calculates the statistics for a line by using the "least squares" method to calculate a straight line that best fits your data, + * and then returns an array that describes the line. + * + * @param mixed[] $yValues Data Series Y + * @param null|mixed[] $xValues Data Series X + * @param bool $const a logical value specifying whether to force the intersect to equal 0 + * @param bool $stats a logical value specifying whether to return additional regression statistics + * + * @return array|int|string The result, or a string containing an error + */ + public static function LINEST($yValues, $xValues = null, $const = true, $stats = false) + { + $const = ($const === null) ? true : (bool) Functions::flattenSingleValue($const); + $stats = ($stats === null) ? false : (bool) Functions::flattenSingleValue($stats); + if ($xValues === null) { + $xValues = range(1, count(Functions::flattenArray($yValues))); + } + + if (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return 0; + } + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues, $const); + if ($stats) { + return [ + [ + $bestFitLinear->getSlope(), + $bestFitLinear->getSlopeSE(), + $bestFitLinear->getGoodnessOfFit(), + $bestFitLinear->getF(), + $bestFitLinear->getSSRegression(), + ], + [ + $bestFitLinear->getIntersect(), + $bestFitLinear->getIntersectSE(), + $bestFitLinear->getStdevOfResiduals(), + $bestFitLinear->getDFResiduals(), + $bestFitLinear->getSSResiduals(), + ], + ]; + } + + return [ + $bestFitLinear->getSlope(), + $bestFitLinear->getIntersect(), + ]; + } + + /** + * LOGEST. + * + * Calculates an exponential curve that best fits the X and Y data series, + * and then returns an array that describes the line. + * + * @param mixed[] $yValues Data Series Y + * @param null|mixed[] $xValues Data Series X + * @param bool $const a logical value specifying whether to force the intersect to equal 0 + * @param bool $stats a logical value specifying whether to return additional regression statistics + * + * @return array|int|string The result, or a string containing an error + */ + public static function LOGEST($yValues, $xValues = null, $const = true, $stats = false) + { + $const = ($const === null) ? true : (bool) Functions::flattenSingleValue($const); + $stats = ($stats === null) ? false : (bool) Functions::flattenSingleValue($stats); + if ($xValues === null) { + $xValues = range(1, count(Functions::flattenArray($yValues))); + } + + if (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + foreach ($yValues as $value) { + if ($value <= 0.0) { + return Functions::NAN(); + } + } + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return 1; + } + + $bestFitExponential = Trend::calculate(Trend::TREND_EXPONENTIAL, $yValues, $xValues, $const); + if ($stats) { + return [ + [ + $bestFitExponential->getSlope(), + $bestFitExponential->getSlopeSE(), + $bestFitExponential->getGoodnessOfFit(), + $bestFitExponential->getF(), + $bestFitExponential->getSSRegression(), + ], + [ + $bestFitExponential->getIntersect(), + $bestFitExponential->getIntersectSE(), + $bestFitExponential->getStdevOfResiduals(), + $bestFitExponential->getDFResiduals(), + $bestFitExponential->getSSResiduals(), + ], + ]; + } + + return [ + $bestFitExponential->getSlope(), + $bestFitExponential->getIntersect(), + ]; + } + + /** + * LOGINV. + * + * Returns the inverse of the normal cumulative distribution + * + * @param float $probability + * @param float $mean + * @param float $stdDev + * + * @return float|string The result, or a string containing an error + * + * @todo Try implementing P J Acklam's refinement algorithm for greater + * accuracy if I can get my head round the mathematics + * (as described at) http://home.online.no/~pjacklam/notes/invnorm/ + */ + public static function LOGINV($probability, $mean, $stdDev) + { + $probability = Functions::flattenSingleValue($probability); + $mean = Functions::flattenSingleValue($mean); + $stdDev = Functions::flattenSingleValue($stdDev); + + if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if (($probability < 0) || ($probability > 1) || ($stdDev <= 0)) { + return Functions::NAN(); + } + + return exp($mean + $stdDev * self::NORMSINV($probability)); + } + + return Functions::VALUE(); + } + + /** + * LOGNORMDIST. + * + * Returns the cumulative lognormal distribution of x, where ln(x) is normally distributed + * with parameters mean and standard_dev. + * + * @param float $value + * @param float $mean + * @param float $stdDev + * + * @return float|string The result, or a string containing an error + */ + public static function LOGNORMDIST($value, $mean, $stdDev) + { + $value = Functions::flattenSingleValue($value); + $mean = Functions::flattenSingleValue($mean); + $stdDev = Functions::flattenSingleValue($stdDev); + + if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if (($value <= 0) || ($stdDev <= 0)) { + return Functions::NAN(); + } + + return self::NORMSDIST((log($value) - $mean) / $stdDev); + } + + return Functions::VALUE(); + } + + /** + * MAX. + * + * MAX returns the value of the element of the values passed that has the highest value, + * with negative numbers considered smaller than positive numbers. + * + * Excel Function: + * MAX(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function MAX(...$args) + { + $returnValue = null; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if (($returnValue === null) || ($arg > $returnValue)) { + $returnValue = $arg; + } + } + } + + if ($returnValue === null) { + return 0; + } + + return $returnValue; + } + + /** + * MAXA. + * + * Returns the greatest value in a list of arguments, including numbers, text, and logical values + * + * Excel Function: + * MAXA(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function MAXA(...$args) + { + $returnValue = null; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { + if (is_bool($arg)) { + $arg = (int) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if (($returnValue === null) || ($arg > $returnValue)) { + $returnValue = $arg; + } + } + } + + if ($returnValue === null) { + return 0; + } + + return $returnValue; + } + + /** + * MAXIFS. + * + * Counts the maximum value within a range of cells that contain numbers within the list of arguments + * + * Excel Function: + * MAXIFS(max_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...) + * + * @category Statistical Functions + * + * @param mixed $args Data range and criterias + * + * @return float + */ + public static function MAXIFS(...$args) + { + $arrayList = $args; + + // Return value + $returnValue = null; + + $maxArgs = Functions::flattenArray(array_shift($arrayList)); + $aArgsArray = []; + $conditions = []; + + while (count($arrayList) > 0) { + $aArgsArray[] = Functions::flattenArray(array_shift($arrayList)); + $conditions[] = Functions::ifCondition(array_shift($arrayList)); + } + + // Loop through each arg and see if arguments and conditions are true + foreach ($maxArgs as $index => $value) { + $valid = true; + + foreach ($conditions as $cidx => $condition) { + $arg = $aArgsArray[$cidx][$index]; + + // Loop through arguments + if (!is_numeric($arg)) { + $arg = Calculation::wrapResult(strtoupper($arg)); + } + $testCondition = '=' . $arg . $condition; + if (!Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + // Is not a value within our criteria + $valid = false; + + break; // if false found, don't need to check other conditions + } + } + + if ($valid) { + $returnValue = $returnValue === null ? $value : max($value, $returnValue); + } + } + + // Return + return $returnValue; + } + + /** + * MEDIAN. + * + * Returns the median of the given numbers. The median is the number in the middle of a set of numbers. + * + * Excel Function: + * MEDIAN(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string The result, or a string containing an error + */ + public static function MEDIAN(...$args) + { + $returnValue = Functions::NAN(); + + $mArgs = []; + // Loop through arguments + $aArgs = Functions::flattenArray($args); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + + $mValueCount = count($mArgs); + if ($mValueCount > 0) { + sort($mArgs, SORT_NUMERIC); + $mValueCount = $mValueCount / 2; + if ($mValueCount == floor($mValueCount)) { + $returnValue = ($mArgs[$mValueCount--] + $mArgs[$mValueCount]) / 2; + } else { + $mValueCount = floor($mValueCount); + $returnValue = $mArgs[$mValueCount]; + } + } + + return $returnValue; + } + + /** + * MIN. + * + * MIN returns the value of the element of the values passed that has the smallest value, + * with negative numbers considered smaller than positive numbers. + * + * Excel Function: + * MIN(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function MIN(...$args) + { + $returnValue = null; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if (($returnValue === null) || ($arg < $returnValue)) { + $returnValue = $arg; + } + } + } + + if ($returnValue === null) { + return 0; + } + + return $returnValue; + } + + /** + * MINA. + * + * Returns the smallest value in a list of arguments, including numbers, text, and logical values + * + * Excel Function: + * MINA(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function MINA(...$args) + { + $returnValue = null; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) && ($arg != '')))) { + if (is_bool($arg)) { + $arg = (int) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if (($returnValue === null) || ($arg < $returnValue)) { + $returnValue = $arg; + } + } + } + + if ($returnValue === null) { + return 0; + } + + return $returnValue; + } + + /** + * MINIFS. + * + * Returns the minimum value within a range of cells that contain numbers within the list of arguments + * + * Excel Function: + * MINIFS(min_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...) + * + * @category Statistical Functions + * + * @param mixed $args Data range and criterias + * + * @return float + */ + public static function MINIFS(...$args) + { + $arrayList = $args; + + // Return value + $returnValue = null; + + $minArgs = Functions::flattenArray(array_shift($arrayList)); + $aArgsArray = []; + $conditions = []; + + while (count($arrayList) > 0) { + $aArgsArray[] = Functions::flattenArray(array_shift($arrayList)); + $conditions[] = Functions::ifCondition(array_shift($arrayList)); + } + + // Loop through each arg and see if arguments and conditions are true + foreach ($minArgs as $index => $value) { + $valid = true; + + foreach ($conditions as $cidx => $condition) { + $arg = $aArgsArray[$cidx][$index]; + + // Loop through arguments + if (!is_numeric($arg)) { + $arg = Calculation::wrapResult(strtoupper($arg)); + } + $testCondition = '=' . $arg . $condition; + if (!Calculation::getInstance()->_calculateFormulaValue($testCondition)) { + // Is not a value within our criteria + $valid = false; + + break; // if false found, don't need to check other conditions + } + } + + if ($valid) { + $returnValue = $returnValue === null ? $value : min($value, $returnValue); + } + } + + // Return + return $returnValue; + } + + // + // Special variant of array_count_values that isn't limited to strings and integers, + // but can work with floating point numbers as values + // + private static function modeCalc($data) + { + $frequencyArray = []; + foreach ($data as $datum) { + $found = false; + foreach ($frequencyArray as $key => $value) { + if ((string) $value['value'] == (string) $datum) { + ++$frequencyArray[$key]['frequency']; + $found = true; + + break; + } + } + if (!$found) { + $frequencyArray[] = [ + 'value' => $datum, + 'frequency' => 1, + ]; + } + } + + foreach ($frequencyArray as $key => $value) { + $frequencyList[$key] = $value['frequency']; + $valueList[$key] = $value['value']; + } + array_multisort($frequencyList, SORT_DESC, $valueList, SORT_ASC, SORT_NUMERIC, $frequencyArray); + + if ($frequencyArray[0]['frequency'] == 1) { + return Functions::NA(); + } + + return $frequencyArray[0]['value']; + } + + /** + * MODE. + * + * Returns the most frequently occurring, or repetitive, value in an array or range of data + * + * Excel Function: + * MODE(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string The result, or a string containing an error + */ + public static function MODE(...$args) + { + $returnValue = Functions::NA(); + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + + $mArgs = []; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + + if (!empty($mArgs)) { + return self::modeCalc($mArgs); + } + + return $returnValue; + } + + /** + * NEGBINOMDIST. + * + * Returns the negative binomial distribution. NEGBINOMDIST returns the probability that + * there will be number_f failures before the number_s-th success, when the constant + * probability of a success is probability_s. This function is similar to the binomial + * distribution, except that the number of successes is fixed, and the number of trials is + * variable. Like the binomial, trials are assumed to be independent. + * + * @param float $failures Number of Failures + * @param float $successes Threshold number of Successes + * @param float $probability Probability of success on each trial + * + * @return float|string The result, or a string containing an error + */ + public static function NEGBINOMDIST($failures, $successes, $probability) + { + $failures = floor(Functions::flattenSingleValue($failures)); + $successes = floor(Functions::flattenSingleValue($successes)); + $probability = Functions::flattenSingleValue($probability); + + if ((is_numeric($failures)) && (is_numeric($successes)) && (is_numeric($probability))) { + if (($failures < 0) || ($successes < 1)) { + return Functions::NAN(); + } elseif (($probability < 0) || ($probability > 1)) { + return Functions::NAN(); + } + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) { + if (($failures + $successes - 1) <= 0) { + return Functions::NAN(); + } + } + + return (MathTrig::COMBIN($failures + $successes - 1, $successes - 1)) * (pow($probability, $successes)) * (pow(1 - $probability, $failures)); + } + + return Functions::VALUE(); + } + + /** + * NORMDIST. + * + * Returns the normal distribution for the specified mean and standard deviation. This + * function has a very wide range of applications in statistics, including hypothesis + * testing. + * + * @param float $value + * @param float $mean Mean Value + * @param float $stdDev Standard Deviation + * @param bool $cumulative + * + * @return float|string The result, or a string containing an error + */ + public static function NORMDIST($value, $mean, $stdDev, $cumulative) + { + $value = Functions::flattenSingleValue($value); + $mean = Functions::flattenSingleValue($mean); + $stdDev = Functions::flattenSingleValue($stdDev); + + if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if ($stdDev < 0) { + return Functions::NAN(); + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + return 0.5 * (1 + Engineering::erfVal(($value - $mean) / ($stdDev * sqrt(2)))); + } + + return (1 / (self::SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev)))); + } + } + + return Functions::VALUE(); + } + + /** + * NORMINV. + * + * Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation. + * + * @param float $probability + * @param float $mean Mean Value + * @param float $stdDev Standard Deviation + * + * @return float|string The result, or a string containing an error + */ + public static function NORMINV($probability, $mean, $stdDev) + { + $probability = Functions::flattenSingleValue($probability); + $mean = Functions::flattenSingleValue($mean); + $stdDev = Functions::flattenSingleValue($stdDev); + + if ((is_numeric($probability)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if (($probability < 0) || ($probability > 1)) { + return Functions::NAN(); + } + if ($stdDev < 0) { + return Functions::NAN(); + } + + return (self::inverseNcdf($probability) * $stdDev) + $mean; + } + + return Functions::VALUE(); + } + + /** + * NORMSDIST. + * + * Returns the standard normal cumulative distribution function. The distribution has + * a mean of 0 (zero) and a standard deviation of one. Use this function in place of a + * table of standard normal curve areas. + * + * @param float $value + * + * @return float|string The result, or a string containing an error + */ + public static function NORMSDIST($value) + { + $value = Functions::flattenSingleValue($value); + + return self::NORMDIST($value, 0, 1, true); + } + + /** + * NORMSINV. + * + * Returns the inverse of the standard normal cumulative distribution + * + * @param float $value + * + * @return float|string The result, or a string containing an error + */ + public static function NORMSINV($value) + { + return self::NORMINV($value, 0, 1); + } + + /** + * PERCENTILE. + * + * Returns the nth percentile of values in a range.. + * + * Excel Function: + * PERCENTILE(value1[,value2[, ...]],entry) + * + * @category Statistical Functions + * + * @param mixed $args Data values + * @param float $entry Percentile value in the range 0..1, inclusive. + * + * @return float|string The result, or a string containing an error + */ + public static function PERCENTILE(...$args) + { + $aArgs = Functions::flattenArray($args); + + // Calculate + $entry = array_pop($aArgs); + + if ((is_numeric($entry)) && (!is_string($entry))) { + if (($entry < 0) || ($entry > 1)) { + return Functions::NAN(); + } + $mArgs = []; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + $mValueCount = count($mArgs); + if ($mValueCount > 0) { + sort($mArgs); + $count = self::COUNT($mArgs); + $index = $entry * ($count - 1); + $iBase = floor($index); + if ($index == $iBase) { + return $mArgs[$index]; + } + $iNext = $iBase + 1; + $iProportion = $index - $iBase; + + return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion); + } + } + + return Functions::VALUE(); + } + + /** + * PERCENTRANK. + * + * Returns the rank of a value in a data set as a percentage of the data set. + * + * @param float[] $valueSet An array of, or a reference to, a list of numbers + * @param int $value the number whose rank you want to find + * @param int $significance the number of significant digits for the returned percentage value + * + * @return float + */ + public static function PERCENTRANK($valueSet, $value, $significance = 3) + { + $valueSet = Functions::flattenArray($valueSet); + $value = Functions::flattenSingleValue($value); + $significance = ($significance === null) ? 3 : (int) Functions::flattenSingleValue($significance); + + foreach ($valueSet as $key => $valueEntry) { + if (!is_numeric($valueEntry)) { + unset($valueSet[$key]); + } + } + sort($valueSet, SORT_NUMERIC); + $valueCount = count($valueSet); + if ($valueCount == 0) { + return Functions::NAN(); + } + + $valueAdjustor = $valueCount - 1; + if (($value < $valueSet[0]) || ($value > $valueSet[$valueAdjustor])) { + return Functions::NA(); + } + + $pos = array_search($value, $valueSet); + if ($pos === false) { + $pos = 0; + $testValue = $valueSet[0]; + while ($testValue < $value) { + $testValue = $valueSet[++$pos]; + } + --$pos; + $pos += (($value - $valueSet[$pos]) / ($testValue - $valueSet[$pos])); + } + + return round($pos / $valueAdjustor, $significance); + } + + /** + * PERMUT. + * + * Returns the number of permutations for a given number of objects that can be + * selected from number objects. A permutation is any set or subset of objects or + * events where internal order is significant. Permutations are different from + * combinations, for which the internal order is not significant. Use this function + * for lottery-style probability calculations. + * + * @param int $numObjs Number of different objects + * @param int $numInSet Number of objects in each permutation + * + * @return int|string Number of permutations, or a string containing an error + */ + public static function PERMUT($numObjs, $numInSet) + { + $numObjs = Functions::flattenSingleValue($numObjs); + $numInSet = Functions::flattenSingleValue($numInSet); + + if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { + $numInSet = floor($numInSet); + if ($numObjs < $numInSet) { + return Functions::NAN(); + } + + return round(MathTrig::FACT($numObjs) / MathTrig::FACT($numObjs - $numInSet)); + } + + return Functions::VALUE(); + } + + /** + * POISSON. + * + * Returns the Poisson distribution. A common application of the Poisson distribution + * is predicting the number of events over a specific time, such as the number of + * cars arriving at a toll plaza in 1 minute. + * + * @param float $value + * @param float $mean Mean Value + * @param bool $cumulative + * + * @return float|string The result, or a string containing an error + */ + public static function POISSON($value, $mean, $cumulative) + { + $value = Functions::flattenSingleValue($value); + $mean = Functions::flattenSingleValue($mean); + + if ((is_numeric($value)) && (is_numeric($mean))) { + if (($value < 0) || ($mean <= 0)) { + return Functions::NAN(); + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + $summer = 0; + $floor = floor($value); + for ($i = 0; $i <= $floor; ++$i) { + $summer += pow($mean, $i) / MathTrig::FACT($i); + } + + return exp(0 - $mean) * $summer; + } + + return (exp(0 - $mean) * pow($mean, $value)) / MathTrig::FACT($value); + } + } + + return Functions::VALUE(); + } + + /** + * QUARTILE. + * + * Returns the quartile of a data set. + * + * Excel Function: + * QUARTILE(value1[,value2[, ...]],entry) + * + * @category Statistical Functions + * + * @param mixed $args Data values + * @param int $entry Quartile value in the range 1..3, inclusive. + * + * @return float|string The result, or a string containing an error + */ + public static function QUARTILE(...$args) + { + $aArgs = Functions::flattenArray($args); + + // Calculate + $entry = floor(array_pop($aArgs)); + + if ((is_numeric($entry)) && (!is_string($entry))) { + $entry /= 4; + if (($entry < 0) || ($entry > 1)) { + return Functions::NAN(); + } + + return self::PERCENTILE($aArgs, $entry); + } + + return Functions::VALUE(); + } + + /** + * RANK. + * + * Returns the rank of a number in a list of numbers. + * + * @param int $value the number whose rank you want to find + * @param float[] $valueSet An array of, or a reference to, a list of numbers + * @param int $order Order to sort the values in the value set + * + * @return float|string The result, or a string containing an error + */ + public static function RANK($value, $valueSet, $order = 0) + { + $value = Functions::flattenSingleValue($value); + $valueSet = Functions::flattenArray($valueSet); + $order = ($order === null) ? 0 : (int) Functions::flattenSingleValue($order); + + foreach ($valueSet as $key => $valueEntry) { + if (!is_numeric($valueEntry)) { + unset($valueSet[$key]); + } + } + + if ($order == 0) { + rsort($valueSet, SORT_NUMERIC); + } else { + sort($valueSet, SORT_NUMERIC); + } + $pos = array_search($value, $valueSet); + if ($pos === false) { + return Functions::NA(); + } + + return ++$pos; + } + + /** + * RSQ. + * + * Returns the square of the Pearson product moment correlation coefficient through data points in known_y's and known_x's. + * + * @param mixed[] $yValues Data Series Y + * @param mixed[] $xValues Data Series X + * + * @return float|string The result, or a string containing an error + */ + public static function RSQ($yValues, $xValues) + { + if (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return Functions::DIV0(); + } + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues); + + return $bestFitLinear->getGoodnessOfFit(); + } + + /** + * SKEW. + * + * Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry + * of a distribution around its mean. Positive skewness indicates a distribution with an + * asymmetric tail extending toward more positive values. Negative skewness indicates a + * distribution with an asymmetric tail extending toward more negative values. + * + * @param array ...$args Data Series + * + * @return float|string The result, or a string containing an error + */ + public static function SKEW(...$args) + { + $aArgs = Functions::flattenArrayIndexed($args); + $mean = self::AVERAGE($aArgs); + $stdDev = self::STDEV($aArgs); + + $count = $summer = 0; + // Loop through arguments + foreach ($aArgs as $k => $arg) { + if ((is_bool($arg)) && + (!Functions::isMatrixValue($k))) { + } else { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $summer += pow((($arg - $mean) / $stdDev), 3); + ++$count; + } + } + } + + if ($count > 2) { + return $summer * ($count / (($count - 1) * ($count - 2))); + } + + return Functions::DIV0(); + } + + /** + * SLOPE. + * + * Returns the slope of the linear regression line through data points in known_y's and known_x's. + * + * @param mixed[] $yValues Data Series Y + * @param mixed[] $xValues Data Series X + * + * @return float|string The result, or a string containing an error + */ + public static function SLOPE($yValues, $xValues) + { + if (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return Functions::DIV0(); + } + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues); + + return $bestFitLinear->getSlope(); + } + + /** + * SMALL. + * + * Returns the nth smallest value in a data set. You can use this function to + * select a value based on its relative standing. + * + * Excel Function: + * SMALL(value1[,value2[, ...]],entry) + * + * @category Statistical Functions + * + * @param mixed $args Data values + * @param int $entry Position (ordered from the smallest) in the array or range of data to return + * + * @return float|string The result, or a string containing an error + */ + public static function SMALL(...$args) + { + $aArgs = Functions::flattenArray($args); + + // Calculate + $entry = array_pop($aArgs); + + if ((is_numeric($entry)) && (!is_string($entry))) { + $mArgs = []; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + $count = self::COUNT($mArgs); + $entry = floor(--$entry); + if (($entry < 0) || ($entry >= $count) || ($count == 0)) { + return Functions::NAN(); + } + sort($mArgs); + + return $mArgs[$entry]; + } + + return Functions::VALUE(); + } + + /** + * STANDARDIZE. + * + * Returns a normalized value from a distribution characterized by mean and standard_dev. + * + * @param float $value Value to normalize + * @param float $mean Mean Value + * @param float $stdDev Standard Deviation + * + * @return float|string Standardized value, or a string containing an error + */ + public static function STANDARDIZE($value, $mean, $stdDev) + { + $value = Functions::flattenSingleValue($value); + $mean = Functions::flattenSingleValue($mean); + $stdDev = Functions::flattenSingleValue($stdDev); + + if ((is_numeric($value)) && (is_numeric($mean)) && (is_numeric($stdDev))) { + if ($stdDev <= 0) { + return Functions::NAN(); + } + + return ($value - $mean) / $stdDev; + } + + return Functions::VALUE(); + } + + /** + * STDEV. + * + * Estimates standard deviation based on a sample. The standard deviation is a measure of how + * widely values are dispersed from the average value (the mean). + * + * Excel Function: + * STDEV(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string The result, or a string containing an error + */ + public static function STDEV(...$args) + { + $aArgs = Functions::flattenArrayIndexed($args); + + // Return value + $returnValue = null; + + $aMean = self::AVERAGE($aArgs); + if ($aMean !== null) { + $aCount = -1; + foreach ($aArgs as $k => $arg) { + if ((is_bool($arg)) && + ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { + $arg = (int) $arg; + } + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if ($returnValue === null) { + $returnValue = pow(($arg - $aMean), 2); + } else { + $returnValue += pow(($arg - $aMean), 2); + } + ++$aCount; + } + } + + // Return + if (($aCount > 0) && ($returnValue >= 0)) { + return sqrt($returnValue / $aCount); + } + } + + return Functions::DIV0(); + } + + /** + * STDEVA. + * + * Estimates standard deviation based on a sample, including numbers, text, and logical values + * + * Excel Function: + * STDEVA(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function STDEVA(...$args) + { + $aArgs = Functions::flattenArrayIndexed($args); + + $returnValue = null; + + $aMean = self::AVERAGEA($aArgs); + if ($aMean !== null) { + $aCount = -1; + foreach ($aArgs as $k => $arg) { + if ((is_bool($arg)) && + (!Functions::isMatrixValue($k))) { + } else { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { + if (is_bool($arg)) { + $arg = (int) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if ($returnValue === null) { + $returnValue = pow(($arg - $aMean), 2); + } else { + $returnValue += pow(($arg - $aMean), 2); + } + ++$aCount; + } + } + } + + if (($aCount > 0) && ($returnValue >= 0)) { + return sqrt($returnValue / $aCount); + } + } + + return Functions::DIV0(); + } + + /** + * STDEVP. + * + * Calculates standard deviation based on the entire population + * + * Excel Function: + * STDEVP(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function STDEVP(...$args) + { + $aArgs = Functions::flattenArrayIndexed($args); + + $returnValue = null; + + $aMean = self::AVERAGE($aArgs); + if ($aMean !== null) { + $aCount = 0; + foreach ($aArgs as $k => $arg) { + if ((is_bool($arg)) && + ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) { + $arg = (int) $arg; + } + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + if ($returnValue === null) { + $returnValue = pow(($arg - $aMean), 2); + } else { + $returnValue += pow(($arg - $aMean), 2); + } + ++$aCount; + } + } + + if (($aCount > 0) && ($returnValue >= 0)) { + return sqrt($returnValue / $aCount); + } + } + + return Functions::DIV0(); + } + + /** + * STDEVPA. + * + * Calculates standard deviation based on the entire population, including numbers, text, and logical values + * + * Excel Function: + * STDEVPA(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float|string + */ + public static function STDEVPA(...$args) + { + $aArgs = Functions::flattenArrayIndexed($args); + + $returnValue = null; + + $aMean = self::AVERAGEA($aArgs); + if ($aMean !== null) { + $aCount = 0; + foreach ($aArgs as $k => $arg) { + if ((is_bool($arg)) && + (!Functions::isMatrixValue($k))) { + } else { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { + if (is_bool($arg)) { + $arg = (int) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + if ($returnValue === null) { + $returnValue = pow(($arg - $aMean), 2); + } else { + $returnValue += pow(($arg - $aMean), 2); + } + ++$aCount; + } + } + } + + if (($aCount > 0) && ($returnValue >= 0)) { + return sqrt($returnValue / $aCount); + } + } + + return Functions::DIV0(); + } + + /** + * STEYX. + * + * Returns the standard error of the predicted y-value for each x in the regression. + * + * @param mixed[] $yValues Data Series Y + * @param mixed[] $xValues Data Series X + * + * @return float|string + */ + public static function STEYX($yValues, $xValues) + { + if (!self::checkTrendArrays($yValues, $xValues)) { + return Functions::VALUE(); + } + $yValueCount = count($yValues); + $xValueCount = count($xValues); + + if (($yValueCount == 0) || ($yValueCount != $xValueCount)) { + return Functions::NA(); + } elseif ($yValueCount == 1) { + return Functions::DIV0(); + } + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues); + + return $bestFitLinear->getStdevOfResiduals(); + } + + /** + * TDIST. + * + * Returns the probability of Student's T distribution. + * + * @param float $value Value for the function + * @param float $degrees degrees of freedom + * @param float $tails number of tails (1 or 2) + * + * @return float|string The result, or a string containing an error + */ + public static function TDIST($value, $degrees, $tails) + { + $value = Functions::flattenSingleValue($value); + $degrees = floor(Functions::flattenSingleValue($degrees)); + $tails = floor(Functions::flattenSingleValue($tails)); + + if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) { + if (($value < 0) || ($degrees < 1) || ($tails < 1) || ($tails > 2)) { + return Functions::NAN(); + } + // tdist, which finds the probability that corresponds to a given value + // of t with k degrees of freedom. This algorithm is translated from a + // pascal function on p81 of "Statistical Computing in Pascal" by D + // Cooke, A H Craven & G M Clark (1985: Edward Arnold (Pubs.) Ltd: + // London). The above Pascal algorithm is itself a translation of the + // fortran algoritm "AS 3" by B E Cooper of the Atlas Computer + // Laboratory as reported in (among other places) "Applied Statistics + // Algorithms", editied by P Griffiths and I D Hill (1985; Ellis + // Horwood Ltd.; W. Sussex, England). + $tterm = $degrees; + $ttheta = atan2($value, sqrt($tterm)); + $tc = cos($ttheta); + $ts = sin($ttheta); + $tsum = 0; + + if (($degrees % 2) == 1) { + $ti = 3; + $tterm = $tc; + } else { + $ti = 2; + $tterm = 1; + } + + $tsum = $tterm; + while ($ti < $degrees) { + $tterm *= $tc * $tc * ($ti - 1) / $ti; + $tsum += $tterm; + $ti += 2; + } + $tsum *= $ts; + if (($degrees % 2) == 1) { + $tsum = Functions::M_2DIVPI * ($tsum + $ttheta); + } + $tValue = 0.5 * (1 + $tsum); + if ($tails == 1) { + return 1 - abs($tValue); + } + + return 1 - abs((1 - $tValue) - $tValue); + } + + return Functions::VALUE(); + } + + /** + * TINV. + * + * Returns the one-tailed probability of the chi-squared distribution. + * + * @param float $probability Probability for the function + * @param float $degrees degrees of freedom + * + * @return float|string The result, or a string containing an error + */ + public static function TINV($probability, $degrees) + { + $probability = Functions::flattenSingleValue($probability); + $degrees = floor(Functions::flattenSingleValue($degrees)); + + if ((is_numeric($probability)) && (is_numeric($degrees))) { + $xLo = 100; + $xHi = 0; + + $x = $xNew = 1; + $dx = 1; + $i = 0; + + while ((abs($dx) > Functions::PRECISION) && ($i++ < self::MAX_ITERATIONS)) { + // Apply Newton-Raphson step + $result = self::TDIST($x, $degrees, 2); + $error = $result - $probability; + if ($error == 0.0) { + $dx = 0; + } elseif ($error < 0.0) { + $xLo = $x; + } else { + $xHi = $x; + } + // Avoid division by zero + if ($result != 0.0) { + $dx = $error / $result; + $xNew = $x - $dx; + } + // If the NR fails to converge (which for example may be the + // case if the initial guess is too rough) we apply a bisection + // step to determine a more narrow interval around the root. + if (($xNew < $xLo) || ($xNew > $xHi) || ($result == 0.0)) { + $xNew = ($xLo + $xHi) / 2; + $dx = $xNew - $x; + } + $x = $xNew; + } + if ($i == self::MAX_ITERATIONS) { + return Functions::NA(); + } + + return round($x, 12); + } + + return Functions::VALUE(); + } + + /** + * TREND. + * + * Returns values along a linear Trend + * + * @param mixed[] $yValues Data Series Y + * @param mixed[] $xValues Data Series X + * @param mixed[] $newValues Values of X for which we want to find Y + * @param bool $const a logical value specifying whether to force the intersect to equal 0 + * + * @return array of float + */ + public static function TREND($yValues, $xValues = [], $newValues = [], $const = true) + { + $yValues = Functions::flattenArray($yValues); + $xValues = Functions::flattenArray($xValues); + $newValues = Functions::flattenArray($newValues); + $const = ($const === null) ? true : (bool) Functions::flattenSingleValue($const); + + $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues, $const); + if (empty($newValues)) { + $newValues = $bestFitLinear->getXValues(); + } + + $returnArray = []; + foreach ($newValues as $xValue) { + $returnArray[0][] = $bestFitLinear->getValueOfYForX($xValue); + } + + return $returnArray; + } + + /** + * TRIMMEAN. + * + * Returns the mean of the interior of a data set. TRIMMEAN calculates the mean + * taken by excluding a percentage of data points from the top and bottom tails + * of a data set. + * + * Excel Function: + * TRIMEAN(value1[,value2[, ...]], $discard) + * + * @category Statistical Functions + * + * @param mixed $args Data values + * @param float $discard Percentage to discard + * + * @return float|string + */ + public static function TRIMMEAN(...$args) + { + $aArgs = Functions::flattenArray($args); + + // Calculate + $percent = array_pop($aArgs); + + if ((is_numeric($percent)) && (!is_string($percent))) { + if (($percent < 0) || ($percent > 1)) { + return Functions::NAN(); + } + $mArgs = []; + foreach ($aArgs as $arg) { + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $mArgs[] = $arg; + } + } + $discard = floor(self::COUNT($mArgs) * $percent / 2); + sort($mArgs); + for ($i = 0; $i < $discard; ++$i) { + array_pop($mArgs); + array_shift($mArgs); + } + + return self::AVERAGE($mArgs); + } + + return Functions::VALUE(); + } + + /** + * VARFunc. + * + * Estimates variance based on a sample. + * + * Excel Function: + * VAR(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function VARFunc(...$args) + { + $returnValue = Functions::DIV0(); + + $summerA = $summerB = 0; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + $aCount = 0; + foreach ($aArgs as $arg) { + if (is_bool($arg)) { + $arg = (int) $arg; + } + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $summerA += ($arg * $arg); + $summerB += $arg; + ++$aCount; + } + } + + if ($aCount > 1) { + $summerA *= $aCount; + $summerB *= $summerB; + $returnValue = ($summerA - $summerB) / ($aCount * ($aCount - 1)); + } + + return $returnValue; + } + + /** + * VARA. + * + * Estimates variance based on a sample, including numbers, text, and logical values + * + * Excel Function: + * VARA(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function VARA(...$args) + { + $returnValue = Functions::DIV0(); + + $summerA = $summerB = 0; + + // Loop through arguments + $aArgs = Functions::flattenArrayIndexed($args); + $aCount = 0; + foreach ($aArgs as $k => $arg) { + if ((is_string($arg)) && + (Functions::isValue($k))) { + return Functions::VALUE(); + } elseif ((is_string($arg)) && + (!Functions::isMatrixValue($k))) { + } else { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { + if (is_bool($arg)) { + $arg = (int) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + $summerA += ($arg * $arg); + $summerB += $arg; + ++$aCount; + } + } + } + + if ($aCount > 1) { + $summerA *= $aCount; + $summerB *= $summerB; + $returnValue = ($summerA - $summerB) / ($aCount * ($aCount - 1)); + } + + return $returnValue; + } + + /** + * VARP. + * + * Calculates variance based on the entire population + * + * Excel Function: + * VARP(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function VARP(...$args) + { + // Return value + $returnValue = Functions::DIV0(); + + $summerA = $summerB = 0; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + $aCount = 0; + foreach ($aArgs as $arg) { + if (is_bool($arg)) { + $arg = (int) $arg; + } + // Is it a numeric value? + if ((is_numeric($arg)) && (!is_string($arg))) { + $summerA += ($arg * $arg); + $summerB += $arg; + ++$aCount; + } + } + + if ($aCount > 0) { + $summerA *= $aCount; + $summerB *= $summerB; + $returnValue = ($summerA - $summerB) / ($aCount * $aCount); + } + + return $returnValue; + } + + /** + * VARPA. + * + * Calculates variance based on the entire population, including numbers, text, and logical values + * + * Excel Function: + * VARPA(value1[,value2[, ...]]) + * + * @category Statistical Functions + * + * @param mixed ...$args Data values + * + * @return float + */ + public static function VARPA(...$args) + { + $returnValue = Functions::DIV0(); + + $summerA = $summerB = 0; + + // Loop through arguments + $aArgs = Functions::flattenArrayIndexed($args); + $aCount = 0; + foreach ($aArgs as $k => $arg) { + if ((is_string($arg)) && + (Functions::isValue($k))) { + return Functions::VALUE(); + } elseif ((is_string($arg)) && + (!Functions::isMatrixValue($k))) { + } else { + // Is it a numeric value? + if ((is_numeric($arg)) || (is_bool($arg)) || ((is_string($arg) & ($arg != '')))) { + if (is_bool($arg)) { + $arg = (int) $arg; + } elseif (is_string($arg)) { + $arg = 0; + } + $summerA += ($arg * $arg); + $summerB += $arg; + ++$aCount; + } + } + } + + if ($aCount > 0) { + $summerA *= $aCount; + $summerB *= $summerB; + $returnValue = ($summerA - $summerB) / ($aCount * $aCount); + } + + return $returnValue; + } + + /** + * WEIBULL. + * + * Returns the Weibull distribution. Use this distribution in reliability + * analysis, such as calculating a device's mean time to failure. + * + * @param float $value + * @param float $alpha Alpha Parameter + * @param float $beta Beta Parameter + * @param bool $cumulative + * + * @return float + */ + public static function WEIBULL($value, $alpha, $beta, $cumulative) + { + $value = Functions::flattenSingleValue($value); + $alpha = Functions::flattenSingleValue($alpha); + $beta = Functions::flattenSingleValue($beta); + + if ((is_numeric($value)) && (is_numeric($alpha)) && (is_numeric($beta))) { + if (($value < 0) || ($alpha <= 0) || ($beta <= 0)) { + return Functions::NAN(); + } + if ((is_numeric($cumulative)) || (is_bool($cumulative))) { + if ($cumulative) { + return 1 - exp(0 - pow($value / $beta, $alpha)); + } + + return ($alpha / pow($beta, $alpha)) * pow($value, $alpha - 1) * exp(0 - pow($value / $beta, $alpha)); + } + } + + return Functions::VALUE(); + } + + /** + * ZTEST. + * + * Returns the Weibull distribution. Use this distribution in reliability + * analysis, such as calculating a device's mean time to failure. + * + * @param float $dataSet + * @param float $m0 Alpha Parameter + * @param float $sigma Beta Parameter + * + * @return float|string + */ + public static function ZTEST($dataSet, $m0, $sigma = null) + { + $dataSet = Functions::flattenArrayIndexed($dataSet); + $m0 = Functions::flattenSingleValue($m0); + $sigma = Functions::flattenSingleValue($sigma); + + if ($sigma === null) { + $sigma = self::STDEV($dataSet); + } + $n = count($dataSet); + + return 1 - self::NORMSDIST((self::AVERAGE($dataSet) - $m0) / ($sigma / sqrt($n))); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php new file mode 100644 index 0000000..bbb0392 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php @@ -0,0 +1,674 @@ + 1) { + $character = mb_substr($characters, 0, 1, 'UTF-8'); + } + + return self::unicodeToOrd($character); + } + + /** + * CONCATENATE. + * + * @return string + */ + public static function CONCATENATE(...$args) + { + $returnValue = ''; + + // Loop through arguments + $aArgs = Functions::flattenArray($args); + foreach ($aArgs as $arg) { + if (is_bool($arg)) { + $arg = self::convertBooleanValue($arg); + } + $returnValue .= $arg; + } + + return $returnValue; + } + + /** + * DOLLAR. + * + * This function converts a number to text using currency format, with the decimals rounded to the specified place. + * The format used is $#,##0.00_);($#,##0.00).. + * + * @param float $value The value to format + * @param int $decimals The number of digits to display to the right of the decimal point. + * If decimals is negative, number is rounded to the left of the decimal point. + * If you omit decimals, it is assumed to be 2 + * + * @return string + */ + public static function DOLLAR($value = 0, $decimals = 2) + { + $value = Functions::flattenSingleValue($value); + $decimals = $decimals === null ? 0 : Functions::flattenSingleValue($decimals); + + // Validate parameters + if (!is_numeric($value) || !is_numeric($decimals)) { + return Functions::NAN(); + } + $decimals = floor($decimals); + + $mask = '$#,##0'; + if ($decimals > 0) { + $mask .= '.' . str_repeat('0', $decimals); + } else { + $round = pow(10, abs($decimals)); + if ($value < 0) { + $round = 0 - $round; + } + $value = MathTrig::MROUND($value, $round); + } + + return NumberFormat::toFormattedString($value, $mask); + } + + /** + * SEARCHSENSITIVE. + * + * @param string $needle The string to look for + * @param string $haystack The string in which to look + * @param int $offset Offset within $haystack + * + * @return string + */ + public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1) + { + $needle = Functions::flattenSingleValue($needle); + $haystack = Functions::flattenSingleValue($haystack); + $offset = Functions::flattenSingleValue($offset); + + if (!is_bool($needle)) { + if (is_bool($haystack)) { + $haystack = ($haystack) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + if (($offset > 0) && (StringHelper::countCharacters($haystack) > $offset)) { + if (StringHelper::countCharacters($needle) === 0) { + return $offset; + } + + $pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8'); + if ($pos !== false) { + return ++$pos; + } + } + } + + return Functions::VALUE(); + } + + /** + * SEARCHINSENSITIVE. + * + * @param string $needle The string to look for + * @param string $haystack The string in which to look + * @param int $offset Offset within $haystack + * + * @return string + */ + public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1) + { + $needle = Functions::flattenSingleValue($needle); + $haystack = Functions::flattenSingleValue($haystack); + $offset = Functions::flattenSingleValue($offset); + + if (!is_bool($needle)) { + if (is_bool($haystack)) { + $haystack = ($haystack) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + if (($offset > 0) && (StringHelper::countCharacters($haystack) > $offset)) { + if (StringHelper::countCharacters($needle) === 0) { + return $offset; + } + + $pos = mb_stripos($haystack, $needle, --$offset, 'UTF-8'); + if ($pos !== false) { + return ++$pos; + } + } + } + + return Functions::VALUE(); + } + + /** + * FIXEDFORMAT. + * + * @param mixed $value Value to check + * @param int $decimals + * @param bool $no_commas + * + * @return string + */ + public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false) + { + $value = Functions::flattenSingleValue($value); + $decimals = Functions::flattenSingleValue($decimals); + $no_commas = Functions::flattenSingleValue($no_commas); + + // Validate parameters + if (!is_numeric($value) || !is_numeric($decimals)) { + return Functions::NAN(); + } + $decimals = (int) floor($decimals); + + $valueResult = round($value, $decimals); + if ($decimals < 0) { + $decimals = 0; + } + if (!$no_commas) { + $valueResult = number_format( + $valueResult, + $decimals, + StringHelper::getDecimalSeparator(), + StringHelper::getThousandsSeparator() + ); + } + + return (string) $valueResult; + } + + /** + * LEFT. + * + * @param string $value Value + * @param int $chars Number of characters + * + * @return string + */ + public static function LEFT($value = '', $chars = 1) + { + $value = Functions::flattenSingleValue($value); + $chars = Functions::flattenSingleValue($chars); + + if ($chars < 0) { + return Functions::VALUE(); + } + + if (is_bool($value)) { + $value = ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + return mb_substr($value, 0, $chars, 'UTF-8'); + } + + /** + * MID. + * + * @param string $value Value + * @param int $start Start character + * @param int $chars Number of characters + * + * @return string + */ + public static function MID($value = '', $start = 1, $chars = null) + { + $value = Functions::flattenSingleValue($value); + $start = Functions::flattenSingleValue($start); + $chars = Functions::flattenSingleValue($chars); + + if (($start < 1) || ($chars < 0)) { + return Functions::VALUE(); + } + + if (is_bool($value)) { + $value = ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + if (empty($chars)) { + return ''; + } + + return mb_substr($value, --$start, $chars, 'UTF-8'); + } + + /** + * RIGHT. + * + * @param string $value Value + * @param int $chars Number of characters + * + * @return string + */ + public static function RIGHT($value = '', $chars = 1) + { + $value = Functions::flattenSingleValue($value); + $chars = Functions::flattenSingleValue($chars); + + if ($chars < 0) { + return Functions::VALUE(); + } + + if (is_bool($value)) { + $value = ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8'); + } + + /** + * STRINGLENGTH. + * + * @param string $value Value + * + * @return int + */ + public static function STRINGLENGTH($value = '') + { + $value = Functions::flattenSingleValue($value); + + if (is_bool($value)) { + $value = ($value) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + return mb_strlen($value, 'UTF-8'); + } + + /** + * LOWERCASE. + * + * Converts a string value to upper case. + * + * @param string $mixedCaseString + * + * @return string + */ + public static function LOWERCASE($mixedCaseString) + { + $mixedCaseString = Functions::flattenSingleValue($mixedCaseString); + + if (is_bool($mixedCaseString)) { + $mixedCaseString = ($mixedCaseString) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + return StringHelper::strToLower($mixedCaseString); + } + + /** + * UPPERCASE. + * + * Converts a string value to upper case. + * + * @param string $mixedCaseString + * + * @return string + */ + public static function UPPERCASE($mixedCaseString) + { + $mixedCaseString = Functions::flattenSingleValue($mixedCaseString); + + if (is_bool($mixedCaseString)) { + $mixedCaseString = ($mixedCaseString) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + return StringHelper::strToUpper($mixedCaseString); + } + + /** + * PROPERCASE. + * + * Converts a string value to upper case. + * + * @param string $mixedCaseString + * + * @return string + */ + public static function PROPERCASE($mixedCaseString) + { + $mixedCaseString = Functions::flattenSingleValue($mixedCaseString); + + if (is_bool($mixedCaseString)) { + $mixedCaseString = ($mixedCaseString) ? Calculation::getTRUE() : Calculation::getFALSE(); + } + + return StringHelper::strToTitle($mixedCaseString); + } + + /** + * REPLACE. + * + * @param string $oldText String to modify + * @param int $start Start character + * @param int $chars Number of characters + * @param string $newText String to replace in defined position + * + * @return string + */ + public static function REPLACE($oldText, $start, $chars, $newText) + { + $oldText = Functions::flattenSingleValue($oldText); + $start = Functions::flattenSingleValue($start); + $chars = Functions::flattenSingleValue($chars); + $newText = Functions::flattenSingleValue($newText); + + $left = self::LEFT($oldText, $start - 1); + $right = self::RIGHT($oldText, self::STRINGLENGTH($oldText) - ($start + $chars) + 1); + + return $left . $newText . $right; + } + + /** + * SUBSTITUTE. + * + * @param string $text Value + * @param string $fromText From Value + * @param string $toText To Value + * @param int $instance Instance Number + * + * @return string + */ + public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0) + { + $text = Functions::flattenSingleValue($text); + $fromText = Functions::flattenSingleValue($fromText); + $toText = Functions::flattenSingleValue($toText); + $instance = floor(Functions::flattenSingleValue($instance)); + + if ($instance == 0) { + return str_replace($fromText, $toText, $text); + } + + $pos = -1; + while ($instance > 0) { + $pos = mb_strpos($text, $fromText, $pos + 1, 'UTF-8'); + if ($pos === false) { + break; + } + --$instance; + } + + if ($pos !== false) { + return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText); + } + + return $text; + } + + /** + * RETURNSTRING. + * + * @param mixed $testValue Value to check + * + * @return null|string + */ + public static function RETURNSTRING($testValue = '') + { + $testValue = Functions::flattenSingleValue($testValue); + + if (is_string($testValue)) { + return $testValue; + } + + return null; + } + + /** + * TEXTFORMAT. + * + * @param mixed $value Value to check + * @param string $format Format mask to use + * + * @return string + */ + public static function TEXTFORMAT($value, $format) + { + $value = Functions::flattenSingleValue($value); + $format = Functions::flattenSingleValue($format); + + if ((is_string($value)) && (!is_numeric($value)) && Date::isDateTimeFormatCode($format)) { + $value = DateTime::DATEVALUE($value); + } + + return (string) NumberFormat::toFormattedString($value, $format); + } + + /** + * VALUE. + * + * @param mixed $value Value to check + * + * @return bool + */ + public static function VALUE($value = '') + { + $value = Functions::flattenSingleValue($value); + + if (!is_numeric($value)) { + $numberValue = str_replace( + StringHelper::getThousandsSeparator(), + '', + trim($value, " \t\n\r\0\x0B" . StringHelper::getCurrencyCode()) + ); + if (is_numeric($numberValue)) { + return (float) $numberValue; + } + + $dateSetting = Functions::getReturnDateType(); + Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); + + if (strpos($value, ':') !== false) { + $timeValue = DateTime::TIMEVALUE($value); + if ($timeValue !== Functions::VALUE()) { + Functions::setReturnDateType($dateSetting); + + return $timeValue; + } + } + $dateValue = DateTime::DATEVALUE($value); + if ($dateValue !== Functions::VALUE()) { + Functions::setReturnDateType($dateSetting); + + return $dateValue; + } + Functions::setReturnDateType($dateSetting); + + return Functions::VALUE(); + } + + return (float) $value; + } + + /** + * NUMBERVALUE. + * + * @param mixed $value Value to check + * @param string $decimalSeparator decimal separator, defaults to locale defined value + * @param string $groupSeparator group/thosands separator, defaults to locale defined value + * + * @return float|string + */ + public static function NUMBERVALUE($value = '', $decimalSeparator = null, $groupSeparator = null) + { + $value = Functions::flattenSingleValue($value); + $decimalSeparator = Functions::flattenSingleValue($decimalSeparator); + $groupSeparator = Functions::flattenSingleValue($groupSeparator); + + if (!is_numeric($value)) { + $decimalSeparator = empty($decimalSeparator) ? StringHelper::getDecimalSeparator() : $decimalSeparator; + $groupSeparator = empty($groupSeparator) ? StringHelper::getThousandsSeparator() : $groupSeparator; + + $decimalPositions = preg_match_all('/' . preg_quote($decimalSeparator) . '/', $value, $matches, PREG_OFFSET_CAPTURE); + if ($decimalPositions > 1) { + return Functions::VALUE(); + } + $decimalOffset = array_pop($matches[0])[1]; + if (strpos($value, $groupSeparator, $decimalOffset) !== false) { + return Functions::VALUE(); + } + + $value = str_replace([$groupSeparator, $decimalSeparator], ['', '.'], $value); + + // Handle the special case of trailing % signs + $percentageString = rtrim($value, '%'); + if (!is_numeric($percentageString)) { + return Functions::VALUE(); + } + + $percentageAdjustment = strlen($value) - strlen($percentageString); + if ($percentageAdjustment) { + $value = (float) $percentageString; + $value /= pow(10, $percentageAdjustment * 2); + } + } + + return (float) $value; + } + + /** + * Compares two text strings and returns TRUE if they are exactly the same, FALSE otherwise. + * EXACT is case-sensitive but ignores formatting differences. + * Use EXACT to test text being entered into a document. + * + * @param $value1 + * @param $value2 + * + * @return bool + */ + public static function EXACT($value1, $value2) + { + $value1 = Functions::flattenSingleValue($value1); + $value2 = Functions::flattenSingleValue($value2); + + return (string) $value2 === (string) $value1; + } + + /** + * TEXTJOIN. + * + * @param mixed $delimiter + * @param mixed $ignoreEmpty + * @param mixed $args + * + * @return string + */ + public static function TEXTJOIN($delimiter, $ignoreEmpty, ...$args) + { + // Loop through arguments + $aArgs = Functions::flattenArray($args); + foreach ($aArgs as $key => &$arg) { + if ($ignoreEmpty && trim($arg) == '') { + unset($aArgs[$key]); + } elseif (is_bool($arg)) { + $arg = self::convertBooleanValue($arg); + } + } + + return implode($delimiter, $aArgs); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php new file mode 100644 index 0000000..341a017 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Token/Stack.php @@ -0,0 +1,149 @@ +count; + } + + /** + * Push a new entry onto the stack. + * + * @param mixed $type + * @param mixed $value + * @param mixed $reference + * @param null|string $storeKey will store the result under this alias + * @param null|string $onlyIf will only run computation if the matching + * store key is true + * @param null|string $onlyIfNot will only run computation if the matching + * store key is false + */ + public function push( + $type, + $value, + $reference = null, + $storeKey = null, + $onlyIf = null, + $onlyIfNot = null + ) { + $stackItem = $this->getStackItem($type, $value, $reference, $storeKey, $onlyIf, $onlyIfNot); + + $this->stack[$this->count++] = $stackItem; + + if ($type == 'Function') { + $localeFunction = Calculation::localeFunc($value); + if ($localeFunction != $value) { + $this->stack[($this->count - 1)]['localeValue'] = $localeFunction; + } + } + } + + public function getStackItem( + $type, + $value, + $reference = null, + $storeKey = null, + $onlyIf = null, + $onlyIfNot = null + ) { + $stackItem = [ + 'type' => $type, + 'value' => $value, + 'reference' => $reference, + ]; + + if (isset($storeKey)) { + $stackItem['storeKey'] = $storeKey; + } + + if (isset($onlyIf)) { + $stackItem['onlyIf'] = $onlyIf; + } + + if (isset($onlyIfNot)) { + $stackItem['onlyIfNot'] = $onlyIfNot; + } + + return $stackItem; + } + + /** + * Pop the last entry from the stack. + * + * @return mixed + */ + public function pop() + { + if ($this->count > 0) { + return $this->stack[--$this->count]; + } + + return null; + } + + /** + * Return an entry from the stack without removing it. + * + * @param int $n number indicating how far back in the stack we want to look + * + * @return mixed + */ + public function last($n = 1) + { + if ($this->count - $n < 0) { + return null; + } + + return $this->stack[$this->count - $n]; + } + + /** + * Clear the stack. + */ + public function clear() + { + $this->stack = []; + $this->count = 0; + } + + public function __toString() + { + $str = 'Stack: '; + foreach ($this->stack as $index => $item) { + if ($index > $this->count - 1) { + break; + } + $value = $item['value'] ?? 'no value'; + while (is_array($value)) { + $value = array_pop($value); + } + $str .= $value . ' |> '; + } + + return $str; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/functionlist.txt b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/functionlist.txt new file mode 100644 index 0000000..7776e6e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/functionlist.txt @@ -0,0 +1,390 @@ +ABS +ACCRINT +ACCRINTM +ACOS +ACOSH +ACOT +ACOTH +ADDRESS +AMORDEGRC +AMORLINC +AND +ARABIC +AREAS +ASC +ASIN +ASINH +ATAN +ATAN2 +ATANH +AVEDEV +AVERAGE +AVERAGEA +AVERAGEIF +AVERAGEIFS +BAHTTEXT +BASE +BESSELI +BESSELJ +BESSELK +BESSELY +BETADIST +BETAINV +BIN2DEC +BIN2HEX +BIN2OCT +BINOMDIST +BITAND +BITLSHIFT +BITOR +BITRSHIFT +BITXOR +CEILING +CELL +CHAR +CHIDIST +CHIINV +CHITEST +CHOOSE +CLEAN +CODE +COLUMN +COLUMNS +COMBIN +COMPLEX +CONCAT +CONCATENATE +CONFIDENCE +CONVERT +CORREL +COS +COSH +COT +COTH +COUNT +COUNTA +COUNTBLANK +COUNTIF +COUNTIFS +COUPDAYBS +COUPDAYBS +COUPDAYSNC +COUPNCD +COUPNUM +COUPPCD +COVAR +CRITBINOM +CSC +CSCH +CUBEKPIMEMBER +CUBEMEMBER +CUBEMEMBERPROPERTY +CUBERANKEDMEMBER +CUBESET +CUBESETCOUNT +CUBEVALUE +CUMIPMT +CUMPRINC +DATE +DATEDIF +DATEVALUE +DAVERAGE +DAY +DAYS +DAYS360 +DB +DCOUNT +DCOUNTA +DDB +DEC2BIN +DEC2HEX +DEC2OCT +DEGREES +DELTA +DEVSQ +DGET +DISC +DMAX +DMIN +DOLLAR +DOLLARDE +DOLLARFR +DPRODUCT +DSTDEV +DSTDEVP +DSUM +DURATION +DVAR +DVARP +EDATE +EFFECT +EOMONTH +ERF +ERF.PRECISE +ERFC +ERFC.PRECISE +ERROR.TYPE +EVEN +EXACT +EXP +EXPONDIST +FACT +FACTDOUBLE +FALSE +FDIST +FIND +FINDB +FINV +FISHER +FISHERINV +FIXED +FLOOR +FORECAST +FREQUENCY +FTEST +FV +FVSCHEDULE +GAMAMDIST +GAMMAINV +GAMMALN +GCD +GEOMEAN +GESTEP +GETPIVOTDATA +GROWTH +HARMEAN +HEX2BIN +HEX2OCT +HLOOKUP +HOUR +HYPERLINK +HYPGEOMDIST +IF +IFERROR +IMABS +IMAGINARY +IMARGUMENT +IMCONJUGATE +IMCOS +IMCOSH +IMCOT +IMCSC +IMCSCH +IMEXP +IMLN +IMLOG10 +IMLOG2 +IMPOWER +IMPRODUCT +IMREAL +IMSEC +IMSECH +IMSIN +IMSINH +IMSQRT +IMSUB +IMSUM +IMTAN +INDEX +INDIRECT +INFO +INT +INTERCEPT +INTRATE +IPMT +IRR +ISBLANK +ISERR +ISERROR +ISEVEN +ISLOGICAL +ISNA +ISNONTEXT +ISNUMBER +ISODD +ISOWEEKNUM +ISPMT +ISREF +ISTEXT +JIS +KURT +LARGE +LCM +LEFT +LEFTB +LEN +LENB +LINEST +LN +LOG +LOG10 +LOGEST +LOGINV +LOGNORMDIST +LOOKUP +LOWER +MATCH +MAX +MAXA +MAXIFS +MDETERM +MDURATION +MEDIAN +MID +MIDB +MIN +MINA +MINIFS +MINUTE +MINVERSE +MIRR +MMULT +MOD +MODE +MONTH +MROUND +MULTINOMIAL +N +NA +NEGBINOMDIST +NETWORKDAYS +NOMINAL +NORMDIST +NORMINV +NORMSDIST +NORMSINV +NOT +NOW +NPER +NPV +NUMBERVALUE +OCT2BIN +OCT2DEC +OCT2HEX +ODD +ODDFPRICE +ODDFYIELD +ODDLPRICE +ODDLYIELD +OFFSET +OR +PDURATION +PEARSON +PERCENTILE +PERCENTRANK +PERMUT +PHONETIC +PI +PMT +POISSON +POWER +PPMT +PRICE +PRICEDISC +PRICEMAT +PROB +PRODUCT +PROPER +PV +QUARTILE +QUOTIENT +RADIANS +RAND +RANDBETWEEN +RANK +RATE +RECEIVED +REPLACE +REPLACEB +REPT +RIGHT +RIGHTB +ROMAN +ROUND +ROUNDDOWN +ROUNDUP +ROW +ROWS +RRI +RSQ +RTD +SEARCH +SEARCHB +SEC +SECH +SECOND +SERIESSUM +SIGN +SIN +SINH +SKEW +SLN +SLOPE +SMALL +SQRT +SQRTPI +STANDARDIZE +STDEV +STDEV.A +STDEV.P +STDEVA +STDEVP +STDEVPA +STEYX +SUBSTITUTE +SUBTOTAL +SUM +SUMIF +SUMIFS +SUMPRODUCT +SUMSQ +SUMX2MY2 +SUMX2PY2 +SUMXMY2 +SWITCH +SYD +T +TAN +TANH +TBILLEQ +TBILLPRICE +TBILLYIELD +TDIST +TEXT +TEXTJOIN +TIME +TIMEVALUE +TINV +TODAY +TRANSPOSE +TREND +TRIM +TRIMMEAN +TRUE +TRUNC +TTEST +TYPE +UNICHAR +UNIORD +UPPER +USDOLLAR +VALUE +VAR +VARA +VARP +VARPA +VDB +VLOOKUP +WEEKDAY +WEEKNUM +WEIBULL +WORKDAY +XIRR +XNPV +XOR +YEAR +YEARFRAC +YIELD +YIELDDISC +YIELDMAT +ZTEST diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/bg/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/bg/config new file mode 100644 index 0000000..86f94d3 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/bg/config @@ -0,0 +1,27 @@ +## +## PhpSpreadsheet +## +## +## + + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = лв + + +## +## Excel Error Codes (For future use) + +## +NULL = #ПРАЗНО! +DIV0 = #ДЕЛ/0! +VALUE = #СТОЙНОСТ! +REF = #РЕФ! +NAME = #ИМЕ? +NUM = #ЧИСЛО! +NA = #Н/Д diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/bg/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/bg/functions new file mode 100644 index 0000000..4bc1574 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/bg/functions @@ -0,0 +1,417 @@ +## +## PhpSpreadsheet +## +## +## Data in this file derived from information provided by web-junior (http://www.web-junior.net/) +## +## + + +## +## Add-in and Automation functions Функции надстроек и автоматизации +## +GETPIVOTDATA = ПОЛУЧИТЬ.ДАННЫЕ.СВОДНОЙ.ТАБЛИЦЫ ## Возвращает данные, хранящиеся в отчете сводной таблицы. + + +## +## Cube functions Функции Куб +## +CUBEKPIMEMBER = КУБЭЛЕМЕНТКИП ## Возвращает свойство ключевого индикатора производительности «(КИП)» и отображает имя «КИП» в ячейке. «КИП» представляет собой количественную величину, такую как ежемесячная валовая прибыль или ежеквартальная текучесть кадров, используемой для контроля эффективности работы организации. +CUBEMEMBER = КУБЭЛЕМЕНТ ## Возвращает элемент или кортеж из куба. Используется для проверки существования элемента или кортежа в кубе. +CUBEMEMBERPROPERTY = КУБСВОЙСТВОЭЛЕМЕНТА ## Возвращает значение свойства элемента из куба. Используется для проверки существования имени элемента в кубе и возвращает указанное свойство для этого элемента. +CUBERANKEDMEMBER = КУБПОРЭЛЕМЕНТ ## Возвращает n-ый или ранжированный элемент в множество. Используется для возвращения одного или нескольких элементов в множество, например, лучшего продавца или 10 лучших студентов. +CUBESET = КУБМНОЖ ## Определяет вычислительное множество элементов или кортежей, отправляя на сервер выражение, которое создает множество, а затем возвращает его в Microsoft Office Excel. +CUBESETCOUNT = КУБЧИСЛОЭЛМНОЖ ## Возвращает число элементов множества. +CUBEVALUE = КУБЗНАЧЕНИЕ ## Возвращает обобщенное значение из куба. + + +## +## Database functions Функции для работы с базами данных +## +DAVERAGE = ДСРЗНАЧ ## Возвращает среднее значение выбранных записей базы данных. +DCOUNT = БСЧЁТ ## Подсчитывает количество числовых ячеек в базе данных. +DCOUNTA = БСЧЁТА ## Подсчитывает количество непустых ячеек в базе данных. +DGET = БИЗВЛЕЧЬ ## Извлекает из базы данных одну запись, удовлетворяющую заданному условию. +DMAX = ДМАКС ## Возвращает максимальное значение среди выделенных записей базы данных. +DMIN = ДМИН ## Возвращает минимальное значение среди выделенных записей базы данных. +DPRODUCT = БДПРОИЗВЕД ## Перемножает значения определенного поля в записях базы данных, удовлетворяющих условию. +DSTDEV = ДСТАНДОТКЛ ## Оценивает стандартное отклонение по выборке для выделенных записей базы данных. +DSTDEVP = ДСТАНДОТКЛП ## Вычисляет стандартное отклонение по генеральной совокупности для выделенных записей базы данных +DSUM = БДСУММ ## Суммирует числа в поле для записей базы данных, удовлетворяющих условию. +DVAR = БДДИСП ## Оценивает дисперсию по выборке из выделенных записей базы данных +DVARP = БДДИСПП ## Вычисляет дисперсию по генеральной совокупности для выделенных записей базы данных + + +## +## Date and time functions Функции даты и времени +## +DATE = ДАТА ## Возвращает заданную дату в числовом формате. +DATEVALUE = ДАТАЗНАЧ ## Преобразует дату из текстового формата в числовой формат. +DAY = ДЕНЬ ## Преобразует дату в числовом формате в день месяца. +DAYS360 = ДНЕЙ360 ## Вычисляет количество дней между двумя датами на основе 360-дневного года. +EDATE = ДАТАМЕС ## Возвращает дату в числовом формате, отстоящую на заданное число месяцев вперед или назад от начальной даты. +EOMONTH = КОНМЕСЯЦА ## Возвращает дату в числовом формате для последнего дня месяца, отстоящего вперед или назад на заданное число месяцев. +HOUR = ЧАС ## Преобразует дату в числовом формате в часы. +MINUTE = МИНУТЫ ## Преобразует дату в числовом формате в минуты. +MONTH = МЕСЯЦ ## Преобразует дату в числовом формате в месяцы. +NETWORKDAYS = ЧИСТРАБДНИ ## Возвращает количество рабочих дней между двумя датами. +NOW = ТДАТА ## Возвращает текущую дату и время в числовом формате. +SECOND = СЕКУНДЫ ## Преобразует дату в числовом формате в секунды. +TIME = ВРЕМЯ ## Возвращает заданное время в числовом формате. +TIMEVALUE = ВРЕМЗНАЧ ## Преобразует время из текстового формата в числовой формат. +TODAY = СЕГОДНЯ ## Возвращает текущую дату в числовом формате. +WEEKDAY = ДЕНЬНЕД ## Преобразует дату в числовом формате в день недели. +WEEKNUM = НОМНЕДЕЛИ ## Преобразует числовое представление в число, которое указывает, на какую неделю года приходится указанная дата. +WORKDAY = РАБДЕНЬ ## Возвращает дату в числовом формате, отстоящую вперед или назад на заданное количество рабочих дней. +YEAR = ГОД ## Преобразует дату в числовом формате в год. +YEARFRAC = ДОЛЯГОДА ## Возвращает долю года, которую составляет количество дней между начальной и конечной датами. + + +## +## Engineering functions Инженерные функции +## +BESSELI = БЕССЕЛЬ.I ## Возвращает модифицированную функцию Бесселя In(x). +BESSELJ = БЕССЕЛЬ.J ## Возвращает функцию Бесселя Jn(x). +BESSELK = БЕССЕЛЬ.K ## Возвращает модифицированную функцию Бесселя Kn(x). +BESSELY = БЕССЕЛЬ.Y ## Возвращает функцию Бесселя Yn(x). +BIN2DEC = ДВ.В.ДЕС ## Преобразует двоичное число в десятичное. +BIN2HEX = ДВ.В.ШЕСТН ## Преобразует двоичное число в шестнадцатеричное. +BIN2OCT = ДВ.В.ВОСЬМ ## Преобразует двоичное число в восьмеричное. +COMPLEX = КОМПЛЕКСН ## Преобразует коэффициенты при вещественной и мнимой частях комплексного числа в комплексное число. +CONVERT = ПРЕОБР ## Преобразует число из одной системы единиц измерения в другую. +DEC2BIN = ДЕС.В.ДВ ## Преобразует десятичное число в двоичное. +DEC2HEX = ДЕС.В.ШЕСТН ## Преобразует десятичное число в шестнадцатеричное. +DEC2OCT = ДЕС.В.ВОСЬМ ## Преобразует десятичное число в восьмеричное. +DELTA = ДЕЛЬТА ## Проверяет равенство двух значений. +ERF = ФОШ ## Возвращает функцию ошибки. +ERFC = ДФОШ ## Возвращает дополнительную функцию ошибки. +GESTEP = ПОРОГ ## Проверяет, не превышает ли данное число порогового значения. +HEX2BIN = ШЕСТН.В.ДВ ## Преобразует шестнадцатеричное число в двоичное. +HEX2DEC = ШЕСТН.В.ДЕС ## Преобразует шестнадцатеричное число в десятичное. +HEX2OCT = ШЕСТН.В.ВОСЬМ ## Преобразует шестнадцатеричное число в восьмеричное. +IMABS = МНИМ.ABS ## Возвращает абсолютную величину (модуль) комплексного числа. +IMAGINARY = МНИМ.ЧАСТЬ ## Возвращает коэффициент при мнимой части комплексного числа. +IMARGUMENT = МНИМ.АРГУМЕНТ ## Возвращает значение аргумента комплексного числа (тета) — угол, выраженный в радианах. +IMCONJUGATE = МНИМ.СОПРЯЖ ## Возвращает комплексно-сопряженное комплексное число. +IMCOS = МНИМ.COS ## Возвращает косинус комплексного числа. +IMDIV = МНИМ.ДЕЛ ## Возвращает частное от деления двух комплексных чисел. +IMEXP = МНИМ.EXP ## Возвращает экспоненту комплексного числа. +IMLN = МНИМ.LN ## Возвращает натуральный логарифм комплексного числа. +IMLOG10 = МНИМ.LOG10 ## Возвращает обычный (десятичный) логарифм комплексного числа. +IMLOG2 = МНИМ.LOG2 ## Возвращает двоичный логарифм комплексного числа. +IMPOWER = МНИМ.СТЕПЕНЬ ## Возвращает комплексное число, возведенное в целую степень. +IMPRODUCT = МНИМ.ПРОИЗВЕД ## Возвращает произведение от 2 до 29 комплексных чисел. +IMREAL = МНИМ.ВЕЩ ## Возвращает коэффициент при вещественной части комплексного числа. +IMSIN = МНИМ.SIN ## Возвращает синус комплексного числа. +IMSQRT = МНИМ.КОРЕНЬ ## Возвращает значение квадратного корня из комплексного числа. +IMSUB = МНИМ.РАЗН ## Возвращает разность двух комплексных чисел. +IMSUM = МНИМ.СУММ ## Возвращает сумму комплексных чисел. +OCT2BIN = ВОСЬМ.В.ДВ ## Преобразует восьмеричное число в двоичное. +OCT2DEC = ВОСЬМ.В.ДЕС ## Преобразует восьмеричное число в десятичное. +OCT2HEX = ВОСЬМ.В.ШЕСТН ## Преобразует восьмеричное число в шестнадцатеричное. + + +## +## Financial functions Финансовые функции +## +ACCRINT = НАКОПДОХОД ## Возвращает накопленный процент по ценным бумагам с периодической выплатой процентов. +ACCRINTM = НАКОПДОХОДПОГАШ ## Возвращает накопленный процент по ценным бумагам, проценты по которым выплачиваются в срок погашения. +AMORDEGRC = АМОРУМ ## Возвращает величину амортизации для каждого периода, используя коэффициент амортизации. +AMORLINC = АМОРУВ ## Возвращает величину амортизации для каждого периода. +COUPDAYBS = ДНЕЙКУПОНДО ## Возвращает количество дней от начала действия купона до даты соглашения. +COUPDAYS = ДНЕЙКУПОН ## Возвращает число дней в периоде купона, содержащем дату соглашения. +COUPDAYSNC = ДНЕЙКУПОНПОСЛЕ ## Возвращает число дней от даты соглашения до срока следующего купона. +COUPNCD = ДАТАКУПОНПОСЛЕ ## Возвращает следующую дату купона после даты соглашения. +COUPNUM = ЧИСЛКУПОН ## Возвращает количество купонов, которые могут быть оплачены между датой соглашения и сроком вступления в силу. +COUPPCD = ДАТАКУПОНДО ## Возвращает предыдущую дату купона перед датой соглашения. +CUMIPMT = ОБЩПЛАТ ## Возвращает общую выплату, произведенную между двумя периодическими выплатами. +CUMPRINC = ОБЩДОХОД ## Возвращает общую выплату по займу между двумя периодами. +DB = ФУО ## Возвращает величину амортизации актива для заданного периода, рассчитанную методом фиксированного уменьшения остатка. +DDB = ДДОБ ## Возвращает величину амортизации актива за данный период, используя метод двойного уменьшения остатка или иной явно указанный метод. +DISC = СКИДКА ## Возвращает норму скидки для ценных бумаг. +DOLLARDE = РУБЛЬ.ДЕС ## Преобразует цену в рублях, выраженную в виде дроби, в цену в рублях, выраженную десятичным числом. +DOLLARFR = РУБЛЬ.ДРОБЬ ## Преобразует цену в рублях, выраженную десятичным числом, в цену в рублях, выраженную в виде дроби. +DURATION = ДЛИТ ## Возвращает ежегодную продолжительность действия ценных бумаг с периодическими выплатами по процентам. +EFFECT = ЭФФЕКТ ## Возвращает действующие ежегодные процентные ставки. +FV = БС ## Возвращает будущую стоимость инвестиции. +FVSCHEDULE = БЗРАСПИС ## Возвращает будущую стоимость первоначальной основной суммы после начисления ряда сложных процентов. +INTRATE = ИНОРМА ## Возвращает процентную ставку для полностью инвестированных ценных бумаг. +IPMT = ПРПЛТ ## Возвращает величину выплаты прибыли на вложения за данный период. +IRR = ВСД ## Возвращает внутреннюю ставку доходности для ряда потоков денежных средств. +ISPMT = ПРОЦПЛАТ ## Вычисляет выплаты за указанный период инвестиции. +MDURATION = МДЛИТ ## Возвращает модифицированную длительность Маколея для ценных бумаг с предполагаемой номинальной стоимостью 100 рублей. +MIRR = МВСД ## Возвращает внутреннюю ставку доходности, при которой положительные и отрицательные денежные потоки имеют разные значения ставки. +NOMINAL = НОМИНАЛ ## Возвращает номинальную годовую процентную ставку. +NPER = КПЕР ## Возвращает общее количество периодов выплаты для данного вклада. +NPV = ЧПС ## Возвращает чистую приведенную стоимость инвестиции, основанной на серии периодических денежных потоков и ставке дисконтирования. +ODDFPRICE = ЦЕНАПЕРВНЕРЕГ ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг с нерегулярным первым периодом. +ODDFYIELD = ДОХОДПЕРВНЕРЕГ ## Возвращает доход по ценным бумагам с нерегулярным первым периодом. +ODDLPRICE = ЦЕНАПОСЛНЕРЕГ ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг с нерегулярным последним периодом. +ODDLYIELD = ДОХОДПОСЛНЕРЕГ ## Возвращает доход по ценным бумагам с нерегулярным последним периодом. +PMT = ПЛТ ## Возвращает величину выплаты за один период аннуитета. +PPMT = ОСПЛТ ## Возвращает величину выплат в погашение основной суммы по инвестиции за заданный период. +PRICE = ЦЕНА ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг, по которым производится периодическая выплата процентов. +PRICEDISC = ЦЕНАСКИДКА ## Возвращает цену за 100 рублей номинальной стоимости ценных бумаг, на которые сделана скидка. +PRICEMAT = ЦЕНАПОГАШ ## Возвращает цену за 100 рублей номинальной стоимости ценных бумаг, проценты по которым выплачиваются в срок погашения. +PV = ПС ## Возвращает приведенную (к текущему моменту) стоимость инвестиции. +RATE = СТАВКА ## Возвращает процентную ставку по аннуитету за один период. +RECEIVED = ПОЛУЧЕНО ## Возвращает сумму, полученную к сроку погашения полностью обеспеченных ценных бумаг. +SLN = АПЛ ## Возвращает величину линейной амортизации актива за один период. +SYD = АСЧ ## Возвращает величину амортизации актива за данный период, рассчитанную методом суммы годовых чисел. +TBILLEQ = РАВНОКЧЕК ## Возвращает эквивалентный облигации доход по казначейскому чеку. +TBILLPRICE = ЦЕНАКЧЕК ## Возвращает цену за 100 рублей нарицательной стоимости для казначейского чека. +TBILLYIELD = ДОХОДКЧЕК ## Возвращает доход по казначейскому чеку. +VDB = ПУО ## Возвращает величину амортизации актива для указанного или частичного периода при использовании метода сокращающегося баланса. +XIRR = ЧИСТВНДОХ ## Возвращает внутреннюю ставку доходности для графика денежных потоков, которые не обязательно носят периодический характер. +XNPV = ЧИСТНЗ ## Возвращает чистую приведенную стоимость для денежных потоков, которые не обязательно являются периодическими. +YIELD = ДОХОД ## Возвращает доход от ценных бумаг, по которым производятся периодические выплаты процентов. +YIELDDISC = ДОХОДСКИДКА ## Возвращает годовой доход по ценным бумагам, на которые сделана скидка (пример — казначейские чеки). +YIELDMAT = ДОХОДПОГАШ ## Возвращает годовой доход от ценных бумаг, проценты по которым выплачиваются в срок погашения. + + +## +## Information functions Информационные функции +## +CELL = ЯЧЕЙКА ## Возвращает информацию о формате, расположении или содержимом ячейки. +ERROR.TYPE = ТИП.ОШИБКИ ## Возвращает числовой код, соответствующий типу ошибки. +INFO = ИНФОРМ ## Возвращает информацию о текущей операционной среде. +ISBLANK = ЕПУСТО ## Возвращает значение ИСТИНА, если аргумент является ссылкой на пустую ячейку. +ISERR = ЕОШ ## Возвращает значение ИСТИНА, если аргумент ссылается на любое значение ошибки, кроме #Н/Д. +ISERROR = ЕОШИБКА ## Возвращает значение ИСТИНА, если аргумент ссылается на любое значение ошибки. +ISEVEN = ЕЧЁТН ## Возвращает значение ИСТИНА, если значение аргумента является четным числом. +ISLOGICAL = ЕЛОГИЧ ## Возвращает значение ИСТИНА, если аргумент ссылается на логическое значение. +ISNA = ЕНД ## Возвращает значение ИСТИНА, если аргумент ссылается на значение ошибки #Н/Д. +ISNONTEXT = ЕНЕТЕКСТ ## Возвращает значение ИСТИНА, если значение аргумента не является текстом. +ISNUMBER = ЕЧИСЛО ## Возвращает значение ИСТИНА, если аргумент ссылается на число. +ISODD = ЕНЕЧЁТ ## Возвращает значение ИСТИНА, если значение аргумента является нечетным числом. +ISREF = ЕССЫЛКА ## Возвращает значение ИСТИНА, если значение аргумента является ссылкой. +ISTEXT = ЕТЕКСТ ## Возвращает значение ИСТИНА, если значение аргумента является текстом. +N = Ч ## Возвращает значение, преобразованное в число. +NA = НД ## Возвращает значение ошибки #Н/Д. +TYPE = ТИП ## Возвращает число, обозначающее тип данных значения. + + +## +## Logical functions Логические функции +## +AND = И ## Renvoie VRAI si tous ses arguments sont VRAI. +FALSE = ЛОЖЬ ## Возвращает логическое значение ЛОЖЬ. +IF = ЕСЛИ ## Выполняет проверку условия. +IFERROR = ЕСЛИОШИБКА ## Возвращает введённое значение, если вычисление по формуле вызывает ошибку; в противном случае функция возвращает результат вычисления. +NOT = НЕ ## Меняет логическое значение своего аргумента на противоположное. +OR = ИЛИ ## Возвращает значение ИСТИНА, если хотя бы один аргумент имеет значение ИСТИНА. +TRUE = ИСТИНА ## Возвращает логическое значение ИСТИНА. + + +## +## Lookup and reference functions Функции ссылки и поиска +## +ADDRESS = АДРЕС ## Возвращает ссылку на отдельную ячейку листа в виде текста. +AREAS = ОБЛАСТИ ## Возвращает количество областей в ссылке. +CHOOSE = ВЫБОР ## Выбирает значение из списка значений по индексу. +COLUMN = СТОЛБЕЦ ## Возвращает номер столбца, на который указывает ссылка. +COLUMNS = ЧИСЛСТОЛБ ## Возвращает количество столбцов в ссылке. +HLOOKUP = ГПР ## Ищет в первой строке массива и возвращает значение отмеченной ячейки +HYPERLINK = ГИПЕРССЫЛКА ## Создает ссылку, открывающую документ, который находится на сервере сети, в интрасети или в Интернете. +INDEX = ИНДЕКС ## Использует индекс для выбора значения из ссылки или массива. +INDIRECT = ДВССЫЛ ## Возвращает ссылку, заданную текстовым значением. +LOOKUP = ПРОСМОТР ## Ищет значения в векторе или массиве. +MATCH = ПОИСКПОЗ ## Ищет значения в ссылке или массиве. +OFFSET = СМЕЩ ## Возвращает смещение ссылки относительно заданной ссылки. +ROW = СТРОКА ## Возвращает номер строки, определяемой ссылкой. +ROWS = ЧСТРОК ## Возвращает количество строк в ссылке. +RTD = ДРВ ## Извлекает данные реального времени из программ, поддерживающих автоматизацию COM (Программирование объектов. Стандартное средство для работы с объектами некоторого приложения из другого приложения или средства разработки. Программирование объектов (ранее называемое программированием OLE) является функцией модели COM (Component Object Model, модель компонентных объектов).). +TRANSPOSE = ТРАНСП ## Возвращает транспонированный массив. +VLOOKUP = ВПР ## Ищет значение в первом столбце массива и возвращает значение из ячейки в найденной строке и указанном столбце. + + +## +## Math and trigonometry functions Математические и тригонометрические функции +## +ABS = ABS ## Возвращает модуль (абсолютную величину) числа. +ACOS = ACOS ## Возвращает арккосинус числа. +ACOSH = ACOSH ## Возвращает гиперболический арккосинус числа. +ASIN = ASIN ## Возвращает арксинус числа. +ASINH = ASINH ## Возвращает гиперболический арксинус числа. +ATAN = ATAN ## Возвращает арктангенс числа. +ATAN2 = ATAN2 ## Возвращает арктангенс для заданных координат x и y. +ATANH = ATANH ## Возвращает гиперболический арктангенс числа. +CEILING = ОКРВВЕРХ ## Округляет число до ближайшего целого или до ближайшего кратного указанному значению. +COMBIN = ЧИСЛКОМБ ## Возвращает количество комбинаций для заданного числа объектов. +COS = COS ## Возвращает косинус числа. +COSH = COSH ## Возвращает гиперболический косинус числа. +DEGREES = ГРАДУСЫ ## Преобразует радианы в градусы. +EVEN = ЧЁТН ## Округляет число до ближайшего четного целого. +EXP = EXP ## Возвращает число e, возведенное в указанную степень. +FACT = ФАКТР ## Возвращает факториал числа. +FACTDOUBLE = ДВФАКТР ## Возвращает двойной факториал числа. +FLOOR = ОКРВНИЗ ## Округляет число до ближайшего меньшего по модулю значения. +GCD = НОД ## Возвращает наибольший общий делитель. +INT = ЦЕЛОЕ ## Округляет число до ближайшего меньшего целого. +LCM = НОК ## Возвращает наименьшее общее кратное. +LN = LN ## Возвращает натуральный логарифм числа. +LOG = LOG ## Возвращает логарифм числа по заданному основанию. +LOG10 = LOG10 ## Возвращает десятичный логарифм числа. +MDETERM = МОПРЕД ## Возвращает определитель матрицы массива. +MINVERSE = МОБР ## Возвращает обратную матрицу массива. +MMULT = МУМНОЖ ## Возвращает произведение матриц двух массивов. +MOD = ОСТАТ ## Возвращает остаток от деления. +MROUND = ОКРУГЛТ ## Возвращает число, округленное с требуемой точностью. +MULTINOMIAL = МУЛЬТИНОМ ## Возвращает мультиномиальный коэффициент множества чисел. +ODD = НЕЧЁТ ## Округляет число до ближайшего нечетного целого. +PI = ПИ ## Возвращает число пи. +POWER = СТЕПЕНЬ ## Возвращает результат возведения числа в степень. +PRODUCT = ПРОИЗВЕД ## Возвращает произведение аргументов. +QUOTIENT = ЧАСТНОЕ ## Возвращает целую часть частного при делении. +RADIANS = РАДИАНЫ ## Преобразует градусы в радианы. +RAND = СЛЧИС ## Возвращает случайное число в интервале от 0 до 1. +RANDBETWEEN = СЛУЧМЕЖДУ ## Возвращает случайное число в интервале между двумя заданными числами. +ROMAN = РИМСКОЕ ## Преобразует арабские цифры в римские в виде текста. +ROUND = ОКРУГЛ ## Округляет число до указанного количества десятичных разрядов. +ROUNDDOWN = ОКРУГЛВНИЗ ## Округляет число до ближайшего меньшего по модулю значения. +ROUNDUP = ОКРУГЛВВЕРХ ## Округляет число до ближайшего большего по модулю значения. +SERIESSUM = РЯД.СУММ ## Возвращает сумму степенного ряда, вычисленную по формуле. +SIGN = ЗНАК ## Возвращает знак числа. +SIN = SIN ## Возвращает синус заданного угла. +SINH = SINH ## Возвращает гиперболический синус числа. +SQRT = КОРЕНЬ ## Возвращает положительное значение квадратного корня. +SQRTPI = КОРЕНЬПИ ## Возвращает квадратный корень из значения выражения (число * ПИ). +SUBTOTAL = ПРОМЕЖУТОЧНЫЕ.ИТОГИ ## Возвращает промежуточный итог в списке или базе данных. +SUM = СУММ ## Суммирует аргументы. +SUMIF = СУММЕСЛИ ## Суммирует ячейки, удовлетворяющие заданному условию. +SUMIFS = СУММЕСЛИМН ## Суммирует диапазон ячеек, удовлетворяющих нескольким условиям. +SUMPRODUCT = СУММПРОИЗВ ## Возвращает сумму произведений соответствующих элементов массивов. +SUMSQ = СУММКВ ## Возвращает сумму квадратов аргументов. +SUMX2MY2 = СУММРАЗНКВ ## Возвращает сумму разностей квадратов соответствующих значений в двух массивах. +SUMX2PY2 = СУММСУММКВ ## Возвращает сумму сумм квадратов соответствующих элементов двух массивов. +SUMXMY2 = СУММКВРАЗН ## Возвращает сумму квадратов разностей соответствующих значений в двух массивах. +TAN = TAN ## Возвращает тангенс числа. +TANH = TANH ## Возвращает гиперболический тангенс числа. +TRUNC = ОТБР ## Отбрасывает дробную часть числа. + + +## +## Statistical functions Статистические функции +## +AVEDEV = СРОТКЛ ## Возвращает среднее арифметическое абсолютных значений отклонений точек данных от среднего. +AVERAGE = СРЗНАЧ ## Возвращает среднее арифметическое аргументов. +AVERAGEA = СРЗНАЧА ## Возвращает среднее арифметическое аргументов, включая числа, текст и логические значения. +AVERAGEIF = СРЗНАЧЕСЛИ ## Возвращает среднее значение (среднее арифметическое) всех ячеек в диапазоне, которые удовлетворяют данному условию. +AVERAGEIFS = СРЗНАЧЕСЛИМН ## Возвращает среднее значение (среднее арифметическое) всех ячеек, которые удовлетворяют нескольким условиям. +BETADIST = БЕТАРАСП ## Возвращает интегральную функцию бета-распределения. +BETAINV = БЕТАОБР ## Возвращает обратную интегральную функцию указанного бета-распределения. +BINOMDIST = БИНОМРАСП ## Возвращает отдельное значение биномиального распределения. +CHIDIST = ХИ2РАСП ## Возвращает одностороннюю вероятность распределения хи-квадрат. +CHIINV = ХИ2ОБР ## Возвращает обратное значение односторонней вероятности распределения хи-квадрат. +CHITEST = ХИ2ТЕСТ ## Возвращает тест на независимость. +CONFIDENCE = ДОВЕРИТ ## Возвращает доверительный интервал для среднего значения по генеральной совокупности. +CORREL = КОРРЕЛ ## Возвращает коэффициент корреляции между двумя множествами данных. +COUNT = СЧЁТ ## Подсчитывает количество чисел в списке аргументов. +COUNTA = СЧЁТЗ ## Подсчитывает количество значений в списке аргументов. +COUNTBLANK = СЧИТАТЬПУСТОТЫ ## Подсчитывает количество пустых ячеек в диапазоне +COUNTIF = СЧЁТЕСЛИ ## Подсчитывает количество ячеек в диапазоне, удовлетворяющих заданному условию +COUNTIFS = СЧЁТЕСЛИМН ## Подсчитывает количество ячеек внутри диапазона, удовлетворяющих нескольким условиям. +COVAR = КОВАР ## Возвращает ковариацию, среднее произведений парных отклонений +CRITBINOM = КРИТБИНОМ ## Возвращает наименьшее значение, для которого интегральное биномиальное распределение меньше или равно заданному критерию. +DEVSQ = КВАДРОТКЛ ## Возвращает сумму квадратов отклонений. +EXPONDIST = ЭКСПРАСП ## Возвращает экспоненциальное распределение. +FDIST = FРАСП ## Возвращает F-распределение вероятности. +FINV = FРАСПОБР ## Возвращает обратное значение для F-распределения вероятности. +FISHER = ФИШЕР ## Возвращает преобразование Фишера. +FISHERINV = ФИШЕРОБР ## Возвращает обратное преобразование Фишера. +FORECAST = ПРЕДСКАЗ ## Возвращает значение линейного тренда. +FREQUENCY = ЧАСТОТА ## Возвращает распределение частот в виде вертикального массива. +FTEST = ФТЕСТ ## Возвращает результат F-теста. +GAMMADIST = ГАММАРАСП ## Возвращает гамма-распределение. +GAMMAINV = ГАММАОБР ## Возвращает обратное гамма-распределение. +GAMMALN = ГАММАНЛОГ ## Возвращает натуральный логарифм гамма функции, Γ(x). +GEOMEAN = СРГЕОМ ## Возвращает среднее геометрическое. +GROWTH = РОСТ ## Возвращает значения в соответствии с экспоненциальным трендом. +HARMEAN = СРГАРМ ## Возвращает среднее гармоническое. +HYPGEOMDIST = ГИПЕРГЕОМЕТ ## Возвращает гипергеометрическое распределение. +INTERCEPT = ОТРЕЗОК ## Возвращает отрезок, отсекаемый на оси линией линейной регрессии. +KURT = ЭКСЦЕСС ## Возвращает эксцесс множества данных. +LARGE = НАИБОЛЬШИЙ ## Возвращает k-ое наибольшее значение в множестве данных. +LINEST = ЛИНЕЙН ## Возвращает параметры линейного тренда. +LOGEST = ЛГРФПРИБЛ ## Возвращает параметры экспоненциального тренда. +LOGINV = ЛОГНОРМОБР ## Возвращает обратное логарифмическое нормальное распределение. +LOGNORMDIST = ЛОГНОРМРАСП ## Возвращает интегральное логарифмическое нормальное распределение. +MAX = МАКС ## Возвращает наибольшее значение в списке аргументов. +MAXA = МАКСА ## Возвращает наибольшее значение в списке аргументов, включая числа, текст и логические значения. +MEDIAN = МЕДИАНА ## Возвращает медиану заданных чисел. +MIN = МИН ## Возвращает наименьшее значение в списке аргументов. +MINA = МИНА ## Возвращает наименьшее значение в списке аргументов, включая числа, текст и логические значения. +MODE = МОДА ## Возвращает значение моды множества данных. +NEGBINOMDIST = ОТРБИНОМРАСП ## Возвращает отрицательное биномиальное распределение. +NORMDIST = НОРМРАСП ## Возвращает нормальную функцию распределения. +NORMINV = НОРМОБР ## Возвращает обратное нормальное распределение. +NORMSDIST = НОРМСТРАСП ## Возвращает стандартное нормальное интегральное распределение. +NORMSINV = НОРМСТОБР ## Возвращает обратное значение стандартного нормального распределения. +PEARSON = ПИРСОН ## Возвращает коэффициент корреляции Пирсона. +PERCENTILE = ПЕРСЕНТИЛЬ ## Возвращает k-ую персентиль для значений диапазона. +PERCENTRANK = ПРОЦЕНТРАНГ ## Возвращает процентную норму значения в множестве данных. +PERMUT = ПЕРЕСТ ## Возвращает количество перестановок для заданного числа объектов. +POISSON = ПУАССОН ## Возвращает распределение Пуассона. +PROB = ВЕРОЯТНОСТЬ ## Возвращает вероятность того, что значение из диапазона находится внутри заданных пределов. +QUARTILE = КВАРТИЛЬ ## Возвращает квартиль множества данных. +RANK = РАНГ ## Возвращает ранг числа в списке чисел. +RSQ = КВПИРСОН ## Возвращает квадрат коэффициента корреляции Пирсона. +SKEW = СКОС ## Возвращает асимметрию распределения. +SLOPE = НАКЛОН ## Возвращает наклон линии линейной регрессии. +SMALL = НАИМЕНЬШИЙ ## Возвращает k-ое наименьшее значение в множестве данных. +STANDARDIZE = НОРМАЛИЗАЦИЯ ## Возвращает нормализованное значение. +STDEV = СТАНДОТКЛОН ## Оценивает стандартное отклонение по выборке. +STDEVA = СТАНДОТКЛОНА ## Оценивает стандартное отклонение по выборке, включая числа, текст и логические значения. +STDEVP = СТАНДОТКЛОНП ## Вычисляет стандартное отклонение по генеральной совокупности. +STDEVPA = СТАНДОТКЛОНПА ## Вычисляет стандартное отклонение по генеральной совокупности, включая числа, текст и логические значения. +STEYX = СТОШYX ## Возвращает стандартную ошибку предсказанных значений y для каждого значения x в регрессии. +TDIST = СТЬЮДРАСП ## Возвращает t-распределение Стьюдента. +TINV = СТЬЮДРАСПОБР ## Возвращает обратное t-распределение Стьюдента. +TREND = ТЕНДЕНЦИЯ ## Возвращает значения в соответствии с линейным трендом. +TRIMMEAN = УРЕЗСРЕДНЕЕ ## Возвращает среднее внутренности множества данных. +TTEST = ТТЕСТ ## Возвращает вероятность, соответствующую критерию Стьюдента. +VAR = ДИСП ## Оценивает дисперсию по выборке. +VARA = ДИСПА ## Оценивает дисперсию по выборке, включая числа, текст и логические значения. +VARP = ДИСПР ## Вычисляет дисперсию для генеральной совокупности. +VARPA = ДИСПРА ## Вычисляет дисперсию для генеральной совокупности, включая числа, текст и логические значения. +WEIBULL = ВЕЙБУЛЛ ## Возвращает распределение Вейбулла. +ZTEST = ZТЕСТ ## Возвращает двустороннее P-значение z-теста. + + +## +## Text functions Текстовые функции +## +ASC = ASC ## Для языков с двухбайтовыми наборами знаков (например, катакана) преобразует полноширинные (двухбайтовые) знаки в полуширинные (однобайтовые). +BAHTTEXT = БАТТЕКСТ ## Преобразует число в текст, используя денежный формат ß (БАТ). +CHAR = СИМВОЛ ## Возвращает знак с заданным кодом. +CLEAN = ПЕЧСИМВ ## Удаляет все непечатаемые знаки из текста. +CODE = КОДСИМВ ## Возвращает числовой код первого знака в текстовой строке. +CONCATENATE = СЦЕПИТЬ ## Объединяет несколько текстовых элементов в один. +DOLLAR = РУБЛЬ ## Преобразует число в текст, используя денежный формат. +EXACT = СОВПАД ## Проверяет идентичность двух текстовых значений. +FIND = НАЙТИ ## Ищет вхождения одного текстового значения в другом (с учетом регистра). +FINDB = НАЙТИБ ## Ищет вхождения одного текстового значения в другом (с учетом регистра). +FIXED = ФИКСИРОВАННЫЙ ## Форматирует число и преобразует его в текст с заданным числом десятичных знаков. +JIS = JIS ## Для языков с двухбайтовыми наборами знаков (например, катакана) преобразует полуширинные (однобайтовые) знаки в текстовой строке в полноширинные (двухбайтовые). +LEFT = ЛЕВСИМВ ## Возвращает крайние слева знаки текстового значения. +LEFTB = ЛЕВБ ## Возвращает крайние слева знаки текстового значения. +LEN = ДЛСТР ## Возвращает количество знаков в текстовой строке. +LENB = ДЛИНБ ## Возвращает количество знаков в текстовой строке. +LOWER = СТРОЧН ## Преобразует все буквы текста в строчные. +MID = ПСТР ## Возвращает заданное число знаков из строки текста, начиная с указанной позиции. +MIDB = ПСТРБ ## Возвращает заданное число знаков из строки текста, начиная с указанной позиции. +PHONETIC = PHONETIC ## Извлекает фонетические (фуригана) знаки из текстовой строки. +PROPER = ПРОПНАЧ ## Преобразует первую букву в каждом слове текста в прописную. +REPLACE = ЗАМЕНИТЬ ## Заменяет знаки в тексте. +REPLACEB = ЗАМЕНИТЬБ ## Заменяет знаки в тексте. +REPT = ПОВТОР ## Повторяет текст заданное число раз. +RIGHT = ПРАВСИМВ ## Возвращает крайние справа знаки текстовой строки. +RIGHTB = ПРАВБ ## Возвращает крайние справа знаки текстовой строки. +SEARCH = ПОИСК ## Ищет вхождения одного текстового значения в другом (без учета регистра). +SEARCHB = ПОИСКБ ## Ищет вхождения одного текстового значения в другом (без учета регистра). +SUBSTITUTE = ПОДСТАВИТЬ ## Заменяет в текстовой строке старый текст новым. +T = Т ## Преобразует аргументы в текст. +TEXT = ТЕКСТ ## Форматирует число и преобразует его в текст. +TRIM = СЖПРОБЕЛЫ ## Удаляет из текста пробелы. +UPPER = ПРОПИСН ## Преобразует все буквы текста в прописные. +VALUE = ЗНАЧЕН ## Преобразует текстовый аргумент в число. diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/cs/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/cs/config new file mode 100644 index 0000000..df51373 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/cs/config @@ -0,0 +1,23 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = Kč + + +## +## Excel Error Codes (For future use) +## +NULL = #NULL! +DIV0 = #DIV/0! +VALUE = #HODNOTA! +REF = #REF! +NAME = #NÁZEV? +NUM = #NUM! +NA = #N/A diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/cs/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/cs/functions new file mode 100644 index 0000000..733d406 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/cs/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Funkce doplňků a automatizace +## +GETPIVOTDATA = ZÍSKATKONTDATA ## Vrátí data uložená v kontingenční tabulce. Pomocí funkce ZÍSKATKONTDATA můžete načíst souhrnná data z kontingenční tabulky, pokud jsou tato data v kontingenční sestavě zobrazena. + + +## +## Cube functions Funkce pro práci s krychlemi +## +CUBEKPIMEMBER = CUBEKPIMEMBER ## Vrátí název, vlastnost a velikost klíčového ukazatele výkonu (KUV) a zobrazí v buňce název a vlastnost. Klíčový ukazatel výkonu je kvantifikovatelná veličina, například hrubý měsíční zisk nebo čtvrtletní obrat na zaměstnance, která se používá pro sledování výkonnosti organizace. +CUBEMEMBER = CUBEMEMBER ## Vrátí člen nebo n-tici v hierarchii krychle. Slouží k ověření, zda v krychli existuje člen nebo n-tice. +CUBEMEMBERPROPERTY = CUBEMEMBERPROPERTY ## Vrátí hodnotu vlastnosti člena v krychli. Slouží k ověření, zda v krychli existuje člen s daným názvem, a k vrácení konkrétní vlastnosti tohoto člena. +CUBERANKEDMEMBER = CUBERANKEDMEMBER ## Vrátí n-tý nebo pořadový člen sady. Použijte ji pro vrácení jednoho nebo více prvků sady, například obchodníka s nejvyšším obratem nebo deseti nejlepších studentů. +CUBESET = CUBESET ## Definuje vypočtenou sadu členů nebo n-tic odesláním výrazu sady do krychle na serveru, který vytvoří sadu a potom ji vrátí do aplikace Microsoft Office Excel. +CUBESETCOUNT = CUBESETCOUNT ## Vrátí počet položek v množině +CUBEVALUE = CUBEVALUE ## Vrátí úhrnnou hodnotu z krychle. + + +## +## Database functions Funkce databáze +## +DAVERAGE = DPRŮMĚR ## Vrátí průměr vybraných položek databáze. +DCOUNT = DPOČET ## Spočítá buňky databáze obsahující čísla. +DCOUNTA = DPOČET2 ## Spočítá buňky databáze, které nejsou prázdné. +DGET = DZÍSKAT ## Extrahuje z databáze jeden záznam splňující zadaná kritéria. +DMAX = DMAX ## Vrátí maximální hodnotu z vybraných položek databáze. +DMIN = DMIN ## Vrátí minimální hodnotu z vybraných položek databáze. +DPRODUCT = DSOUČIN ## Vynásobí hodnoty určitého pole záznamů v databázi, které splňují daná kritéria. +DSTDEV = DSMODCH.VÝBĚR ## Odhadne směrodatnou odchylku výběru vybraných položek databáze. +DSTDEVP = DSMODCH ## Vypočte směrodatnou odchylku základního souboru vybraných položek databáze. +DSUM = DSUMA ## Sečte čísla ve sloupcovém poli záznamů databáze, která splňují daná kritéria. +DVAR = DVAR.VÝBĚR ## Odhadne rozptyl výběru vybraných položek databáze. +DVARP = DVAR ## Vypočte rozptyl základního souboru vybraných položek databáze. + + +## +## Date and time functions Funkce data a času +## +DATE = DATUM ## Vrátí pořadové číslo určitého data. +DATEVALUE = DATUMHODN ## Převede datum ve formě textu na pořadové číslo. +DAY = DEN ## Převede pořadové číslo na den v měsíci. +DAYS360 = ROK360 ## Vrátí počet dní mezi dvěma daty na základě roku s 360 dny. +EDATE = EDATE ## Vrátí pořadové číslo data, které označuje určený počet měsíců před nebo po počátečním datu. +EOMONTH = EOMONTH ## Vrátí pořadové číslo posledního dne měsíce před nebo po zadaném počtu měsíců. +HOUR = HODINA ## Převede pořadové číslo na hodinu. +MINUTE = MINUTA ## Převede pořadové číslo na minutu. +MONTH = MĚSÍC ## Převede pořadové číslo na měsíc. +NETWORKDAYS = NETWORKDAYS ## Vrátí počet celých pracovních dní mezi dvěma daty. +NOW = NYNÍ ## Vrátí pořadové číslo aktuálního data a času. +SECOND = SEKUNDA ## Převede pořadové číslo na sekundu. +TIME = ČAS ## Vrátí pořadové číslo určitého času. +TIMEVALUE = ČASHODN ## Převede čas ve formě textu na pořadové číslo. +TODAY = DNES ## Vrátí pořadové číslo dnešního data. +WEEKDAY = DENTÝDNE ## Převede pořadové číslo na den v týdnu. +WEEKNUM = WEEKNUM ## Převede pořadové číslo na číslo představující číselnou pozici týdne v roce. +WORKDAY = WORKDAY ## Vrátí pořadové číslo data před nebo po zadaném počtu pracovních dní. +YEAR = ROK ## Převede pořadové číslo na rok. +YEARFRAC = YEARFRAC ## Vrátí část roku vyjádřenou zlomkem a představující počet celých dní mezi počátečním a koncovým datem. + + +## +## Engineering functions Inženýrské funkce (Technické funkce) +## +BESSELI = BESSELI ## Vrátí modifikovanou Besselovu funkci In(x). +BESSELJ = BESSELJ ## Vrátí modifikovanou Besselovu funkci Jn(x). +BESSELK = BESSELK ## Vrátí modifikovanou Besselovu funkci Kn(x). +BESSELY = BESSELY ## Vrátí Besselovu funkci Yn(x). +BIN2DEC = BIN2DEC ## Převede binární číslo na desítkové. +BIN2HEX = BIN2HEX ## Převede binární číslo na šestnáctkové. +BIN2OCT = BIN2OCT ## Převede binární číslo na osmičkové. +COMPLEX = COMPLEX ## Převede reálnou a imaginární část na komplexní číslo. +CONVERT = CONVERT ## Převede číslo do jiného jednotkového měrného systému. +DEC2BIN = DEC2BIN ## Převede desítkového čísla na dvojkové +DEC2HEX = DEC2HEX ## Převede desítkové číslo na šestnáctkové. +DEC2OCT = DEC2OCT ## Převede desítkové číslo na osmičkové. +DELTA = DELTA ## Testuje rovnost dvou hodnot. +ERF = ERF ## Vrátí chybovou funkci. +ERFC = ERFC ## Vrátí doplňkovou chybovou funkci. +GESTEP = GESTEP ## Testuje, zda je číslo větší než mezní hodnota. +HEX2BIN = HEX2BIN ## Převede šestnáctkové číslo na binární. +HEX2DEC = HEX2DEC ## Převede šestnáctkové číslo na desítkové. +HEX2OCT = HEX2OCT ## Převede šestnáctkové číslo na osmičkové. +IMABS = IMABS ## Vrátí absolutní hodnotu (modul) komplexního čísla. +IMAGINARY = IMAGINARY ## Vrátí imaginární část komplexního čísla. +IMARGUMENT = IMARGUMENT ## Vrátí argument théta, úhel vyjádřený v radiánech. +IMCONJUGATE = IMCONJUGATE ## Vrátí komplexně sdružené číslo ke komplexnímu číslu. +IMCOS = IMCOS ## Vrátí kosinus komplexního čísla. +IMDIV = IMDIV ## Vrátí podíl dvou komplexních čísel. +IMEXP = IMEXP ## Vrátí exponenciální tvar komplexního čísla. +IMLN = IMLN ## Vrátí přirozený logaritmus komplexního čísla. +IMLOG10 = IMLOG10 ## Vrátí dekadický logaritmus komplexního čísla. +IMLOG2 = IMLOG2 ## Vrátí logaritmus komplexního čísla při základu 2. +IMPOWER = IMPOWER ## Vrátí komplexní číslo umocněné na celé číslo. +IMPRODUCT = IMPRODUCT ## Vrátí součin komplexních čísel. +IMREAL = IMREAL ## Vrátí reálnou část komplexního čísla. +IMSIN = IMSIN ## Vrátí sinus komplexního čísla. +IMSQRT = IMSQRT ## Vrátí druhou odmocninu komplexního čísla. +IMSUB = IMSUB ## Vrátí rozdíl mezi dvěma komplexními čísly. +IMSUM = IMSUM ## Vrátí součet dvou komplexních čísel. +OCT2BIN = OCT2BIN ## Převede osmičkové číslo na binární. +OCT2DEC = OCT2DEC ## Převede osmičkové číslo na desítkové. +OCT2HEX = OCT2HEX ## Převede osmičkové číslo na šestnáctkové. + + +## +## Financial functions Finanční funkce +## +ACCRINT = ACCRINT ## Vrátí nahromaděný úrok z cenného papíru, ze kterého je úrok placen v pravidelných termínech. +ACCRINTM = ACCRINTM ## Vrátí nahromaděný úrok z cenného papíru, ze kterého je úrok placen k datu splatnosti. +AMORDEGRC = AMORDEGRC ## Vrátí lineární amortizaci v každém účetním období pomocí koeficientu amortizace. +AMORLINC = AMORLINC ## Vrátí lineární amortizaci v každém účetním období. +COUPDAYBS = COUPDAYBS ## Vrátí počet dnů od začátku období placení kupónů do data splatnosti. +COUPDAYS = COUPDAYS ## Vrátí počet dnů v období placení kupónů, které obsahuje den zúčtování. +COUPDAYSNC = COUPDAYSNC ## Vrátí počet dnů od data zúčtování do následujícího data placení kupónu. +COUPNCD = COUPNCD ## Vrátí následující datum placení kupónu po datu zúčtování. +COUPNUM = COUPNUM ## Vrátí počet kupónů splatných mezi datem zúčtování a datem splatnosti. +COUPPCD = COUPPCD ## Vrátí předchozí datum placení kupónu před datem zúčtování. +CUMIPMT = CUMIPMT ## Vrátí kumulativní úrok splacený mezi dvěma obdobími. +CUMPRINC = CUMPRINC ## Vrátí kumulativní jistinu splacenou mezi dvěma obdobími půjčky. +DB = ODPIS.ZRYCH ## Vrátí odpis aktiva za určité období pomocí degresivní metody odpisu s pevným zůstatkem. +DDB = ODPIS.ZRYCH2 ## Vrátí odpis aktiva za určité období pomocí dvojité degresivní metody odpisu nebo jiné metody, kterou zadáte. +DISC = DISC ## Vrátí diskontní sazbu cenného papíru. +DOLLARDE = DOLLARDE ## Převede částku v korunách vyjádřenou zlomkem na částku v korunách vyjádřenou desetinným číslem. +DOLLARFR = DOLLARFR ## Převede částku v korunách vyjádřenou desetinným číslem na částku v korunách vyjádřenou zlomkem. +DURATION = DURATION ## Vrátí roční dobu cenného papíru s pravidelnými úrokovými sazbami. +EFFECT = EFFECT ## Vrátí efektivní roční úrokovou sazbu. +FV = BUDHODNOTA ## Vrátí budoucí hodnotu investice. +FVSCHEDULE = FVSCHEDULE ## Vrátí budoucí hodnotu počáteční jistiny po použití série sazeb složitého úroku. +INTRATE = INTRATE ## Vrátí úrokovou sazbu plně investovaného cenného papíru. +IPMT = PLATBA.ÚROK ## Vrátí výšku úroku investice za dané období. +IRR = MÍRA.VÝNOSNOSTI ## Vrátí vnitřní výnosové procento série peněžních toků. +ISPMT = ISPMT ## Vypočte výši úroku z investice zaplaceného během určitého období. +MDURATION = MDURATION ## Vrátí Macauleyho modifikovanou dobu cenného papíru o nominální hodnotě 100 Kč. +MIRR = MOD.MÍRA.VÝNOSNOSTI ## Vrátí vnitřní sazbu výnosu, přičemž kladné a záporné hodnoty peněžních prostředků jsou financovány podle různých sazeb. +NOMINAL = NOMINAL ## Vrátí nominální roční úrokovou sazbu. +NPER = POČET.OBDOBÍ ## Vrátí počet období pro investici. +NPV = ČISTÁ.SOUČHODNOTA ## Vrátí čistou současnou hodnotu investice vypočítanou na základě série pravidelných peněžních toků a diskontní sazby. +ODDFPRICE = ODDFPRICE ## Vrátí cenu cenného papíru o nominální hodnotě 100 Kč s odlišným prvním obdobím. +ODDFYIELD = ODDFYIELD ## Vrátí výnos cenného papíru s odlišným prvním obdobím. +ODDLPRICE = ODDLPRICE ## Vrátí cenu cenného papíru o nominální hodnotě 100 Kč s odlišným posledním obdobím. +ODDLYIELD = ODDLYIELD ## Vrátí výnos cenného papíru s odlišným posledním obdobím. +PMT = PLATBA ## Vrátí hodnotu pravidelné splátky anuity. +PPMT = PLATBA.ZÁKLAD ## Vrátí hodnotu splátky jistiny pro zadanou investici za dané období. +PRICE = PRICE ## Vrátí cenu cenného papíru o nominální hodnotě 100 Kč, ze kterého je úrok placen v pravidelných termínech. +PRICEDISC = PRICEDISC ## Vrátí cenu diskontního cenného papíru o nominální hodnotě 100 Kč. +PRICEMAT = PRICEMAT ## Vrátí cenu cenného papíru o nominální hodnotě 100 Kč, ze kterého je úrok placen k datu splatnosti. +PV = SOUČHODNOTA ## Vrátí současnou hodnotu investice. +RATE = ÚROKOVÁ.MÍRA ## Vrátí úrokovou sazbu vztaženou na období anuity. +RECEIVED = RECEIVED ## Vrátí částku obdrženou k datu splatnosti plně investovaného cenného papíru. +SLN = ODPIS.LIN ## Vrátí přímé odpisy aktiva pro jedno období. +SYD = ODPIS.NELIN ## Vrátí směrné číslo ročních odpisů aktiva pro zadané období. +TBILLEQ = TBILLEQ ## Vrátí výnos směnky státní pokladny ekvivalentní výnosu obligace. +TBILLPRICE = TBILLPRICE ## Vrátí cenu směnky státní pokladny o nominální hodnotě 100 Kč. +TBILLYIELD = TBILLYIELD ## Vrátí výnos směnky státní pokladny. +VDB = ODPIS.ZA.INT ## Vrátí odpis aktiva pro určité období nebo část období pomocí degresivní metody odpisu. +XIRR = XIRR ## Vrátí vnitřní výnosnost pro harmonogram peněžních toků, který nemusí být nutně periodický. +XNPV = XNPV ## Vrátí čistou současnou hodnotu pro harmonogram peněžních toků, který nemusí být nutně periodický. +YIELD = YIELD ## Vrátí výnos cenného papíru, ze kterého je úrok placen v pravidelných termínech. +YIELDDISC = YIELDDISC ## Vrátí roční výnos diskontního cenného papíru, například směnky státní pokladny. +YIELDMAT = YIELDMAT ## Vrátí roční výnos cenného papíru, ze kterého je úrok placen k datu splatnosti. + + +## +## Information functions Informační funkce +## +CELL = POLÍČKO ## Vrátí informace o formátování, umístění nebo obsahu buňky. +ERROR.TYPE = CHYBA.TYP ## Vrátí číslo odpovídající typu chyby. +INFO = O.PROSTŘEDÍ ## Vrátí informace o aktuálním pracovním prostředí. +ISBLANK = JE.PRÁZDNÉ ## Vrátí hodnotu PRAVDA, pokud se argument hodnota odkazuje na prázdnou buňku. +ISERR = JE.CHYBA ## Vrátí hodnotu PRAVDA, pokud je argument hodnota libovolná chybová hodnota (kromě #N/A). +ISERROR = JE.CHYBHODN ## Vrátí hodnotu PRAVDA, pokud je argument hodnota libovolná chybová hodnota. +ISEVEN = ISEVEN ## Vrátí hodnotu PRAVDA, pokud je číslo sudé. +ISLOGICAL = JE.LOGHODN ## Vrátí hodnotu PRAVDA, pokud je argument hodnota logická hodnota. +ISNA = JE.NEDEF ## Vrátí hodnotu PRAVDA, pokud je argument hodnota chybová hodnota #N/A. +ISNONTEXT = JE.NETEXT ## Vrátí hodnotu PRAVDA, pokud argument hodnota není text. +ISNUMBER = JE.ČÍSLO ## Vrátí hodnotu PRAVDA, pokud je argument hodnota číslo. +ISODD = ISODD ## Vrátí hodnotu PRAVDA, pokud je číslo liché. +ISREF = JE.ODKAZ ## Vrátí hodnotu PRAVDA, pokud je argument hodnota odkaz. +ISTEXT = JE.TEXT ## Vrátí hodnotu PRAVDA, pokud je argument hodnota text. +N = N ## Vrátí hodnotu převedenou na číslo. +NA = NEDEF ## Vrátí chybovou hodnotu #N/A. +TYPE = TYP ## Vrátí číslo označující datový typ hodnoty. + + +## +## Logical functions Logické funkce +## +AND = A ## Vrátí hodnotu PRAVDA, mají-li všechny argumenty hodnotu PRAVDA. +FALSE = NEPRAVDA ## Vrátí logickou hodnotu NEPRAVDA. +IF = KDYŽ ## Určí, který logický test má proběhnout. +IFERROR = IFERROR ## Pokud je vzorec vyhodnocen jako chyba, vrátí zadanou hodnotu. V opačném případě vrátí výsledek vzorce. +NOT = NE ## Provede logickou negaci argumentu funkce. +OR = NEBO ## Vrátí hodnotu PRAVDA, je-li alespoň jeden argument roven hodnotě PRAVDA. +TRUE = PRAVDA ## Vrátí logickou hodnotu PRAVDA. + + +## +## Lookup and reference functions Vyhledávací funkce +## +ADDRESS = ODKAZ ## Vrátí textový odkaz na jednu buňku listu. +AREAS = POČET.BLOKŮ ## Vrátí počet oblastí v odkazu. +CHOOSE = ZVOLIT ## Zvolí hodnotu ze seznamu hodnot. +COLUMN = SLOUPEC ## Vrátí číslo sloupce odkazu. +COLUMNS = SLOUPCE ## Vrátí počet sloupců v odkazu. +HLOOKUP = VVYHLEDAT ## Prohledá horní řádek matice a vrátí hodnotu určené buňky. +HYPERLINK = HYPERTEXTOVÝ.ODKAZ ## Vytvoří zástupce nebo odkaz, který otevře dokument uložený na síťovém serveru, v síti intranet nebo Internet. +INDEX = INDEX ## Pomocí rejstříku zvolí hodnotu z odkazu nebo matice. +INDIRECT = NEPŘÍMÝ.ODKAZ ## Vrátí odkaz určený textovou hodnotou. +LOOKUP = VYHLEDAT ## Vyhledá hodnoty ve vektoru nebo matici. +MATCH = POZVYHLEDAT ## Vyhledá hodnoty v odkazu nebo matici. +OFFSET = POSUN ## Vrátí posun odkazu od zadaného odkazu. +ROW = ŘÁDEK ## Vrátí číslo řádku odkazu. +ROWS = ŘÁDKY ## Vrátí počet řádků v odkazu. +RTD = RTD ## Načte data reálného času z programu, který podporuje automatizaci modelu COM (Automatizace: Způsob práce s objekty určité aplikace z jiné aplikace nebo nástroje pro vývoj. Automatizace (dříve nazývaná automatizace OLE) je počítačovým standardem a je funkcí modelu COM (Component Object Model).). +TRANSPOSE = TRANSPOZICE ## Vrátí transponovanou matici. +VLOOKUP = SVYHLEDAT ## Prohledá první sloupec matice, přesune kurzor v řádku a vrátí hodnotu buňky. + + +## +## Math and trigonometry functions Matematické a trigonometrické funkce +## +ABS = ABS ## Vrátí absolutní hodnotu čísla. +ACOS = ARCCOS ## Vrátí arkuskosinus čísla. +ACOSH = ARCCOSH ## Vrátí hyperbolický arkuskosinus čísla. +ASIN = ARCSIN ## Vrátí arkussinus čísla. +ASINH = ARCSINH ## Vrátí hyperbolický arkussinus čísla. +ATAN = ARCTG ## Vrátí arkustangens čísla. +ATAN2 = ARCTG2 ## Vrátí arkustangens x-ové a y-ové souřadnice. +ATANH = ARCTGH ## Vrátí hyperbolický arkustangens čísla. +CEILING = ZAOKR.NAHORU ## Zaokrouhlí číslo na nejbližší celé číslo nebo na nejbližší násobek zadané hodnoty. +COMBIN = KOMBINACE ## Vrátí počet kombinací pro daný počet položek. +COS = COS ## Vrátí kosinus čísla. +COSH = COSH ## Vrátí hyperbolický kosinus čísla. +DEGREES = DEGREES ## Převede radiány na stupně. +EVEN = ZAOKROUHLIT.NA.SUDÉ ## Zaokrouhlí číslo nahoru na nejbližší celé sudé číslo. +EXP = EXP ## Vrátí základ přirozeného logaritmu e umocněný na zadané číslo. +FACT = FAKTORIÁL ## Vrátí faktoriál čísla. +FACTDOUBLE = FACTDOUBLE ## Vrátí dvojitý faktoriál čísla. +FLOOR = ZAOKR.DOLŮ ## Zaokrouhlí číslo dolů, směrem k nule. +GCD = GCD ## Vrátí největší společný dělitel. +INT = CELÁ.ČÁST ## Zaokrouhlí číslo dolů na nejbližší celé číslo. +LCM = LCM ## Vrátí nejmenší společný násobek. +LN = LN ## Vrátí přirozený logaritmus čísla. +LOG = LOGZ ## Vrátí logaritmus čísla při zadaném základu. +LOG10 = LOG ## Vrátí dekadický logaritmus čísla. +MDETERM = DETERMINANT ## Vrátí determinant matice. +MINVERSE = INVERZE ## Vrátí inverzní matici. +MMULT = SOUČIN.MATIC ## Vrátí součin dvou matic. +MOD = MOD ## Vrátí zbytek po dělení. +MROUND = MROUND ## Vrátí číslo zaokrouhlené na požadovaný násobek. +MULTINOMIAL = MULTINOMIAL ## Vrátí mnohočlen z množiny čísel. +ODD = ZAOKROUHLIT.NA.LICHÉ ## Zaokrouhlí číslo nahoru na nejbližší celé liché číslo. +PI = PI ## Vrátí hodnotu čísla pí. +POWER = POWER ## Umocní číslo na zadanou mocninu. +PRODUCT = SOUČIN ## Vynásobí argumenty funkce. +QUOTIENT = QUOTIENT ## Vrátí celou část dělení. +RADIANS = RADIANS ## Převede stupně na radiány. +RAND = NÁHČÍSLO ## Vrátí náhodné číslo mezi 0 a 1. +RANDBETWEEN = RANDBETWEEN ## Vrátí náhodné číslo mezi zadanými čísly. +ROMAN = ROMAN ## Převede arabskou číslici na římskou ve formátu textu. +ROUND = ZAOKROUHLIT ## Zaokrouhlí číslo na zadaný počet číslic. +ROUNDDOWN = ROUNDDOWN ## Zaokrouhlí číslo dolů, směrem k nule. +ROUNDUP = ROUNDUP ## Zaokrouhlí číslo nahoru, směrem od nuly. +SERIESSUM = SERIESSUM ## Vrátí součet mocninné řady určené podle vzorce. +SIGN = SIGN ## Vrátí znaménko čísla. +SIN = SIN ## Vrátí sinus daného úhlu. +SINH = SINH ## Vrátí hyperbolický sinus čísla. +SQRT = ODMOCNINA ## Vrátí kladnou druhou odmocninu. +SQRTPI = SQRTPI ## Vrátí druhou odmocninu výrazu (číslo * pí). +SUBTOTAL = SUBTOTAL ## Vrátí souhrn v seznamu nebo databázi. +SUM = SUMA ## Sečte argumenty funkce. +SUMIF = SUMIF ## Sečte buňky vybrané podle zadaných kritérií. +SUMIFS = SUMIFS ## Sečte buňky určené více zadanými podmínkami. +SUMPRODUCT = SOUČIN.SKALÁRNÍ ## Vrátí součet součinů odpovídajících prvků matic. +SUMSQ = SUMA.ČTVERCŮ ## Vrátí součet čtverců argumentů. +SUMX2MY2 = SUMX2MY2 ## Vrátí součet rozdílu čtverců odpovídajících hodnot ve dvou maticích. +SUMX2PY2 = SUMX2PY2 ## Vrátí součet součtu čtverců odpovídajících hodnot ve dvou maticích. +SUMXMY2 = SUMXMY2 ## Vrátí součet čtverců rozdílů odpovídajících hodnot ve dvou maticích. +TAN = TGTG ## Vrátí tangens čísla. +TANH = TGH ## Vrátí hyperbolický tangens čísla. +TRUNC = USEKNOUT ## Zkrátí číslo na celé číslo. + + +## +## Statistical functions Statistické funkce +## +AVEDEV = PRŮMODCHYLKA ## Vrátí průměrnou hodnotu absolutních odchylek datových bodů od jejich střední hodnoty. +AVERAGE = PRŮMĚR ## Vrátí průměrnou hodnotu argumentů. +AVERAGEA = AVERAGEA ## Vrátí průměrnou hodnotu argumentů včetně čísel, textu a logických hodnot. +AVERAGEIF = AVERAGEIF ## Vrátí průměrnou hodnotu (aritmetický průměr) všech buněk v oblasti, které vyhovují příslušné podmínce. +AVERAGEIFS = AVERAGEIFS ## Vrátí průměrnou hodnotu (aritmetický průměr) všech buněk vyhovujících několika podmínkám. +BETADIST = BETADIST ## Vrátí hodnotu součtového rozdělení beta. +BETAINV = BETAINV ## Vrátí inverzní hodnotu součtového rozdělení pro zadané rozdělení beta. +BINOMDIST = BINOMDIST ## Vrátí hodnotu binomického rozdělení pravděpodobnosti jednotlivých veličin. +CHIDIST = CHIDIST ## Vrátí jednostrannou pravděpodobnost rozdělení chí-kvadrát. +CHIINV = CHIINV ## Vrátí hodnotu funkce inverzní k distribuční funkci jednostranné pravděpodobnosti rozdělení chí-kvadrát. +CHITEST = CHITEST ## Vrátí test nezávislosti. +CONFIDENCE = CONFIDENCE ## Vrátí interval spolehlivosti pro střední hodnotu základního souboru. +CORREL = CORREL ## Vrátí korelační koeficient mezi dvěma množinami dat. +COUNT = POČET ## Vrátí počet čísel v seznamu argumentů. +COUNTA = POČET2 ## Vrátí počet hodnot v seznamu argumentů. +COUNTBLANK = COUNTBLANK ## Spočítá počet prázdných buněk v oblasti. +COUNTIF = COUNTIF ## Spočítá buňky v oblasti, které odpovídají zadaným kritériím. +COUNTIFS = COUNTIFS ## Spočítá buňky v oblasti, které odpovídají více kritériím. +COVAR = COVAR ## Vrátí hodnotu kovariance, průměrnou hodnotu součinů párových odchylek +CRITBINOM = CRITBINOM ## Vrátí nejmenší hodnotu, pro kterou má součtové binomické rozdělení hodnotu větší nebo rovnu hodnotě kritéria. +DEVSQ = DEVSQ ## Vrátí součet čtverců odchylek. +EXPONDIST = EXPONDIST ## Vrátí hodnotu exponenciálního rozdělení. +FDIST = FDIST ## Vrátí hodnotu rozdělení pravděpodobnosti F. +FINV = FINV ## Vrátí hodnotu inverzní funkce k distribuční funkci rozdělení F. +FISHER = FISHER ## Vrátí hodnotu Fisherovy transformace. +FISHERINV = FISHERINV ## Vrátí hodnotu inverzní funkce k Fisherově transformaci. +FORECAST = FORECAST ## Vrátí hodnotu lineárního trendu. +FREQUENCY = ČETNOSTI ## Vrátí četnost rozdělení jako svislou matici. +FTEST = FTEST ## Vrátí výsledek F-testu. +GAMMADIST = GAMMADIST ## Vrátí hodnotu rozdělení gama. +GAMMAINV = GAMMAINV ## Vrátí hodnotu inverzní funkce k distribuční funkci součtového rozdělení gama. +GAMMALN = GAMMALN ## Vrátí přirozený logaritmus funkce gama, Γ(x). +GEOMEAN = GEOMEAN ## Vrátí geometrický průměr. +GROWTH = LOGLINTREND ## Vrátí hodnoty exponenciálního trendu. +HARMEAN = HARMEAN ## Vrátí harmonický průměr. +HYPGEOMDIST = HYPGEOMDIST ## Vrátí hodnotu hypergeometrického rozdělení. +INTERCEPT = INTERCEPT ## Vrátí úsek lineární regresní čáry. +KURT = KURT ## Vrátí hodnotu excesu množiny dat. +LARGE = LARGE ## Vrátí k-tou největší hodnotu množiny dat. +LINEST = LINREGRESE ## Vrátí parametry lineárního trendu. +LOGEST = LOGLINREGRESE ## Vrátí parametry exponenciálního trendu. +LOGINV = LOGINV ## Vrátí inverzní funkci k distribuční funkci logaritmicko-normálního rozdělení. +LOGNORMDIST = LOGNORMDIST ## Vrátí hodnotu součtového logaritmicko-normálního rozdělení. +MAX = MAX ## Vrátí maximální hodnotu seznamu argumentů. +MAXA = MAXA ## Vrátí maximální hodnotu seznamu argumentů včetně čísel, textu a logických hodnot. +MEDIAN = MEDIAN ## Vrátí střední hodnotu zadaných čísel. +MIN = MIN ## Vrátí minimální hodnotu seznamu argumentů. +MINA = MINA ## Vrátí nejmenší hodnotu v seznamu argumentů včetně čísel, textu a logických hodnot. +MODE = MODE ## Vrátí hodnotu, která se v množině dat vyskytuje nejčastěji. +NEGBINOMDIST = NEGBINOMDIST ## Vrátí hodnotu negativního binomického rozdělení. +NORMDIST = NORMDIST ## Vrátí hodnotu normálního součtového rozdělení. +NORMINV = NORMINV ## Vrátí inverzní funkci k funkci normálního součtového rozdělení. +NORMSDIST = NORMSDIST ## Vrátí hodnotu standardního normálního součtového rozdělení. +NORMSINV = NORMSINV ## Vrátí inverzní funkci k funkci standardního normálního součtového rozdělení. +PEARSON = PEARSON ## Vrátí Pearsonův výsledný momentový korelační koeficient. +PERCENTILE = PERCENTIL ## Vrátí hodnotu k-tého percentilu hodnot v oblasti. +PERCENTRANK = PERCENTRANK ## Vrátí pořadí hodnoty v množině dat vyjádřené procentuální částí množiny dat. +PERMUT = PERMUTACE ## Vrátí počet permutací pro zadaný počet objektů. +POISSON = POISSON ## Vrátí hodnotu distribuční funkce Poissonova rozdělení. +PROB = PROB ## Vrátí pravděpodobnost výskytu hodnot v oblasti mezi dvěma mezními hodnotami. +QUARTILE = QUARTIL ## Vrátí hodnotu kvartilu množiny dat. +RANK = RANK ## Vrátí pořadí čísla v seznamu čísel. +RSQ = RKQ ## Vrátí druhou mocninu Pearsonova výsledného momentového korelačního koeficientu. +SKEW = SKEW ## Vrátí zešikmení rozdělení. +SLOPE = SLOPE ## Vrátí směrnici lineární regresní čáry. +SMALL = SMALL ## Vrátí k-tou nejmenší hodnotu množiny dat. +STANDARDIZE = STANDARDIZE ## Vrátí normalizovanou hodnotu. +STDEV = SMODCH.VÝBĚR ## Vypočte směrodatnou odchylku výběru. +STDEVA = STDEVA ## Vypočte směrodatnou odchylku výběru včetně čísel, textu a logických hodnot. +STDEVP = SMODCH ## Vypočte směrodatnou odchylku základního souboru. +STDEVPA = STDEVPA ## Vypočte směrodatnou odchylku základního souboru včetně čísel, textu a logických hodnot. +STEYX = STEYX ## Vrátí standardní chybu předpovězené hodnoty y pro každou hodnotu x v regresi. +TDIST = TDIST ## Vrátí hodnotu Studentova t-rozdělení. +TINV = TINV ## Vrátí inverzní funkci k distribuční funkci Studentova t-rozdělení. +TREND = LINTREND ## Vrátí hodnoty lineárního trendu. +TRIMMEAN = TRIMMEAN ## Vrátí střední hodnotu vnitřní části množiny dat. +TTEST = TTEST ## Vrátí pravděpodobnost spojenou se Studentovým t-testem. +VAR = VAR.VÝBĚR ## Vypočte rozptyl výběru. +VARA = VARA ## Vypočte rozptyl výběru včetně čísel, textu a logických hodnot. +VARP = VAR ## Vypočte rozptyl základního souboru. +VARPA = VARPA ## Vypočte rozptyl základního souboru včetně čísel, textu a logických hodnot. +WEIBULL = WEIBULL ## Vrátí hodnotu Weibullova rozdělení. +ZTEST = ZTEST ## Vrátí jednostrannou P-hodnotu z-testu. + + +## +## Text functions Textové funkce +## +ASC = ASC ## Změní znaky s plnou šířkou (dvoubajtové)v řetězci znaků na znaky s poloviční šířkou (jednobajtové). +BAHTTEXT = BAHTTEXT ## Převede číslo na text ve formátu, měny ß (baht). +CHAR = ZNAK ## Vrátí znak určený číslem kódu. +CLEAN = VYČISTIT ## Odebere z textu všechny netisknutelné znaky. +CODE = KÓD ## Vrátí číselný kód prvního znaku zadaného textového řetězce. +CONCATENATE = CONCATENATE ## Spojí několik textových položek do jedné. +DOLLAR = KČ ## Převede číslo na text ve formátu měny Kč (česká koruna). +EXACT = STEJNÉ ## Zkontroluje, zda jsou dvě textové hodnoty shodné. +FIND = NAJÍT ## Nalezne textovou hodnotu uvnitř jiné (rozlišuje malá a velká písmena). +FINDB = FINDB ## Nalezne textovou hodnotu uvnitř jiné (rozlišuje malá a velká písmena). +FIXED = ZAOKROUHLIT.NA.TEXT ## Zformátuje číslo jako text s pevným počtem desetinných míst. +JIS = JIS ## Změní znaky s poloviční šířkou (jednobajtové) v řetězci znaků na znaky s plnou šířkou (dvoubajtové). +LEFT = ZLEVA ## Vrátí první znaky textové hodnoty umístěné nejvíce vlevo. +LEFTB = LEFTB ## Vrátí první znaky textové hodnoty umístěné nejvíce vlevo. +LEN = DÉLKA ## Vrátí počet znaků textového řetězce. +LENB = LENB ## Vrátí počet znaků textového řetězce. +LOWER = MALÁ ## Převede text na malá písmena. +MID = ČÁST ## Vrátí určitý počet znaků textového řetězce počínaje zadaným místem. +MIDB = MIDB ## Vrátí určitý počet znaků textového řetězce počínaje zadaným místem. +PHONETIC = ZVUKOVÉ ## Extrahuje fonetické znaky (furigana) z textového řetězce. +PROPER = VELKÁ2 ## Převede první písmeno každého slova textové hodnoty na velké. +REPLACE = NAHRADIT ## Nahradí znaky uvnitř textu. +REPLACEB = NAHRADITB ## Nahradí znaky uvnitř textu. +REPT = OPAKOVAT ## Zopakuje text podle zadaného počtu opakování. +RIGHT = ZPRAVA ## Vrátí první znaky textové hodnoty umístěné nejvíce vpravo. +RIGHTB = RIGHTB ## Vrátí první znaky textové hodnoty umístěné nejvíce vpravo. +SEARCH = HLEDAT ## Nalezne textovou hodnotu uvnitř jiné (malá a velká písmena nejsou rozlišována). +SEARCHB = SEARCHB ## Nalezne textovou hodnotu uvnitř jiné (malá a velká písmena nejsou rozlišována). +SUBSTITUTE = DOSADIT ## V textovém řetězci nahradí starý text novým. +T = T ## Převede argumenty na text. +TEXT = HODNOTA.NA.TEXT ## Zformátuje číslo a převede ho na text. +TRIM = PROČISTIT ## Odstraní z textu mezery. +UPPER = VELKÁ ## Převede text na velká písmena. +VALUE = HODNOTA ## Převede textový argument na číslo. diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/da/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/da/config new file mode 100644 index 0000000..a7aa8fe --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/da/config @@ -0,0 +1,25 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = kr + + + +## +## Excel Error Codes (For future use) + +## +NULL = #NUL! +DIV0 = #DIVISION/0! +VALUE = #VÆRDI! +REF = #REFERENCE! +NAME = #NAVN? +NUM = #NUM! +NA = #I/T diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/da/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/da/functions new file mode 100644 index 0000000..d02aa2e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/da/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Tilføjelsesprogram- og automatiseringsfunktioner +## +GETPIVOTDATA = HENTPIVOTDATA ## Returnerer data, der er lagret i en pivottabelrapport + + +## +## Cube functions Kubefunktioner +## +CUBEKPIMEMBER = KUBE.KPI.MEDLEM ## Returnerer navn, egenskab og mål for en KPI-indikator og viser navnet og egenskaben i cellen. En KPI-indikator er en målbar størrelse, f.eks. bruttooverskud pr. måned eller personaleudskiftning pr. kvartal, der bruges til at overvåge en organisations præstationer. +CUBEMEMBER = KUBE.MEDLEM ## Returnerer et medlem eller en tupel fra kubehierarkiet. Bruges til at validere, om et medlem eller en tupel findes i kuben. +CUBEMEMBERPROPERTY = KUBEMEDLEM.EGENSKAB ## Returnerer værdien af en egenskab for et medlem i kuben. Bruges til at validere, om et medlemsnavn findes i kuben, og returnere den angivne egenskab for medlemmet. +CUBERANKEDMEMBER = KUBEMEDLEM.RANG ## Returnerer det n'te eller rangordnede medlem i et sæt. Bruges til at returnere et eller flere elementer i et sæt, f.eks. topsælgere eller de 10 bedste elever. +CUBESET = KUBESÆT ## Definerer et beregnet sæt medlemmer eller tupler ved at sende et sætudtryk til kuben på serveren, som opretter sættet og returnerer det til Microsoft Office Excel. +CUBESETCOUNT = KUBESÆT.TÆL ## Returnerer antallet af elementer i et sæt. +CUBEVALUE = KUBEVÆRDI ## Returnerer en sammenlagt (aggregeret) værdi fra en kube. + + +## +## Database functions Databasefunktioner +## +DAVERAGE = DMIDDEL ## Returnerer gennemsnittet af markerede databaseposter +DCOUNT = DTÆL ## Tæller de celler, der indeholder tal, i en database +DCOUNTA = DTÆLV ## Tæller udfyldte celler i en database +DGET = DHENT ## Uddrager en enkelt post, der opfylder de angivne kriterier, fra en database +DMAX = DMAKS ## Returnerer den største værdi blandt markerede databaseposter +DMIN = DMIN ## Returnerer den mindste værdi blandt markerede databaseposter +DPRODUCT = DPRODUKT ## Ganger værdierne i et bestemt felt med poster, der opfylder kriterierne i en database +DSTDEV = DSTDAFV ## Beregner et skøn over standardafvigelsen baseret på en stikprøve af markerede databaseposter +DSTDEVP = DSTDAFVP ## Beregner standardafvigelsen baseret på hele populationen af markerede databaseposter +DSUM = DSUM ## Sammenlægger de tal i feltkolonnen i databasen, der opfylder kriterierne +DVAR = DVARIANS ## Beregner varians baseret på en stikprøve af markerede databaseposter +DVARP = DVARIANSP ## Beregner varians baseret på hele populationen af markerede databaseposter + + +## +## Date and time functions Dato- og klokkeslætsfunktioner +## +DATE = DATO ## Returnerer serienummeret for en bestemt dato +DATEVALUE = DATOVÆRDI ## Konverterer en dato i form af tekst til et serienummer +DAY = DAG ## Konverterer et serienummer til en dag i måneden +DAYS360 = DAGE360 ## Beregner antallet af dage mellem to datoer på grundlag af et år med 360 dage +EDATE = EDATO ## Returnerer serienummeret for den dato, der ligger det angivne antal måneder før eller efter startdatoen +EOMONTH = SLUT.PÅ.MÅNED ## Returnerer serienummeret på den sidste dag i måneden før eller efter et angivet antal måneder +HOUR = TIME ## Konverterer et serienummer til en time +MINUTE = MINUT ## Konverterer et serienummer til et minut +MONTH = MÅNED ## Konverterer et serienummer til en måned +NETWORKDAYS = ANTAL.ARBEJDSDAGE ## Returnerer antallet af hele arbejdsdage mellem to datoer +NOW = NU ## Returnerer serienummeret for den aktuelle dato eller det aktuelle klokkeslæt +SECOND = SEKUND ## Konverterer et serienummer til et sekund +TIME = KLOKKESLÆT ## Returnerer serienummeret for et bestemt klokkeslæt +TIMEVALUE = TIDSVÆRDI ## Konverterer et klokkeslæt i form af tekst til et serienummer +TODAY = IDAG ## Returnerer serienummeret for dags dato +WEEKDAY = UGEDAG ## Konverterer et serienummer til en ugedag +WEEKNUM = UGE.NR ## Konverterer et serienummer til et tal, der angiver ugenummeret i året +WORKDAY = ARBEJDSDAG ## Returnerer serienummeret for dagen før eller efter det angivne antal arbejdsdage +YEAR = ÅR ## Konverterer et serienummer til et år +YEARFRAC = ÅR.BRØK ## Returnerer årsbrøken, der repræsenterer antallet af hele dage mellem startdato og slutdato + + +## +## Engineering functions Tekniske funktioner +## +BESSELI = BESSELI ## Returnerer den modificerede Bessel-funktion In(x) +BESSELJ = BESSELJ ## Returnerer Bessel-funktionen Jn(x) +BESSELK = BESSELK ## Returnerer den modificerede Bessel-funktion Kn(x) +BESSELY = BESSELY ## Returnerer Bessel-funktionen Yn(x) +BIN2DEC = BIN.TIL.DEC ## Konverterer et binært tal til et decimaltal +BIN2HEX = BIN.TIL.HEX ## Konverterer et binært tal til et heksadecimalt tal +BIN2OCT = BIN.TIL.OKT ## Konverterer et binært tal til et oktaltal. +COMPLEX = KOMPLEKS ## Konverterer reelle og imaginære koefficienter til et komplekst tal +CONVERT = KONVERTER ## Konverterer et tal fra én måleenhed til en anden +DEC2BIN = DEC.TIL.BIN ## Konverterer et decimaltal til et binært tal +DEC2HEX = DEC.TIL.HEX ## Konverterer et decimaltal til et heksadecimalt tal +DEC2OCT = DEC.TIL.OKT ## Konverterer et decimaltal til et oktaltal +DELTA = DELTA ## Tester, om to værdier er ens +ERF = FEJLFUNK ## Returner fejlfunktionen +ERFC = FEJLFUNK.KOMP ## Returnerer den komplementære fejlfunktion +GESTEP = GETRIN ## Tester, om et tal er større end en grænseværdi +HEX2BIN = HEX.TIL.BIN ## Konverterer et heksadecimalt tal til et binært tal +HEX2DEC = HEX.TIL.DEC ## Konverterer et decimaltal til et heksadecimalt tal +HEX2OCT = HEX.TIL.OKT ## Konverterer et heksadecimalt tal til et oktaltal +IMABS = IMAGABS ## Returnerer den absolutte værdi (modulus) for et komplekst tal +IMAGINARY = IMAGINÆR ## Returnerer den imaginære koefficient for et komplekst tal +IMARGUMENT = IMAGARGUMENT ## Returnerer argumentet theta, en vinkel udtrykt i radianer +IMCONJUGATE = IMAGKONJUGERE ## Returnerer den komplekse konjugation af et komplekst tal +IMCOS = IMAGCOS ## Returnerer et komplekst tals cosinus +IMDIV = IMAGDIV ## Returnerer kvotienten for to komplekse tal +IMEXP = IMAGEKSP ## Returnerer et komplekst tals eksponentialfunktion +IMLN = IMAGLN ## Returnerer et komplekst tals naturlige logaritme +IMLOG10 = IMAGLOG10 ## Returnerer et komplekst tals sædvanlige logaritme (titalslogaritme) +IMLOG2 = IMAGLOG2 ## Returnerer et komplekst tals sædvanlige logaritme (totalslogaritme) +IMPOWER = IMAGPOTENS ## Returnerer et komplekst tal opløftet i en heltalspotens +IMPRODUCT = IMAGPRODUKT ## Returnerer produktet af komplekse tal +IMREAL = IMAGREELT ## Returnerer den reelle koefficient for et komplekst tal +IMSIN = IMAGSIN ## Returnerer et komplekst tals sinus +IMSQRT = IMAGKVROD ## Returnerer et komplekst tals kvadratrod +IMSUB = IMAGSUB ## Returnerer forskellen mellem to komplekse tal +IMSUM = IMAGSUM ## Returnerer summen af komplekse tal +OCT2BIN = OKT.TIL.BIN ## Konverterer et oktaltal til et binært tal +OCT2DEC = OKT.TIL.DEC ## Konverterer et oktaltal til et decimaltal +OCT2HEX = OKT.TIL.HEX ## Konverterer et oktaltal til et heksadecimalt tal + + +## +## Financial functions Finansielle funktioner +## +ACCRINT = PÅLØBRENTE ## Returnerer den påløbne rente for et værdipapir med periodiske renteudbetalinger +ACCRINTM = PÅLØBRENTE.UDLØB ## Returnerer den påløbne rente for et værdipapir, hvor renteudbetalingen finder sted ved papirets udløb +AMORDEGRC = AMORDEGRC ## Returnerer afskrivningsbeløbet for hver regnskabsperiode ved hjælp af en afskrivningskoefficient +AMORLINC = AMORLINC ## Returnerer afskrivningsbeløbet for hver regnskabsperiode +COUPDAYBS = KUPONDAGE.SA ## Returnerer antallet af dage fra starten af kuponperioden til afregningsdatoen +COUPDAYS = KUPONDAGE.A ## Returnerer antallet af dage fra begyndelsen af kuponperioden til afregningsdatoen +COUPDAYSNC = KUPONDAGE.ANK ## Returnerer antallet af dage i den kuponperiode, der indeholder afregningsdatoen +COUPNCD = KUPONDAG.NÆSTE ## Returnerer den næste kupondato efter afregningsdatoen +COUPNUM = KUPONBETALINGER ## Returnerer antallet af kuponudbetalinger mellem afregnings- og udløbsdatoen +COUPPCD = KUPONDAG.FORRIGE ## Returnerer den forrige kupondato før afregningsdatoen +CUMIPMT = AKKUM.RENTE ## Returnerer den akkumulerede rente, der betales på et lån mellem to perioder +CUMPRINC = AKKUM.HOVEDSTOL ## Returnerer den akkumulerede nedbringelse af hovedstol mellem to perioder +DB = DB ## Returnerer afskrivningen på et aktiv i en angivet periode ved anvendelse af saldometoden +DDB = DSA ## Returnerer afskrivningsbeløbet for et aktiv over en bestemt periode ved anvendelse af dobbeltsaldometoden eller en anden afskrivningsmetode, som du angiver +DISC = DISKONTO ## Returnerer et værdipapirs diskonto +DOLLARDE = KR.DECIMAL ## Konverterer en kronepris udtrykt som brøk til en kronepris udtrykt som decimaltal +DOLLARFR = KR.BRØK ## Konverterer en kronepris udtrykt som decimaltal til en kronepris udtrykt som brøk +DURATION = VARIGHED ## Returnerer den årlige løbetid for et værdipapir med periodiske renteudbetalinger +EFFECT = EFFEKTIV.RENTE ## Returnerer den årlige effektive rente +FV = FV ## Returnerer fremtidsværdien af en investering +FVSCHEDULE = FVTABEL ## Returnerer den fremtidige værdi af en hovedstol, når der er tilskrevet rente og rentes rente efter forskellige rentesatser +INTRATE = RENTEFOD ## Returnerer renten på et fuldt ud investeret værdipapir +IPMT = R.YDELSE ## Returnerer renten fra en investering for en given periode +IRR = IA ## Returnerer den interne rente for en række pengestrømme +ISPMT = ISPMT ## Beregner den betalte rente i løbet af en bestemt investeringsperiode +MDURATION = MVARIGHED ## Returnerer Macauleys modificerede løbetid for et værdipapir med en formodet pari på kr. 100 +MIRR = MIA ## Returnerer den interne forrentning, hvor positive og negative pengestrømme finansieres til forskellig rente +NOMINAL = NOMINEL ## Returnerer den årlige nominelle rente +NPER = NPER ## Returnerer antallet af perioder for en investering +NPV = NUTIDSVÆRDI ## Returnerer nettonutidsværdien for en investering baseret på en række periodiske pengestrømme og en diskonteringssats +ODDFPRICE = ULIGE.KURS.PÅLYDENDE ## Returnerer kursen pr. kr. 100 nominel værdi for et værdipapir med en ulige (kort eller lang) første periode +ODDFYIELD = ULIGE.FØRSTE.AFKAST ## Returnerer afkastet for et værdipapir med ulige første periode +ODDLPRICE = ULIGE.SIDSTE.KURS ## Returnerer kursen pr. kr. 100 nominel værdi for et værdipapir med ulige sidste periode +ODDLYIELD = ULIGE.SIDSTE.AFKAST ## Returnerer afkastet for et værdipapir med ulige sidste periode +PMT = YDELSE ## Returnerer renten fra en investering for en given periode +PPMT = H.YDELSE ## Returnerer ydelsen på hovedstolen for en investering i en given periode +PRICE = KURS ## Returnerer kursen pr. kr 100 nominel værdi for et værdipapir med periodiske renteudbetalinger +PRICEDISC = KURS.DISKONTO ## Returnerer kursen pr. kr 100 nominel værdi for et diskonteret værdipapir +PRICEMAT = KURS.UDLØB ## Returnerer kursen pr. kr 100 nominel værdi for et værdipapir, hvor renten udbetales ved papirets udløb +PV = NV ## Returnerer den nuværende værdi af en investering +RATE = RENTE ## Returnerer renten i hver periode for en annuitet +RECEIVED = MODTAGET.VED.UDLØB ## Returnerer det beløb, der modtages ved udløbet af et fuldt ud investeret værdipapir +SLN = LA ## Returnerer den lineære afskrivning for et aktiv i en enkelt periode +SYD = ÅRSAFSKRIVNING ## Returnerer den årlige afskrivning på et aktiv i en bestemt periode +TBILLEQ = STATSOBLIGATION ## Returnerer det obligationsækvivalente afkast for en statsobligation +TBILLPRICE = STATSOBLIGATION.KURS ## Returnerer kursen pr. kr 100 nominel værdi for en statsobligation +TBILLYIELD = STATSOBLIGATION.AFKAST ## Returnerer en afkastet på en statsobligation +VDB = VSA ## Returnerer afskrivningen på et aktiv i en angivet periode, herunder delperioder, ved brug af dobbeltsaldometoden +XIRR = INTERN.RENTE ## Returnerer den interne rente for en plan over pengestrømme, der ikke behøver at være periodiske +XNPV = NETTO.NUTIDSVÆRDI ## Returnerer nutidsværdien for en plan over pengestrømme, der ikke behøver at være periodiske +YIELD = AFKAST ## Returnerer afkastet for et værdipapir med periodiske renteudbetalinger +YIELDDISC = AFKAST.DISKONTO ## Returnerer det årlige afkast for et diskonteret værdipapir, f.eks. en statsobligation +YIELDMAT = AFKAST.UDLØBSDATO ## Returnerer det årlige afkast for et værdipapir, hvor renten udbetales ved papirets udløb + + +## +## Information functions Informationsfunktioner +## +CELL = CELLE ## Returnerer oplysninger om formatering, placering eller indhold af en celle +ERROR.TYPE = FEJLTYPE ## Returnerer et tal, der svarer til en fejltype +INFO = INFO ## Returnerer oplysninger om det aktuelle operativmiljø +ISBLANK = ER.TOM ## Returnerer SAND, hvis værdien er tom +ISERR = ER.FJL ## Returnerer SAND, hvis værdien er en fejlværdi undtagen #I/T +ISERROR = ER.FEJL ## Returnerer SAND, hvis værdien er en fejlværdi +ISEVEN = ER.LIGE ## Returnerer SAND, hvis tallet er lige +ISLOGICAL = ER.LOGISK ## Returnerer SAND, hvis værdien er en logisk værdi +ISNA = ER.IKKE.TILGÆNGELIG ## Returnerer SAND, hvis værdien er fejlværdien #I/T +ISNONTEXT = ER.IKKE.TEKST ## Returnerer SAND, hvis værdien ikke er tekst +ISNUMBER = ER.TAL ## Returnerer SAND, hvis værdien er et tal +ISODD = ER.ULIGE ## Returnerer SAND, hvis tallet er ulige +ISREF = ER.REFERENCE ## Returnerer SAND, hvis værdien er en reference +ISTEXT = ER.TEKST ## Returnerer SAND, hvis værdien er tekst +N = TAL ## Returnerer en værdi konverteret til et tal +NA = IKKE.TILGÆNGELIG ## Returnerer fejlværdien #I/T +TYPE = VÆRDITYPE ## Returnerer et tal, der angiver datatypen for en værdi + + +## +## Logical functions Logiske funktioner +## +AND = OG ## Returnerer SAND, hvis alle argumenterne er sande +FALSE = FALSK ## Returnerer den logiske værdi FALSK +IF = HVIS ## Angiver en logisk test, der skal udføres +IFERROR = HVIS.FEJL ## Returnerer en værdi, du angiver, hvis en formel evauleres som en fejl. Returnerer i modsat fald resultatet af formlen +NOT = IKKE ## Vender argumentets logik om +OR = ELLER ## Returneret værdien SAND, hvis mindst ét argument er sandt +TRUE = SAND ## Returnerer den logiske værdi SAND + + +## +## Lookup and reference functions Opslags- og referencefunktioner +## +ADDRESS = ADRESSE ## Returnerer en reference som tekst til en enkelt celle i et regneark +AREAS = OMRÅDER ## Returnerer antallet af områder i en reference +CHOOSE = VÆLG ## Vælger en værdi på en liste med værdier +COLUMN = KOLONNE ## Returnerer kolonnenummeret i en reference +COLUMNS = KOLONNER ## Returnerer antallet af kolonner i en reference +HLOOKUP = VOPSLAG ## Søger i den øverste række af en matrix og returnerer værdien af den angivne celle +HYPERLINK = HYPERLINK ## Opretter en genvej kaldet et hyperlink, der åbner et dokument, som er lagret på en netværksserver, på et intranet eller på internettet +INDEX = INDEKS ## Anvender et indeks til at vælge en værdi fra en reference eller en matrix +INDIRECT = INDIREKTE ## Returnerer en reference, der er angivet af en tekstværdi +LOOKUP = SLÅ.OP ## Søger værdier i en vektor eller en matrix +MATCH = SAMMENLIGN ## Søger værdier i en reference eller en matrix +OFFSET = FORSKYDNING ## Returnerer en reference forskudt i forhold til en given reference +ROW = RÆKKE ## Returnerer rækkenummeret for en reference +ROWS = RÆKKER ## Returnerer antallet af rækker i en reference +RTD = RTD ## Henter realtidsdata fra et program, der understøtter COM-automatisering (Automation: En metode til at arbejde med objekter fra et andet program eller udviklingsværktøj. Automation, som tidligere blev kaldt OLE Automation, er en industristandard og en funktion i COM (Component Object Model).) +TRANSPOSE = TRANSPONER ## Returnerer en transponeret matrix +VLOOKUP = LOPSLAG ## Søger i øverste række af en matrix og flytter på tværs af rækken for at returnere en celleværdi + + +## +## Math and trigonometry functions Matematiske og trigonometriske funktioner +## +ABS = ABS ## Returnerer den absolutte værdi af et tal +ACOS = ARCCOS ## Returnerer et tals arcus cosinus +ACOSH = ARCCOSH ## Returnerer den inverse hyperbolske cosinus af tal +ASIN = ARCSIN ## Returnerer et tals arcus sinus +ASINH = ARCSINH ## Returnerer den inverse hyperbolske sinus for tal +ATAN = ARCTAN ## Returnerer et tals arcus tangens +ATAN2 = ARCTAN2 ## Returnerer de angivne x- og y-koordinaters arcus tangens +ATANH = ARCTANH ## Returnerer et tals inverse hyperbolske tangens +CEILING = AFRUND.LOFT ## Afrunder et tal til nærmeste heltal eller til nærmeste multiplum af betydning +COMBIN = KOMBIN ## Returnerer antallet af kombinationer for et givet antal objekter +COS = COS ## Returnerer et tals cosinus +COSH = COSH ## Returnerer den inverse hyperbolske cosinus af et tal +DEGREES = GRADER ## Konverterer radianer til grader +EVEN = LIGE ## Runder et tal op til nærmeste lige heltal +EXP = EKSP ## Returnerer e opløftet til en potens af et angivet tal +FACT = FAKULTET ## Returnerer et tals fakultet +FACTDOUBLE = DOBBELT.FAKULTET ## Returnerer et tals dobbelte fakultet +FLOOR = AFRUND.GULV ## Runder et tal ned mod nul +GCD = STØRSTE.FÆLLES.DIVISOR ## Returnerer den største fælles divisor +INT = HELTAL ## Nedrunder et tal til det nærmeste heltal +LCM = MINDSTE.FÆLLES.MULTIPLUM ## Returnerer det mindste fælles multiplum +LN = LN ## Returnerer et tals naturlige logaritme +LOG = LOG ## Returnerer logaritmen for et tal på grundlag af et angivet grundtal +LOG10 = LOG10 ## Returnerer titalslogaritmen af et tal +MDETERM = MDETERM ## Returnerer determinanten for en matrix +MINVERSE = MINVERT ## Returnerer den inverse matrix for en matrix +MMULT = MPRODUKT ## Returnerer matrixproduktet af to matrixer +MOD = REST ## Returnerer restværdien fra division +MROUND = MAFRUND ## Returnerer et tal afrundet til det ønskede multiplum +MULTINOMIAL = MULTINOMIAL ## Returnerer et multinomialt talsæt +ODD = ULIGE ## Runder et tal op til nærmeste ulige heltal +PI = PI ## Returnerer værdien af pi +POWER = POTENS ## Returnerer resultatet af et tal opløftet til en potens +PRODUCT = PRODUKT ## Multiplicerer argumenterne +QUOTIENT = KVOTIENT ## Returnerer heltalsdelen ved division +RADIANS = RADIANER ## Konverterer grader til radianer +RAND = SLUMP ## Returnerer et tilfældigt tal mellem 0 og 1 +RANDBETWEEN = SLUMP.MELLEM ## Returnerer et tilfældigt tal mellem de tal, der angives +ROMAN = ROMERTAL ## Konverterer et arabertal til romertal som tekst +ROUND = AFRUND ## Afrunder et tal til et angivet antal decimaler +ROUNDDOWN = RUND.NED ## Runder et tal ned mod nul +ROUNDUP = RUND.OP ## Runder et tal op, væk fra 0 (nul) +SERIESSUM = SERIESUM ## Returnerer summen af en potensserie baseret på en formel +SIGN = FORTEGN ## Returnerer et tals fortegn +SIN = SIN ## Returnerer en given vinkels sinusværdi +SINH = SINH ## Returnerer den hyperbolske sinus af et tal +SQRT = KVROD ## Returnerer en positiv kvadratrod +SQRTPI = KVRODPI ## Returnerer kvadratroden af (tal * pi;) +SUBTOTAL = SUBTOTAL ## Returnerer en subtotal på en liste eller i en database +SUM = SUM ## Lægger argumenterne sammen +SUMIF = SUM.HVIS ## Lægger de celler sammen, der er specificeret af et givet kriterium. +SUMIFS = SUM.HVISER ## Lægger de celler i et område sammen, der opfylder flere kriterier. +SUMPRODUCT = SUMPRODUKT ## Returnerer summen af produkter af ens matrixkomponenter +SUMSQ = SUMKV ## Returnerer summen af argumenternes kvadrater +SUMX2MY2 = SUMX2MY2 ## Returnerer summen af differensen mellem kvadrater af ens værdier i to matrixer +SUMX2PY2 = SUMX2PY2 ## Returnerer summen af summen af kvadrater af tilsvarende værdier i to matrixer +SUMXMY2 = SUMXMY2 ## Returnerer summen af kvadrater af differenser mellem ens værdier i to matrixer +TAN = TAN ## Returnerer et tals tangens +TANH = TANH ## Returnerer et tals hyperbolske tangens +TRUNC = AFKORT ## Afkorter et tal til et heltal + + +## +## Statistical functions Statistiske funktioner +## +AVEDEV = MAD ## Returnerer den gennemsnitlige numeriske afvigelse fra stikprøvens middelværdi +AVERAGE = MIDDEL ## Returnerer middelværdien af argumenterne +AVERAGEA = MIDDELV ## Returnerer middelværdien af argumenterne og medtager tal, tekst og logiske værdier +AVERAGEIF = MIDDEL.HVIS ## Returnerer gennemsnittet (den aritmetiske middelværdi) af alle de celler, der opfylder et givet kriterium, i et område +AVERAGEIFS = MIDDEL.HVISER ## Returnerer gennemsnittet (den aritmetiske middelværdi) af alle de celler, der opfylder flere kriterier. +BETADIST = BETAFORDELING ## Returnerer den kumulative betafordelingsfunktion +BETAINV = BETAINV ## Returnerer den inverse kumulative fordelingsfunktion for en angivet betafordeling +BINOMDIST = BINOMIALFORDELING ## Returnerer punktsandsynligheden for binomialfordelingen +CHIDIST = CHIFORDELING ## Returnerer fraktilsandsynligheden for en chi2-fordeling +CHIINV = CHIINV ## Returnerer den inverse fraktilsandsynlighed for en chi2-fordeling +CHITEST = CHITEST ## Foretager en test for uafhængighed +CONFIDENCE = KONFIDENSINTERVAL ## Returnerer et konfidensinterval for en population +CORREL = KORRELATION ## Returnerer korrelationskoefficienten mellem to datasæt +COUNT = TÆL ## Tæller antallet af tal på en liste med argumenter +COUNTA = TÆLV ## Tæller antallet af værdier på en liste med argumenter +COUNTBLANK = ANTAL.BLANKE ## Tæller antallet af tomme celler i et område +COUNTIF = TÆLHVIS ## Tæller antallet af celler, som opfylder de givne kriterier, i et område +COUNTIFS = TÆL.HVISER ## Tæller antallet af de celler, som opfylder flere kriterier, i et område +COVAR = KOVARIANS ## Beregner kovariansen mellem to stokastiske variabler +CRITBINOM = KRITBINOM ## Returnerer den mindste værdi for x, for hvilken det gælder, at fordelingsfunktionen er mindre end eller lig med kriterieværdien. +DEVSQ = SAK ## Returnerer summen af de kvadrerede afvigelser fra middelværdien +EXPONDIST = EKSPFORDELING ## Returnerer eksponentialfordelingen +FDIST = FFORDELING ## Returnerer fraktilsandsynligheden for F-fordelingen +FINV = FINV ## Returnerer den inverse fraktilsandsynlighed for F-fordelingen +FISHER = FISHER ## Returnerer Fisher-transformationen +FISHERINV = FISHERINV ## Returnerer den inverse Fisher-transformation +FORECAST = PROGNOSE ## Returnerer en prognoseværdi baseret på lineær tendens +FREQUENCY = FREKVENS ## Returnerer en frekvensfordeling i en søjlevektor +FTEST = FTEST ## Returnerer resultatet af en F-test til sammenligning af varians +GAMMADIST = GAMMAFORDELING ## Returnerer fordelingsfunktionen for gammafordelingen +GAMMAINV = GAMMAINV ## Returnerer den inverse fordelingsfunktion for gammafordelingen +GAMMALN = GAMMALN ## Returnerer den naturlige logaritme til gammafordelingen, G(x) +GEOMEAN = GEOMIDDELVÆRDI ## Returnerer det geometriske gennemsnit +GROWTH = FORØGELSE ## Returnerer værdier langs en eksponentiel tendens +HARMEAN = HARMIDDELVÆRDI ## Returnerer det harmoniske gennemsnit +HYPGEOMDIST = HYPGEOFORDELING ## Returnerer punktsandsynligheden i en hypergeometrisk fordeling +INTERCEPT = SKÆRING ## Returnerer afskæringsværdien på y-aksen i en lineær regression +KURT = TOPSTEJL ## Returnerer kurtosisværdien for en stokastisk variabel +LARGE = STOR ## Returnerer den k'te største værdi i et datasæt +LINEST = LINREGR ## Returnerer parameterestimaterne for en lineær tendens +LOGEST = LOGREGR ## Returnerer parameterestimaterne for en eksponentiel tendens +LOGINV = LOGINV ## Returnerer den inverse fordelingsfunktion for lognormalfordelingen +LOGNORMDIST = LOGNORMFORDELING ## Returnerer fordelingsfunktionen for lognormalfordelingen +MAX = MAKS ## Returnerer den maksimale værdi på en liste med argumenter. +MAXA = MAKSV ## Returnerer den maksimale værdi på en liste med argumenter og medtager tal, tekst og logiske værdier +MEDIAN = MEDIAN ## Returnerer medianen for de angivne tal +MIN = MIN ## Returnerer den mindste værdi på en liste med argumenter. +MINA = MINV ## Returnerer den mindste værdi på en liste med argumenter og medtager tal, tekst og logiske værdier +MODE = HYPPIGST ## Returnerer den hyppigste værdi i et datasæt +NEGBINOMDIST = NEGBINOMFORDELING ## Returnerer den negative binomialfordeling +NORMDIST = NORMFORDELING ## Returnerer fordelingsfunktionen for normalfordelingen +NORMINV = NORMINV ## Returnerer den inverse fordelingsfunktion for normalfordelingen +NORMSDIST = STANDARDNORMFORDELING ## Returnerer fordelingsfunktionen for standardnormalfordelingen +NORMSINV = STANDARDNORMINV ## Returnerer den inverse fordelingsfunktion for standardnormalfordelingen +PEARSON = PEARSON ## Returnerer Pearsons korrelationskoefficient +PERCENTILE = FRAKTIL ## Returnerer den k'te fraktil for datasættet +PERCENTRANK = PROCENTPLADS ## Returnerer den procentuelle rang for en given værdi i et datasæt +PERMUT = PERMUT ## Returnerer antallet af permutationer for et givet sæt objekter +POISSON = POISSON ## Returnerer fordelingsfunktionen for en Poisson-fordeling +PROB = SANDSYNLIGHED ## Returnerer intervalsandsynligheden +QUARTILE = KVARTIL ## Returnerer kvartilen i et givet datasæt +RANK = PLADS ## Returnerer rangen for et tal på en liste med tal +RSQ = FORKLARINGSGRAD ## Returnerer R2-værdien fra en simpel lineær regression +SKEW = SKÆVHED ## Returnerer skævheden for en stokastisk variabel +SLOPE = HÆLDNING ## Returnerer estimatet på hældningen fra en simpel lineær regression +SMALL = MINDSTE ## Returnerer den k'te mindste værdi i datasættet +STANDARDIZE = STANDARDISER ## Returnerer en standardiseret værdi +STDEV = STDAFV ## Estimerer standardafvigelsen på basis af en stikprøve +STDEVA = STDAFVV ## Beregner standardafvigelsen på basis af en prøve og medtager tal, tekst og logiske værdier +STDEVP = STDAFVP ## Beregner standardafvigelsen på basis af en hel population +STDEVPA = STDAFVPV ## Beregner standardafvigelsen på basis af en hel population og medtager tal, tekst og logiske værdier +STEYX = STFYX ## Returnerer standardafvigelsen for de estimerede y-værdier i den simple lineære regression +TDIST = TFORDELING ## Returnerer fordelingsfunktionen for Student's t-fordeling +TINV = TINV ## Returnerer den inverse fordelingsfunktion for Student's t-fordeling +TREND = TENDENS ## Returnerer værdi under antagelse af en lineær tendens +TRIMMEAN = TRIMMIDDELVÆRDI ## Returnerer den trimmede middelværdi for datasættet +TTEST = TTEST ## Returnerer den sandsynlighed, der er forbundet med Student's t-test +VAR = VARIANS ## Beregner variansen på basis af en prøve +VARA = VARIANSV ## Beregner variansen på basis af en prøve og medtager tal, tekst og logiske værdier +VARP = VARIANSP ## Beregner variansen på basis af hele populationen +VARPA = VARIANSPV ## Beregner variansen på basis af hele populationen og medtager tal, tekst og logiske værdier +WEIBULL = WEIBULL ## Returnerer fordelingsfunktionen for Weibull-fordelingen +ZTEST = ZTEST ## Returnerer sandsynlighedsværdien ved en en-sidet z-test + + +## +## Text functions Tekstfunktioner +## +ASC = ASC ## Ændrer engelske tegn i fuld bredde (dobbelt-byte) eller katakana i en tegnstreng til tegn i halv bredde (enkelt-byte) +BAHTTEXT = BAHTTEKST ## Konverterer et tal til tekst ved hjælp af valutaformatet ß (baht) +CHAR = TEGN ## Returnerer det tegn, der svarer til kodenummeret +CLEAN = RENS ## Fjerner alle tegn, der ikke kan udskrives, fra tekst +CODE = KODE ## Returnerer en numerisk kode for det første tegn i en tekststreng +CONCATENATE = SAMMENKÆDNING ## Sammenkæder adskillige tekstelementer til ét tekstelement +DOLLAR = KR ## Konverterer et tal til tekst ved hjælp af valutaformatet kr. (kroner) +EXACT = EKSAKT ## Kontrollerer, om to tekstværdier er identiske +FIND = FIND ## Søger efter en tekstværdi i en anden tekstværdi (der skelnes mellem store og små bogstaver) +FINDB = FINDB ## Søger efter en tekstværdi i en anden tekstværdi (der skelnes mellem store og små bogstaver) +FIXED = FAST ## Formaterer et tal som tekst med et fast antal decimaler +JIS = JIS ## Ændrer engelske tegn i halv bredde (enkelt-byte) eller katakana i en tegnstreng til tegn i fuld bredde (dobbelt-byte) +LEFT = VENSTRE ## Returnerer tegnet længst til venstre i en tekstværdi +LEFTB = VENSTREB ## Returnerer tegnet længst til venstre i en tekstværdi +LEN = LÆNGDE ## Returnerer antallet af tegn i en tekststreng +LENB = LÆNGDEB ## Returnerer antallet af tegn i en tekststreng +LOWER = SMÅ.BOGSTAVER ## Konverterer tekst til små bogstaver +MID = MIDT ## Returnerer et bestemt antal tegn fra en tekststreng fra og med den angivne startposition +MIDB = MIDTB ## Returnerer et bestemt antal tegn fra en tekststreng fra og med den angivne startposition +PHONETIC = FONETISK ## Uddrager de fonetiske (furigana) tegn fra en tekststreng +PROPER = STORT.FORBOGSTAV ## Konverterer første bogstav i hvert ord i teksten til stort bogstav +REPLACE = ERSTAT ## Erstatter tegn i tekst +REPLACEB = ERSTATB ## Erstatter tegn i tekst +REPT = GENTAG ## Gentager tekst et givet antal gange +RIGHT = HØJRE ## Returnerer tegnet længste til højre i en tekstværdi +RIGHTB = HØJREB ## Returnerer tegnet længste til højre i en tekstværdi +SEARCH = SØG ## Søger efter en tekstværdi i en anden tekstværdi (der skelnes ikke mellem store og små bogstaver) +SEARCHB = SØGB ## Søger efter en tekstværdi i en anden tekstværdi (der skelnes ikke mellem store og små bogstaver) +SUBSTITUTE = UDSKIFT ## Udskifter gammel tekst med ny tekst i en tekststreng +T = T ## Konverterer argumenterne til tekst +TEXT = TEKST ## Formaterer et tal og konverterer det til tekst +TRIM = FJERN.OVERFLØDIGE.BLANKE ## Fjerner mellemrum fra tekst +UPPER = STORE.BOGSTAVER ## Konverterer tekst til store bogstaver +VALUE = VÆRDI ## Konverterer et tekstargument til et tal diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/de/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/de/config new file mode 100644 index 0000000..9751c4b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/de/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) + +## +NULL = #NULL! +DIV0 = #DIV/0! +VALUE = #WERT! +REF = #BEZUG! +NAME = #NAME? +NUM = #ZAHL! +NA = #NV diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/de/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/de/functions new file mode 100644 index 0000000..01df42f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/de/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Add-In- und Automatisierungsfunktionen +## +GETPIVOTDATA = PIVOTDATENZUORDNEN ## In einem PivotTable-Bericht gespeicherte Daten werden zurückgegeben. + + +## +## Cube functions Cubefunktionen +## +CUBEKPIMEMBER = CUBEKPIELEMENT ## Gibt Name, Eigenschaft und Measure eines Key Performance Indicators (KPI) zurück und zeigt den Namen und die Eigenschaft in der Zelle an. Ein KPI ist ein quantifizierbares Maß, wie z. B. der monatliche Bruttogewinn oder die vierteljährliche Mitarbeiterfluktuation, mit dessen Hilfe das Leistungsverhalten eines Unternehmens überwacht werden kann. +CUBEMEMBER = CUBEELEMENT ## Gibt ein Element oder ein Tuple in einer Cubehierarchie zurück. Wird verwendet, um zu überprüfen, ob das Element oder Tuple im Cube vorhanden ist. +CUBEMEMBERPROPERTY = CUBEELEMENTEIGENSCHAFT ## Gibt den Wert einer Elementeigenschaft im Cube zurück. Wird verwendet, um zu überprüfen, ob ein Elementname im Cube vorhanden ist, und um die für dieses Element angegebene Eigenschaft zurückzugeben. +CUBERANKEDMEMBER = CUBERANGELEMENT ## Gibt das n-te oder n-rangige Element in einer Menge zurück. Wird verwendet, um mindestens ein Element in einer Menge zurückzugeben, wie z. B. bester Vertriebsmitarbeiter oder 10 beste Kursteilnehmer. +CUBESET = CUBEMENGE ## Definiert eine berechnete Menge Elemente oder Tuples durch Senden eines Mengenausdrucks an den Cube auf dem Server, der die Menge erstellt und an Microsoft Office Excel zurückgibt. +CUBESETCOUNT = CUBEMENGENANZAHL ## Gibt die Anzahl der Elemente in einer Menge zurück. +CUBEVALUE = CUBEWERT ## Gibt einen Aggregatwert aus einem Cube zurück. + + +## +## Database functions Datenbankfunktionen +## +DAVERAGE = DBMITTELWERT ## Gibt den Mittelwert der ausgewählten Datenbankeinträge zurück +DCOUNT = DBANZAHL ## Zählt die Zellen mit Zahlen in einer Datenbank +DCOUNTA = DBANZAHL2 ## Zählt nicht leere Zellen in einer Datenbank +DGET = DBAUSZUG ## Extrahiert aus einer Datenbank einen einzelnen Datensatz, der den angegebenen Kriterien entspricht +DMAX = DBMAX ## Gibt den größten Wert aus ausgewählten Datenbankeinträgen zurück +DMIN = DBMIN ## Gibt den kleinsten Wert aus ausgewählten Datenbankeinträgen zurück +DPRODUCT = DBPRODUKT ## Multipliziert die Werte in einem bestimmten Feld mit Datensätzen, die den Kriterien in einer Datenbank entsprechen +DSTDEV = DBSTDABW ## Schätzt die Standardabweichung auf der Grundlage einer Stichprobe aus ausgewählten Datenbankeinträgen +DSTDEVP = DBSTDABWN ## Berechnet die Standardabweichung auf der Grundlage der Grundgesamtheit ausgewählter Datenbankeinträge +DSUM = DBSUMME ## Addiert die Zahlen in der Feldspalte mit Datensätzen in der Datenbank, die den Kriterien entsprechen +DVAR = DBVARIANZ ## Schätzt die Varianz auf der Grundlage ausgewählter Datenbankeinträge +DVARP = DBVARIANZEN ## Berechnet die Varianz auf der Grundlage der Grundgesamtheit ausgewählter Datenbankeinträge + + +## +## Date and time functions Datums- und Zeitfunktionen +## +DATE = DATUM ## Gibt die fortlaufende Zahl eines bestimmten Datums zurück +DATEVALUE = DATWERT ## Wandelt ein Datum in Form von Text in eine fortlaufende Zahl um +DAY = TAG ## Wandelt eine fortlaufende Zahl in den Tag des Monats um +DAYS360 = TAGE360 ## Berechnet die Anzahl der Tage zwischen zwei Datumsangaben ausgehend von einem Jahr, das 360 Tage hat +EDATE = EDATUM ## Gibt die fortlaufende Zahl des Datums zurück, bei dem es sich um die angegebene Anzahl von Monaten vor oder nach dem Anfangstermin handelt +EOMONTH = MONATSENDE ## Gibt die fortlaufende Zahl des letzten Tags des Monats vor oder nach einer festgelegten Anzahl von Monaten zurück +HOUR = STUNDE ## Wandelt eine fortlaufende Zahl in eine Stunde um +MINUTE = MINUTE ## Wandelt eine fortlaufende Zahl in eine Minute um +MONTH = MONAT ## Wandelt eine fortlaufende Zahl in einen Monat um +NETWORKDAYS = NETTOARBEITSTAGE ## Gibt die Anzahl von ganzen Arbeitstagen zwischen zwei Datumswerten zurück +NOW = JETZT ## Gibt die fortlaufende Zahl des aktuellen Datums und der aktuellen Uhrzeit zurück +SECOND = SEKUNDE ## Wandelt eine fortlaufende Zahl in eine Sekunde um +TIME = ZEIT ## Gibt die fortlaufende Zahl einer bestimmten Uhrzeit zurück +TIMEVALUE = ZEITWERT ## Wandelt eine Uhrzeit in Form von Text in eine fortlaufende Zahl um +TODAY = HEUTE ## Gibt die fortlaufende Zahl des heutigen Datums zurück +WEEKDAY = WOCHENTAG ## Wandelt eine fortlaufende Zahl in den Wochentag um +WEEKNUM = KALENDERWOCHE ## Wandelt eine fortlaufende Zahl in eine Zahl um, die angibt, in welche Woche eines Jahres das angegebene Datum fällt +WORKDAY = ARBEITSTAG ## Gibt die fortlaufende Zahl des Datums vor oder nach einer bestimmten Anzahl von Arbeitstagen zurück +YEAR = JAHR ## Wandelt eine fortlaufende Zahl in ein Jahr um +YEARFRAC = BRTEILJAHRE ## Gibt die Anzahl der ganzen Tage zwischen Ausgangsdatum und Enddatum in Bruchteilen von Jahren zurück + + +## +## Engineering functions Konstruktionsfunktionen +## +BESSELI = BESSELI ## Gibt die geänderte Besselfunktion In(x) zurück +BESSELJ = BESSELJ ## Gibt die Besselfunktion Jn(x) zurück +BESSELK = BESSELK ## Gibt die geänderte Besselfunktion Kn(x) zurück +BESSELY = BESSELY ## Gibt die Besselfunktion Yn(x) zurück +BIN2DEC = BININDEZ ## Wandelt eine binäre Zahl (Dualzahl) in eine dezimale Zahl um +BIN2HEX = BININHEX ## Wandelt eine binäre Zahl (Dualzahl) in eine hexadezimale Zahl um +BIN2OCT = BININOKT ## Wandelt eine binäre Zahl (Dualzahl) in eine oktale Zahl um +COMPLEX = KOMPLEXE ## Wandelt den Real- und Imaginärteil in eine komplexe Zahl um +CONVERT = UMWANDELN ## Wandelt eine Zahl von einem Maßsystem in ein anderes um +DEC2BIN = DEZINBIN ## Wandelt eine dezimale Zahl in eine binäre Zahl (Dualzahl) um +DEC2HEX = DEZINHEX ## Wandelt eine dezimale Zahl in eine hexadezimale Zahl um +DEC2OCT = DEZINOKT ## Wandelt eine dezimale Zahl in eine oktale Zahl um +DELTA = DELTA ## Überprüft, ob zwei Werte gleich sind +ERF = GAUSSFEHLER ## Gibt die Gauss'sche Fehlerfunktion zurück +ERFC = GAUSSFKOMPL ## Gibt das Komplement zur Gauss'schen Fehlerfunktion zurück +GESTEP = GGANZZAHL ## Überprüft, ob eine Zahl größer als ein gegebener Schwellenwert ist +HEX2BIN = HEXINBIN ## Wandelt eine hexadezimale Zahl in eine Binärzahl um +HEX2DEC = HEXINDEZ ## Wandelt eine hexadezimale Zahl in eine dezimale Zahl um +HEX2OCT = HEXINOKT ## Wandelt eine hexadezimale Zahl in eine Oktalzahl um +IMABS = IMABS ## Gibt den Absolutbetrag (Modulo) einer komplexen Zahl zurück +IMAGINARY = IMAGINÄRTEIL ## Gibt den Imaginärteil einer komplexen Zahl zurück +IMARGUMENT = IMARGUMENT ## Gibt das Argument Theta zurück, einen Winkel, der als Bogenmaß ausgedrückt wird +IMCONJUGATE = IMKONJUGIERTE ## Gibt die konjugierte komplexe Zahl zu einer komplexen Zahl zurück +IMCOS = IMCOS ## Gibt den Kosinus einer komplexen Zahl zurück +IMDIV = IMDIV ## Gibt den Quotienten zweier komplexer Zahlen zurück +IMEXP = IMEXP ## Gibt die algebraische Form einer in exponentieller Schreibweise vorliegenden komplexen Zahl zurück +IMLN = IMLN ## Gibt den natürlichen Logarithmus einer komplexen Zahl zurück +IMLOG10 = IMLOG10 ## Gibt den Logarithmus einer komplexen Zahl zur Basis 10 zurück +IMLOG2 = IMLOG2 ## Gibt den Logarithmus einer komplexen Zahl zur Basis 2 zurück +IMPOWER = IMAPOTENZ ## Potenziert eine komplexe Zahl mit einer ganzen Zahl +IMPRODUCT = IMPRODUKT ## Gibt das Produkt von komplexen Zahlen zurück +IMREAL = IMREALTEIL ## Gibt den Realteil einer komplexen Zahl zurück +IMSIN = IMSIN ## Gibt den Sinus einer komplexen Zahl zurück +IMSQRT = IMWURZEL ## Gibt die Quadratwurzel einer komplexen Zahl zurück +IMSUB = IMSUB ## Gibt die Differenz zwischen zwei komplexen Zahlen zurück +IMSUM = IMSUMME ## Gibt die Summe von komplexen Zahlen zurück +OCT2BIN = OKTINBIN ## Wandelt eine oktale Zahl in eine binäre Zahl (Dualzahl) um +OCT2DEC = OKTINDEZ ## Wandelt eine oktale Zahl in eine dezimale Zahl um +OCT2HEX = OKTINHEX ## Wandelt eine oktale Zahl in eine hexadezimale Zahl um + + +## +## Financial functions Finanzmathematische Funktionen +## +ACCRINT = AUFGELZINS ## Gibt die aufgelaufenen Zinsen (Stückzinsen) eines Wertpapiers mit periodischen Zinszahlungen zurück +ACCRINTM = AUFGELZINSF ## Gibt die aufgelaufenen Zinsen (Stückzinsen) eines Wertpapiers zurück, die bei Fälligkeit ausgezahlt werden +AMORDEGRC = AMORDEGRK ## Gibt die Abschreibung für die einzelnen Abschreibungszeiträume mithilfe eines Abschreibungskoeffizienten zurück +AMORLINC = AMORLINEARK ## Gibt die Abschreibung für die einzelnen Abschreibungszeiträume zurück +COUPDAYBS = ZINSTERMTAGVA ## Gibt die Anzahl der Tage vom Anfang des Zinstermins bis zum Abrechnungstermin zurück +COUPDAYS = ZINSTERMTAGE ## Gibt die Anzahl der Tage der Zinsperiode zurück, die den Abrechnungstermin einschließt +COUPDAYSNC = ZINSTERMTAGNZ ## Gibt die Anzahl der Tage vom Abrechnungstermin bis zum nächsten Zinstermin zurück +COUPNCD = ZINSTERMNZ ## Gibt das Datum des ersten Zinstermins nach dem Abrechnungstermin zurück +COUPNUM = ZINSTERMZAHL ## Gibt die Anzahl der Zinstermine zwischen Abrechnungs- und Fälligkeitsdatum zurück +COUPPCD = ZINSTERMVZ ## Gibt das Datum des letzten Zinstermins vor dem Abrechnungstermin zurück +CUMIPMT = KUMZINSZ ## Berechnet die kumulierten Zinsen, die zwischen zwei Perioden zu zahlen sind +CUMPRINC = KUMKAPITAL ## Berechnet die aufgelaufene Tilgung eines Darlehens, die zwischen zwei Perioden zu zahlen ist +DB = GDA2 ## Gibt die geometrisch-degressive Abschreibung eines Wirtschaftsguts für eine bestimmte Periode zurück +DDB = GDA ## Gibt die Abschreibung eines Anlageguts für einen angegebenen Zeitraum unter Verwendung der degressiven Doppelraten-Abschreibung oder eines anderen von Ihnen angegebenen Abschreibungsverfahrens zurück +DISC = DISAGIO ## Gibt den in Prozent ausgedrückten Abzinsungssatz eines Wertpapiers zurück +DOLLARDE = NOTIERUNGDEZ ## Wandelt eine Notierung, die als Dezimalbruch ausgedrückt wurde, in eine Dezimalzahl um +DOLLARFR = NOTIERUNGBRU ## Wandelt eine Notierung, die als Dezimalzahl ausgedrückt wurde, in einen Dezimalbruch um +DURATION = DURATION ## Gibt die jährliche Duration eines Wertpapiers mit periodischen Zinszahlungen zurück +EFFECT = EFFEKTIV ## Gibt die jährliche Effektivverzinsung zurück +FV = ZW ## Gibt den zukünftigen Wert (Endwert) einer Investition zurück +FVSCHEDULE = ZW2 ## Gibt den aufgezinsten Wert des Anfangskapitals für eine Reihe periodisch unterschiedlicher Zinssätze zurück +INTRATE = ZINSSATZ ## Gibt den Zinssatz eines voll investierten Wertpapiers zurück +IPMT = ZINSZ ## Gibt die Zinszahlung einer Investition für die angegebene Periode zurück +IRR = IKV ## Gibt den internen Zinsfuß einer Investition ohne Finanzierungskosten oder Reinvestitionsgewinne zurück +ISPMT = ISPMT ## Berechnet die während eines bestimmten Zeitraums für eine Investition gezahlten Zinsen +MDURATION = MDURATION ## Gibt die geänderte Dauer für ein Wertpapier mit einem angenommenen Nennwert von 100 € zurück +MIRR = QIKV ## Gibt den internen Zinsfuß zurück, wobei positive und negative Zahlungen zu unterschiedlichen Sätzen finanziert werden +NOMINAL = NOMINAL ## Gibt die jährliche Nominalverzinsung zurück +NPER = ZZR ## Gibt die Anzahl der Zahlungsperioden einer Investition zurück +NPV = NBW ## Gibt den Nettobarwert einer Investition auf Basis periodisch anfallender Zahlungen und eines Abzinsungsfaktors zurück +ODDFPRICE = UNREGER.KURS ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers mit einem unregelmäßigen ersten Zinstermin zurück +ODDFYIELD = UNREGER.REND ## Gibt die Rendite eines Wertpapiers mit einem unregelmäßigen ersten Zinstermin zurück +ODDLPRICE = UNREGLE.KURS ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers mit einem unregelmäßigen letzten Zinstermin zurück +ODDLYIELD = UNREGLE.REND ## Gibt die Rendite eines Wertpapiers mit einem unregelmäßigen letzten Zinstermin zurück +PMT = RMZ ## Gibt die periodische Zahlung für eine Annuität zurück +PPMT = KAPZ ## Gibt die Kapitalrückzahlung einer Investition für eine angegebene Periode zurück +PRICE = KURS ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers zurück, das periodisch Zinsen auszahlt +PRICEDISC = KURSDISAGIO ## Gibt den Kurs pro 100 € Nennwert eines unverzinslichen Wertpapiers zurück +PRICEMAT = KURSFÄLLIG ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers zurück, das Zinsen am Fälligkeitsdatum auszahlt +PV = BW ## Gibt den Barwert einer Investition zurück +RATE = ZINS ## Gibt den Zinssatz pro Zeitraum einer Annuität zurück +RECEIVED = AUSZAHLUNG ## Gibt den Auszahlungsbetrag eines voll investierten Wertpapiers am Fälligkeitstermin zurück +SLN = LIA ## Gibt die lineare Abschreibung eines Wirtschaftsguts pro Periode zurück +SYD = DIA ## Gibt die arithmetisch-degressive Abschreibung eines Wirtschaftsguts für eine bestimmte Periode zurück +TBILLEQ = TBILLÄQUIV ## Gibt die Rendite für ein Wertpapier zurück +TBILLPRICE = TBILLKURS ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers zurück +TBILLYIELD = TBILLRENDITE ## Gibt die Rendite für ein Wertpapier zurück +VDB = VDB ## Gibt die degressive Abschreibung eines Wirtschaftsguts für eine bestimmte Periode oder Teilperiode zurück +XIRR = XINTZINSFUSS ## Gibt den internen Zinsfuß einer Reihe nicht periodisch anfallender Zahlungen zurück +XNPV = XKAPITALWERT ## Gibt den Nettobarwert (Kapitalwert) einer Reihe nicht periodisch anfallender Zahlungen zurück +YIELD = RENDITE ## Gibt die Rendite eines Wertpapiers zurück, das periodisch Zinsen auszahlt +YIELDDISC = RENDITEDIS ## Gibt die jährliche Rendite eines unverzinslichen Wertpapiers zurück +YIELDMAT = RENDITEFÄLL ## Gibt die jährliche Rendite eines Wertpapiers zurück, das Zinsen am Fälligkeitsdatum auszahlt + + +## +## Information functions Informationsfunktionen +## +CELL = ZELLE ## Gibt Informationen zu Formatierung, Position oder Inhalt einer Zelle zurück +ERROR.TYPE = FEHLER.TYP ## Gibt eine Zahl zurück, die einem Fehlertyp entspricht +INFO = INFO ## Gibt Informationen zur aktuellen Betriebssystemumgebung zurück +ISBLANK = ISTLEER ## Gibt WAHR zurück, wenn der Wert leer ist +ISERR = ISTFEHL ## Gibt WAHR zurück, wenn der Wert ein beliebiger Fehlerwert außer #N/V ist +ISERROR = ISTFEHLER ## Gibt WAHR zurück, wenn der Wert ein beliebiger Fehlerwert ist +ISEVEN = ISTGERADE ## Gibt WAHR zurück, wenn es sich um eine gerade Zahl handelt +ISLOGICAL = ISTLOG ## Gibt WAHR zurück, wenn der Wert ein Wahrheitswert ist +ISNA = ISTNV ## Gibt WAHR zurück, wenn der Wert der Fehlerwert #N/V ist +ISNONTEXT = ISTKTEXT ## Gibt WAHR zurück, wenn der Wert ein Element ist, das keinen Text enthält +ISNUMBER = ISTZAHL ## Gibt WAHR zurück, wenn der Wert eine Zahl ist +ISODD = ISTUNGERADE ## Gibt WAHR zurück, wenn es sich um eine ungerade Zahl handelt +ISREF = ISTBEZUG ## Gibt WAHR zurück, wenn der Wert ein Bezug ist +ISTEXT = ISTTEXT ## Gibt WAHR zurück, wenn der Wert ein Element ist, das Text enthält +N = N ## Gibt den in eine Zahl umgewandelten Wert zurück +NA = NV ## Gibt den Fehlerwert #NV zurück +TYPE = TYP ## Gibt eine Zahl zurück, die den Datentyp des angegebenen Werts anzeigt + + +## +## Logical functions Logische Funktionen +## +AND = UND ## Gibt WAHR zurück, wenn alle zugehörigen Argumente WAHR sind +FALSE = FALSCH ## Gibt den Wahrheitswert FALSCH zurück +IF = WENN ## Gibt einen logischen Test zum Ausführen an +IFERROR = WENNFEHLER ## Gibt einen von Ihnen festgelegten Wert zurück, wenn die Auswertung der Formel zu einem Fehler führt; andernfalls wird das Ergebnis der Formel zurückgegeben +NOT = NICHT ## Kehrt den Wahrheitswert der zugehörigen Argumente um +OR = ODER ## Gibt WAHR zurück, wenn ein Argument WAHR ist +TRUE = WAHR ## Gibt den Wahrheitswert WAHR zurück + + +## +## Lookup and reference functions Nachschlage- und Verweisfunktionen +## +ADDRESS = ADRESSE ## Gibt einen Bezug auf eine einzelne Zelle in einem Tabellenblatt als Text zurück +AREAS = BEREICHE ## Gibt die Anzahl der innerhalb eines Bezugs aufgeführten Bereiche zurück +CHOOSE = WAHL ## Wählt einen Wert aus eine Liste mit Werten aus +COLUMN = SPALTE ## Gibt die Spaltennummer eines Bezugs zurück +COLUMNS = SPALTEN ## Gibt die Anzahl der Spalten in einem Bezug zurück +HLOOKUP = HVERWEIS ## Sucht in der obersten Zeile einer Matrix und gibt den Wert der angegebenen Zelle zurück +HYPERLINK = HYPERLINK ## Erstellt eine Verknüpfung, über die ein auf einem Netzwerkserver, in einem Intranet oder im Internet gespeichertes Dokument geöffnet wird +INDEX = INDEX ## Verwendet einen Index, um einen Wert aus einem Bezug oder einer Matrix auszuwählen +INDIRECT = INDIREKT ## Gibt einen Bezug zurück, der von einem Textwert angegeben wird +LOOKUP = LOOKUP ## Sucht Werte in einem Vektor oder einer Matrix +MATCH = VERGLEICH ## Sucht Werte in einem Bezug oder einer Matrix +OFFSET = BEREICH.VERSCHIEBEN ## Gibt einen Bezugoffset aus einem gegebenen Bezug zurück +ROW = ZEILE ## Gibt die Zeilennummer eines Bezugs zurück +ROWS = ZEILEN ## Gibt die Anzahl der Zeilen in einem Bezug zurück +RTD = RTD ## Ruft Echtzeitdaten von einem Programm ab, das die COM-Automatisierung (Automatisierung: Ein Verfahren, bei dem aus einer Anwendung oder einem Entwicklungstool heraus mit den Objekten einer anderen Anwendung gearbeitet wird. Die früher als OLE-Automatisierung bezeichnete Automatisierung ist ein Industriestandard und eine Funktion von COM (Component Object Model).) unterstützt +TRANSPOSE = MTRANS ## Gibt die transponierte Matrix einer Matrix zurück +VLOOKUP = SVERWEIS ## Sucht in der ersten Spalte einer Matrix und arbeitet sich durch die Zeile, um den Wert einer Zelle zurückzugeben + + +## +## Math and trigonometry functions Mathematische und trigonometrische Funktionen +## +ABS = ABS ## Gibt den Absolutwert einer Zahl zurück +ACOS = ARCCOS ## Gibt den Arkuskosinus einer Zahl zurück +ACOSH = ARCCOSHYP ## Gibt den umgekehrten hyperbolischen Kosinus einer Zahl zurück +ASIN = ARCSIN ## Gibt den Arkussinus einer Zahl zurück +ASINH = ARCSINHYP ## Gibt den umgekehrten hyperbolischen Sinus einer Zahl zurück +ATAN = ARCTAN ## Gibt den Arkustangens einer Zahl zurück +ATAN2 = ARCTAN2 ## Gibt den Arkustangens einer x- und einer y-Koordinate zurück +ATANH = ARCTANHYP ## Gibt den umgekehrten hyperbolischen Tangens einer Zahl zurück +CEILING = OBERGRENZE ## Rundet eine Zahl auf die nächste ganze Zahl oder das nächste Vielfache von Schritt +COMBIN = KOMBINATIONEN ## Gibt die Anzahl der Kombinationen für eine bestimmte Anzahl von Objekten zurück +COS = COS ## Gibt den Kosinus einer Zahl zurück +COSH = COSHYP ## Gibt den hyperbolischen Kosinus einer Zahl zurück +DEGREES = GRAD ## Wandelt Bogenmaß (Radiant) in Grad um +EVEN = GERADE ## Rundet eine Zahl auf die nächste gerade ganze Zahl auf +EXP = EXP ## Potenziert die Basis e mit der als Argument angegebenen Zahl +FACT = FAKULTÄT ## Gibt die Fakultät einer Zahl zurück +FACTDOUBLE = ZWEIFAKULTÄT ## Gibt die Fakultät zu Zahl mit Schrittlänge 2 zurück +FLOOR = UNTERGRENZE ## Rundet die Zahl auf Anzahl_Stellen ab +GCD = GGT ## Gibt den größten gemeinsamen Teiler zurück +INT = GANZZAHL ## Rundet eine Zahl auf die nächstkleinere ganze Zahl ab +LCM = KGV ## Gibt das kleinste gemeinsame Vielfache zurück +LN = LN ## Gibt den natürlichen Logarithmus einer Zahl zurück +LOG = LOG ## Gibt den Logarithmus einer Zahl zu der angegebenen Basis zurück +LOG10 = LOG10 ## Gibt den Logarithmus einer Zahl zur Basis 10 zurück +MDETERM = MDET ## Gibt die Determinante einer Matrix zurück +MINVERSE = MINV ## Gibt die inverse Matrix einer Matrix zurück +MMULT = MMULT ## Gibt das Produkt zweier Matrizen zurück +MOD = REST ## Gibt den Rest einer Division zurück +MROUND = VRUNDEN ## Gibt eine auf das gewünschte Vielfache gerundete Zahl zurück +MULTINOMIAL = POLYNOMIAL ## Gibt den Polynomialkoeffizienten einer Gruppe von Zahlen zurück +ODD = UNGERADE ## Rundet eine Zahl auf die nächste ungerade ganze Zahl auf +PI = PI ## Gibt den Wert Pi zurück +POWER = POTENZ ## Gibt als Ergebnis eine potenzierte Zahl zurück +PRODUCT = PRODUKT ## Multipliziert die zugehörigen Argumente +QUOTIENT = QUOTIENT ## Gibt den ganzzahligen Anteil einer Division zurück +RADIANS = BOGENMASS ## Wandelt Grad in Bogenmaß (Radiant) um +RAND = ZUFALLSZAHL ## Gibt eine Zufallszahl zwischen 0 und 1 zurück +RANDBETWEEN = ZUFALLSBEREICH ## Gibt eine Zufallszahl aus dem festgelegten Bereich zurück +ROMAN = RÖMISCH ## Wandelt eine arabische Zahl in eine römische Zahl als Text um +ROUND = RUNDEN ## Rundet eine Zahl auf eine bestimmte Anzahl von Dezimalstellen +ROUNDDOWN = ABRUNDEN ## Rundet die Zahl auf Anzahl_Stellen ab +ROUNDUP = AUFRUNDEN ## Rundet die Zahl auf Anzahl_Stellen auf +SERIESSUM = POTENZREIHE ## Gibt die Summe von Potenzen (zur Berechnung von Potenzreihen und dichotomen Wahrscheinlichkeiten) zurück +SIGN = VORZEICHEN ## Gibt das Vorzeichen einer Zahl zurück +SIN = SIN ## Gibt den Sinus einer Zahl zurück +SINH = SINHYP ## Gibt den hyperbolischen Sinus einer Zahl zurück +SQRT = WURZEL ## Gibt die Quadratwurzel einer Zahl zurück +SQRTPI = WURZELPI ## Gibt die Wurzel aus der mit Pi (pi) multiplizierten Zahl zurück +SUBTOTAL = TEILERGEBNIS ## Gibt ein Teilergebnis in einer Liste oder Datenbank zurück +SUM = SUMME ## Addiert die zugehörigen Argumente +SUMIF = SUMMEWENN ## Addiert Zahlen, die mit den Suchkriterien übereinstimmen +SUMIFS = SUMMEWENNS ## Die Zellen, die mehrere Kriterien erfüllen, werden in einem Bereich hinzugefügt +SUMPRODUCT = SUMMENPRODUKT ## Gibt die Summe der Produkte zusammengehöriger Matrixkomponenten zurück +SUMSQ = QUADRATESUMME ## Gibt die Summe der quadrierten Argumente zurück +SUMX2MY2 = SUMMEX2MY2 ## Gibt die Summe der Differenzen der Quadrate für zusammengehörige Komponenten zweier Matrizen zurück +SUMX2PY2 = SUMMEX2PY2 ## Gibt die Summe der Quadrate für zusammengehörige Komponenten zweier Matrizen zurück +SUMXMY2 = SUMMEXMY2 ## Gibt die Summe der quadrierten Differenzen für zusammengehörige Komponenten zweier Matrizen zurück +TAN = TAN ## Gibt den Tangens einer Zahl zurück +TANH = TANHYP ## Gibt den hyperbolischen Tangens einer Zahl zurück +TRUNC = KÜRZEN ## Schneidet die Kommastellen einer Zahl ab und gibt als Ergebnis eine ganze Zahl zurück + + +## +## Statistical functions Statistische Funktionen +## +AVEDEV = MITTELABW ## Gibt die durchschnittliche absolute Abweichung einer Reihe von Merkmalsausprägungen und ihrem Mittelwert zurück +AVERAGE = MITTELWERT ## Gibt den Mittelwert der zugehörigen Argumente zurück +AVERAGEA = MITTELWERTA ## Gibt den Mittelwert der zugehörigen Argumente, die Zahlen, Text und Wahrheitswerte enthalten, zurück +AVERAGEIF = MITTELWERTWENN ## Der Durchschnittswert (arithmetisches Mittel) für alle Zellen in einem Bereich, die einem angegebenen Kriterium entsprechen, wird zurückgegeben +AVERAGEIFS = MITTELWERTWENNS ## Gibt den Durchschnittswert (arithmetisches Mittel) aller Zellen zurück, die mehreren Kriterien entsprechen +BETADIST = BETAVERT ## Gibt die Werte der kumulierten Betaverteilungsfunktion zurück +BETAINV = BETAINV ## Gibt das Quantil der angegebenen Betaverteilung zurück +BINOMDIST = BINOMVERT ## Gibt Wahrscheinlichkeiten einer binomialverteilten Zufallsvariablen zurück +CHIDIST = CHIVERT ## Gibt Werte der Verteilungsfunktion (1-Alpha) einer Chi-Quadrat-verteilten Zufallsgröße zurück +CHIINV = CHIINV ## Gibt Quantile der Verteilungsfunktion (1-Alpha) der Chi-Quadrat-Verteilung zurück +CHITEST = CHITEST ## Gibt die Teststatistik eines Unabhängigkeitstests zurück +CONFIDENCE = KONFIDENZ ## Ermöglicht die Berechnung des 1-Alpha Konfidenzintervalls für den Erwartungswert einer Zufallsvariablen +CORREL = KORREL ## Gibt den Korrelationskoeffizienten zweier Reihen von Merkmalsausprägungen zurück +COUNT = ANZAHL ## Gibt die Anzahl der Zahlen in der Liste mit Argumenten an +COUNTA = ANZAHL2 ## Gibt die Anzahl der Werte in der Liste mit Argumenten an +COUNTBLANK = ANZAHLLEEREZELLEN ## Gibt die Anzahl der leeren Zellen in einem Bereich an +COUNTIF = ZÄHLENWENN ## Gibt die Anzahl der Zellen in einem Bereich an, deren Inhalte mit den Suchkriterien übereinstimmen +COUNTIFS = ZÄHLENWENNS ## Gibt die Anzahl der Zellen in einem Bereich an, deren Inhalte mit mehreren Suchkriterien übereinstimmen +COVAR = KOVAR ## Gibt die Kovarianz zurück, den Mittelwert der für alle Datenpunktpaare gebildeten Produkte der Abweichungen +CRITBINOM = KRITBINOM ## Gibt den kleinsten Wert zurück, für den die kumulierten Wahrscheinlichkeiten der Binomialverteilung kleiner oder gleich einer Grenzwahrscheinlichkeit sind +DEVSQ = SUMQUADABW ## Gibt die Summe der quadrierten Abweichungen der Datenpunkte von ihrem Stichprobenmittelwert zurück +EXPONDIST = EXPONVERT ## Gibt Wahrscheinlichkeiten einer exponential verteilten Zufallsvariablen zurück +FDIST = FVERT ## Gibt Werte der Verteilungsfunktion (1-Alpha) einer F-verteilten Zufallsvariablen zurück +FINV = FINV ## Gibt Quantile der F-Verteilung zurück +FISHER = FISHER ## Gibt die Fisher-Transformation zurück +FISHERINV = FISHERINV ## Gibt die Umkehrung der Fisher-Transformation zurück +FORECAST = PROGNOSE ## Gibt einen Wert zurück, der sich aus einem linearen Trend ergibt +FREQUENCY = HÄUFIGKEIT ## Gibt eine Häufigkeitsverteilung als vertikale Matrix zurück +FTEST = FTEST ## Gibt die Teststatistik eines F-Tests zurück +GAMMADIST = GAMMAVERT ## Gibt Wahrscheinlichkeiten einer gammaverteilten Zufallsvariablen zurück +GAMMAINV = GAMMAINV ## Gibt Quantile der Gammaverteilung zurück +GAMMALN = GAMMALN ## Gibt den natürlichen Logarithmus der Gammafunktion zurück, Γ(x) +GEOMEAN = GEOMITTEL ## Gibt das geometrische Mittel zurück +GROWTH = VARIATION ## Gibt Werte zurück, die sich aus einem exponentiellen Trend ergeben +HARMEAN = HARMITTEL ## Gibt das harmonische Mittel zurück +HYPGEOMDIST = HYPGEOMVERT ## Gibt Wahrscheinlichkeiten einer hypergeometrisch-verteilten Zufallsvariablen zurück +INTERCEPT = ACHSENABSCHNITT ## Gibt den Schnittpunkt der Regressionsgeraden zurück +KURT = KURT ## Gibt die Kurtosis (Exzess) einer Datengruppe zurück +LARGE = KGRÖSSTE ## Gibt den k-größten Wert einer Datengruppe zurück +LINEST = RGP ## Gibt die Parameter eines linearen Trends zurück +LOGEST = RKP ## Gibt die Parameter eines exponentiellen Trends zurück +LOGINV = LOGINV ## Gibt Quantile der Lognormalverteilung zurück +LOGNORMDIST = LOGNORMVERT ## Gibt Werte der Verteilungsfunktion einer lognormalverteilten Zufallsvariablen zurück +MAX = MAX ## Gibt den Maximalwert einer Liste mit Argumenten zurück +MAXA = MAXA ## Gibt den Maximalwert einer Liste mit Argumenten zurück, die Zahlen, Text und Wahrheitswerte enthalten +MEDIAN = MEDIAN ## Gibt den Median der angegebenen Zahlen zurück +MIN = MIN ## Gibt den Minimalwert einer Liste mit Argumenten zurück +MINA = MINA ## Gibt den kleinsten Wert einer Liste mit Argumenten zurück, die Zahlen, Text und Wahrheitswerte enthalten +MODE = MODALWERT ## Gibt den am häufigsten vorkommenden Wert in einer Datengruppe zurück +NEGBINOMDIST = NEGBINOMVERT ## Gibt Wahrscheinlichkeiten einer negativen, binominal verteilten Zufallsvariablen zurück +NORMDIST = NORMVERT ## Gibt Wahrscheinlichkeiten einer normal verteilten Zufallsvariablen zurück +NORMINV = NORMINV ## Gibt Quantile der Normalverteilung zurück +NORMSDIST = STANDNORMVERT ## Gibt Werte der Verteilungsfunktion einer standardnormalverteilten Zufallsvariablen zurück +NORMSINV = STANDNORMINV ## Gibt Quantile der Standardnormalverteilung zurück +PEARSON = PEARSON ## Gibt den Pearsonschen Korrelationskoeffizienten zurück +PERCENTILE = QUANTIL ## Gibt das Alpha-Quantil einer Gruppe von Daten zurück +PERCENTRANK = QUANTILSRANG ## Gibt den prozentualen Rang (Alpha) eines Werts in einer Datengruppe zurück +PERMUT = VARIATIONEN ## Gibt die Anzahl der Möglichkeiten zurück, um k Elemente aus einer Menge von n Elementen ohne Zurücklegen zu ziehen +POISSON = POISSON ## Gibt Wahrscheinlichkeiten einer poissonverteilten Zufallsvariablen zurück +PROB = WAHRSCHBEREICH ## Gibt die Wahrscheinlichkeit für ein von zwei Werten eingeschlossenes Intervall zurück +QUARTILE = QUARTILE ## Gibt die Quartile der Datengruppe zurück +RANK = RANG ## Gibt den Rang zurück, den eine Zahl innerhalb einer Liste von Zahlen einnimmt +RSQ = BESTIMMTHEITSMASS ## Gibt das Quadrat des Pearsonschen Korrelationskoeffizienten zurück +SKEW = SCHIEFE ## Gibt die Schiefe einer Verteilung zurück +SLOPE = STEIGUNG ## Gibt die Steigung der Regressionsgeraden zurück +SMALL = KKLEINSTE ## Gibt den k-kleinsten Wert einer Datengruppe zurück +STANDARDIZE = STANDARDISIERUNG ## Gibt den standardisierten Wert zurück +STDEV = STABW ## Schätzt die Standardabweichung ausgehend von einer Stichprobe +STDEVA = STABWA ## Schätzt die Standardabweichung ausgehend von einer Stichprobe, die Zahlen, Text und Wahrheitswerte enthält +STDEVP = STABWN ## Berechnet die Standardabweichung ausgehend von der Grundgesamtheit +STDEVPA = STABWNA ## Berechnet die Standardabweichung ausgehend von der Grundgesamtheit, die Zahlen, Text und Wahrheitswerte enthält +STEYX = STFEHLERYX ## Gibt den Standardfehler der geschätzten y-Werte für alle x-Werte der Regression zurück +TDIST = TVERT ## Gibt Werte der Verteilungsfunktion (1-Alpha) einer (Student) t-verteilten Zufallsvariablen zurück +TINV = TINV ## Gibt Quantile der t-Verteilung zurück +TREND = TREND ## Gibt Werte zurück, die sich aus einem linearen Trend ergeben +TRIMMEAN = GESTUTZTMITTEL ## Gibt den Mittelwert einer Datengruppe zurück, ohne die Randwerte zu berücksichtigen +TTEST = TTEST ## Gibt die Teststatistik eines Student'schen t-Tests zurück +VAR = VARIANZ ## Schätzt die Varianz ausgehend von einer Stichprobe +VARA = VARIANZA ## Schätzt die Varianz ausgehend von einer Stichprobe, die Zahlen, Text und Wahrheitswerte enthält +VARP = VARIANZEN ## Berechnet die Varianz ausgehend von der Grundgesamtheit +VARPA = VARIANZENA ## Berechnet die Varianz ausgehend von der Grundgesamtheit, die Zahlen, Text und Wahrheitswerte enthält +WEIBULL = WEIBULL ## Gibt Wahrscheinlichkeiten einer weibullverteilten Zufallsvariablen zurück +ZTEST = GTEST ## Gibt den einseitigen Wahrscheinlichkeitswert für einen Gausstest (Normalverteilung) zurück + + +## +## Text functions Textfunktionen +## +ASC = ASC ## Konvertiert DB-Text in einer Zeichenfolge (lateinische Buchstaben oder Katakana) in SB-Text +BAHTTEXT = BAHTTEXT ## Wandelt eine Zahl in Text im Währungsformat ß (Baht) um +CHAR = ZEICHEN ## Gibt das der Codezahl entsprechende Zeichen zurück +CLEAN = SÄUBERN ## Löscht alle nicht druckbaren Zeichen aus einem Text +CODE = CODE ## Gibt die Codezahl des ersten Zeichens in einem Text zurück +CONCATENATE = VERKETTEN ## Verknüpft mehrere Textelemente zu einem Textelement +DOLLAR = DM ## Wandelt eine Zahl in Text im Währungsformat € (Euro) um +EXACT = IDENTISCH ## Prüft, ob zwei Textwerte identisch sind +FIND = FINDEN ## Sucht nach einem Textwert, der in einem anderen Textwert enthalten ist (Groß-/Kleinschreibung wird unterschieden) +FINDB = FINDENB ## Sucht nach einem Textwert, der in einem anderen Textwert enthalten ist (Groß-/Kleinschreibung wird unterschieden) +FIXED = FEST ## Formatiert eine Zahl als Text mit einer festen Anzahl von Dezimalstellen +JIS = JIS ## Konvertiert SB-Text in einer Zeichenfolge (lateinische Buchstaben oder Katakana) in DB-Text +LEFT = LINKS ## Gibt die Zeichen ganz links in einem Textwert zurück +LEFTB = LINKSB ## Gibt die Zeichen ganz links in einem Textwert zurück +LEN = LÄNGE ## Gibt die Anzahl der Zeichen in einer Zeichenfolge zurück +LENB = LÄNGEB ## Gibt die Anzahl der Zeichen in einer Zeichenfolge zurück +LOWER = KLEIN ## Wandelt Text in Kleinbuchstaben um +MID = TEIL ## Gibt eine bestimmte Anzahl Zeichen aus einer Zeichenfolge ab der von Ihnen angegebenen Stelle zurück +MIDB = TEILB ## Gibt eine bestimmte Anzahl Zeichen aus einer Zeichenfolge ab der von Ihnen angegebenen Stelle zurück +PHONETIC = PHONETIC ## Extrahiert die phonetischen (Furigana-)Zeichen aus einer Textzeichenfolge +PROPER = GROSS2 ## Wandelt den ersten Buchstaben aller Wörter eines Textwerts in Großbuchstaben um +REPLACE = ERSETZEN ## Ersetzt Zeichen in Text +REPLACEB = ERSETZENB ## Ersetzt Zeichen in Text +REPT = WIEDERHOLEN ## Wiederholt einen Text so oft wie angegeben +RIGHT = RECHTS ## Gibt die Zeichen ganz rechts in einem Textwert zurück +RIGHTB = RECHTSB ## Gibt die Zeichen ganz rechts in einem Textwert zurück +SEARCH = SUCHEN ## Sucht nach einem Textwert, der in einem anderen Textwert enthalten ist (Groß-/Kleinschreibung wird nicht unterschieden) +SEARCHB = SUCHENB ## Sucht nach einem Textwert, der in einem anderen Textwert enthalten ist (Groß-/Kleinschreibung wird nicht unterschieden) +SUBSTITUTE = WECHSELN ## Ersetzt in einer Zeichenfolge neuen Text gegen alten +T = T ## Wandelt die zugehörigen Argumente in Text um +TEXT = TEXT ## Formatiert eine Zahl und wandelt sie in Text um +TRIM = GLÄTTEN ## Entfernt Leerzeichen aus Text +UPPER = GROSS ## Wandelt Text in Großbuchstaben um +VALUE = WERT ## Wandelt ein Textargument in eine Zahl um diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/en/uk/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/en/uk/config new file mode 100644 index 0000000..859e4be --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/en/uk/config @@ -0,0 +1,8 @@ +## +## PhpSpreadsheet +## + +## +## (For future use) +## +currencySymbol = £ diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/es/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/es/config new file mode 100644 index 0000000..5b9b948 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/es/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = $ ## I'm surprised that the Excel Documentation suggests $ rather than € + + +## +## Excel Error Codes (For future use) + +## +NULL = #¡NULO! +DIV0 = #¡DIV/0! +VALUE = #¡VALOR! +REF = #¡REF! +NAME = #¿NOMBRE? +NUM = #¡NÚM! +NA = #N/A diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/es/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/es/functions new file mode 100644 index 0000000..ac1ac86 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/es/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Funciones de complementos y automatización +## +GETPIVOTDATA = IMPORTARDATOSDINAMICOS ## Devuelve los datos almacenados en un informe de tabla dinámica. + + +## +## Cube functions Funciones de cubo +## +CUBEKPIMEMBER = MIEMBROKPICUBO ## Devuelve un nombre, propiedad y medida de indicador de rendimiento clave (KPI) y muestra el nombre y la propiedad en la celda. Un KPI es una medida cuantificable, como los beneficios brutos mensuales o la facturación trimestral por empleado, que se usa para supervisar el rendimiento de una organización. +CUBEMEMBER = MIEMBROCUBO ## Devuelve un miembro o tupla en una jerarquía de cubo. Se usa para validar la existencia del miembro o la tupla en el cubo. +CUBEMEMBERPROPERTY = PROPIEDADMIEMBROCUBO ## Devuelve el valor de una propiedad de miembro del cubo Se usa para validar la existencia de un nombre de miembro en el cubo y para devolver la propiedad especificada para este miembro. +CUBERANKEDMEMBER = MIEMBRORANGOCUBO ## Devuelve el miembro n, o clasificado, de un conjunto. Se usa para devolver uno o más elementos de un conjunto, por ejemplo, el representante con mejores ventas o los diez mejores alumnos. +CUBESET = CONJUNTOCUBO ## Define un conjunto calculado de miembros o tuplas mediante el envío de una expresión de conjunto al cubo en el servidor, lo que crea el conjunto y, después, devuelve dicho conjunto a Microsoft Office Excel. +CUBESETCOUNT = RECUENTOCONJUNTOCUBO ## Devuelve el número de elementos de un conjunto. +CUBEVALUE = VALORCUBO ## Devuelve un valor agregado de un cubo. + + +## +## Database functions Funciones de base de datos +## +DAVERAGE = BDPROMEDIO ## Devuelve el promedio de las entradas seleccionadas en la base de datos. +DCOUNT = BDCONTAR ## Cuenta el número de celdas que contienen números en una base de datos. +DCOUNTA = BDCONTARA ## Cuenta el número de celdas no vacías en una base de datos. +DGET = BDEXTRAER ## Extrae de una base de datos un único registro que cumple los criterios especificados. +DMAX = BDMAX ## Devuelve el valor máximo de las entradas seleccionadas de la base de datos. +DMIN = BDMIN ## Devuelve el valor mínimo de las entradas seleccionadas de la base de datos. +DPRODUCT = BDPRODUCTO ## Multiplica los valores de un campo concreto de registros de una base de datos que cumplen los criterios especificados. +DSTDEV = BDDESVEST ## Calcula la desviación estándar a partir de una muestra de entradas seleccionadas en la base de datos. +DSTDEVP = BDDESVESTP ## Calcula la desviación estándar en función de la población total de las entradas seleccionadas de la base de datos. +DSUM = BDSUMA ## Suma los números de la columna de campo de los registros de la base de datos que cumplen los criterios. +DVAR = BDVAR ## Calcula la varianza a partir de una muestra de entradas seleccionadas de la base de datos. +DVARP = BDVARP ## Calcula la varianza a partir de la población total de entradas seleccionadas de la base de datos. + + +## +## Date and time functions Funciones de fecha y hora +## +DATE = FECHA ## Devuelve el número de serie correspondiente a una fecha determinada. +DATEVALUE = FECHANUMERO ## Convierte una fecha con formato de texto en un valor de número de serie. +DAY = DIA ## Convierte un número de serie en un valor de día del mes. +DAYS360 = DIAS360 ## Calcula el número de días entre dos fechas a partir de un año de 360 días. +EDATE = FECHA.MES ## Devuelve el número de serie de la fecha equivalente al número indicado de meses anteriores o posteriores a la fecha inicial. +EOMONTH = FIN.MES ## Devuelve el número de serie correspondiente al último día del mes anterior o posterior a un número de meses especificado. +HOUR = HORA ## Convierte un número de serie en un valor de hora. +MINUTE = MINUTO ## Convierte un número de serie en un valor de minuto. +MONTH = MES ## Convierte un número de serie en un valor de mes. +NETWORKDAYS = DIAS.LAB ## Devuelve el número de todos los días laborables existentes entre dos fechas. +NOW = AHORA ## Devuelve el número de serie correspondiente a la fecha y hora actuales. +SECOND = SEGUNDO ## Convierte un número de serie en un valor de segundo. +TIME = HORA ## Devuelve el número de serie correspondiente a una hora determinada. +TIMEVALUE = HORANUMERO ## Convierte una hora con formato de texto en un valor de número de serie. +TODAY = HOY ## Devuelve el número de serie correspondiente al día actual. +WEEKDAY = DIASEM ## Convierte un número de serie en un valor de día de la semana. +WEEKNUM = NUM.DE.SEMANA ## Convierte un número de serie en un número que representa el lugar numérico correspondiente a una semana de un año. +WORKDAY = DIA.LAB ## Devuelve el número de serie de la fecha que tiene lugar antes o después de un número determinado de días laborables. +YEAR = AÑO ## Convierte un número de serie en un valor de año. +YEARFRAC = FRAC.AÑO ## Devuelve la fracción de año que representa el número total de días existentes entre el valor de fecha_inicial y el de fecha_final. + + +## +## Engineering functions Funciones de ingeniería +## +BESSELI = BESSELI ## Devuelve la función Bessel In(x) modificada. +BESSELJ = BESSELJ ## Devuelve la función Bessel Jn(x). +BESSELK = BESSELK ## Devuelve la función Bessel Kn(x) modificada. +BESSELY = BESSELY ## Devuelve la función Bessel Yn(x). +BIN2DEC = BIN.A.DEC ## Convierte un número binario en decimal. +BIN2HEX = BIN.A.HEX ## Convierte un número binario en hexadecimal. +BIN2OCT = BIN.A.OCT ## Convierte un número binario en octal. +COMPLEX = COMPLEJO ## Convierte coeficientes reales e imaginarios en un número complejo. +CONVERT = CONVERTIR ## Convierte un número de un sistema de medida a otro. +DEC2BIN = DEC.A.BIN ## Convierte un número decimal en binario. +DEC2HEX = DEC.A.HEX ## Convierte un número decimal en hexadecimal. +DEC2OCT = DEC.A.OCT ## Convierte un número decimal en octal. +DELTA = DELTA ## Comprueba si dos valores son iguales. +ERF = FUN.ERROR ## Devuelve la función de error. +ERFC = FUN.ERROR.COMPL ## Devuelve la función de error complementario. +GESTEP = MAYOR.O.IGUAL ## Comprueba si un número es mayor que un valor de umbral. +HEX2BIN = HEX.A.BIN ## Convierte un número hexadecimal en binario. +HEX2DEC = HEX.A.DEC ## Convierte un número hexadecimal en decimal. +HEX2OCT = HEX.A.OCT ## Convierte un número hexadecimal en octal. +IMABS = IM.ABS ## Devuelve el valor absoluto (módulo) de un número complejo. +IMAGINARY = IMAGINARIO ## Devuelve el coeficiente imaginario de un número complejo. +IMARGUMENT = IM.ANGULO ## Devuelve el argumento theta, un ángulo expresado en radianes. +IMCONJUGATE = IM.CONJUGADA ## Devuelve la conjugada compleja de un número complejo. +IMCOS = IM.COS ## Devuelve el coseno de un número complejo. +IMDIV = IM.DIV ## Devuelve el cociente de dos números complejos. +IMEXP = IM.EXP ## Devuelve el valor exponencial de un número complejo. +IMLN = IM.LN ## Devuelve el logaritmo natural (neperiano) de un número complejo. +IMLOG10 = IM.LOG10 ## Devuelve el logaritmo en base 10 de un número complejo. +IMLOG2 = IM.LOG2 ## Devuelve el logaritmo en base 2 de un número complejo. +IMPOWER = IM.POT ## Devuelve un número complejo elevado a una potencia entera. +IMPRODUCT = IM.PRODUCT ## Devuelve el producto de números complejos. +IMREAL = IM.REAL ## Devuelve el coeficiente real de un número complejo. +IMSIN = IM.SENO ## Devuelve el seno de un número complejo. +IMSQRT = IM.RAIZ2 ## Devuelve la raíz cuadrada de un número complejo. +IMSUB = IM.SUSTR ## Devuelve la diferencia entre dos números complejos. +IMSUM = IM.SUM ## Devuelve la suma de números complejos. +OCT2BIN = OCT.A.BIN ## Convierte un número octal en binario. +OCT2DEC = OCT.A.DEC ## Convierte un número octal en decimal. +OCT2HEX = OCT.A.HEX ## Convierte un número octal en hexadecimal. + + +## +## Financial functions Funciones financieras +## +ACCRINT = INT.ACUM ## Devuelve el interés acumulado de un valor bursátil con pagos de interés periódicos. +ACCRINTM = INT.ACUM.V ## Devuelve el interés acumulado de un valor bursátil con pagos de interés al vencimiento. +AMORDEGRC = AMORTIZ.PROGRE ## Devuelve la amortización de cada período contable mediante el uso de un coeficiente de amortización. +AMORLINC = AMORTIZ.LIN ## Devuelve la amortización de cada uno de los períodos contables. +COUPDAYBS = CUPON.DIAS.L1 ## Devuelve el número de días desde el principio del período de un cupón hasta la fecha de liquidación. +COUPDAYS = CUPON.DIAS ## Devuelve el número de días del período (entre dos cupones) donde se encuentra la fecha de liquidación. +COUPDAYSNC = CUPON.DIAS.L2 ## Devuelve el número de días desde la fecha de liquidación hasta la fecha del próximo cupón. +COUPNCD = CUPON.FECHA.L2 ## Devuelve la fecha del próximo cupón después de la fecha de liquidación. +COUPNUM = CUPON.NUM ## Devuelve el número de pagos de cupón entre la fecha de liquidación y la fecha de vencimiento. +COUPPCD = CUPON.FECHA.L1 ## Devuelve la fecha de cupón anterior a la fecha de liquidación. +CUMIPMT = PAGO.INT.ENTRE ## Devuelve el interés acumulado pagado entre dos períodos. +CUMPRINC = PAGO.PRINC.ENTRE ## Devuelve el capital acumulado pagado de un préstamo entre dos períodos. +DB = DB ## Devuelve la amortización de un bien durante un período específico a través del método de amortización de saldo fijo. +DDB = DDB ## Devuelve la amortización de un bien durante un período específico a través del método de amortización por doble disminución de saldo u otro método que se especifique. +DISC = TASA.DESC ## Devuelve la tasa de descuento de un valor bursátil. +DOLLARDE = MONEDA.DEC ## Convierte una cotización de un valor bursátil expresada en forma fraccionaria en una cotización de un valor bursátil expresada en forma decimal. +DOLLARFR = MONEDA.FRAC ## Convierte una cotización de un valor bursátil expresada en forma decimal en una cotización de un valor bursátil expresada en forma fraccionaria. +DURATION = DURACION ## Devuelve la duración anual de un valor bursátil con pagos de interés periódico. +EFFECT = INT.EFECTIVO ## Devuelve la tasa de interés anual efectiva. +FV = VF ## Devuelve el valor futuro de una inversión. +FVSCHEDULE = VF.PLAN ## Devuelve el valor futuro de un capital inicial después de aplicar una serie de tasas de interés compuesto. +INTRATE = TASA.INT ## Devuelve la tasa de interés para la inversión total de un valor bursátil. +IPMT = PAGOINT ## Devuelve el pago de intereses de una inversión durante un período determinado. +IRR = TIR ## Devuelve la tasa interna de retorno para una serie de flujos de efectivo periódicos. +ISPMT = INT.PAGO.DIR ## Calcula el interés pagado durante un período específico de una inversión. +MDURATION = DURACION.MODIF ## Devuelve la duración de Macauley modificada de un valor bursátil con un valor nominal supuesto de 100 $. +MIRR = TIRM ## Devuelve la tasa interna de retorno donde se financian flujos de efectivo positivos y negativos a tasas diferentes. +NOMINAL = TASA.NOMINAL ## Devuelve la tasa nominal de interés anual. +NPER = NPER ## Devuelve el número de períodos de una inversión. +NPV = VNA ## Devuelve el valor neto actual de una inversión en función de una serie de flujos periódicos de efectivo y una tasa de descuento. +ODDFPRICE = PRECIO.PER.IRREGULAR.1 ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil con un primer período impar. +ODDFYIELD = RENDTO.PER.IRREGULAR.1 ## Devuelve el rendimiento de un valor bursátil con un primer período impar. +ODDLPRICE = PRECIO.PER.IRREGULAR.2 ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil con un último período impar. +ODDLYIELD = RENDTO.PER.IRREGULAR.2 ## Devuelve el rendimiento de un valor bursátil con un último período impar. +PMT = PAGO ## Devuelve el pago periódico de una anualidad. +PPMT = PAGOPRIN ## Devuelve el pago de capital de una inversión durante un período determinado. +PRICE = PRECIO ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil que paga una tasa de interés periódico. +PRICEDISC = PRECIO.DESCUENTO ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil con descuento. +PRICEMAT = PRECIO.VENCIMIENTO ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil que paga interés a su vencimiento. +PV = VALACT ## Devuelve el valor actual de una inversión. +RATE = TASA ## Devuelve la tasa de interés por período de una anualidad. +RECEIVED = CANTIDAD.RECIBIDA ## Devuelve la cantidad recibida al vencimiento de un valor bursátil completamente invertido. +SLN = SLN ## Devuelve la amortización por método directo de un bien en un período dado. +SYD = SYD ## Devuelve la amortización por suma de dígitos de los años de un bien durante un período especificado. +TBILLEQ = LETRA.DE.TES.EQV.A.BONO ## Devuelve el rendimiento de un bono equivalente a una letra del Tesoro (de EE.UU.) +TBILLPRICE = LETRA.DE.TES.PRECIO ## Devuelve el precio por un valor nominal de 100 $ de una letra del Tesoro (de EE.UU.) +TBILLYIELD = LETRA.DE.TES.RENDTO ## Devuelve el rendimiento de una letra del Tesoro (de EE.UU.) +VDB = DVS ## Devuelve la amortización de un bien durante un período específico o parcial a través del método de cálculo del saldo en disminución. +XIRR = TIR.NO.PER ## Devuelve la tasa interna de retorno para un flujo de efectivo que no es necesariamente periódico. +XNPV = VNA.NO.PER ## Devuelve el valor neto actual para un flujo de efectivo que no es necesariamente periódico. +YIELD = RENDTO ## Devuelve el rendimiento de un valor bursátil que paga intereses periódicos. +YIELDDISC = RENDTO.DESC ## Devuelve el rendimiento anual de un valor bursátil con descuento; por ejemplo, una letra del Tesoro (de EE.UU.) +YIELDMAT = RENDTO.VENCTO ## Devuelve el rendimiento anual de un valor bursátil que paga intereses al vencimiento. + + +## +## Information functions Funciones de información +## +CELL = CELDA ## Devuelve información acerca del formato, la ubicación o el contenido de una celda. +ERROR.TYPE = TIPO.DE.ERROR ## Devuelve un número que corresponde a un tipo de error. +INFO = INFO ## Devuelve información acerca del entorno operativo en uso. +ISBLANK = ESBLANCO ## Devuelve VERDADERO si el valor está en blanco. +ISERR = ESERR ## Devuelve VERDADERO si el valor es cualquier valor de error excepto #N/A. +ISERROR = ESERROR ## Devuelve VERDADERO si el valor es cualquier valor de error. +ISEVEN = ES.PAR ## Devuelve VERDADERO si el número es par. +ISLOGICAL = ESLOGICO ## Devuelve VERDADERO si el valor es un valor lógico. +ISNA = ESNOD ## Devuelve VERDADERO si el valor es el valor de error #N/A. +ISNONTEXT = ESNOTEXTO ## Devuelve VERDADERO si el valor no es texto. +ISNUMBER = ESNUMERO ## Devuelve VERDADERO si el valor es un número. +ISODD = ES.IMPAR ## Devuelve VERDADERO si el número es impar. +ISREF = ESREF ## Devuelve VERDADERO si el valor es una referencia. +ISTEXT = ESTEXTO ## Devuelve VERDADERO si el valor es texto. +N = N ## Devuelve un valor convertido en un número. +NA = ND ## Devuelve el valor de error #N/A. +TYPE = TIPO ## Devuelve un número que indica el tipo de datos de un valor. + + +## +## Logical functions Funciones lógicas +## +AND = Y ## Devuelve VERDADERO si todos sus argumentos son VERDADERO. +FALSE = FALSO ## Devuelve el valor lógico FALSO. +IF = SI ## Especifica una prueba lógica que realizar. +IFERROR = SI.ERROR ## Devuelve un valor que se especifica si una fórmula lo evalúa como un error; de lo contrario, devuelve el resultado de la fórmula. +NOT = NO ## Invierte el valor lógico del argumento. +OR = O ## Devuelve VERDADERO si cualquier argumento es VERDADERO. +TRUE = VERDADERO ## Devuelve el valor lógico VERDADERO. + + +## +## Lookup and reference functions Funciones de búsqueda y referencia +## +ADDRESS = DIRECCION ## Devuelve una referencia como texto a una sola celda de una hoja de cálculo. +AREAS = AREAS ## Devuelve el número de áreas de una referencia. +CHOOSE = ELEGIR ## Elige un valor de una lista de valores. +COLUMN = COLUMNA ## Devuelve el número de columna de una referencia. +COLUMNS = COLUMNAS ## Devuelve el número de columnas de una referencia. +HLOOKUP = BUSCARH ## Busca en la fila superior de una matriz y devuelve el valor de la celda indicada. +HYPERLINK = HIPERVINCULO ## Crea un acceso directo o un salto que abre un documento almacenado en un servidor de red, en una intranet o en Internet. +INDEX = INDICE ## Usa un índice para elegir un valor de una referencia o matriz. +INDIRECT = INDIRECTO ## Devuelve una referencia indicada por un valor de texto. +LOOKUP = BUSCAR ## Busca valores de un vector o una matriz. +MATCH = COINCIDIR ## Busca valores de una referencia o matriz. +OFFSET = DESREF ## Devuelve un desplazamiento de referencia respecto a una referencia dada. +ROW = FILA ## Devuelve el número de fila de una referencia. +ROWS = FILAS ## Devuelve el número de filas de una referencia. +RTD = RDTR ## Recupera datos en tiempo real desde un programa compatible con la automatización COM (automatización: modo de trabajar con los objetos de una aplicación desde otra aplicación o herramienta de entorno. La automatización, antes denominada automatización OLE, es un estándar de la industria y una función del Modelo de objetos componentes (COM).). +TRANSPOSE = TRANSPONER ## Devuelve la transposición de una matriz. +VLOOKUP = BUSCARV ## Busca en la primera columna de una matriz y se mueve en horizontal por la fila para devolver el valor de una celda. + + +## +## Math and trigonometry functions Funciones matemáticas y trigonométricas +## +ABS = ABS ## Devuelve el valor absoluto de un número. +ACOS = ACOS ## Devuelve el arcocoseno de un número. +ACOSH = ACOSH ## Devuelve el coseno hiperbólico inverso de un número. +ASIN = ASENO ## Devuelve el arcoseno de un número. +ASINH = ASENOH ## Devuelve el seno hiperbólico inverso de un número. +ATAN = ATAN ## Devuelve la arcotangente de un número. +ATAN2 = ATAN2 ## Devuelve la arcotangente de las coordenadas "x" e "y". +ATANH = ATANH ## Devuelve la tangente hiperbólica inversa de un número. +CEILING = MULTIPLO.SUPERIOR ## Redondea un número al entero más próximo o al múltiplo significativo más cercano. +COMBIN = COMBINAT ## Devuelve el número de combinaciones para un número determinado de objetos. +COS = COS ## Devuelve el coseno de un número. +COSH = COSH ## Devuelve el coseno hiperbólico de un número. +DEGREES = GRADOS ## Convierte radianes en grados. +EVEN = REDONDEA.PAR ## Redondea un número hasta el entero par más próximo. +EXP = EXP ## Devuelve e elevado a la potencia de un número dado. +FACT = FACT ## Devuelve el factorial de un número. +FACTDOUBLE = FACT.DOBLE ## Devuelve el factorial doble de un número. +FLOOR = MULTIPLO.INFERIOR ## Redondea un número hacia abajo, en dirección hacia cero. +GCD = M.C.D ## Devuelve el máximo común divisor. +INT = ENTERO ## Redondea un número hacia abajo hasta el entero más próximo. +LCM = M.C.M ## Devuelve el mínimo común múltiplo. +LN = LN ## Devuelve el logaritmo natural (neperiano) de un número. +LOG = LOG ## Devuelve el logaritmo de un número en una base especificada. +LOG10 = LOG10 ## Devuelve el logaritmo en base 10 de un número. +MDETERM = MDETERM ## Devuelve la determinante matricial de una matriz. +MINVERSE = MINVERSA ## Devuelve la matriz inversa de una matriz. +MMULT = MMULT ## Devuelve el producto de matriz de dos matrices. +MOD = RESIDUO ## Devuelve el resto de la división. +MROUND = REDOND.MULT ## Devuelve un número redondeado al múltiplo deseado. +MULTINOMIAL = MULTINOMIAL ## Devuelve el polinomio de un conjunto de números. +ODD = REDONDEA.IMPAR ## Redondea un número hacia arriba hasta el entero impar más próximo. +PI = PI ## Devuelve el valor de pi. +POWER = POTENCIA ## Devuelve el resultado de elevar un número a una potencia. +PRODUCT = PRODUCTO ## Multiplica sus argumentos. +QUOTIENT = COCIENTE ## Devuelve la parte entera de una división. +RADIANS = RADIANES ## Convierte grados en radianes. +RAND = ALEATORIO ## Devuelve un número aleatorio entre 0 y 1. +RANDBETWEEN = ALEATORIO.ENTRE ## Devuelve un número aleatorio entre los números que especifique. +ROMAN = NUMERO.ROMANO ## Convierte un número arábigo en número romano, con formato de texto. +ROUND = REDONDEAR ## Redondea un número al número de decimales especificado. +ROUNDDOWN = REDONDEAR.MENOS ## Redondea un número hacia abajo, en dirección hacia cero. +ROUNDUP = REDONDEAR.MAS ## Redondea un número hacia arriba, en dirección contraria a cero. +SERIESSUM = SUMA.SERIES ## Devuelve la suma de una serie de potencias en función de la fórmula. +SIGN = SIGNO ## Devuelve el signo de un número. +SIN = SENO ## Devuelve el seno de un ángulo determinado. +SINH = SENOH ## Devuelve el seno hiperbólico de un número. +SQRT = RAIZ ## Devuelve la raíz cuadrada positiva de un número. +SQRTPI = RAIZ2PI ## Devuelve la raíz cuadrada de un número multiplicado por PI (número * pi). +SUBTOTAL = SUBTOTALES ## Devuelve un subtotal en una lista o base de datos. +SUM = SUMA ## Suma sus argumentos. +SUMIF = SUMAR.SI ## Suma las celdas especificadas que cumplen unos criterios determinados. +SUMIFS = SUMAR.SI.CONJUNTO ## Suma las celdas de un rango que cumplen varios criterios. +SUMPRODUCT = SUMAPRODUCTO ## Devuelve la suma de los productos de los correspondientes componentes de matriz. +SUMSQ = SUMA.CUADRADOS ## Devuelve la suma de los cuadrados de los argumentos. +SUMX2MY2 = SUMAX2MENOSY2 ## Devuelve la suma de la diferencia de los cuadrados de los valores correspondientes de dos matrices. +SUMX2PY2 = SUMAX2MASY2 ## Devuelve la suma de la suma de los cuadrados de los valores correspondientes de dos matrices. +SUMXMY2 = SUMAXMENOSY2 ## Devuelve la suma de los cuadrados de las diferencias de los valores correspondientes de dos matrices. +TAN = TAN ## Devuelve la tangente de un número. +TANH = TANH ## Devuelve la tangente hiperbólica de un número. +TRUNC = TRUNCAR ## Trunca un número a un entero. + + +## +## Statistical functions Funciones estadísticas +## +AVEDEV = DESVPROM ## Devuelve el promedio de las desviaciones absolutas de la media de los puntos de datos. +AVERAGE = PROMEDIO ## Devuelve el promedio de sus argumentos. +AVERAGEA = PROMEDIOA ## Devuelve el promedio de sus argumentos, incluidos números, texto y valores lógicos. +AVERAGEIF = PROMEDIO.SI ## Devuelve el promedio (media aritmética) de todas las celdas de un rango que cumplen unos criterios determinados. +AVERAGEIFS = PROMEDIO.SI.CONJUNTO ## Devuelve el promedio (media aritmética) de todas las celdas que cumplen múltiples criterios. +BETADIST = DISTR.BETA ## Devuelve la función de distribución beta acumulativa. +BETAINV = DISTR.BETA.INV ## Devuelve la función inversa de la función de distribución acumulativa de una distribución beta especificada. +BINOMDIST = DISTR.BINOM ## Devuelve la probabilidad de una variable aleatoria discreta siguiendo una distribución binomial. +CHIDIST = DISTR.CHI ## Devuelve la probabilidad de una variable aleatoria continua siguiendo una distribución chi cuadrado de una sola cola. +CHIINV = PRUEBA.CHI.INV ## Devuelve la función inversa de la probabilidad de una variable aleatoria continua siguiendo una distribución chi cuadrado de una sola cola. +CHITEST = PRUEBA.CHI ## Devuelve la prueba de independencia. +CONFIDENCE = INTERVALO.CONFIANZA ## Devuelve el intervalo de confianza de la media de una población. +CORREL = COEF.DE.CORREL ## Devuelve el coeficiente de correlación entre dos conjuntos de datos. +COUNT = CONTAR ## Cuenta cuántos números hay en la lista de argumentos. +COUNTA = CONTARA ## Cuenta cuántos valores hay en la lista de argumentos. +COUNTBLANK = CONTAR.BLANCO ## Cuenta el número de celdas en blanco de un rango. +COUNTIF = CONTAR.SI ## Cuenta el número de celdas, dentro del rango, que cumplen el criterio especificado. +COUNTIFS = CONTAR.SI.CONJUNTO ## Cuenta el número de celdas, dentro del rango, que cumplen varios criterios. +COVAR = COVAR ## Devuelve la covarianza, que es el promedio de los productos de las desviaciones para cada pareja de puntos de datos. +CRITBINOM = BINOM.CRIT ## Devuelve el menor valor cuya distribución binomial acumulativa es menor o igual a un valor de criterio. +DEVSQ = DESVIA2 ## Devuelve la suma de los cuadrados de las desviaciones. +EXPONDIST = DISTR.EXP ## Devuelve la distribución exponencial. +FDIST = DISTR.F ## Devuelve la distribución de probabilidad F. +FINV = DISTR.F.INV ## Devuelve la función inversa de la distribución de probabilidad F. +FISHER = FISHER ## Devuelve la transformación Fisher. +FISHERINV = PRUEBA.FISHER.INV ## Devuelve la función inversa de la transformación Fisher. +FORECAST = PRONOSTICO ## Devuelve un valor en una tendencia lineal. +FREQUENCY = FRECUENCIA ## Devuelve una distribución de frecuencia como una matriz vertical. +FTEST = PRUEBA.F ## Devuelve el resultado de una prueba F. +GAMMADIST = DISTR.GAMMA ## Devuelve la distribución gamma. +GAMMAINV = DISTR.GAMMA.INV ## Devuelve la función inversa de la distribución gamma acumulativa. +GAMMALN = GAMMA.LN ## Devuelve el logaritmo natural de la función gamma, G(x). +GEOMEAN = MEDIA.GEOM ## Devuelve la media geométrica. +GROWTH = CRECIMIENTO ## Devuelve valores en una tendencia exponencial. +HARMEAN = MEDIA.ARMO ## Devuelve la media armónica. +HYPGEOMDIST = DISTR.HIPERGEOM ## Devuelve la distribución hipergeométrica. +INTERCEPT = INTERSECCION.EJE ## Devuelve la intersección de la línea de regresión lineal. +KURT = CURTOSIS ## Devuelve la curtosis de un conjunto de datos. +LARGE = K.ESIMO.MAYOR ## Devuelve el k-ésimo mayor valor de un conjunto de datos. +LINEST = ESTIMACION.LINEAL ## Devuelve los parámetros de una tendencia lineal. +LOGEST = ESTIMACION.LOGARITMICA ## Devuelve los parámetros de una tendencia exponencial. +LOGINV = DISTR.LOG.INV ## Devuelve la función inversa de la distribución logarítmico-normal. +LOGNORMDIST = DISTR.LOG.NORM ## Devuelve la distribución logarítmico-normal acumulativa. +MAX = MAX ## Devuelve el valor máximo de una lista de argumentos. +MAXA = MAXA ## Devuelve el valor máximo de una lista de argumentos, incluidos números, texto y valores lógicos. +MEDIAN = MEDIANA ## Devuelve la mediana de los números dados. +MIN = MIN ## Devuelve el valor mínimo de una lista de argumentos. +MINA = MINA ## Devuelve el valor mínimo de una lista de argumentos, incluidos números, texto y valores lógicos. +MODE = MODA ## Devuelve el valor más común de un conjunto de datos. +NEGBINOMDIST = NEGBINOMDIST ## Devuelve la distribución binomial negativa. +NORMDIST = DISTR.NORM ## Devuelve la distribución normal acumulativa. +NORMINV = DISTR.NORM.INV ## Devuelve la función inversa de la distribución normal acumulativa. +NORMSDIST = DISTR.NORM.ESTAND ## Devuelve la distribución normal estándar acumulativa. +NORMSINV = DISTR.NORM.ESTAND.INV ## Devuelve la función inversa de la distribución normal estándar acumulativa. +PEARSON = PEARSON ## Devuelve el coeficiente de momento de correlación de producto Pearson. +PERCENTILE = PERCENTIL ## Devuelve el k-ésimo percentil de los valores de un rango. +PERCENTRANK = RANGO.PERCENTIL ## Devuelve el rango porcentual de un valor de un conjunto de datos. +PERMUT = PERMUTACIONES ## Devuelve el número de permutaciones de un número determinado de objetos. +POISSON = POISSON ## Devuelve la distribución de Poisson. +PROB = PROBABILIDAD ## Devuelve la probabilidad de que los valores de un rango se encuentren entre dos límites. +QUARTILE = CUARTIL ## Devuelve el cuartil de un conjunto de datos. +RANK = JERARQUIA ## Devuelve la jerarquía de un número en una lista de números. +RSQ = COEFICIENTE.R2 ## Devuelve el cuadrado del coeficiente de momento de correlación de producto Pearson. +SKEW = COEFICIENTE.ASIMETRIA ## Devuelve la asimetría de una distribución. +SLOPE = PENDIENTE ## Devuelve la pendiente de la línea de regresión lineal. +SMALL = K.ESIMO.MENOR ## Devuelve el k-ésimo menor valor de un conjunto de datos. +STANDARDIZE = NORMALIZACION ## Devuelve un valor normalizado. +STDEV = DESVEST ## Calcula la desviación estándar a partir de una muestra. +STDEVA = DESVESTA ## Calcula la desviación estándar a partir de una muestra, incluidos números, texto y valores lógicos. +STDEVP = DESVESTP ## Calcula la desviación estándar en función de toda la población. +STDEVPA = DESVESTPA ## Calcula la desviación estándar en función de toda la población, incluidos números, texto y valores lógicos. +STEYX = ERROR.TIPICO.XY ## Devuelve el error estándar del valor de "y" previsto para cada "x" de la regresión. +TDIST = DISTR.T ## Devuelve la distribución de t de Student. +TINV = DISTR.T.INV ## Devuelve la función inversa de la distribución de t de Student. +TREND = TENDENCIA ## Devuelve valores en una tendencia lineal. +TRIMMEAN = MEDIA.ACOTADA ## Devuelve la media del interior de un conjunto de datos. +TTEST = PRUEBA.T ## Devuelve la probabilidad asociada a una prueba t de Student. +VAR = VAR ## Calcula la varianza en función de una muestra. +VARA = VARA ## Calcula la varianza en función de una muestra, incluidos números, texto y valores lógicos. +VARP = VARP ## Calcula la varianza en función de toda la población. +VARPA = VARPA ## Calcula la varianza en función de toda la población, incluidos números, texto y valores lógicos. +WEIBULL = DIST.WEIBULL ## Devuelve la distribución de Weibull. +ZTEST = PRUEBA.Z ## Devuelve el valor de una probabilidad de una cola de una prueba z. + + +## +## Text functions Funciones de texto +## +ASC = ASC ## Convierte las letras inglesas o katakana de ancho completo (de dos bytes) dentro de una cadena de caracteres en caracteres de ancho medio (de un byte). +BAHTTEXT = TEXTOBAHT ## Convierte un número en texto, con el formato de moneda ß (Baht). +CHAR = CARACTER ## Devuelve el carácter especificado por el número de código. +CLEAN = LIMPIAR ## Quita del texto todos los caracteres no imprimibles. +CODE = CODIGO ## Devuelve un código numérico del primer carácter de una cadena de texto. +CONCATENATE = CONCATENAR ## Concatena varios elementos de texto en uno solo. +DOLLAR = MONEDA ## Convierte un número en texto, con el formato de moneda $ (dólar). +EXACT = IGUAL ## Comprueba si dos valores de texto son idénticos. +FIND = ENCONTRAR ## Busca un valor de texto dentro de otro (distingue mayúsculas de minúsculas). +FINDB = ENCONTRARB ## Busca un valor de texto dentro de otro (distingue mayúsculas de minúsculas). +FIXED = DECIMAL ## Da formato a un número como texto con un número fijo de decimales. +JIS = JIS ## Convierte las letras inglesas o katakana de ancho medio (de un byte) dentro de una cadena de caracteres en caracteres de ancho completo (de dos bytes). +LEFT = IZQUIERDA ## Devuelve los caracteres del lado izquierdo de un valor de texto. +LEFTB = IZQUIERDAB ## Devuelve los caracteres del lado izquierdo de un valor de texto. +LEN = LARGO ## Devuelve el número de caracteres de una cadena de texto. +LENB = LARGOB ## Devuelve el número de caracteres de una cadena de texto. +LOWER = MINUSC ## Pone el texto en minúsculas. +MID = EXTRAE ## Devuelve un número específico de caracteres de una cadena de texto que comienza en la posición que se especifique. +MIDB = EXTRAEB ## Devuelve un número específico de caracteres de una cadena de texto que comienza en la posición que se especifique. +PHONETIC = FONETICO ## Extrae los caracteres fonéticos (furigana) de una cadena de texto. +PROPER = NOMPROPIO ## Pone en mayúscula la primera letra de cada palabra de un valor de texto. +REPLACE = REEMPLAZAR ## Reemplaza caracteres de texto. +REPLACEB = REEMPLAZARB ## Reemplaza caracteres de texto. +REPT = REPETIR ## Repite el texto un número determinado de veces. +RIGHT = DERECHA ## Devuelve los caracteres del lado derecho de un valor de texto. +RIGHTB = DERECHAB ## Devuelve los caracteres del lado derecho de un valor de texto. +SEARCH = HALLAR ## Busca un valor de texto dentro de otro (no distingue mayúsculas de minúsculas). +SEARCHB = HALLARB ## Busca un valor de texto dentro de otro (no distingue mayúsculas de minúsculas). +SUBSTITUTE = SUSTITUIR ## Sustituye texto nuevo por texto antiguo en una cadena de texto. +T = T ## Convierte sus argumentos a texto. +TEXT = TEXTO ## Da formato a un número y lo convierte en texto. +TRIM = ESPACIOS ## Quita los espacios del texto. +UPPER = MAYUSC ## Pone el texto en mayúsculas. +VALUE = VALOR ## Convierte un argumento de texto en un número. diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fi/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fi/config new file mode 100644 index 0000000..22aaf58 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fi/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = $ # Symbol not known, should it be a € (Euro)? + + +## +## Excel Error Codes (For future use) + +## +NULL = #TYHJÄ! +DIV0 = #JAKO/0! +VALUE = #ARVO! +REF = #VIITTAUS! +NAME = #NIMI? +NUM = #LUKU! +NA = #PUUTTUU diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fi/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fi/functions new file mode 100644 index 0000000..289e0ea --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fi/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Apuohjelma- ja automaatiofunktiot +## +GETPIVOTDATA = NOUDA.PIVOT.TIEDOT ## Palauttaa pivot-taulukkoraporttiin tallennettuja tietoja. + + +## +## Cube functions Kuutiofunktiot +## +CUBEKPIMEMBER = KUUTIOKPIJÄSEN ## Palauttaa suorituskykyilmaisimen (KPI) nimen, ominaisuuden sekä mitan ja näyttää nimen sekä ominaisuuden solussa. KPI on mitattavissa oleva suure, kuten kuukauden bruttotuotto tai vuosineljänneksen työntekijäkohtainen liikevaihto, joiden avulla tarkkaillaan organisaation suorituskykyä. +CUBEMEMBER = KUUTIONJÄSEN ## Palauttaa kuutiohierarkian jäsenen tai monikon. Tällä funktiolla voit tarkistaa, että jäsen tai monikko on olemassa kuutiossa. +CUBEMEMBERPROPERTY = KUUTIONJÄSENENOMINAISUUS ## Palauttaa kuution jäsenominaisuuden arvon. Tällä funktiolla voit tarkistaa, että nimi on olemassa kuutiossa, ja palauttaa tämän jäsenen määritetyn ominaisuuden. +CUBERANKEDMEMBER = KUUTIONLUOKITELTUJÄSEN ## Palauttaa joukon n:nnen jäsenen. Tällä funktiolla voit palauttaa joukosta elementtejä, kuten parhaan myyjän tai 10 parasta opiskelijaa. +CUBESET = KUUTIOJOUKKO ## Määrittää lasketun jäsen- tai monikkojoukon lähettämällä joukon lausekkeita palvelimessa olevalle kuutiolle. Palvelin luo joukon ja palauttaa sen Microsoft Office Excelille. +CUBESETCOUNT = KUUTIOJOUKKOJENMÄÄRÄ ## Palauttaa joukon kohteiden määrän. +CUBEVALUE = KUUTIONARVO ## Palauttaa koostetun arvon kuutiosta. + + +## +## Database functions Tietokantafunktiot +## +DAVERAGE = TKESKIARVO ## Palauttaa valittujen tietokantamerkintöjen keskiarvon. +DCOUNT = TLASKE ## Laskee tietokannan lukuja sisältävien solujen määrän. +DCOUNTA = TLASKEA ## Laskee tietokannan tietoja sisältävien solujen määrän. +DGET = TNOUDA ## Hakee määritettyjä ehtoja vastaavan tietueen tietokannasta. +DMAX = TMAKS ## Palauttaa suurimman arvon tietokannasta valittujen arvojen joukosta. +DMIN = TMIN ## Palauttaa pienimmän arvon tietokannasta valittujen arvojen joukosta. +DPRODUCT = TTULO ## Kertoo määritetyn ehdon täyttävien tietokannan tietueiden tietyssä kentässä olevat arvot. +DSTDEV = TKESKIHAJONTA ## Laskee keskihajonnan tietokannasta valituista arvoista muodostuvan otoksen perusteella. +DSTDEVP = TKESKIHAJONTAP ## Laskee keskihajonnan tietokannasta valittujen arvojen koko populaation perusteella. +DSUM = TSUMMA ## Lisää luvut määritetyn ehdon täyttävien tietokannan tietueiden kenttäsarakkeeseen. +DVAR = TVARIANSSI ## Laskee varianssin tietokannasta valittujen arvojen otoksen perusteella. +DVARP = TVARIANSSIP ## Laskee varianssin tietokannasta valittujen arvojen koko populaation perusteella. + + +## +## Date and time functions Päivämäärä- ja aikafunktiot +## +DATE = PÄIVÄYS ## Palauttaa annetun päivämäärän järjestysluvun. +DATEVALUE = PÄIVÄYSARVO ## Muuntaa tekstimuodossa olevan päivämäärän järjestysluvuksi. +DAY = PÄIVÄ ## Muuntaa järjestysluvun kuukauden päiväksi. +DAYS360 = PÄIVÄT360 ## Laskee kahden päivämäärän välisten päivien määrän käyttäen perustana 360-päiväistä vuotta. +EDATE = PÄIVÄ.KUUKAUSI ## Palauttaa järjestyslukuna päivämäärän, joka poikkeaa aloituspäivän päivämäärästä annetun kuukausimäärän verran joko eteen- tai taaksepäin. +EOMONTH = KUUKAUSI.LOPPU ## Palauttaa järjestyslukuna sen kuukauden viimeisen päivämäärän, joka poikkeaa annetun kuukausimäärän verran eteen- tai taaksepäin. +HOUR = TUNNIT ## Muuntaa järjestysluvun tunneiksi. +MINUTE = MINUUTIT ## Muuntaa järjestysluvun minuuteiksi. +MONTH = KUUKAUSI ## Muuntaa järjestysluvun kuukausiksi. +NETWORKDAYS = TYÖPÄIVÄT ## Palauttaa kahden päivämäärän välissä olevien täysien työpäivien määrän. +NOW = NYT ## Palauttaa kuluvan päivämäärän ja ajan järjestysnumeron. +SECOND = SEKUNNIT ## Muuntaa järjestysluvun sekunneiksi. +TIME = AIKA ## Palauttaa annetun kellonajan järjestysluvun. +TIMEVALUE = AIKA_ARVO ## Muuntaa tekstimuodossa olevan kellonajan järjestysluvuksi. +TODAY = TÄMÄ.PÄIVÄ ## Palauttaa kuluvan päivän päivämäärän järjestysluvun. +WEEKDAY = VIIKONPÄIVÄ ## Muuntaa järjestysluvun viikonpäiväksi. +WEEKNUM = VIIKKO.NRO ## Muuntaa järjestysluvun luvuksi, joka ilmaisee viikon järjestysluvun vuoden alusta laskettuna. +WORKDAY = TYÖPÄIVÄ ## Palauttaa järjestysluvun päivämäärälle, joka sijaitsee annettujen työpäivien verran eteen tai taaksepäin. +YEAR = VUOSI ## Muuntaa järjestysluvun vuosiksi. +YEARFRAC = VUOSI.OSA ## Palauttaa määritettyjen päivämäärien (aloituspäivä ja lopetuspäivä) välisen osan vuodesta. + + +## +## Engineering functions Tekniset funktiot +## +BESSELI = BESSELI ## Palauttaa muunnetun Bessel-funktion In(x). +BESSELJ = BESSELJ ## Palauttaa Bessel-funktion Jn(x). +BESSELK = BESSELK ## Palauttaa muunnetun Bessel-funktion Kn(x). +BESSELY = BESSELY ## Palauttaa Bessel-funktion Yn(x). +BIN2DEC = BINDES ## Muuntaa binaariluvun desimaaliluvuksi. +BIN2HEX = BINHEKSA ## Muuntaa binaariluvun heksadesimaaliluvuksi. +BIN2OCT = BINOKT ## Muuntaa binaariluvun oktaaliluvuksi. +COMPLEX = KOMPLEKSI ## Muuntaa reaali- ja imaginaariosien kertoimet kompleksiluvuksi. +CONVERT = MUUNNA ## Muuntaa luvun toisen mittajärjestelmän mukaiseksi. +DEC2BIN = DESBIN ## Muuntaa desimaaliluvun binaariluvuksi. +DEC2HEX = DESHEKSA ## Muuntaa kymmenjärjestelmän luvun heksadesimaaliluvuksi. +DEC2OCT = DESOKT ## Muuntaa kymmenjärjestelmän luvun oktaaliluvuksi. +DELTA = SAMA.ARVO ## Tarkistaa, ovatko kaksi arvoa yhtä suuria. +ERF = VIRHEFUNKTIO ## Palauttaa virhefunktion. +ERFC = VIRHEFUNKTIO.KOMPLEMENTTI ## Palauttaa komplementtivirhefunktion. +GESTEP = RAJA ## Testaa, onko luku suurempi kuin kynnysarvo. +HEX2BIN = HEKSABIN ## Muuntaa heksadesimaaliluvun binaariluvuksi. +HEX2DEC = HEKSADES ## Muuntaa heksadesimaaliluvun desimaaliluvuksi. +HEX2OCT = HEKSAOKT ## Muuntaa heksadesimaaliluvun oktaaliluvuksi. +IMABS = KOMPLEKSI.ITSEISARVO ## Palauttaa kompleksiluvun itseisarvon (moduluksen). +IMAGINARY = KOMPLEKSI.IMAG ## Palauttaa kompleksiluvun imaginaariosan kertoimen. +IMARGUMENT = KOMPLEKSI.ARG ## Palauttaa theeta-argumentin, joka on radiaaneina annettu kulma. +IMCONJUGATE = KOMPLEKSI.KONJ ## Palauttaa kompleksiluvun konjugaattiluvun. +IMCOS = KOMPLEKSI.COS ## Palauttaa kompleksiluvun kosinin. +IMDIV = KOMPLEKSI.OSAM ## Palauttaa kahden kompleksiluvun osamäärän. +IMEXP = KOMPLEKSI.EKSP ## Palauttaa kompleksiluvun eksponentin. +IMLN = KOMPLEKSI.LN ## Palauttaa kompleksiluvun luonnollisen logaritmin. +IMLOG10 = KOMPLEKSI.LOG10 ## Palauttaa kompleksiluvun kymmenkantaisen logaritmin. +IMLOG2 = KOMPLEKSI.LOG2 ## Palauttaa kompleksiluvun kaksikantaisen logaritmin. +IMPOWER = KOMPLEKSI.POT ## Palauttaa kokonaislukupotenssiin korotetun kompleksiluvun. +IMPRODUCT = KOMPLEKSI.TULO ## Palauttaa kompleksilukujen tulon. +IMREAL = KOMPLEKSI.REAALI ## Palauttaa kompleksiluvun reaaliosan kertoimen. +IMSIN = KOMPLEKSI.SIN ## Palauttaa kompleksiluvun sinin. +IMSQRT = KOMPLEKSI.NELIÖJ ## Palauttaa kompleksiluvun neliöjuuren. +IMSUB = KOMPLEKSI.EROTUS ## Palauttaa kahden kompleksiluvun erotuksen. +IMSUM = KOMPLEKSI.SUM ## Palauttaa kompleksilukujen summan. +OCT2BIN = OKTBIN ## Muuntaa oktaaliluvun binaariluvuksi. +OCT2DEC = OKTDES ## Muuntaa oktaaliluvun desimaaliluvuksi. +OCT2HEX = OKTHEKSA ## Muuntaa oktaaliluvun heksadesimaaliluvuksi. + + +## +## Financial functions Rahoitusfunktiot +## +ACCRINT = KERTYNYT.KORKO ## Laskee arvopaperille kertyneen koron, kun korko kertyy säännöllisin väliajoin. +ACCRINTM = KERTYNYT.KORKO.LOPUSSA ## Laskee arvopaperille kertyneen koron, kun korko maksetaan eräpäivänä. +AMORDEGRC = AMORDEGRC ## Laskee kunkin laskentakauden poiston poistokerrointa käyttämällä. +AMORLINC = AMORLINC ## Palauttaa kunkin laskentakauden poiston. +COUPDAYBS = KORKOPÄIVÄT.ALUSTA ## Palauttaa koronmaksukauden aloituspäivän ja tilityspäivän välisen ajanjakson päivien määrän. +COUPDAYS = KORKOPÄIVÄT ## Palauttaa päivien määrän koronmaksukaudelta, johon tilityspäivä kuuluu. +COUPDAYSNC = KORKOPÄIVÄT.SEURAAVA ## Palauttaa tilityspäivän ja seuraavan koronmaksupäivän välisen ajanjakson päivien määrän. +COUPNCD = KORKOMAKSU.SEURAAVA ## Palauttaa tilityspäivän jälkeisen seuraavan koronmaksupäivän. +COUPNUM = KORKOPÄIVÄJAKSOT ## Palauttaa arvopaperin ostopäivän ja erääntymispäivän välisten koronmaksupäivien määrän. +COUPPCD = KORKOPÄIVÄ.EDELLINEN ## Palauttaa tilityspäivää edeltävän koronmaksupäivän. +CUMIPMT = MAKSETTU.KORKO ## Palauttaa kahden jakson välisenä aikana kertyneen koron. +CUMPRINC = MAKSETTU.LYHENNYS ## Palauttaa lainalle kahden jakson välisenä aikana kertyneen lyhennyksen. +DB = DB ## Palauttaa kauden kirjanpidollisen poiston amerikkalaisen DB-menetelmän (Fixed-declining balance) mukaan. +DDB = DDB ## Palauttaa kauden kirjanpidollisen poiston amerikkalaisen DDB-menetelmän (Double-Declining Balance) tai jonkin muun määrittämäsi menetelmän mukaan. +DISC = DISKONTTOKORKO ## Palauttaa arvopaperin diskonttokoron. +DOLLARDE = VALUUTTA.DES ## Muuntaa murtolukuna ilmoitetun valuuttamäärän desimaaliluvuksi. +DOLLARFR = VALUUTTA.MURTO ## Muuntaa desimaalilukuna ilmaistun valuuttamäärän murtoluvuksi. +DURATION = KESTO ## Palauttaa keston arvopaperille, jonka koronmaksu tapahtuu säännöllisesti. +EFFECT = KORKO.EFEKT ## Palauttaa todellisen vuosikoron. +FV = TULEVA.ARVO ## Palauttaa sijoituksen tulevan arvon. +FVSCHEDULE = TULEVA.ARVO.ERIKORKO ## Palauttaa pääoman tulevan arvon, kun pääomalle on kertynyt korkoa vaihtelevasti. +INTRATE = KORKO.ARVOPAPERI ## Palauttaa arvopaperin korkokannan täysin sijoitetulle arvopaperille. +IPMT = IPMT ## Laskee sijoitukselle tai lainalle tiettynä ajanjaksona kertyvän koron. +IRR = SISÄINEN.KORKO ## Laskee sisäisen korkokannan kassavirrasta muodostuvalle sarjalle. +ISPMT = ONMAKSU ## Laskee sijoituksen maksetun koron tietyllä jaksolla. +MDURATION = KESTO.MUUNN ## Palauttaa muunnetun Macauley-keston arvopaperille, jonka oletettu nimellisarvo on 100 euroa. +MIRR = MSISÄINEN ## Palauttaa sisäisen korkokannan, kun positiivisten ja negatiivisten kassavirtojen rahoituskorko on erilainen. +NOMINAL = KORKO.VUOSI ## Palauttaa vuosittaisen nimelliskoron. +NPER = NJAKSO ## Palauttaa sijoituksen jaksojen määrän. +NPV = NNA ## Palauttaa sijoituksen nykyarvon toistuvista kassavirroista muodostuvan sarjan ja diskonttokoron perusteella. +ODDFPRICE = PARITON.ENS.NIMELLISARVO ## Palauttaa arvopaperin hinnan tilanteessa, jossa ensimmäinen jakso on pariton. +ODDFYIELD = PARITON.ENS.TUOTTO ## Palauttaa arvopaperin tuoton tilanteessa, jossa ensimmäinen jakso on pariton. +ODDLPRICE = PARITON.VIIM.NIMELLISARVO ## Palauttaa arvopaperin hinnan tilanteessa, jossa viimeinen jakso on pariton. +ODDLYIELD = PARITON.VIIM.TUOTTO ## Palauttaa arvopaperin tuoton tilanteessa, jossa viimeinen jakso on pariton. +PMT = MAKSU ## Palauttaa annuiteetin kausittaisen maksuerän. +PPMT = PPMT ## Laskee sijoitukselle tai lainalle tiettynä ajanjaksona maksettavan lyhennyksen. +PRICE = HINTA ## Palauttaa hinnan 100 euron nimellisarvoa kohden arvopaperille, jonka korko maksetaan säännöllisin väliajoin. +PRICEDISC = HINTA.DISK ## Palauttaa diskontatun arvopaperin hinnan 100 euron nimellisarvoa kohden. +PRICEMAT = HINTA.LUNASTUS ## Palauttaa hinnan 100 euron nimellisarvoa kohden arvopaperille, jonka korko maksetaan erääntymispäivänä. +PV = NA ## Palauttaa sijoituksen nykyarvon. +RATE = KORKO ## Palauttaa annuiteetin kausittaisen korkokannan. +RECEIVED = SAATU.HINTA ## Palauttaa arvopaperin tuoton erääntymispäivänä kokonaan maksetulle sijoitukselle. +SLN = STP ## Palauttaa sijoituksen tasapoiston yhdeltä jaksolta. +SYD = VUOSIPOISTO ## Palauttaa sijoituksen vuosipoiston annettuna kautena amerikkalaisen SYD-menetelmän (Sum-of-Year's Digits) avulla. +TBILLEQ = OBLIG.TUOTTOPROS ## Palauttaa valtion obligaation tuoton vastaavana joukkovelkakirjan tuottona. +TBILLPRICE = OBLIG.HINTA ## Palauttaa obligaation hinnan 100 euron nimellisarvoa kohden. +TBILLYIELD = OBLIG.TUOTTO ## Palauttaa obligaation tuoton. +VDB = VDB ## Palauttaa annetun kauden tai kauden osan kirjanpidollisen poiston amerikkalaisen DB-menetelmän (Fixed-declining balance) mukaan. +XIRR = SISÄINEN.KORKO.JAKSOTON ## Palauttaa sisäisen korkokannan kassavirtojen sarjoille, jotka eivät välttämättä ole säännöllisiä. +XNPV = NNA.JAKSOTON ## Palauttaa nettonykyarvon kassavirtasarjalle, joka ei välttämättä ole kausittainen. +YIELD = TUOTTO ## Palauttaa tuoton arvopaperille, jonka korko maksetaan säännöllisin väliajoin. +YIELDDISC = TUOTTO.DISK ## Palauttaa diskontatun arvopaperin, kuten obligaation, vuosittaisen tuoton. +YIELDMAT = TUOTTO.ERÄP ## Palauttaa erääntymispäivänään korkoa tuottavan arvopaperin vuosittaisen tuoton. + + +## +## Information functions Erikoisfunktiot +## +CELL = SOLU ## Palauttaa tietoja solun muotoilusta, sijainnista ja sisällöstä. +ERROR.TYPE = VIRHEEN.LAJI ## Palauttaa virhetyyppiä vastaavan luvun. +INFO = KUVAUS ## Palauttaa tietoja nykyisestä käyttöympäristöstä. +ISBLANK = ONTYHJÄ ## Palauttaa arvon TOSI, jos arvo on tyhjä. +ISERR = ONVIRH ## Palauttaa arvon TOSI, jos arvo on mikä tahansa virhearvo paitsi arvo #PUUTTUU!. +ISERROR = ONVIRHE ## Palauttaa arvon TOSI, jos arvo on mikä tahansa virhearvo. +ISEVEN = ONPARILLINEN ## Palauttaa arvon TOSI, jos arvo on parillinen. +ISLOGICAL = ONTOTUUS ## Palauttaa arvon TOSI, jos arvo on mikä tahansa looginen arvo. +ISNA = ONPUUTTUU ## Palauttaa arvon TOSI, jos virhearvo on #PUUTTUU!. +ISNONTEXT = ONEI_TEKSTI ## Palauttaa arvon TOSI, jos arvo ei ole teksti. +ISNUMBER = ONLUKU ## Palauttaa arvon TOSI, jos arvo on luku. +ISODD = ONPARITON ## Palauttaa arvon TOSI, jos arvo on pariton. +ISREF = ONVIITT ## Palauttaa arvon TOSI, jos arvo on viittaus. +ISTEXT = ONTEKSTI ## Palauttaa arvon TOSI, jos arvo on teksti. +N = N ## Palauttaa arvon luvuksi muunnettuna. +NA = PUUTTUU ## Palauttaa virhearvon #PUUTTUU!. +TYPE = TYYPPI ## Palauttaa luvun, joka ilmaisee arvon tietotyypin. + + +## +## Logical functions Loogiset funktiot +## +AND = JA ## Palauttaa arvon TOSI, jos kaikkien argumenttien arvo on TOSI. +FALSE = EPÄTOSI ## Palauttaa totuusarvon EPÄTOSI. +IF = JOS ## Määrittää suoritettavan loogisen testin. +IFERROR = JOSVIRHE ## Palauttaa määrittämäsi arvon, jos kaavan tulos on virhe; muussa tapauksessa palauttaa kaavan tuloksen. +NOT = EI ## Kääntää argumentin loogisen arvon. +OR = TAI ## Palauttaa arvon TOSI, jos minkä tahansa argumentin arvo on TOSI. +TRUE = TOSI ## Palauttaa totuusarvon TOSI. + + +## +## Lookup and reference functions Haku- ja viitefunktiot +## +ADDRESS = OSOITE ## Palauttaa laskentataulukon soluun osoittavan viittauksen tekstinä. +AREAS = ALUEET ## Palauttaa viittauksessa olevien alueiden määrän. +CHOOSE = VALITSE.INDEKSI ## Valitsee arvon arvoluettelosta. +COLUMN = SARAKE ## Palauttaa viittauksen sarakenumeron. +COLUMNS = SARAKKEET ## Palauttaa viittauksessa olevien sarakkeiden määrän. +HLOOKUP = VHAKU ## Suorittaa haun matriisin ylimmältä riviltä ja palauttaa määritetyn solun arvon. +HYPERLINK = HYPERLINKKI ## Luo pikakuvakkeen tai tekstin, joka avaa verkkopalvelimeen, intranetiin tai Internetiin tallennetun tiedoston. +INDEX = INDEKSI ## Valitsee arvon viittauksesta tai matriisista indeksin mukaan. +INDIRECT = EPÄSUORA ## Palauttaa tekstiarvona ilmaistun viittauksen. +LOOKUP = HAKU ## Etsii arvoja vektorista tai matriisista. +MATCH = VASTINE ## Etsii arvoja viittauksesta tai matriisista. +OFFSET = SIIRTYMÄ ## Palauttaa annetun viittauksen siirtymän. +ROW = RIVI ## Palauttaa viittauksen rivinumeron. +ROWS = RIVIT ## Palauttaa viittauksessa olevien rivien määrän. +RTD = RTD ## Noutaa COM-automaatiota (automaatio: Tapa käsitellä sovelluksen objekteja toisesta sovelluksesta tai kehitystyökalusta. Automaatio, jota aiemmin kutsuttiin OLE-automaatioksi, on teollisuusstandardi ja COM-mallin (Component Object Model) ominaisuus.) tukevasta ohjelmasta reaaliaikaisia tietoja. +TRANSPOSE = TRANSPONOI ## Palauttaa matriisin käänteismatriisin. +VLOOKUP = PHAKU ## Suorittaa haun matriisin ensimmäisestä sarakkeesta ja palauttaa rivillä olevan solun arvon. + + +## +## Math and trigonometry functions Matemaattiset ja trigonometriset funktiot +## +ABS = ITSEISARVO ## Palauttaa luvun itseisarvon. +ACOS = ACOS ## Palauttaa luvun arkuskosinin. +ACOSH = ACOSH ## Palauttaa luvun käänteisen hyperbolisen kosinin. +ASIN = ASIN ## Palauttaa luvun arkussinin. +ASINH = ASINH ## Palauttaa luvun käänteisen hyperbolisen sinin. +ATAN = ATAN ## Palauttaa luvun arkustangentin. +ATAN2 = ATAN2 ## Palauttaa arkustangentin x- ja y-koordinaatin perusteella. +ATANH = ATANH ## Palauttaa luvun käänteisen hyperbolisen tangentin. +CEILING = PYÖRISTÄ.KERR.YLÖS ## Pyöristää luvun lähimpään kokonaislukuun tai tarkkuusargumentin lähimpään kerrannaiseen. +COMBIN = KOMBINAATIO ## Palauttaa mahdollisten kombinaatioiden määrän annetulle objektien määrälle. +COS = COS ## Palauttaa luvun kosinin. +COSH = COSH ## Palauttaa luvun hyperbolisen kosinin. +DEGREES = ASTEET ## Muuntaa radiaanit asteiksi. +EVEN = PARILLINEN ## Pyöristää luvun ylöspäin lähimpään parilliseen kokonaislukuun. +EXP = EKSPONENTTI ## Palauttaa e:n korotettuna annetun luvun osoittamaan potenssiin. +FACT = KERTOMA ## Palauttaa luvun kertoman. +FACTDOUBLE = KERTOMA.OSA ## Palauttaa luvun osakertoman. +FLOOR = PYÖRISTÄ.KERR.ALAS ## Pyöristää luvun alaspäin (nollaa kohti). +GCD = SUURIN.YHT.TEKIJÄ ## Palauttaa suurimman yhteisen tekijän. +INT = KOKONAISLUKU ## Pyöristää luvun alaspäin lähimpään kokonaislukuun. +LCM = PIENIN.YHT.JAETTAVA ## Palauttaa pienimmän yhteisen tekijän. +LN = LUONNLOG ## Palauttaa luvun luonnollisen logaritmin. +LOG = LOG ## Laskee luvun logaritmin käyttämällä annettua kantalukua. +LOG10 = LOG10 ## Palauttaa luvun kymmenkantaisen logaritmin. +MDETERM = MDETERM ## Palauttaa matriisin matriisideterminantin. +MINVERSE = MKÄÄNTEINEN ## Palauttaa matriisin käänteismatriisin. +MMULT = MKERRO ## Palauttaa kahden matriisin tulon. +MOD = JAKOJ ## Palauttaa jakolaskun jäännöksen. +MROUND = PYÖRISTÄ.KERR ## Palauttaa luvun pyöristettynä annetun luvun kerrannaiseen. +MULTINOMIAL = MULTINOMI ## Palauttaa lukujoukon multinomin. +ODD = PARITON ## Pyöristää luvun ylöspäin lähimpään parittomaan kokonaislukuun. +PI = PII ## Palauttaa piin arvon. +POWER = POTENSSI ## Palauttaa luvun korotettuna haluttuun potenssiin. +PRODUCT = TULO ## Kertoo annetut argumentit. +QUOTIENT = OSAMÄÄRÄ ## Palauttaa osamäärän kokonaislukuosan. +RADIANS = RADIAANIT ## Muuntaa asteet radiaaneiksi. +RAND = SATUNNAISLUKU ## Palauttaa satunnaisluvun väliltä 0–1. +RANDBETWEEN = SATUNNAISLUKU.VÄLILTÄ ## Palauttaa satunnaisluvun määritettyjen lukujen väliltä. +ROMAN = ROMAN ## Muuntaa arabialaisen numeron tekstimuotoiseksi roomalaiseksi numeroksi. +ROUND = PYÖRISTÄ ## Pyöristää luvun annettuun määrään desimaaleja. +ROUNDDOWN = PYÖRISTÄ.DES.ALAS ## Pyöristää luvun alaspäin (nollaa kohti). +ROUNDUP = PYÖRISTÄ.DES.YLÖS ## Pyöristää luvun ylöspäin (poispäin nollasta). +SERIESSUM = SARJA.SUMMA ## Palauttaa kaavaan perustuvan potenssisarjan arvon. +SIGN = ETUMERKKI ## Palauttaa luvun etumerkin. +SIN = SIN ## Palauttaa annetun kulman sinin. +SINH = SINH ## Palauttaa luvun hyperbolisen sinin. +SQRT = NELIÖJUURI ## Palauttaa positiivisen neliöjuuren. +SQRTPI = NELIÖJUURI.PII ## Palauttaa tulon (luku * pii) neliöjuuren. +SUBTOTAL = VÄLISUMMA ## Palauttaa luettelon tai tietokannan välisumman. +SUM = SUMMA ## Laskee yhteen annetut argumentit. +SUMIF = SUMMA.JOS ## Laskee ehdot täyttävien solujen summan. +SUMIFS = SUMMA.JOS.JOUKKO ## Laskee yhteen solualueen useita ehtoja vastaavat solut. +SUMPRODUCT = TULOJEN.SUMMA ## Palauttaa matriisin toisiaan vastaavien osien tulojen summan. +SUMSQ = NELIÖSUMMA ## Palauttaa argumenttien neliöiden summan. +SUMX2MY2 = NELIÖSUMMIEN.EROTUS ## Palauttaa kahden matriisin toisiaan vastaavien arvojen laskettujen neliösummien erotuksen. +SUMX2PY2 = NELIÖSUMMIEN.SUMMA ## Palauttaa kahden matriisin toisiaan vastaavien arvojen neliösummien summan. +SUMXMY2 = EROTUSTEN.NELIÖSUMMA ## Palauttaa kahden matriisin toisiaan vastaavien arvojen erotusten neliösumman. +TAN = TAN ## Palauttaa luvun tangentin. +TANH = TANH ## Palauttaa luvun hyperbolisen tangentin. +TRUNC = KATKAISE ## Katkaisee luvun kokonaisluvuksi. + + +## +## Statistical functions Tilastolliset funktiot +## +AVEDEV = KESKIPOIKKEAMA ## Palauttaa hajontojen itseisarvojen keskiarvon. +AVERAGE = KESKIARVO ## Palauttaa argumenttien keskiarvon. +AVERAGEA = KESKIARVOA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, keskiarvon. +AVERAGEIF = KESKIARVO.JOS ## Palauttaa alueen niiden solujen keskiarvon (aritmeettisen keskiarvon), jotka täyttävät annetut ehdot. +AVERAGEIFS = KESKIARVO.JOS.JOUKKO ## Palauttaa niiden solujen keskiarvon (aritmeettisen keskiarvon), jotka vastaavat useita ehtoja. +BETADIST = BEETAJAKAUMA ## Palauttaa kumulatiivisen beetajakaumafunktion arvon. +BETAINV = BEETAJAKAUMA.KÄÄNT ## Palauttaa määritetyn beetajakauman käänteisen kumulatiivisen jakaumafunktion arvon. +BINOMDIST = BINOMIJAKAUMA ## Palauttaa yksittäisen termin binomijakaumatodennäköisyyden. +CHIDIST = CHIJAKAUMA ## Palauttaa yksisuuntaisen chi-neliön jakauman todennäköisyyden. +CHIINV = CHIJAKAUMA.KÄÄNT ## Palauttaa yksisuuntaisen chi-neliön jakauman todennäköisyyden käänteisarvon. +CHITEST = CHITESTI ## Palauttaa riippumattomuustestin tuloksen. +CONFIDENCE = LUOTTAMUSVÄLI ## Palauttaa luottamusvälin populaation keskiarvolle. +CORREL = KORRELAATIO ## Palauttaa kahden arvojoukon korrelaatiokertoimen. +COUNT = LASKE ## Laskee argumenttiluettelossa olevien lukujen määrän. +COUNTA = LASKE.A ## Laskee argumenttiluettelossa olevien arvojen määrän. +COUNTBLANK = LASKE.TYHJÄT ## Laskee alueella olevien tyhjien solujen määrän. +COUNTIF = LASKE.JOS ## Laskee alueella olevien sellaisten solujen määrän, joiden sisältö vastaa annettuja ehtoja. +COUNTIFS = LASKE.JOS.JOUKKO ## Laskee alueella olevien sellaisten solujen määrän, joiden sisältö vastaa useita ehtoja. +COVAR = KOVARIANSSI ## Palauttaa kovarianssin, joka on keskiarvo havaintoaineiston kunkin pisteparin poikkeamien tuloista. +CRITBINOM = BINOMIJAKAUMA.KRIT ## Palauttaa pienimmän arvon, jossa binomijakauman kertymäfunktion arvo on pienempi tai yhtä suuri kuin vertailuarvo. +DEVSQ = OIKAISTU.NELIÖSUMMA ## Palauttaa keskipoikkeamien neliösumman. +EXPONDIST = EKSPONENTIAALIJAKAUMA ## Palauttaa eksponentiaalijakauman. +FDIST = FJAKAUMA ## Palauttaa F-todennäköisyysjakauman. +FINV = FJAKAUMA.KÄÄNT ## Palauttaa F-todennäköisyysjakauman käänteisfunktion. +FISHER = FISHER ## Palauttaa Fisher-muunnoksen. +FISHERINV = FISHER.KÄÄNT ## Palauttaa käänteisen Fisher-muunnoksen. +FORECAST = ENNUSTE ## Palauttaa lineaarisen trendin arvon. +FREQUENCY = TAAJUUS ## Palauttaa frekvenssijakautuman pystysuuntaisena matriisina. +FTEST = FTESTI ## Palauttaa F-testin tuloksen. +GAMMADIST = GAMMAJAKAUMA ## Palauttaa gammajakauman. +GAMMAINV = GAMMAJAKAUMA.KÄÄNT ## Palauttaa käänteisen gammajakauman kertymäfunktion. +GAMMALN = GAMMALN ## Palauttaa gammafunktion luonnollisen logaritmin G(x). +GEOMEAN = KESKIARVO.GEOM ## Palauttaa geometrisen keskiarvon. +GROWTH = KASVU ## Palauttaa eksponentiaalisen trendin arvon. +HARMEAN = KESKIARVO.HARM ## Palauttaa harmonisen keskiarvon. +HYPGEOMDIST = HYPERGEOM.JAKAUMA ## Palauttaa hypergeometrisen jakauman. +INTERCEPT = LEIKKAUSPISTE ## Palauttaa lineaarisen regressiosuoran leikkauspisteen. +KURT = KURT ## Palauttaa tietoalueen vinous-arvon eli huipukkuuden. +LARGE = SUURI ## Palauttaa tietojoukon k:nneksi suurimman arvon. +LINEST = LINREGR ## Palauttaa lineaarisen trendin parametrit. +LOGEST = LOGREGR ## Palauttaa eksponentiaalisen trendin parametrit. +LOGINV = LOGNORM.JAKAUMA.KÄÄNT ## Palauttaa lognormeeratun jakauman käänteisfunktion. +LOGNORMDIST = LOGNORM.JAKAUMA ## Palauttaa lognormaalisen jakauman kertymäfunktion. +MAX = MAKS ## Palauttaa suurimman arvon argumenttiluettelosta. +MAXA = MAKSA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, suurimman arvon. +MEDIAN = MEDIAANI ## Palauttaa annettujen lukujen mediaanin. +MIN = MIN ## Palauttaa pienimmän arvon argumenttiluettelosta. +MINA = MINA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, pienimmän arvon. +MODE = MOODI ## Palauttaa tietojoukossa useimmin esiintyvän arvon. +NEGBINOMDIST = BINOMIJAKAUMA.NEG ## Palauttaa negatiivisen binomijakauman. +NORMDIST = NORM.JAKAUMA ## Palauttaa normaalijakauman kertymäfunktion. +NORMINV = NORM.JAKAUMA.KÄÄNT ## Palauttaa käänteisen normaalijakauman kertymäfunktion. +NORMSDIST = NORM.JAKAUMA.NORMIT ## Palauttaa normitetun normaalijakauman kertymäfunktion. +NORMSINV = NORM.JAKAUMA.NORMIT.KÄÄNT ## Palauttaa normitetun normaalijakauman kertymäfunktion käänteisarvon. +PEARSON = PEARSON ## Palauttaa Pearsonin tulomomenttikorrelaatiokertoimen. +PERCENTILE = PROSENTTIPISTE ## Palauttaa alueen arvojen k:nnen prosenttipisteen. +PERCENTRANK = PROSENTTIJÄRJESTYS ## Palauttaa tietojoukon arvon prosentuaalisen järjestysluvun. +PERMUT = PERMUTAATIO ## Palauttaa mahdollisten permutaatioiden määrän annetulle objektien määrälle. +POISSON = POISSON ## Palauttaa Poissonin todennäköisyysjakauman. +PROB = TODENNÄKÖISYYS ## Palauttaa todennäköisyyden sille, että arvot ovat tietyltä väliltä. +QUARTILE = NELJÄNNES ## Palauttaa tietoalueen neljänneksen. +RANK = ARVON.MUKAAN ## Palauttaa luvun paikan lukuarvoluettelossa. +RSQ = PEARSON.NELIÖ ## Palauttaa Pearsonin tulomomenttikorrelaatiokertoimen neliön. +SKEW = JAKAUMAN.VINOUS ## Palauttaa jakauman vinouden. +SLOPE = KULMAKERROIN ## Palauttaa lineaarisen regressiosuoran kulmakertoimen. +SMALL = PIENI ## Palauttaa tietojoukon k:nneksi pienimmän arvon. +STANDARDIZE = NORMITA ## Palauttaa normitetun arvon. +STDEV = KESKIHAJONTA ## Laskee populaation keskihajonnan otoksen perusteella. +STDEVA = KESKIHAJONTAA ## Laskee populaation keskihajonnan otoksen perusteella, mukaan lukien luvut, tekstin ja loogiset arvot. +STDEVP = KESKIHAJONTAP ## Laskee normaalijakautuman koko populaation perusteella. +STDEVPA = KESKIHAJONTAPA ## Laskee populaation keskihajonnan koko populaation perusteella, mukaan lukien luvut, tekstin ja totuusarvot. +STEYX = KESKIVIRHE ## Palauttaa regression kutakin x-arvoa vastaavan ennustetun y-arvon keskivirheen. +TDIST = TJAKAUMA ## Palauttaa t-jakautuman. +TINV = TJAKAUMA.KÄÄNT ## Palauttaa käänteisen t-jakauman. +TREND = SUUNTAUS ## Palauttaa lineaarisen trendin arvoja. +TRIMMEAN = KESKIARVO.TASATTU ## Palauttaa tietojoukon tasatun keskiarvon. +TTEST = TTESTI ## Palauttaa t-testiin liittyvän todennäköisyyden. +VAR = VAR ## Arvioi populaation varianssia otoksen perusteella. +VARA = VARA ## Laskee populaation varianssin otoksen perusteella, mukaan lukien luvut, tekstin ja loogiset arvot. +VARP = VARP ## Laskee varianssin koko populaation perusteella. +VARPA = VARPA ## Laskee populaation varianssin koko populaation perusteella, mukaan lukien luvut, tekstin ja totuusarvot. +WEIBULL = WEIBULL ## Palauttaa Weibullin jakauman. +ZTEST = ZTESTI ## Palauttaa z-testin yksisuuntaisen todennäköisyysarvon. + + +## +## Text functions Tekstifunktiot +## +ASC = ASC ## Muuntaa merkkijonossa olevat englanninkieliset DBCS- tai katakana-merkit SBCS-merkeiksi. +BAHTTEXT = BAHTTEKSTI ## Muuntaa luvun tekstiksi ß (baht) -valuuttamuotoa käyttämällä. +CHAR = MERKKI ## Palauttaa koodin lukua vastaavan merkin. +CLEAN = SIIVOA ## Poistaa tekstistä kaikki tulostumattomat merkit. +CODE = KOODI ## Palauttaa tekstimerkkijonon ensimmäisen merkin numerokoodin. +CONCATENATE = KETJUTA ## Yhdistää useat merkkijonot yhdeksi merkkijonoksi. +DOLLAR = VALUUTTA ## Muuntaa luvun tekstiksi $ (dollari) -valuuttamuotoa käyttämällä. +EXACT = VERTAA ## Tarkistaa, ovatko kaksi tekstiarvoa samanlaiset. +FIND = ETSI ## Etsii tekstiarvon toisen tekstin sisältä (tunnistaa isot ja pienet kirjaimet). +FINDB = ETSIB ## Etsii tekstiarvon toisen tekstin sisältä (tunnistaa isot ja pienet kirjaimet). +FIXED = KIINTEÄ ## Muotoilee luvun tekstiksi, jossa on kiinteä määrä desimaaleja. +JIS = JIS ## Muuntaa merkkijonossa olevat englanninkieliset SBCS- tai katakana-merkit DBCS-merkeiksi. +LEFT = VASEN ## Palauttaa tekstiarvon vasemmanpuoliset merkit. +LEFTB = VASENB ## Palauttaa tekstiarvon vasemmanpuoliset merkit. +LEN = PITUUS ## Palauttaa tekstimerkkijonon merkkien määrän. +LENB = PITUUSB ## Palauttaa tekstimerkkijonon merkkien määrän. +LOWER = PIENET ## Muuntaa tekstin pieniksi kirjaimiksi. +MID = POIMI.TEKSTI ## Palauttaa määritetyn määrän merkkejä merkkijonosta alkaen annetusta kohdasta. +MIDB = POIMI.TEKSTIB ## Palauttaa määritetyn määrän merkkejä merkkijonosta alkaen annetusta kohdasta. +PHONETIC = FONEETTINEN ## Hakee foneettiset (furigana) merkit merkkijonosta. +PROPER = ERISNIMI ## Muuttaa merkkijonon kunkin sanan ensimmäisen kirjaimen isoksi. +REPLACE = KORVAA ## Korvaa tekstissä olevat merkit. +REPLACEB = KORVAAB ## Korvaa tekstissä olevat merkit. +REPT = TOISTA ## Toistaa tekstin annetun määrän kertoja. +RIGHT = OIKEA ## Palauttaa tekstiarvon oikeanpuoliset merkit. +RIGHTB = OIKEAB ## Palauttaa tekstiarvon oikeanpuoliset merkit. +SEARCH = KÄY.LÄPI ## Etsii tekstiarvon toisen tekstin sisältä (isot ja pienet kirjaimet tulkitaan samoiksi merkeiksi). +SEARCHB = KÄY.LÄPIB ## Etsii tekstiarvon toisen tekstin sisältä (isot ja pienet kirjaimet tulkitaan samoiksi merkeiksi). +SUBSTITUTE = VAIHDA ## Korvaa merkkijonossa olevan tekstin toisella. +T = T ## Muuntaa argumentit tekstiksi. +TEXT = TEKSTI ## Muotoilee luvun ja muuntaa sen tekstiksi. +TRIM = POISTA.VÄLIT ## Poistaa välilyönnit tekstistä. +UPPER = ISOT ## Muuntaa tekstin isoiksi kirjaimiksi. +VALUE = ARVO ## Muuntaa tekstiargumentin luvuksi. diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fr/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fr/config new file mode 100644 index 0000000..8189598 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fr/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) + +## +NULL = #NUL! +DIV0 = #DIV/0! +VALUE = #VALEUR! +REF = #REF! +NAME = #NOM? +NUM = #NOMBRE! +NA = #N/A diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fr/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fr/functions new file mode 100644 index 0000000..7f40d5f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/fr/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Fonctions de complément et d’automatisation +## +GETPIVOTDATA = LIREDONNEESTABCROISDYNAMIQUE ## Renvoie les données stockées dans un rapport de tableau croisé dynamique. + + +## +## Cube functions Fonctions Cube +## +CUBEKPIMEMBER = MEMBREKPICUBE ## Renvoie un nom, une propriété et une mesure d’indicateur de performance clé et affiche le nom et la propriété dans la cellule. Un indicateur de performance clé est une mesure quantifiable, telle que la marge bénéficiaire brute mensuelle ou la rotation trimestrielle du personnel, utilisée pour évaluer les performances d’une entreprise. +CUBEMEMBER = MEMBRECUBE ## Renvoie un membre ou un uplet dans une hiérarchie de cubes. Utilisez cette fonction pour valider l’existence du membre ou de l’uplet dans le cube. +CUBEMEMBERPROPERTY = PROPRIETEMEMBRECUBE ## Renvoie la valeur d’une propriété de membre du cube. Utilisez cette fonction pour valider l’existence d’un nom de membre dans le cube et pour renvoyer la propriété spécifiée pour ce membre. +CUBERANKEDMEMBER = RANGMEMBRECUBE ## Renvoie le nième membre ou le membre placé à un certain rang dans un ensemble. Utilisez cette fonction pour renvoyer un ou plusieurs éléments d’un ensemble, tels que les meilleurs vendeurs ou les 10 meilleurs étudiants. +CUBESET = JEUCUBE ## Définit un ensemble calculé de membres ou d’uplets en envoyant une expression définie au cube sur le serveur qui crée l’ensemble et le renvoie à Microsoft Office Excel. +CUBESETCOUNT = NBJEUCUBE ## Renvoie le nombre d’éléments dans un jeu. +CUBEVALUE = VALEURCUBE ## Renvoie une valeur d’agrégation issue d’un cube. + + +## +## Database functions Fonctions de base de données +## +DAVERAGE = BDMOYENNE ## Renvoie la moyenne des entrées de base de données sélectionnées. +DCOUNT = BCOMPTE ## Compte le nombre de cellules d’une base de données qui contiennent des nombres. +DCOUNTA = BDNBVAL ## Compte les cellules non vides d’une base de données. +DGET = BDLIRE ## Extrait d’une base de données un enregistrement unique répondant aux critères spécifiés. +DMAX = BDMAX ## Renvoie la valeur maximale des entrées de base de données sélectionnées. +DMIN = BDMIN ## Renvoie la valeur minimale des entrées de base de données sélectionnées. +DPRODUCT = BDPRODUIT ## Multiplie les valeurs d’un champ particulier des enregistrements d’une base de données, qui répondent aux critères spécifiés. +DSTDEV = BDECARTYPE ## Calcule l’écart type pour un échantillon d’entrées de base de données sélectionnées. +DSTDEVP = BDECARTYPEP ## Calcule l’écart type pour l’ensemble d’une population d’entrées de base de données sélectionnées. +DSUM = BDSOMME ## Ajoute les nombres dans la colonne de champ des enregistrements de la base de données, qui répondent aux critères. +DVAR = BDVAR ## Calcule la variance pour un échantillon d’entrées de base de données sélectionnées. +DVARP = BDVARP ## Calcule la variance pour l’ensemble d’une population d’entrées de base de données sélectionnées. + + +## +## Date and time functions Fonctions de date et d’heure +## +DATE = DATE ## Renvoie le numéro de série d’une date précise. +DATEVALUE = DATEVAL ## Convertit une date représentée sous forme de texte en numéro de série. +DAY = JOUR ## Convertit un numéro de série en jour du mois. +DAYS360 = JOURS360 ## Calcule le nombre de jours qui séparent deux dates sur la base d’une année de 360 jours. +EDATE = MOIS.DECALER ## Renvoie le numéro séquentiel de la date qui représente une date spécifiée (l’argument date_départ), corrigée en plus ou en moins du nombre de mois indiqué. +EOMONTH = FIN.MOIS ## Renvoie le numéro séquentiel de la date du dernier jour du mois précédant ou suivant la date_départ du nombre de mois indiqué. +HOUR = HEURE ## Convertit un numéro de série en heure. +MINUTE = MINUTE ## Convertit un numéro de série en minute. +MONTH = MOIS ## Convertit un numéro de série en mois. +NETWORKDAYS = NB.JOURS.OUVRES ## Renvoie le nombre de jours ouvrés entiers compris entre deux dates. +NOW = MAINTENANT ## Renvoie le numéro de série de la date et de l’heure du jour. +SECOND = SECONDE ## Convertit un numéro de série en seconde. +TIME = TEMPS ## Renvoie le numéro de série d’une heure précise. +TIMEVALUE = TEMPSVAL ## Convertit une date représentée sous forme de texte en numéro de série. +TODAY = AUJOURDHUI ## Renvoie le numéro de série de la date du jour. +WEEKDAY = JOURSEM ## Convertit un numéro de série en jour de la semaine. +WEEKNUM = NO.SEMAINE ## Convertit un numéro de série en un numéro représentant l’ordre de la semaine dans l’année. +WORKDAY = SERIE.JOUR.OUVRE ## Renvoie le numéro de série de la date avant ou après le nombre de jours ouvrés spécifiés. +YEAR = ANNEE ## Convertit un numéro de série en année. +YEARFRAC = FRACTION.ANNEE ## Renvoie la fraction de l’année représentant le nombre de jours entre la date de début et la date de fin. + + +## +## Engineering functions Fonctions d’ingénierie +## +BESSELI = BESSELI ## Renvoie la fonction Bessel modifiée In(x). +BESSELJ = BESSELJ ## Renvoie la fonction Bessel Jn(x). +BESSELK = BESSELK ## Renvoie la fonction Bessel modifiée Kn(x). +BESSELY = BESSELY ## Renvoie la fonction Bessel Yn(x). +BIN2DEC = BINDEC ## Convertit un nombre binaire en nombre décimal. +BIN2HEX = BINHEX ## Convertit un nombre binaire en nombre hexadécimal. +BIN2OCT = BINOCT ## Convertit un nombre binaire en nombre octal. +COMPLEX = COMPLEXE ## Convertit des coefficients réel et imaginaire en un nombre complexe. +CONVERT = CONVERT ## Convertit un nombre d’une unité de mesure à une autre. +DEC2BIN = DECBIN ## Convertit un nombre décimal en nombre binaire. +DEC2HEX = DECHEX ## Convertit un nombre décimal en nombre hexadécimal. +DEC2OCT = DECOCT ## Convertit un nombre décimal en nombre octal. +DELTA = DELTA ## Teste l’égalité de deux nombres. +ERF = ERF ## Renvoie la valeur de la fonction d’erreur. +ERFC = ERFC ## Renvoie la valeur de la fonction d’erreur complémentaire. +GESTEP = SUP.SEUIL ## Teste si un nombre est supérieur à une valeur de seuil. +HEX2BIN = HEXBIN ## Convertit un nombre hexadécimal en nombre binaire. +HEX2DEC = HEXDEC ## Convertit un nombre hexadécimal en nombre décimal. +HEX2OCT = HEXOCT ## Convertit un nombre hexadécimal en nombre octal. +IMABS = COMPLEXE.MODULE ## Renvoie la valeur absolue (module) d’un nombre complexe. +IMAGINARY = COMPLEXE.IMAGINAIRE ## Renvoie le coefficient imaginaire d’un nombre complexe. +IMARGUMENT = COMPLEXE.ARGUMENT ## Renvoie l’argument thêta, un angle exprimé en radians. +IMCONJUGATE = COMPLEXE.CONJUGUE ## Renvoie le nombre complexe conjugué d’un nombre complexe. +IMCOS = IMCOS ## Renvoie le cosinus d’un nombre complexe. +IMDIV = COMPLEXE.DIV ## Renvoie le quotient de deux nombres complexes. +IMEXP = COMPLEXE.EXP ## Renvoie la fonction exponentielle d’un nombre complexe. +IMLN = COMPLEXE.LN ## Renvoie le logarithme népérien d’un nombre complexe. +IMLOG10 = COMPLEXE.LOG10 ## Calcule le logarithme en base 10 d’un nombre complexe. +IMLOG2 = COMPLEXE.LOG2 ## Calcule le logarithme en base 2 d’un nombre complexe. +IMPOWER = COMPLEXE.PUISSANCE ## Renvoie un nombre complexe élevé à une puissance entière. +IMPRODUCT = COMPLEXE.PRODUIT ## Renvoie le produit de plusieurs nombres complexes. +IMREAL = COMPLEXE.REEL ## Renvoie le coefficient réel d’un nombre complexe. +IMSIN = COMPLEXE.SIN ## Renvoie le sinus d’un nombre complexe. +IMSQRT = COMPLEXE.RACINE ## Renvoie la racine carrée d’un nombre complexe. +IMSUB = COMPLEXE.DIFFERENCE ## Renvoie la différence entre deux nombres complexes. +IMSUM = COMPLEXE.SOMME ## Renvoie la somme de plusieurs nombres complexes. +OCT2BIN = OCTBIN ## Convertit un nombre octal en nombre binaire. +OCT2DEC = OCTDEC ## Convertit un nombre octal en nombre décimal. +OCT2HEX = OCTHEX ## Convertit un nombre octal en nombre hexadécimal. + + +## +## Financial functions Fonctions financières +## +ACCRINT = INTERET.ACC ## Renvoie l’intérêt couru non échu d’un titre dont l’intérêt est perçu périodiquement. +ACCRINTM = INTERET.ACC.MAT ## Renvoie l’intérêt couru non échu d’un titre dont l’intérêt est perçu à l’échéance. +AMORDEGRC = AMORDEGRC ## Renvoie l’amortissement correspondant à chaque période comptable en utilisant un coefficient d’amortissement. +AMORLINC = AMORLINC ## Renvoie l’amortissement d’un bien à la fin d’une période fiscale donnée. +COUPDAYBS = NB.JOURS.COUPON.PREC ## Renvoie le nombre de jours entre le début de la période de coupon et la date de liquidation. +COUPDAYS = NB.JOURS.COUPONS ## Renvoie le nombre de jours pour la période du coupon contenant la date de liquidation. +COUPDAYSNC = NB.JOURS.COUPON.SUIV ## Renvoie le nombre de jours entre la date de liquidation et la date du coupon suivant la date de liquidation. +COUPNCD = DATE.COUPON.SUIV ## Renvoie la première date de coupon ultérieure à la date de règlement. +COUPNUM = NB.COUPONS ## Renvoie le nombre de coupons dus entre la date de règlement et la date d’échéance. +COUPPCD = DATE.COUPON.PREC ## Renvoie la date de coupon précédant la date de règlement. +CUMIPMT = CUMUL.INTER ## Renvoie l’intérêt cumulé payé sur un emprunt entre deux périodes. +CUMPRINC = CUMUL.PRINCPER ## Renvoie le montant cumulé des remboursements du capital d’un emprunt effectués entre deux périodes. +DB = DB ## Renvoie l’amortissement d’un bien pour une période spécifiée en utilisant la méthode de l’amortissement dégressif à taux fixe. +DDB = DDB ## Renvoie l’amortissement d’un bien pour toute période spécifiée, en utilisant la méthode de l’amortissement dégressif à taux double ou selon un coefficient à spécifier. +DISC = TAUX.ESCOMPTE ## Calcule le taux d’escompte d’une transaction. +DOLLARDE = PRIX.DEC ## Convertit un prix en euros, exprimé sous forme de fraction, en un prix en euros exprimé sous forme de nombre décimal. +DOLLARFR = PRIX.FRAC ## Convertit un prix en euros, exprimé sous forme de nombre décimal, en un prix en euros exprimé sous forme de fraction. +DURATION = DUREE ## Renvoie la durée, en années, d’un titre dont l’intérêt est perçu périodiquement. +EFFECT = TAUX.EFFECTIF ## Renvoie le taux d’intérêt annuel effectif. +FV = VC ## Renvoie la valeur future d’un investissement. +FVSCHEDULE = VC.PAIEMENTS ## Calcule la valeur future d’un investissement en appliquant une série de taux d’intérêt composites. +INTRATE = TAUX.INTERET ## Affiche le taux d’intérêt d’un titre totalement investi. +IPMT = INTPER ## Calcule le montant des intérêts d’un investissement pour une période donnée. +IRR = TRI ## Calcule le taux de rentabilité interne d’un investissement pour une succession de trésoreries. +ISPMT = ISPMT ## Calcule le montant des intérêts d’un investissement pour une période donnée. +MDURATION = DUREE.MODIFIEE ## Renvoie la durée de Macauley modifiée pour un titre ayant une valeur nominale hypothétique de 100_euros. +MIRR = TRIM ## Calcule le taux de rentabilité interne lorsque les paiements positifs et négatifs sont financés à des taux différents. +NOMINAL = TAUX.NOMINAL ## Calcule le taux d’intérêt nominal annuel. +NPER = NPM ## Renvoie le nombre de versements nécessaires pour rembourser un emprunt. +NPV = VAN ## Calcule la valeur actuelle nette d’un investissement basé sur une série de décaissements et un taux d’escompte. +ODDFPRICE = PRIX.PCOUPON.IRREG ## Renvoie le prix par tranche de valeur nominale de 100 euros d’un titre dont la première période de coupon est irrégulière. +ODDFYIELD = REND.PCOUPON.IRREG ## Renvoie le taux de rendement d’un titre dont la première période de coupon est irrégulière. +ODDLPRICE = PRIX.DCOUPON.IRREG ## Renvoie le prix par tranche de valeur nominale de 100 euros d’un titre dont la première période de coupon est irrégulière. +ODDLYIELD = REND.DCOUPON.IRREG ## Renvoie le taux de rendement d’un titre dont la dernière période de coupon est irrégulière. +PMT = VPM ## Calcule le paiement périodique d’un investissement donné. +PPMT = PRINCPER ## Calcule, pour une période donnée, la part de remboursement du principal d’un investissement. +PRICE = PRIX.TITRE ## Renvoie le prix d’un titre rapportant des intérêts périodiques, pour une valeur nominale de 100 euros. +PRICEDISC = VALEUR.ENCAISSEMENT ## Renvoie la valeur d’encaissement d’un escompte commercial, pour une valeur nominale de 100 euros. +PRICEMAT = PRIX.TITRE.ECHEANCE ## Renvoie le prix d’un titre dont la valeur nominale est 100 euros et qui rapporte des intérêts à l’échéance. +PV = PV ## Calcule la valeur actuelle d’un investissement. +RATE = TAUX ## Calcule le taux d’intérêt par période pour une annuité. +RECEIVED = VALEUR.NOMINALE ## Renvoie la valeur nominale à échéance d’un effet de commerce. +SLN = AMORLIN ## Calcule l’amortissement linéaire d’un bien pour une période donnée. +SYD = SYD ## Calcule l’amortissement d’un bien pour une période donnée sur la base de la méthode américaine Sum-of-Years Digits (amortissement dégressif à taux décroissant appliqué à une valeur constante). +TBILLEQ = TAUX.ESCOMPTE.R ## Renvoie le taux d’escompte rationnel d’un bon du Trésor. +TBILLPRICE = PRIX.BON.TRESOR ## Renvoie le prix d’un bon du Trésor d’une valeur nominale de 100 euros. +TBILLYIELD = RENDEMENT.BON.TRESOR ## Calcule le taux de rendement d’un bon du Trésor. +VDB = VDB ## Renvoie l’amortissement d’un bien pour une période spécifiée ou partielle en utilisant une méthode de l’amortissement dégressif à taux fixe. +XIRR = TRI.PAIEMENTS ## Calcule le taux de rentabilité interne d’un ensemble de paiements non périodiques. +XNPV = VAN.PAIEMENTS ## Renvoie la valeur actuelle nette d’un ensemble de paiements non périodiques. +YIELD = RENDEMENT.TITRE ## Calcule le rendement d’un titre rapportant des intérêts périodiquement. +YIELDDISC = RENDEMENT.SIMPLE ## Calcule le taux de rendement d’un emprunt à intérêt simple (par exemple, un bon du Trésor). +YIELDMAT = RENDEMENT.TITRE.ECHEANCE ## Renvoie le rendement annuel d’un titre qui rapporte des intérêts à l’échéance. + + +## +## Information functions Fonctions d’information +## +CELL = CELLULE ## Renvoie des informations sur la mise en forme, l’emplacement et le contenu d’une cellule. +ERROR.TYPE = TYPE.ERREUR ## Renvoie un nombre correspondant à un type d’erreur. +INFO = INFORMATIONS ## Renvoie des informations sur l’environnement d’exploitation actuel. +ISBLANK = ESTVIDE ## Renvoie VRAI si l’argument valeur est vide. +ISERR = ESTERR ## Renvoie VRAI si l’argument valeur fait référence à une valeur d’erreur, sauf #N/A. +ISERROR = ESTERREUR ## Renvoie VRAI si l’argument valeur fait référence à une valeur d’erreur. +ISEVEN = EST.PAIR ## Renvoie VRAI si le chiffre est pair. +ISLOGICAL = ESTLOGIQUE ## Renvoie VRAI si l’argument valeur fait référence à une valeur logique. +ISNA = ESTNA ## Renvoie VRAI si l’argument valeur fait référence à la valeur d’erreur #N/A. +ISNONTEXT = ESTNONTEXTE ## Renvoie VRAI si l’argument valeur ne se présente pas sous forme de texte. +ISNUMBER = ESTNUM ## Renvoie VRAI si l’argument valeur représente un nombre. +ISODD = EST.IMPAIR ## Renvoie VRAI si le chiffre est impair. +ISREF = ESTREF ## Renvoie VRAI si l’argument valeur est une référence. +ISTEXT = ESTTEXTE ## Renvoie VRAI si l’argument valeur se présente sous forme de texte. +N = N ## Renvoie une valeur convertie en nombre. +NA = NA ## Renvoie la valeur d’erreur #N/A. +TYPE = TYPE ## Renvoie un nombre indiquant le type de données d’une valeur. + + +## +## Logical functions Fonctions logiques +## +AND = ET ## Renvoie VRAI si tous ses arguments sont VRAI. +FALSE = FAUX ## Renvoie la valeur logique FAUX. +IF = SI ## Spécifie un test logique à effectuer. +IFERROR = SIERREUR ## Renvoie une valeur que vous spécifiez si une formule génère une erreur ; sinon, elle renvoie le résultat de la formule. +NOT = NON ## Inverse la logique de cet argument. +OR = OU ## Renvoie VRAI si un des arguments est VRAI. +TRUE = VRAI ## Renvoie la valeur logique VRAI. + + +## +## Lookup and reference functions Fonctions de recherche et de référence +## +ADDRESS = ADRESSE ## Renvoie une référence sous forme de texte à une seule cellule d’une feuille de calcul. +AREAS = ZONES ## Renvoie le nombre de zones dans une référence. +CHOOSE = CHOISIR ## Choisit une valeur dans une liste. +COLUMN = COLONNE ## Renvoie le numéro de colonne d’une référence. +COLUMNS = COLONNES ## Renvoie le nombre de colonnes dans une référence. +HLOOKUP = RECHERCHEH ## Effectue une recherche dans la première ligne d’une matrice et renvoie la valeur de la cellule indiquée. +HYPERLINK = LIEN_HYPERTEXTE ## Crée un raccourci ou un renvoi qui ouvre un document stocké sur un serveur réseau, sur un réseau Intranet ou sur Internet. +INDEX = INDEX ## Utilise un index pour choisir une valeur provenant d’une référence ou d’une matrice. +INDIRECT = INDIRECT ## Renvoie une référence indiquée par une valeur de texte. +LOOKUP = RECHERCHE ## Recherche des valeurs dans un vecteur ou une matrice. +MATCH = EQUIV ## Recherche des valeurs dans une référence ou une matrice. +OFFSET = DECALER ## Renvoie une référence décalée par rapport à une référence donnée. +ROW = LIGNE ## Renvoie le numéro de ligne d’une référence. +ROWS = LIGNES ## Renvoie le nombre de lignes dans une référence. +RTD = RTD ## Extrait les données en temps réel à partir d’un programme prenant en charge l’automation COM (Automation : utilisation des objets d'une application à partir d'une autre application ou d'un autre outil de développement. Autrefois appelée OLE Automation, Automation est une norme industrielle et une fonctionnalité du modèle d'objet COM (Component Object Model).). +TRANSPOSE = TRANSPOSE ## Renvoie la transposition d’une matrice. +VLOOKUP = RECHERCHEV ## Effectue une recherche dans la première colonne d’une matrice et se déplace sur la ligne pour renvoyer la valeur d’une cellule. + + +## +## Math and trigonometry functions Fonctions mathématiques et trigonométriques +## +ABS = ABS ## Renvoie la valeur absolue d’un nombre. +ACOS = ACOS ## Renvoie l’arccosinus d’un nombre. +ACOSH = ACOSH ## Renvoie le cosinus hyperbolique inverse d’un nombre. +ASIN = ASIN ## Renvoie l’arcsinus d’un nombre. +ASINH = ASINH ## Renvoie le sinus hyperbolique inverse d’un nombre. +ATAN = ATAN ## Renvoie l’arctangente d’un nombre. +ATAN2 = ATAN2 ## Renvoie l’arctangente des coordonnées x et y. +ATANH = ATANH ## Renvoie la tangente hyperbolique inverse d’un nombre. +CEILING = PLAFOND ## Arrondit un nombre au nombre entier le plus proche ou au multiple le plus proche de l’argument précision en s’éloignant de zéro. +COMBIN = COMBIN ## Renvoie le nombre de combinaisons que l’on peut former avec un nombre donné d’objets. +COS = COS ## Renvoie le cosinus d’un nombre. +COSH = COSH ## Renvoie le cosinus hyperbolique d’un nombre. +DEGREES = DEGRES ## Convertit des radians en degrés. +EVEN = PAIR ## Arrondit un nombre au nombre entier pair le plus proche en s’éloignant de zéro. +EXP = EXP ## Renvoie e élevé à la puissance d’un nombre donné. +FACT = FACT ## Renvoie la factorielle d’un nombre. +FACTDOUBLE = FACTDOUBLE ## Renvoie la factorielle double d’un nombre. +FLOOR = PLANCHER ## Arrondit un nombre en tendant vers 0 (zéro). +GCD = PGCD ## Renvoie le plus grand commun diviseur. +INT = ENT ## Arrondit un nombre à l’entier immédiatement inférieur. +LCM = PPCM ## Renvoie le plus petit commun multiple. +LN = LN ## Renvoie le logarithme népérien d’un nombre. +LOG = LOG ## Renvoie le logarithme d’un nombre dans la base spécifiée. +LOG10 = LOG10 ## Calcule le logarithme en base 10 d’un nombre. +MDETERM = DETERMAT ## Renvoie le déterminant d’une matrice. +MINVERSE = INVERSEMAT ## Renvoie la matrice inverse d’une matrice. +MMULT = PRODUITMAT ## Renvoie le produit de deux matrices. +MOD = MOD ## Renvoie le reste d’une division. +MROUND = ARRONDI.AU.MULTIPLE ## Donne l’arrondi d’un nombre au multiple spécifié. +MULTINOMIAL = MULTINOMIALE ## Calcule la multinomiale d’un ensemble de nombres. +ODD = IMPAIR ## Renvoie le nombre, arrondi à la valeur du nombre entier impair le plus proche en s’éloignant de zéro. +PI = PI ## Renvoie la valeur de pi. +POWER = PUISSANCE ## Renvoie la valeur du nombre élevé à une puissance. +PRODUCT = PRODUIT ## Multiplie ses arguments. +QUOTIENT = QUOTIENT ## Renvoie la partie entière du résultat d’une division. +RADIANS = RADIANS ## Convertit des degrés en radians. +RAND = ALEA ## Renvoie un nombre aléatoire compris entre 0 et 1. +RANDBETWEEN = ALEA.ENTRE.BORNES ## Renvoie un nombre aléatoire entre les nombres que vous spécifiez. +ROMAN = ROMAIN ## Convertit des chiffres arabes en chiffres romains, sous forme de texte. +ROUND = ARRONDI ## Arrondit un nombre au nombre de chiffres indiqué. +ROUNDDOWN = ARRONDI.INF ## Arrondit un nombre en tendant vers 0 (zéro). +ROUNDUP = ARRONDI.SUP ## Arrondit un nombre à l’entier supérieur, en s’éloignant de zéro. +SERIESSUM = SOMME.SERIES ## Renvoie la somme d’une série géométrique en s’appuyant sur la formule suivante : +SIGN = SIGNE ## Renvoie le signe d’un nombre. +SIN = SIN ## Renvoie le sinus d’un angle donné. +SINH = SINH ## Renvoie le sinus hyperbolique d’un nombre. +SQRT = RACINE ## Renvoie la racine carrée d’un nombre. +SQRTPI = RACINE.PI ## Renvoie la racine carrée de (nombre * pi). +SUBTOTAL = SOUS.TOTAL ## Renvoie un sous-total dans une liste ou une base de données. +SUM = SOMME ## Calcule la somme de ses arguments. +SUMIF = SOMME.SI ## Additionne les cellules spécifiées si elles répondent à un critère donné. +SUMIFS = SOMME.SI.ENS ## Ajoute les cellules d’une plage qui répondent à plusieurs critères. +SUMPRODUCT = SOMMEPROD ## Multiplie les valeurs correspondantes des matrices spécifiées et calcule la somme de ces produits. +SUMSQ = SOMME.CARRES ## Renvoie la somme des carrés des arguments. +SUMX2MY2 = SOMME.X2MY2 ## Renvoie la somme de la différence des carrés des valeurs correspondantes de deux matrices. +SUMX2PY2 = SOMME.X2PY2 ## Renvoie la somme de la somme des carrés des valeurs correspondantes de deux matrices. +SUMXMY2 = SOMME.XMY2 ## Renvoie la somme des carrés des différences entre les valeurs correspondantes de deux matrices. +TAN = TAN ## Renvoie la tangente d’un nombre. +TANH = TANH ## Renvoie la tangente hyperbolique d’un nombre. +TRUNC = TRONQUE ## Renvoie la partie entière d’un nombre. + + +## +## Statistical functions Fonctions statistiques +## +AVEDEV = ECART.MOYEN ## Renvoie la moyenne des écarts absolus observés dans la moyenne des points de données. +AVERAGE = MOYENNE ## Renvoie la moyenne de ses arguments. +AVERAGEA = AVERAGEA ## Renvoie la moyenne de ses arguments, nombres, texte et valeurs logiques inclus. +AVERAGEIF = MOYENNE.SI ## Renvoie la moyenne (arithmétique) de toutes les cellules d’une plage qui répondent à des critères donnés. +AVERAGEIFS = MOYENNE.SI.ENS ## Renvoie la moyenne (arithmétique) de toutes les cellules qui répondent à plusieurs critères. +BETADIST = LOI.BETA ## Renvoie la fonction de distribution cumulée. +BETAINV = BETA.INVERSE ## Renvoie l’inverse de la fonction de distribution cumulée pour une distribution bêta spécifiée. +BINOMDIST = LOI.BINOMIALE ## Renvoie la probabilité d’une variable aléatoire discrète suivant la loi binomiale. +CHIDIST = LOI.KHIDEUX ## Renvoie la probabilité unilatérale de la distribution khi-deux. +CHIINV = KHIDEUX.INVERSE ## Renvoie l’inverse de la probabilité unilatérale de la distribution khi-deux. +CHITEST = TEST.KHIDEUX ## Renvoie le test d’indépendance. +CONFIDENCE = INTERVALLE.CONFIANCE ## Renvoie l’intervalle de confiance pour une moyenne de population. +CORREL = COEFFICIENT.CORRELATION ## Renvoie le coefficient de corrélation entre deux séries de données. +COUNT = NB ## Détermine les nombres compris dans la liste des arguments. +COUNTA = NBVAL ## Détermine le nombre de valeurs comprises dans la liste des arguments. +COUNTBLANK = NB.VIDE ## Compte le nombre de cellules vides dans une plage. +COUNTIF = NB.SI ## Compte le nombre de cellules qui répondent à un critère donné dans une plage. +COUNTIFS = NB.SI.ENS ## Compte le nombre de cellules à l’intérieur d’une plage qui répondent à plusieurs critères. +COVAR = COVARIANCE ## Renvoie la covariance, moyenne des produits des écarts pour chaque série d’observations. +CRITBINOM = CRITERE.LOI.BINOMIALE ## Renvoie la plus petite valeur pour laquelle la distribution binomiale cumulée est inférieure ou égale à une valeur de critère. +DEVSQ = SOMME.CARRES.ECARTS ## Renvoie la somme des carrés des écarts. +EXPONDIST = LOI.EXPONENTIELLE ## Renvoie la distribution exponentielle. +FDIST = LOI.F ## Renvoie la distribution de probabilité F. +FINV = INVERSE.LOI.F ## Renvoie l’inverse de la distribution de probabilité F. +FISHER = FISHER ## Renvoie la transformation de Fisher. +FISHERINV = FISHER.INVERSE ## Renvoie l’inverse de la transformation de Fisher. +FORECAST = PREVISION ## Calcule une valeur par rapport à une tendance linéaire. +FREQUENCY = FREQUENCE ## Calcule la fréquence d’apparition des valeurs dans une plage de valeurs, puis renvoie des nombres sous forme de matrice verticale. +FTEST = TEST.F ## Renvoie le résultat d’un test F. +GAMMADIST = LOI.GAMMA ## Renvoie la probabilité d’une variable aléatoire suivant une loi Gamma. +GAMMAINV = LOI.GAMMA.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi Gamma. +GAMMALN = LNGAMMA ## Renvoie le logarithme népérien de la fonction Gamma, G(x) +GEOMEAN = MOYENNE.GEOMETRIQUE ## Renvoie la moyenne géométrique. +GROWTH = CROISSANCE ## Calcule des valeurs par rapport à une tendance exponentielle. +HARMEAN = MOYENNE.HARMONIQUE ## Renvoie la moyenne harmonique. +HYPGEOMDIST = LOI.HYPERGEOMETRIQUE ## Renvoie la probabilité d’une variable aléatoire discrète suivant une loi hypergéométrique. +INTERCEPT = ORDONNEE.ORIGINE ## Renvoie l’ordonnée à l’origine d’une droite de régression linéaire. +KURT = KURTOSIS ## Renvoie le kurtosis d’une série de données. +LARGE = GRANDE.VALEUR ## Renvoie la k-ième plus grande valeur d’une série de données. +LINEST = DROITEREG ## Renvoie les paramètres d’une tendance linéaire. +LOGEST = LOGREG ## Renvoie les paramètres d’une tendance exponentielle. +LOGINV = LOI.LOGNORMALE.INVERSE ## Renvoie l’inverse de la probabilité pour une variable aléatoire suivant la loi lognormale. +LOGNORMDIST = LOI.LOGNORMALE ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi lognormale. +MAX = MAX ## Renvoie la valeur maximale contenue dans une liste d’arguments. +MAXA = MAXA ## Renvoie la valeur maximale d’une liste d’arguments, nombres, texte et valeurs logiques inclus. +MEDIAN = MEDIANE ## Renvoie la valeur médiane des nombres donnés. +MIN = MIN ## Renvoie la valeur minimale contenue dans une liste d’arguments. +MINA = MINA ## Renvoie la plus petite valeur d’une liste d’arguments, nombres, texte et valeurs logiques inclus. +MODE = MODE ## Renvoie la valeur la plus courante d’une série de données. +NEGBINOMDIST = LOI.BINOMIALE.NEG ## Renvoie la probabilité d’une variable aléatoire discrète suivant une loi binomiale négative. +NORMDIST = LOI.NORMALE ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi normale. +NORMINV = LOI.NORMALE.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi normale standard. +NORMSDIST = LOI.NORMALE.STANDARD ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi normale standard. +NORMSINV = LOI.NORMALE.STANDARD.INVERSE ## Renvoie l’inverse de la distribution cumulée normale standard. +PEARSON = PEARSON ## Renvoie le coefficient de corrélation d’échantillonnage de Pearson. +PERCENTILE = CENTILE ## Renvoie le k-ième centile des valeurs d’une plage. +PERCENTRANK = RANG.POURCENTAGE ## Renvoie le rang en pourcentage d’une valeur d’une série de données. +PERMUT = PERMUTATION ## Renvoie le nombre de permutations pour un nombre donné d’objets. +POISSON = LOI.POISSON ## Renvoie la probabilité d’une variable aléatoire suivant une loi de Poisson. +PROB = PROBABILITE ## Renvoie la probabilité que des valeurs d’une plage soient comprises entre deux limites. +QUARTILE = QUARTILE ## Renvoie le quartile d’une série de données. +RANK = RANG ## Renvoie le rang d’un nombre contenu dans une liste. +RSQ = COEFFICIENT.DETERMINATION ## Renvoie la valeur du coefficient de détermination R^2 d’une régression linéaire. +SKEW = COEFFICIENT.ASYMETRIE ## Renvoie l’asymétrie d’une distribution. +SLOPE = PENTE ## Renvoie la pente d’une droite de régression linéaire. +SMALL = PETITE.VALEUR ## Renvoie la k-ième plus petite valeur d’une série de données. +STANDARDIZE = CENTREE.REDUITE ## Renvoie une valeur centrée réduite. +STDEV = ECARTYPE ## Évalue l’écart type d’une population en se basant sur un échantillon de cette population. +STDEVA = STDEVA ## Évalue l’écart type d’une population en se basant sur un échantillon de cette population, nombres, texte et valeurs logiques inclus. +STDEVP = ECARTYPEP ## Calcule l’écart type d’une population à partir de la population entière. +STDEVPA = STDEVPA ## Calcule l’écart type d’une population à partir de l’ensemble de la population, nombres, texte et valeurs logiques inclus. +STEYX = ERREUR.TYPE.XY ## Renvoie l’erreur type de la valeur y prévue pour chaque x de la régression. +TDIST = LOI.STUDENT ## Renvoie la probabilité d’une variable aléatoire suivant une loi T de Student. +TINV = LOI.STUDENT.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi T de Student. +TREND = TENDANCE ## Renvoie des valeurs par rapport à une tendance linéaire. +TRIMMEAN = MOYENNE.REDUITE ## Renvoie la moyenne de l’intérieur d’une série de données. +TTEST = TEST.STUDENT ## Renvoie la probabilité associée à un test T de Student. +VAR = VAR ## Calcule la variance sur la base d’un échantillon. +VARA = VARA ## Estime la variance d’une population en se basant sur un échantillon de cette population, nombres, texte et valeurs logiques incluses. +VARP = VAR.P ## Calcule la variance sur la base de l’ensemble de la population. +VARPA = VARPA ## Calcule la variance d’une population en se basant sur la population entière, nombres, texte et valeurs logiques inclus. +WEIBULL = LOI.WEIBULL ## Renvoie la probabilité d’une variable aléatoire suivant une loi de Weibull. +ZTEST = TEST.Z ## Renvoie la valeur de probabilité unilatérale d’un test z. + + +## +## Text functions Fonctions de texte +## +ASC = ASC ## Change les caractères anglais ou katakana à pleine chasse (codés sur deux octets) à l’intérieur d’une chaîne de caractères en caractères à demi-chasse (codés sur un octet). +BAHTTEXT = BAHTTEXT ## Convertit un nombre en texte en utilisant le format monétaire ß (baht). +CHAR = CAR ## Renvoie le caractère spécifié par le code numérique. +CLEAN = EPURAGE ## Supprime tous les caractères de contrôle du texte. +CODE = CODE ## Renvoie le numéro de code du premier caractère du texte. +CONCATENATE = CONCATENER ## Assemble plusieurs éléments textuels de façon à n’en former qu’un seul. +DOLLAR = EURO ## Convertit un nombre en texte en utilisant le format monétaire € (euro). +EXACT = EXACT ## Vérifie si deux valeurs de texte sont identiques. +FIND = TROUVE ## Trouve un valeur textuelle dans une autre, en respectant la casse. +FINDB = TROUVERB ## Trouve un valeur textuelle dans une autre, en respectant la casse. +FIXED = CTXT ## Convertit un nombre au format texte avec un nombre de décimales spécifié. +JIS = JIS ## Change les caractères anglais ou katakana à demi-chasse (codés sur un octet) à l’intérieur d’une chaîne de caractères en caractères à à pleine chasse (codés sur deux octets). +LEFT = GAUCHE ## Renvoie des caractères situés à l’extrême gauche d’une chaîne de caractères. +LEFTB = GAUCHEB ## Renvoie des caractères situés à l’extrême gauche d’une chaîne de caractères. +LEN = NBCAR ## Renvoie le nombre de caractères contenus dans une chaîne de texte. +LENB = LENB ## Renvoie le nombre de caractères contenus dans une chaîne de texte. +LOWER = MINUSCULE ## Convertit le texte en minuscules. +MID = STXT ## Renvoie un nombre déterminé de caractères d’une chaîne de texte à partir de la position que vous indiquez. +MIDB = STXTB ## Renvoie un nombre déterminé de caractères d’une chaîne de texte à partir de la position que vous indiquez. +PHONETIC = PHONETIQUE ## Extrait les caractères phonétiques (furigana) d’une chaîne de texte. +PROPER = NOMPROPRE ## Met en majuscules la première lettre de chaque mot dans une chaîne textuelle. +REPLACE = REMPLACER ## Remplace des caractères dans un texte. +REPLACEB = REMPLACERB ## Remplace des caractères dans un texte. +REPT = REPT ## Répète un texte un certain nombre de fois. +RIGHT = DROITE ## Renvoie des caractères situés à l’extrême droite d’une chaîne de caractères. +RIGHTB = DROITEB ## Renvoie des caractères situés à l’extrême droite d’une chaîne de caractères. +SEARCH = CHERCHE ## Trouve un texte dans un autre texte (sans respecter la casse). +SEARCHB = CHERCHERB ## Trouve un texte dans un autre texte (sans respecter la casse). +SUBSTITUTE = SUBSTITUE ## Remplace l’ancien texte d’une chaîne de caractères par un nouveau. +T = T ## Convertit ses arguments en texte. +TEXT = TEXTE ## Convertit un nombre au format texte. +TRIM = SUPPRESPACE ## Supprime les espaces du texte. +UPPER = MAJUSCULE ## Convertit le texte en majuscules. +VALUE = CNUM ## Convertit un argument textuel en nombre diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/hu/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/hu/config new file mode 100644 index 0000000..db61436 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/hu/config @@ -0,0 +1,23 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = Ft + + +## +## Excel Error Codes (For future use) +## +NULL = #NULLA! +DIV0 = #ZÉRÓOSZTÓ! +VALUE = #ÉRTÉK! +REF = #HIV! +NAME = #NÉV? +NUM = #SZÁM! +NA = #HIÁNYZIK diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/hu/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/hu/functions new file mode 100644 index 0000000..3adffeb --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/hu/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Bővítmények és automatizálási függvények +## +GETPIVOTDATA = KIMUTATÁSADATOT.VESZ ## A kimutatásokban tárolt adatok visszaadására használható. + + +## +## Cube functions Kockafüggvények +## +CUBEKPIMEMBER = KOCKA.FŐTELJMUT ## Egy fő teljesítménymutató (KPI) nevét, tulajdonságát és mértékegységét adja eredményül, a nevet és a tulajdonságot megjeleníti a cellában. A KPI-k számszerűsíthető mérési lehetőséget jelentenek – ilyen mutató például a havi bruttó nyereség vagy az egy alkalmazottra jutó negyedéves forgalom –, egy szervezet teljesítményének nyomonkövetésére használhatók. +CUBEMEMBER = KOCKA.TAG ## Kockahierachia tagját vagy rekordját adja eredményül. Ellenőrizhető vele, hogy szerepel-e a kockában az adott tag vagy rekord. +CUBEMEMBERPROPERTY = KOCKA.TAG.TUL ## A kocka egyik tagtulajdonságának értékét adja eredményül. Használatával ellenőrizhető, hogy szerepel-e egy tagnév a kockában, eredménye pedig az erre a tagra vonatkozó, megadott tulajdonság. +CUBERANKEDMEMBER = KOCKA.HALM.ELEM ## Egy halmaz rangsor szerinti n-edik tagját adja eredményül. Használatával egy halmaz egy vagy több elemét kaphatja meg, például a legnagyobb teljesítményű üzletkötőt vagy a 10 legjobb tanulót. +CUBESET = KOCKA.HALM ## Számított tagok vagy rekordok halmazát adja eredményül, ehhez egy beállított kifejezést elküld a kiszolgálón található kockának, majd ezt a halmazt adja vissza a Microsoft Office Excel alkalmazásnak. +CUBESETCOUNT = KOCKA.HALM.DB ## Egy halmaz elemszámát adja eredményül. +CUBEVALUE = KOCKA.ÉRTÉK ## Kockából összesített értéket ad eredményül. + + +## +## Database functions Adatbázis-kezelő függvények +## +DAVERAGE = AB.ÁTLAG ## A kijelölt adatbáziselemek átlagát számítja ki. +DCOUNT = AB.DARAB ## Megszámolja, hogy az adatbázisban hány cella tartalmaz számokat. +DCOUNTA = AB.DARAB2 ## Megszámolja az adatbázisban lévő nem üres cellákat. +DGET = AB.MEZŐ ## Egy adatbázisból egyetlen olyan rekordot ad vissza, amely megfelel a megadott feltételeknek. +DMAX = AB.MAX ## A kiválasztott adatbáziselemek közül a legnagyobb értéket adja eredményül. +DMIN = AB.MIN ## A kijelölt adatbáziselemek közül a legkisebb értéket adja eredményül. +DPRODUCT = AB.SZORZAT ## Az adatbázis megadott feltételeknek eleget tevő rekordjaira összeszorozza a megadott mezőben található számértékeket, és eredményül ezt a szorzatot adja. +DSTDEV = AB.SZÓRÁS ## A kijelölt adatbáziselemek egy mintája alapján megbecsüli a szórást. +DSTDEVP = AB.SZÓRÁS2 ## A kijelölt adatbáziselemek teljes sokasága alapján kiszámítja a szórást. +DSUM = AB.SZUM ## Összeadja a feltételnek megfelelő adatbázisrekordok mezőoszlopában a számokat. +DVAR = AB.VAR ## A kijelölt adatbáziselemek mintája alapján becslést ad a szórásnégyzetre. +DVARP = AB.VAR2 ## A kijelölt adatbáziselemek teljes sokasága alapján kiszámítja a szórásnégyzetet. + + +## +## Date and time functions Dátumfüggvények +## +DATE = DÁTUM ## Adott dátum dátumértékét adja eredményül. +DATEVALUE = DÁTUMÉRTÉK ## Szövegként megadott dátumot dátumértékké alakít át. +DAY = NAP ## Dátumértéket a hónap egy napjává (0-31) alakít. +DAYS360 = NAP360 ## Két dátum közé eső napok számát számítja ki a 360 napos év alapján. +EDATE = EDATE ## Adott dátumnál adott számú hónappal korábbi vagy későbbi dátum dátumértékét adja eredményül. +EOMONTH = EOMONTH ## Adott dátumnál adott számú hónappal korábbi vagy későbbi hónap utolsó napjának dátumértékét adja eredményül. +HOUR = ÓRA ## Időértéket órákká alakít. +MINUTE = PERC ## Időértéket percekké alakít. +MONTH = HÓNAP ## Időértéket hónapokká alakít. +NETWORKDAYS = NETWORKDAYS ## Két dátum között a teljes munkanapok számát adja meg. +NOW = MOST ## A napi dátum dátumértékét és a pontos idő időértékét adja eredményül. +SECOND = MPERC ## Időértéket másodpercekké alakít át. +TIME = IDŐ ## Adott időpont időértékét adja meg. +TIMEVALUE = IDŐÉRTÉK ## Szövegként megadott időpontot időértékké alakít át. +TODAY = MA ## A napi dátum dátumértékét adja eredményül. +WEEKDAY = HÉT.NAPJA ## Dátumértéket a hét napjává alakítja át. +WEEKNUM = WEEKNUM ## Visszatérési értéke egy szám, amely azt mutatja meg, hogy a megadott dátum az év hányadik hetére esik. +WORKDAY = WORKDAY ## Adott dátumnál adott munkanappal korábbi vagy későbbi dátum dátumértékét adja eredményül. +YEAR = ÉV ## Sorszámot évvé alakít át. +YEARFRAC = YEARFRAC ## Az adott dátumok közötti teljes napok számát törtévként adja meg. + + +## +## Engineering functions Mérnöki függvények +## +BESSELI = BESSELI ## Az In(x) módosított Bessel-függvény értékét adja eredményül. +BESSELJ = BESSELJ ## A Jn(x) Bessel-függvény értékét adja eredményül. +BESSELK = BESSELK ## A Kn(x) módosított Bessel-függvény értékét adja eredményül. +BESSELY = BESSELY ## Az Yn(x) módosított Bessel-függvény értékét adja eredményül. +BIN2DEC = BIN2DEC ## Bináris számot decimálissá alakít át. +BIN2HEX = BIN2HEX ## Bináris számot hexadecimálissá alakít át. +BIN2OCT = BIN2OCT ## Bináris számot oktálissá alakít át. +COMPLEX = COMPLEX ## Valós és képzetes részből komplex számot képez. +CONVERT = CONVERT ## Mértékegységeket vált át. +DEC2BIN = DEC2BIN ## Decimális számot binárissá alakít át. +DEC2HEX = DEC2HEX ## Decimális számot hexadecimálissá alakít át. +DEC2OCT = DEC2OCT ## Decimális számot oktálissá alakít át. +DELTA = DELTA ## Azt vizsgálja, hogy két érték egyenlő-e. +ERF = ERF ## A hibafüggvény értékét adja eredményül. +ERFC = ERFC ## A kiegészített hibafüggvény értékét adja eredményül. +GESTEP = GESTEP ## Azt vizsgálja, hogy egy szám nagyobb-e adott küszöbértéknél. +HEX2BIN = HEX2BIN ## Hexadecimális számot binárissá alakít át. +HEX2DEC = HEX2DEC ## Hexadecimális számot decimálissá alakít át. +HEX2OCT = HEX2OCT ## Hexadecimális számot oktálissá alakít át. +IMABS = IMABS ## Komplex szám abszolút értékét (modulusát) adja eredményül. +IMAGINARY = IMAGINARY ## Komplex szám képzetes részét adja eredményül. +IMARGUMENT = IMARGUMENT ## A komplex szám radiánban kifejezett théta argumentumát adja eredményül. +IMCONJUGATE = IMCONJUGATE ## Komplex szám komplex konjugáltját adja eredményül. +IMCOS = IMCOS ## Komplex szám koszinuszát adja eredményül. +IMDIV = IMDIV ## Két komplex szám hányadosát adja eredményül. +IMEXP = IMEXP ## Az e szám komplex kitevőjű hatványát adja eredményül. +IMLN = IMLN ## Komplex szám természetes logaritmusát adja eredményül. +IMLOG10 = IMLOG10 ## Komplex szám tízes alapú logaritmusát adja eredményül. +IMLOG2 = IMLOG2 ## Komplex szám kettes alapú logaritmusát adja eredményül. +IMPOWER = IMPOWER ## Komplex szám hatványát adja eredményül. +IMPRODUCT = IMPRODUCT ## Komplex számok szorzatát adja eredményül. +IMREAL = IMREAL ## Komplex szám valós részét adja eredményül. +IMSIN = IMSIN ## Komplex szám szinuszát adja eredményül. +IMSQRT = IMSQRT ## Komplex szám négyzetgyökét adja eredményül. +IMSUB = IMSUB ## Két komplex szám különbségét adja eredményül. +IMSUM = IMSUM ## Komplex számok összegét adja eredményül. +OCT2BIN = OCT2BIN ## Oktális számot binárissá alakít át. +OCT2DEC = OCT2DEC ## Oktális számot decimálissá alakít át. +OCT2HEX = OCT2HEX ## Oktális számot hexadecimálissá alakít át. + + +## +## Financial functions Pénzügyi függvények +## +ACCRINT = ACCRINT ## Periodikusan kamatozó értékpapír felszaporodott kamatát adja eredményül. +ACCRINTM = ACCRINTM ## Lejáratkor kamatozó értékpapír felszaporodott kamatát adja eredményül. +AMORDEGRC = AMORDEGRC ## Állóeszköz lineáris értékcsökkenését adja meg az egyes könyvelési időszakokra vonatkozóan. +AMORLINC = AMORLINC ## Az egyes könyvelési időszakokban az értékcsökkenést adja meg. +COUPDAYBS = COUPDAYBS ## A szelvényidőszak kezdetétől a kifizetés időpontjáig eltelt napokat adja vissza. +COUPDAYS = COUPDAYS ## A kifizetés időpontját magában foglaló szelvényperiódus hosszát adja meg napokban. +COUPDAYSNC = COUPDAYSNC ## A kifizetés időpontja és a legközelebbi szelvénydátum közötti napok számát adja meg. +COUPNCD = COUPNCD ## A kifizetést követő legelső szelvénydátumot adja eredményül. +COUPNUM = COUPNUM ## A kifizetés és a lejárat időpontja között kifizetendő szelvények számát adja eredményül. +COUPPCD = COUPPCD ## A kifizetés előtti utolsó szelvénydátumot adja eredményül. +CUMIPMT = CUMIPMT ## Két fizetési időszak között kifizetett kamat halmozott értékét adja eredményül. +CUMPRINC = CUMPRINC ## Két fizetési időszak között kifizetett részletek halmozott (kamatot nem tartalmazó) értékét adja eredményül. +DB = KCS2 ## Eszköz adott időszak alatti értékcsökkenését számítja ki a lineáris leírási modell alkalmazásával. +DDB = KCSA ## Eszköz értékcsökkenését számítja ki adott időszakra vonatkozóan a progresszív vagy egyéb megadott leírási modell alkalmazásával. +DISC = DISC ## Értékpapír leszámítolási kamatlábát adja eredményül. +DOLLARDE = DOLLARDE ## Egy közönséges törtként megadott számot tizedes törtté alakít át. +DOLLARFR = DOLLARFR ## Tizedes törtként megadott számot közönséges törtté alakít át. +DURATION = DURATION ## Periodikus kamatfizetésű értékpapír éves kamatérzékenységét adja eredményül. +EFFECT = EFFECT ## Az éves tényleges kamatláb értékét adja eredményül. +FV = JBÉ ## Befektetés jövőbeli értékét számítja ki. +FVSCHEDULE = FVSCHEDULE ## A kezdőtőke adott kamatlábak szerint megnövelt jövőbeli értékét adja eredményül. +INTRATE = INTRATE ## A lejáratig teljesen lekötött értékpapír kamatrátáját adja eredményül. +IPMT = RRÉSZLET ## Hiteltörlesztésen belül a tőketörlesztés nagyságát számítja ki adott időszakra. +IRR = BMR ## A befektetés belső megtérülési rátáját számítja ki pénzáramláshoz. +ISPMT = LRÉSZLETKAMAT ## A befektetés adott időszakára fizetett kamatot számítja ki. +MDURATION = MDURATION ## Egy 100 Ft névértékű értékpapír Macauley-féle módosított kamatérzékenységét adja eredményül. +MIRR = MEGTÉRÜLÉS ## A befektetés belső megtérülési rátáját számítja ki a költségek és a bevételek különböző kamatlába mellett. +NOMINAL = NOMINAL ## Az éves névleges kamatláb értékét adja eredményül. +NPER = PER.SZÁM ## A törlesztési időszakok számát adja meg. +NPV = NMÉ ## Befektetéshez kapcsolódó pénzáramlás nettó jelenértékét számítja ki ismert pénzáramlás és kamatláb mellett. +ODDFPRICE = ODDFPRICE ## Egy 100 Ft névértékű, a futamidő elején töredék-időszakos értékpapír árát adja eredményül. +ODDFYIELD = ODDFYIELD ## A futamidő elején töredék-időszakos értékpapír hozamát adja eredményül. +ODDLPRICE = ODDLPRICE ## Egy 100 Ft névértékű, a futamidő végén töredék-időszakos értékpapír árát adja eredményül. +ODDLYIELD = ODDLYIELD ## A futamidő végén töredék-időszakos értékpapír hozamát adja eredményül. +PMT = RÉSZLET ## A törlesztési időszakra vonatkozó törlesztési összeget számítja ki. +PPMT = PRÉSZLET ## Hiteltörlesztésen belül a tőketörlesztés nagyságát számítja ki adott időszakra. +PRICE = PRICE ## Egy 100 Ft névértékű, periodikusan kamatozó értékpapír árát adja eredményül. +PRICEDISC = PRICEDISC ## Egy 100 Ft névértékű leszámítolt értékpapír árát adja eredményül. +PRICEMAT = PRICEMAT ## Egy 100 Ft névértékű, a lejáratkor kamatozó értékpapír árát adja eredményül. +PV = MÉ ## Befektetés jelenlegi értékét számítja ki. +RATE = RÁTA ## Egy törlesztési időszakban az egy időszakra eső kamatláb nagyságát számítja ki. +RECEIVED = RECEIVED ## A lejáratig teljesen lekötött értékpapír lejáratakor kapott összegét adja eredményül. +SLN = LCSA ## Tárgyi eszköz egy időszakra eső amortizációját adja meg bruttó érték szerinti lineáris leírási kulcsot alkalmazva. +SYD = SYD ## Tárgyi eszköz értékcsökkenését számítja ki adott időszakra az évek számjegyösszegével dolgozó módszer alapján. +TBILLEQ = TBILLEQ ## Kincstárjegy kötvény-egyenértékű hozamát adja eredményül. +TBILLPRICE = TBILLPRICE ## Egy 100 Ft névértékű kincstárjegy árát adja eredményül. +TBILLYIELD = TBILLYIELD ## Kincstárjegy hozamát adja eredményül. +VDB = ÉCSRI ## Tárgyi eszköz amortizációját számítja ki megadott vagy részidőszakra a csökkenő egyenleg módszerének alkalmazásával. +XIRR = XIRR ## Ütemezett készpénzforgalom (cash flow) belső megtérülési kamatrátáját adja eredményül. +XNPV = XNPV ## Ütemezett készpénzforgalom (cash flow) nettó jelenlegi értékét adja eredményül. +YIELD = YIELD ## Periodikusan kamatozó értékpapír hozamát adja eredményül. +YIELDDISC = YIELDDISC ## Leszámítolt értékpapír (például kincstárjegy) éves hozamát adja eredményül. +YIELDMAT = YIELDMAT ## Lejáratkor kamatozó értékpapír éves hozamát adja eredményül. + + +## +## Information functions Információs függvények +## +CELL = CELLA ## Egy cella formátumára, elhelyezkedésére vagy tartalmára vonatkozó adatokat ad eredményül. +ERROR.TYPE = HIBA.TÍPUS ## Egy hibatípushoz tartozó számot ad eredményül. +INFO = INFÓ ## A rendszer- és munkakörnyezet pillanatnyi állapotáról ad felvilágosítást. +ISBLANK = ÜRES ## Eredménye IGAZ, ha az érték üres. +ISERR = HIBA ## Eredménye IGAZ, ha az érték valamelyik hibaérték a #HIÁNYZIK kivételével. +ISERROR = HIBÁS ## Eredménye IGAZ, ha az érték valamelyik hibaérték. +ISEVEN = ISEVEN ## Eredménye IGAZ, ha argumentuma páros szám. +ISLOGICAL = LOGIKAI ## Eredménye IGAZ, ha az érték logikai érték. +ISNA = NINCS ## Eredménye IGAZ, ha az érték a #HIÁNYZIK hibaérték. +ISNONTEXT = NEM.SZÖVEG ## Eredménye IGAZ, ha az érték nem szöveg. +ISNUMBER = SZÁM ## Eredménye IGAZ, ha az érték szám. +ISODD = ISODD ## Eredménye IGAZ, ha argumentuma páratlan szám. +ISREF = HIVATKOZÁS ## Eredménye IGAZ, ha az érték hivatkozás. +ISTEXT = SZÖVEG.E ## Eredménye IGAZ, ha az érték szöveg. +N = N ## Argumentumának értékét számmá alakítja. +NA = HIÁNYZIK ## Eredménye a #HIÁNYZIK hibaérték. +TYPE = TÍPUS ## Érték adattípusának azonosítószámát adja eredményül. + + +## +## Logical functions Logikai függvények +## +AND = ÉS ## Eredménye IGAZ, ha minden argumentuma IGAZ. +FALSE = HAMIS ## A HAMIS logikai értéket adja eredményül. +IF = HA ## Logikai vizsgálatot hajt végre. +IFERROR = HAHIBA ## A megadott értéket adja vissza, ha egy képlet hibához vezet; más esetben a képlet értékét adja eredményül. +NOT = NEM ## Argumentuma értékének ellentettjét adja eredményül. +OR = VAGY ## Eredménye IGAZ, ha bármely argumentuma IGAZ. +TRUE = IGAZ ## Az IGAZ logikai értéket adja eredményül. + + +## +## Lookup and reference functions Keresési és hivatkozási függvények +## +ADDRESS = CÍM ## A munkalap egy cellájára való hivatkozást adja szövegként eredményül. +AREAS = TERÜLET ## Hivatkozásban a területek számát adja eredményül. +CHOOSE = VÁLASZT ## Értékek listájából választ ki egy elemet. +COLUMN = OSZLOP ## Egy hivatkozás oszlopszámát adja eredményül. +COLUMNS = OSZLOPOK ## A hivatkozásban található oszlopok számát adja eredményül. +HLOOKUP = VKERES ## A megadott tömb felső sorában adott értékű elemet keres, és a megtalált elem oszlopából adott sorban elhelyezkedő értékkel tér vissza. +HYPERLINK = HIPERHIVATKOZÁS ## Hálózati kiszolgálón, intraneten vagy az interneten tárolt dokumentumot megnyitó parancsikont vagy hivatkozást hoz létre. +INDEX = INDEX ## Tömb- vagy hivatkozás indexszel megadott értékét adja vissza. +INDIRECT = INDIREKT ## Szöveg megadott hivatkozást ad eredményül. +LOOKUP = KERES ## Vektorban vagy tömbben keres meg értékeket. +MATCH = HOL.VAN ## Hivatkozásban vagy tömbben értékeket keres. +OFFSET = OFSZET ## Hivatkozás egy másik hivatkozástól számított távolságát adja meg. +ROW = SOR ## Egy hivatkozás sorának számát adja meg. +ROWS = SOROK ## Egy hivatkozás sorainak számát adja meg. +RTD = RTD ## Valós idejű adatokat keres vissza a COM automatizmust (automatizálás: Egy alkalmazás objektumaival való munka másik alkalmazásból vagy fejlesztőeszközből. A korábban OLE automatizmusnak nevezett automatizálás iparági szabvány, a Component Object Model (COM) szolgáltatása.) támogató programból. +TRANSPOSE = TRANSZPONÁLÁS ## Egy tömb transzponáltját adja eredményül. +VLOOKUP = FKERES ## A megadott tömb bal szélső oszlopában megkeres egy értéket, majd annak sora és a megadott oszlop metszéspontjában levő értéked adja eredményül. + + +## +## Math and trigonometry functions Matematikai és trigonometrikus függvények +## +ABS = ABS ## Egy szám abszolút értékét adja eredményül. +ACOS = ARCCOS ## Egy szám arkusz koszinuszát számítja ki. +ACOSH = ACOSH ## Egy szám inverz koszinusz hiperbolikuszát számítja ki. +ASIN = ARCSIN ## Egy szám arkusz szinuszát számítja ki. +ASINH = ASINH ## Egy szám inverz szinusz hiperbolikuszát számítja ki. +ATAN = ARCTAN ## Egy szám arkusz tangensét számítja ki. +ATAN2 = ARCTAN2 ## X és y koordináták alapján számítja ki az arkusz tangens értéket. +ATANH = ATANH ## A szám inverz tangens hiperbolikuszát számítja ki. +CEILING = PLAFON ## Egy számot a legközelebbi egészre vagy a pontosságként megadott érték legközelebb eső többszörösére kerekít. +COMBIN = KOMBINÁCIÓK ## Adott számú objektum összes lehetséges kombinációinak számát számítja ki. +COS = COS ## Egy szám koszinuszát számítja ki. +COSH = COSH ## Egy szám koszinusz hiperbolikuszát számítja ki. +DEGREES = FOK ## Radiánt fokká alakít át. +EVEN = PÁROS ## Egy számot a legközelebbi páros egész számra kerekít. +EXP = KITEVŐ ## Az e adott kitevőjű hatványát adja eredményül. +FACT = FAKT ## Egy szám faktoriálisát számítja ki. +FACTDOUBLE = FACTDOUBLE ## Egy szám dupla faktoriálisát adja eredményül. +FLOOR = PADLÓ ## Egy számot lefelé, a nulla felé kerekít. +GCD = GCD ## A legnagyobb közös osztót adja eredményül. +INT = INT ## Egy számot lefelé kerekít a legközelebbi egészre. +LCM = LCM ## A legkisebb közös többszöröst adja eredményül. +LN = LN ## Egy szám természetes logaritmusát számítja ki. +LOG = LOG ## Egy szám adott alapú logaritmusát számítja ki. +LOG10 = LOG10 ## Egy szám 10-es alapú logaritmusát számítja ki. +MDETERM = MDETERM ## Egy tömb mátrix-determinánsát számítja ki. +MINVERSE = INVERZ.MÁTRIX ## Egy tömb mátrix inverzét adja eredményül. +MMULT = MSZORZAT ## Két tömb mátrix-szorzatát adja meg. +MOD = MARADÉK ## Egy szám osztási maradékát adja eredményül. +MROUND = MROUND ## A kívánt többszörösére kerekített értéket ad eredményül. +MULTINOMIAL = MULTINOMIAL ## Számhalmaz multinomiálisát adja eredményül. +ODD = PÁRATLAN ## Egy számot a legközelebbi páratlan számra kerekít. +PI = PI ## A pi matematikai állandót adja vissza. +POWER = HATVÁNY ## Egy szám adott kitevőjű hatványát számítja ki. +PRODUCT = SZORZAT ## Argumentumai szorzatát számítja ki. +QUOTIENT = QUOTIENT ## Egy hányados egész részét adja eredményül. +RADIANS = RADIÁN ## Fokot radiánná alakít át. +RAND = VÉL ## Egy 0 és 1 közötti véletlen számot ad eredményül. +RANDBETWEEN = RANDBETWEEN ## Megadott számok közé eső véletlen számot állít elő. +ROMAN = RÓMAI ## Egy számot római számokkal kifejezve szövegként ad eredményül. +ROUND = KEREKÍTÉS ## Egy számot adott számú számjegyre kerekít. +ROUNDDOWN = KEREKÍTÉS.LE ## Egy számot lefelé, a nulla felé kerekít. +ROUNDUP = KEREKÍTÉS.FEL ## Egy számot felfelé, a nullától távolabbra kerekít. +SERIESSUM = SERIESSUM ## Hatványsor összegét adja eredményül. +SIGN = ELŐJEL ## Egy szám előjelét adja meg. +SIN = SIN ## Egy szög szinuszát számítja ki. +SINH = SINH ## Egy szám szinusz hiperbolikuszát számítja ki. +SQRT = GYÖK ## Egy szám pozitív négyzetgyökét számítja ki. +SQRTPI = SQRTPI ## A (szám*pi) négyzetgyökét adja eredményül. +SUBTOTAL = RÉSZÖSSZEG ## Lista vagy adatbázis részösszegét adja eredményül. +SUM = SZUM ## Összeadja az argumentumlistájában lévő számokat. +SUMIF = SZUMHA ## A megadott feltételeknek eleget tevő cellákban található értékeket adja össze. +SUMIFS = SZUMHATÖBB ## Több megadott feltételnek eleget tévő tartománycellák összegét adja eredményül. +SUMPRODUCT = SZORZATÖSSZEG ## A megfelelő tömbelemek szorzatának összegét számítja ki. +SUMSQ = NÉGYZETÖSSZEG ## Argumentumai négyzetének összegét számítja ki. +SUMX2MY2 = SZUMX2BŐLY2 ## Két tömb megfelelő elemei négyzetének különbségét összegzi. +SUMX2PY2 = SZUMX2MEGY2 ## Két tömb megfelelő elemei négyzetének összegét összegzi. +SUMXMY2 = SZUMXBŐLY2 ## Két tömb megfelelő elemei különbségének négyzetösszegét számítja ki. +TAN = TAN ## Egy szám tangensét számítja ki. +TANH = TANH ## Egy szám tangens hiperbolikuszát számítja ki. +TRUNC = CSONK ## Egy számot egésszé csonkít. + + +## +## Statistical functions Statisztikai függvények +## +AVEDEV = ÁTL.ELTÉRÉS ## Az adatpontoknak átlaguktól való átlagos abszolút eltérését számítja ki. +AVERAGE = ÁTLAG ## Argumentumai átlagát számítja ki. +AVERAGEA = ÁTLAGA ## Argumentumai átlagát számítja ki (beleértve a számokat, szöveget és logikai értékeket). +AVERAGEIF = ÁTLAGHA ## A megadott feltételnek eleget tévő tartomány celláinak átlagát (számtani közepét) adja eredményül. +AVERAGEIFS = ÁTLAGHATÖBB ## A megadott feltételeknek eleget tévő cellák átlagát (számtani közepét) adja eredményül. +BETADIST = BÉTA.ELOSZLÁS ## A béta-eloszlás függvényt számítja ki. +BETAINV = INVERZ.BÉTA ## Adott béta-eloszláshoz kiszámítja a béta eloszlásfüggvény inverzét. +BINOMDIST = BINOM.ELOSZLÁS ## A diszkrét binomiális eloszlás valószínűségértékét számítja ki. +CHIDIST = KHI.ELOSZLÁS ## A khi-négyzet-eloszlás egyszélű valószínűségértékét számítja ki. +CHIINV = INVERZ.KHI ## A khi-négyzet-eloszlás egyszélű valószínűségértékének inverzét számítja ki. +CHITEST = KHI.PRÓBA ## Függetlenségvizsgálatot hajt végre. +CONFIDENCE = MEGBÍZHATÓSÁG ## Egy statisztikai sokaság várható értékének megbízhatósági intervallumát adja eredményül. +CORREL = KORREL ## Két adathalmaz korrelációs együtthatóját számítja ki. +COUNT = DARAB ## Megszámolja, hogy argumentumlistájában hány szám található. +COUNTA = DARAB2 ## Megszámolja, hogy argumentumlistájában hány érték található. +COUNTBLANK = DARABÜRES ## Egy tartományban összeszámolja az üres cellákat. +COUNTIF = DARABTELI ## Egy tartományban összeszámolja azokat a cellákat, amelyek eleget tesznek a megadott feltételnek. +COUNTIFS = DARABHATÖBB ## Egy tartományban összeszámolja azokat a cellákat, amelyek eleget tesznek több feltételnek. +COVAR = KOVAR ## A kovarianciát, azaz a páronkénti eltérések szorzatának átlagát számítja ki. +CRITBINOM = KRITBINOM ## Azt a legkisebb számot adja eredményül, amelyre a binomiális eloszlásfüggvény értéke nem kisebb egy adott határértéknél. +DEVSQ = SQ ## Az átlagtól való eltérések négyzetének összegét számítja ki. +EXPONDIST = EXP.ELOSZLÁS ## Az exponenciális eloszlás értékét számítja ki. +FDIST = F.ELOSZLÁS ## Az F-eloszlás értékét számítja ki. +FINV = INVERZ.F ## Az F-eloszlás inverzének értékét számítja ki. +FISHER = FISHER ## Fisher-transzformációt hajt végre. +FISHERINV = INVERZ.FISHER ## A Fisher-transzformáció inverzét hajtja végre. +FORECAST = ELŐREJELZÉS ## Az ismert értékek alapján lineáris regresszióval becsült értéket ad eredményül. +FREQUENCY = GYAKORISÁG ## A gyakorisági vagy empirikus eloszlás értékét függőleges tömbként adja eredményül. +FTEST = F.PRÓBA ## Az F-próba értékét adja eredményül. +GAMMADIST = GAMMA.ELOSZLÁS ## A gamma-eloszlás értékét számítja ki. +GAMMAINV = INVERZ.GAMMA ## A gamma-eloszlás eloszlásfüggvénye inverzének értékét számítja ki. +GAMMALN = GAMMALN ## A gamma-függvény természetes logaritmusát számítja ki. +GEOMEAN = MÉRTANI.KÖZÉP ## Argumentumai mértani középértékét számítja ki. +GROWTH = NÖV ## Exponenciális regresszió alapján ad becslést. +HARMEAN = HARM.KÖZÉP ## Argumentumai harmonikus átlagát számítja ki. +HYPGEOMDIST = HIPERGEOM.ELOSZLÁS ## A hipergeometriai eloszlás értékét számítja ki. +INTERCEPT = METSZ ## A regressziós egyenes y tengellyel való metszéspontját határozza meg. +KURT = CSÚCSOSSÁG ## Egy adathalmaz csúcsosságát számítja ki. +LARGE = NAGY ## Egy adathalmaz k-adik legnagyobb elemét adja eredményül. +LINEST = LIN.ILL ## A legkisebb négyzetek módszerével az adatokra illesztett egyenes paramétereit határozza meg. +LOGEST = LOG.ILL ## Az adatokra illesztett exponenciális görbe paramétereit határozza meg. +LOGINV = INVERZ.LOG.ELOSZLÁS ## A lognormális eloszlás inverzét számítja ki. +LOGNORMDIST = LOG.ELOSZLÁS ## A lognormális eloszlásfüggvény értékét számítja ki. +MAX = MAX ## Az argumentumai között szereplő legnagyobb számot adja meg. +MAXA = MAX2 ## Az argumentumai között szereplő legnagyobb számot adja meg (beleértve a számokat, szöveget és logikai értékeket). +MEDIAN = MEDIÁN ## Adott számhalmaz mediánját számítja ki. +MIN = MIN ## Az argumentumai között szereplő legkisebb számot adja meg. +MINA = MIN2 ## Az argumentumai között szereplő legkisebb számot adja meg, beleértve a számokat, szöveget és logikai értékeket. +MODE = MÓDUSZ ## Egy adathalmazból kiválasztja a leggyakrabban előforduló számot. +NEGBINOMDIST = NEGBINOM.ELOSZL ## A negatív binomiális eloszlás értékét számítja ki. +NORMDIST = NORM.ELOSZL ## A normális eloszlás értékét számítja ki. +NORMINV = INVERZ.NORM ## A normális eloszlás eloszlásfüggvénye inverzének értékét számítja ki. +NORMSDIST = STNORMELOSZL ## A standard normális eloszlás eloszlásfüggvényének értékét számítja ki. +NORMSINV = INVERZ.STNORM ## A standard normális eloszlás eloszlásfüggvénye inverzének értékét számítja ki. +PEARSON = PEARSON ## A Pearson-féle korrelációs együtthatót számítja ki. +PERCENTILE = PERCENTILIS ## Egy tartományban található értékek k-adik percentilisét, azaz százalékosztályát adja eredményül. +PERCENTRANK = SZÁZALÉKRANG ## Egy értéknek egy adathalmazon belül vett százalékos rangját (elhelyezkedését) számítja ki. +PERMUT = VARIÁCIÓK ## Adott számú objektum k-ad osztályú ismétlés nélküli variációinak számát számítja ki. +POISSON = POISSON ## A Poisson-eloszlás értékét számítja ki. +PROB = VALÓSZÍNŰSÉG ## Annak valószínűségét számítja ki, hogy adott értékek két határérték közé esnek. +QUARTILE = KVARTILIS ## Egy adathalmaz kvartilisét (negyedszintjét) számítja ki. +RANK = SORSZÁM ## Kiszámítja, hogy egy szám hányadik egy számsorozatban. +RSQ = RNÉGYZET ## Kiszámítja a Pearson-féle szorzatmomentum korrelációs együtthatójának négyzetét. +SKEW = FERDESÉG ## Egy eloszlás ferdeségét határozza meg. +SLOPE = MEREDEKSÉG ## Egy lineáris regressziós egyenes meredekségét számítja ki. +SMALL = KICSI ## Egy adathalmaz k-adik legkisebb elemét adja meg. +STANDARDIZE = NORMALIZÁLÁS ## Normalizált értéket ad eredményül. +STDEV = SZÓRÁS ## Egy statisztikai sokaság mintájából kiszámítja annak szórását. +STDEVA = SZÓRÁSA ## Egy statisztikai sokaság mintájából kiszámítja annak szórását (beleértve a számokat, szöveget és logikai értékeket). +STDEVP = SZÓRÁSP ## Egy statisztikai sokaság egészéből kiszámítja annak szórását. +STDEVPA = SZÓRÁSPA ## Egy statisztikai sokaság egészéből kiszámítja annak szórását (beleértve számokat, szöveget és logikai értékeket). +STEYX = STHIBAYX ## Egy regresszió esetén az egyes x-értékek alapján meghatározott y-értékek standard hibáját számítja ki. +TDIST = T.ELOSZLÁS ## A Student-féle t-eloszlás értékét számítja ki. +TINV = INVERZ.T ## A Student-féle t-eloszlás inverzét számítja ki. +TREND = TREND ## Lineáris trend értékeit számítja ki. +TRIMMEAN = RÉSZÁTLAG ## Egy adathalmaz középső részének átlagát számítja ki. +TTEST = T.PRÓBA ## A Student-féle t-próbához tartozó valószínűséget számítja ki. +VAR = VAR ## Minta alapján becslést ad a varianciára. +VARA = VARA ## Minta alapján becslést ad a varianciára (beleértve számokat, szöveget és logikai értékeket). +VARP = VARP ## Egy statisztikai sokaság varianciáját számítja ki. +VARPA = VARPA ## Egy statisztikai sokaság varianciáját számítja ki (beleértve számokat, szöveget és logikai értékeket). +WEIBULL = WEIBULL ## A Weibull-féle eloszlás értékét számítja ki. +ZTEST = Z.PRÓBA ## Az egyszélű z-próbával kapott valószínűségértéket számítja ki. + + +## +## Text functions Szövegműveletekhez használható függvények +## +ASC = ASC ## Szöveg teljes szélességű (kétbájtos) latin és katakana karaktereit félszélességű (egybájtos) karakterekké alakítja. +BAHTTEXT = BAHTSZÖVEG ## Számot szöveggé alakít a ß (baht) pénznemformátum használatával. +CHAR = KARAKTER ## A kódszámmal meghatározott karaktert adja eredményül. +CLEAN = TISZTÍT ## A szövegből eltávolítja az összes nem nyomtatható karaktert. +CODE = KÓD ## Karaktersorozat első karakterének numerikus kódját adja eredményül. +CONCATENATE = ÖSSZEFŰZ ## Több szövegelemet egyetlen szöveges elemmé fűz össze. +DOLLAR = FORINT ## Számot pénznem formátumú szöveggé alakít át. +EXACT = AZONOS ## Megvizsgálja, hogy két érték azonos-e. +FIND = SZÖVEG.TALÁL ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk megkülönböztetésével). +FINDB = SZÖVEG.TALÁL2 ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk megkülönböztetésével). +FIXED = FIX ## Számot szöveges formátumúra alakít adott számú tizedesjegyre kerekítve. +JIS = JIS ## A félszélességű (egybájtos) latin és a katakana karaktereket teljes szélességű (kétbájtos) karakterekké alakítja. +LEFT = BAL ## Szöveg bal szélső karaktereit adja eredményül. +LEFTB = BAL2 ## Szöveg bal szélső karaktereit adja eredményül. +LEN = HOSSZ ## Szöveg karakterekben mért hosszát adja eredményül. +LENB = HOSSZ2 ## Szöveg karakterekben mért hosszát adja eredményül. +LOWER = KISBETŰ ## Szöveget kisbetűssé alakít át. +MID = KÖZÉP ## A szöveg adott pozíciójától kezdve megadott számú karaktert ad vissza eredményként. +MIDB = KÖZÉP2 ## A szöveg adott pozíciójától kezdve megadott számú karaktert ad vissza eredményként. +PHONETIC = PHONETIC ## Szöveg furigana (fonetikus) karaktereit adja vissza. +PROPER = TNÉV ## Szöveg minden szavának kezdőbetűjét nagybetűsre cseréli. +REPLACE = CSERE ## A szövegen belül karaktereket cserél. +REPLACEB = CSERE2 ## A szövegen belül karaktereket cserél. +REPT = SOKSZOR ## Megadott számú alkalommal megismétel egy szövegrészt. +RIGHT = JOBB ## Szövegrész jobb szélső karaktereit adja eredményül. +RIGHTB = JOBB2 ## Szövegrész jobb szélső karaktereit adja eredményül. +SEARCH = SZÖVEG.KERES ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk között nem tesz különbséget). +SEARCHB = SZÖVEG.KERES2 ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk között nem tesz különbséget). +SUBSTITUTE = HELYETTE ## Szövegben adott karaktereket másikra cserél. +T = T ## Argumentumát szöveggé alakítja át. +TEXT = SZÖVEG ## Számértéket alakít át adott számformátumú szöveggé. +TRIM = TRIM ## A szövegből eltávolítja a szóközöket. +UPPER = NAGYBETŰS ## Szöveget nagybetűssé alakít át. +VALUE = ÉRTÉK ## Szöveget számmá alakít át. diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/it/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/it/config new file mode 100644 index 0000000..6cc013a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/it/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) + +## +NULL = #NULLO! +DIV0 = #DIV/0! +VALUE = #VALORE! +REF = #RIF! +NAME = #NOME? +NUM = #NUM! +NA = #N/D diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/it/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/it/functions new file mode 100644 index 0000000..1901baf --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/it/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Funzioni di automazione e dei componenti aggiuntivi +## +GETPIVOTDATA = INFO.DATI.TAB.PIVOT ## Restituisce i dati memorizzati in un rapporto di tabella pivot + + +## +## Cube functions Funzioni cubo +## +CUBEKPIMEMBER = MEMBRO.KPI.CUBO ## Restituisce il nome, la proprietà e la misura di un indicatore di prestazioni chiave (KPI) e visualizza il nome e la proprietà nella cella. Un KPI è una misura quantificabile, ad esempio l'utile lordo mensile o il fatturato trimestrale dei dipendenti, utilizzata per il monitoraggio delle prestazioni di un'organizzazione. +CUBEMEMBER = MEMBRO.CUBO ## Restituisce un membro o una tupla in una gerarchia di cubi. Consente di verificare l'esistenza del membro o della tupla nel cubo. +CUBEMEMBERPROPERTY = PROPRIETÀ.MEMBRO.CUBO ## Restituisce il valore di una proprietà di un membro del cubo. Consente di verificare l'esistenza di un nome di membro all'interno del cubo e di restituire la proprietà specificata per tale membro. +CUBERANKEDMEMBER = MEMBRO.CUBO.CON.RANGO ## Restituisce l'n-esimo membro o il membro ordinato di un insieme. Consente di restituire uno o più elementi in un insieme, ad esempio l'agente di vendita migliore o i primi 10 studenti. +CUBESET = SET.CUBO ## Definisce un insieme di tuple o membri calcolati mediante l'invio di un'espressione di insieme al cubo sul server. In questo modo l'insieme viene creato e restituito a Microsoft Office Excel. +CUBESETCOUNT = CONTA.SET.CUBO ## Restituisce il numero di elementi di un insieme. +CUBEVALUE = VALORE.CUBO ## Restituisce un valore aggregato da un cubo. + + +## +## Database functions Funzioni di database +## +DAVERAGE = DB.MEDIA ## Restituisce la media di voci del database selezionate +DCOUNT = DB.CONTA.NUMERI ## Conta le celle di un database contenenti numeri +DCOUNTA = DB.CONTA.VALORI ## Conta le celle non vuote in un database +DGET = DB.VALORI ## Estrae da un database un singolo record che soddisfa i criteri specificati +DMAX = DB.MAX ## Restituisce il valore massimo dalle voci selezionate in un database +DMIN = DB.MIN ## Restituisce il valore minimo dalle voci di un database selezionate +DPRODUCT = DB.PRODOTTO ## Moltiplica i valori in un determinato campo di record che soddisfano i criteri del database +DSTDEV = DB.DEV.ST ## Restituisce una stima della deviazione standard sulla base di un campione di voci di un database selezionate +DSTDEVP = DB.DEV.ST.POP ## Calcola la deviazione standard sulla base di tutte le voci di un database selezionate +DSUM = DB.SOMMA ## Aggiunge i numeri nel campo colonna di record del database che soddisfa determinati criteri +DVAR = DB.VAR ## Restituisce una stima della varianza sulla base di un campione da voci di un database selezionate +DVARP = DB.VAR.POP ## Calcola la varianza sulla base di tutte le voci di un database selezionate + + +## +## Date and time functions Funzioni data e ora +## +DATE = DATA ## Restituisce il numero seriale di una determinata data +DATEVALUE = DATA.VALORE ## Converte una data sotto forma di testo in un numero seriale +DAY = GIORNO ## Converte un numero seriale in un giorno del mese +DAYS360 = GIORNO360 ## Calcola il numero di giorni compreso tra due date basandosi su un anno di 360 giorni +EDATE = DATA.MESE ## Restituisce il numero seriale della data che rappresenta il numero di mesi prima o dopo la data di inizio +EOMONTH = FINE.MESE ## Restituisce il numero seriale dell'ultimo giorno del mese, prima o dopo un determinato numero di mesi +HOUR = ORA ## Converte un numero seriale in un'ora +MINUTE = MINUTO ## Converte un numero seriale in un minuto +MONTH = MESE ## Converte un numero seriale in un mese +NETWORKDAYS = GIORNI.LAVORATIVI.TOT ## Restituisce il numero di tutti i giorni lavorativi compresi fra due date +NOW = ADESSO ## Restituisce il numero seriale della data e dell'ora corrente +SECOND = SECONDO ## Converte un numero seriale in un secondo +TIME = ORARIO ## Restituisce il numero seriale di una determinata ora +TIMEVALUE = ORARIO.VALORE ## Converte un orario in forma di testo in un numero seriale +TODAY = OGGI ## Restituisce il numero seriale relativo alla data odierna +WEEKDAY = GIORNO.SETTIMANA ## Converte un numero seriale in un giorno della settimana +WEEKNUM = NUM.SETTIMANA ## Converte un numero seriale in un numero che rappresenta la posizione numerica di una settimana nell'anno +WORKDAY = GIORNO.LAVORATIVO ## Restituisce il numero della data prima o dopo un determinato numero di giorni lavorativi +YEAR = ANNO ## Converte un numero seriale in un anno +YEARFRAC = FRAZIONE.ANNO ## Restituisce la frazione dell'anno che rappresenta il numero dei giorni compresi tra una data_ iniziale e una data_finale + + +## +## Engineering functions Funzioni ingegneristiche +## +BESSELI = BESSEL.I ## Restituisce la funzione di Bessel modificata In(x) +BESSELJ = BESSEL.J ## Restituisce la funzione di Bessel Jn(x) +BESSELK = BESSEL.K ## Restituisce la funzione di Bessel modificata Kn(x) +BESSELY = BESSEL.Y ## Restituisce la funzione di Bessel Yn(x) +BIN2DEC = BINARIO.DECIMALE ## Converte un numero binario in decimale +BIN2HEX = BINARIO.HEX ## Converte un numero binario in esadecimale +BIN2OCT = BINARIO.OCT ## Converte un numero binario in ottale +COMPLEX = COMPLESSO ## Converte i coefficienti reali e immaginari in numeri complessi +CONVERT = CONVERTI ## Converte un numero da un sistema di misura in un altro +DEC2BIN = DECIMALE.BINARIO ## Converte un numero decimale in binario +DEC2HEX = DECIMALE.HEX ## Converte un numero decimale in esadecimale +DEC2OCT = DECIMALE.OCT ## Converte un numero decimale in ottale +DELTA = DELTA ## Verifica se due valori sono uguali +ERF = FUNZ.ERRORE ## Restituisce la funzione di errore +ERFC = FUNZ.ERRORE.COMP ## Restituisce la funzione di errore complementare +GESTEP = SOGLIA ## Verifica se un numero è maggiore del valore di soglia +HEX2BIN = HEX.BINARIO ## Converte un numero esadecimale in binario +HEX2DEC = HEX.DECIMALE ## Converte un numero esadecimale in decimale +HEX2OCT = HEX.OCT ## Converte un numero esadecimale in ottale +IMABS = COMP.MODULO ## Restituisce il valore assoluto (modulo) di un numero complesso +IMAGINARY = COMP.IMMAGINARIO ## Restituisce il coefficiente immaginario di un numero complesso +IMARGUMENT = COMP.ARGOMENTO ## Restituisce l'argomento theta, un angolo espresso in radianti +IMCONJUGATE = COMP.CONIUGATO ## Restituisce il complesso coniugato del numero complesso +IMCOS = COMP.COS ## Restituisce il coseno di un numero complesso +IMDIV = COMP.DIV ## Restituisce il quoziente di due numeri complessi +IMEXP = COMP.EXP ## Restituisce il valore esponenziale di un numero complesso +IMLN = COMP.LN ## Restituisce il logaritmo naturale di un numero complesso +IMLOG10 = COMP.LOG10 ## Restituisce il logaritmo in base 10 di un numero complesso +IMLOG2 = COMP.LOG2 ## Restituisce un logaritmo in base 2 di un numero complesso +IMPOWER = COMP.POTENZA ## Restituisce il numero complesso elevato a una potenza intera +IMPRODUCT = COMP.PRODOTTO ## Restituisce il prodotto di numeri complessi compresi tra 2 e 29 +IMREAL = COMP.PARTE.REALE ## Restituisce il coefficiente reale di un numero complesso +IMSIN = COMP.SEN ## Restituisce il seno di un numero complesso +IMSQRT = COMP.RADQ ## Restituisce la radice quadrata di un numero complesso +IMSUB = COMP.DIFF ## Restituisce la differenza fra due numeri complessi +IMSUM = COMP.SOMMA ## Restituisce la somma di numeri complessi +OCT2BIN = OCT.BINARIO ## Converte un numero ottale in binario +OCT2DEC = OCT.DECIMALE ## Converte un numero ottale in decimale +OCT2HEX = OCT.HEX ## Converte un numero ottale in esadecimale + + +## +## Financial functions Funzioni finanziarie +## +ACCRINT = INT.MATURATO.PER ## Restituisce l'interesse maturato di un titolo che paga interessi periodici +ACCRINTM = INT.MATURATO.SCAD ## Restituisce l'interesse maturato di un titolo che paga interessi alla scadenza +AMORDEGRC = AMMORT.DEGR ## Restituisce l'ammortamento per ogni periodo contabile utilizzando un coefficiente di ammortamento +AMORLINC = AMMORT.PER ## Restituisce l'ammortamento per ogni periodo contabile +COUPDAYBS = GIORNI.CED.INIZ.LIQ ## Restituisce il numero dei giorni che vanno dall'inizio del periodo di durata della cedola alla data di liquidazione +COUPDAYS = GIORNI.CED ## Restituisce il numero dei giorni relativi al periodo della cedola che contiene la data di liquidazione +COUPDAYSNC = GIORNI.CED.NUOVA ## Restituisce il numero di giorni che vanno dalla data di liquidazione alla data della cedola successiva +COUPNCD = DATA.CED.SUCC ## Restituisce un numero che rappresenta la data della cedola successiva alla data di liquidazione +COUPNUM = NUM.CED ## Restituisce il numero di cedole pagabili fra la data di liquidazione e la data di scadenza +COUPPCD = DATA.CED.PREC ## Restituisce un numero che rappresenta la data della cedola precedente alla data di liquidazione +CUMIPMT = INT.CUMUL ## Restituisce l'interesse cumulativo pagato fra due periodi +CUMPRINC = CAP.CUM ## Restituisce il capitale cumulativo pagato per estinguere un debito fra due periodi +DB = DB ## Restituisce l'ammortamento di un bene per un periodo specificato utilizzando il metodo di ammortamento a quote fisse decrescenti +DDB = AMMORT ## Restituisce l'ammortamento di un bene per un periodo specificato utilizzando il metodo di ammortamento a doppie quote decrescenti o altri metodi specificati +DISC = TASSO.SCONTO ## Restituisce il tasso di sconto per un titolo +DOLLARDE = VALUTA.DEC ## Converte un prezzo valuta, espresso come frazione, in prezzo valuta, espresso come numero decimale +DOLLARFR = VALUTA.FRAZ ## Converte un prezzo valuta, espresso come numero decimale, in prezzo valuta, espresso come frazione +DURATION = DURATA ## Restituisce la durata annuale di un titolo con i pagamenti di interesse periodico +EFFECT = EFFETTIVO ## Restituisce l'effettivo tasso di interesse annuo +FV = VAL.FUT ## Restituisce il valore futuro di un investimento +FVSCHEDULE = VAL.FUT.CAPITALE ## Restituisce il valore futuro di un capitale iniziale dopo aver applicato una serie di tassi di interesse composti +INTRATE = TASSO.INT ## Restituisce il tasso di interesse per un titolo interamente investito +IPMT = INTERESSI ## Restituisce il valore degli interessi per un investimento relativo a un periodo specifico +IRR = TIR.COST ## Restituisce il tasso di rendimento interno per una serie di flussi di cassa +ISPMT = INTERESSE.RATA ## Calcola l'interesse di un investimento pagato durante un periodo specifico +MDURATION = DURATA.M ## Restituisce la durata Macauley modificata per un titolo con un valore presunto di € 100 +MIRR = TIR.VAR ## Restituisce il tasso di rendimento interno in cui i flussi di cassa positivi e negativi sono finanziati a tassi differenti +NOMINAL = NOMINALE ## Restituisce il tasso di interesse nominale annuale +NPER = NUM.RATE ## Restituisce un numero di periodi relativi a un investimento +NPV = VAN ## Restituisce il valore attuale netto di un investimento basato su una serie di flussi di cassa periodici e sul tasso di sconto +ODDFPRICE = PREZZO.PRIMO.IRR ## Restituisce il prezzo di un titolo dal valore nominale di € 100 avente il primo periodo di durata irregolare +ODDFYIELD = REND.PRIMO.IRR ## Restituisce il rendimento di un titolo avente il primo periodo di durata irregolare +ODDLPRICE = PREZZO.ULTIMO.IRR ## Restituisce il prezzo di un titolo dal valore nominale di € 100 avente l'ultimo periodo di durata irregolare +ODDLYIELD = REND.ULTIMO.IRR ## Restituisce il rendimento di un titolo avente l'ultimo periodo di durata irregolare +PMT = RATA ## Restituisce il pagamento periodico di una rendita annua +PPMT = P.RATA ## Restituisce il pagamento sul capitale di un investimento per un dato periodo +PRICE = PREZZO ## Restituisce il prezzo di un titolo dal valore nominale di € 100 che paga interessi periodici +PRICEDISC = PREZZO.SCONT ## Restituisce il prezzo di un titolo scontato dal valore nominale di € 100 +PRICEMAT = PREZZO.SCAD ## Restituisce il prezzo di un titolo dal valore nominale di € 100 che paga gli interessi alla scadenza +PV = VA ## Restituisce il valore attuale di un investimento +RATE = TASSO ## Restituisce il tasso di interesse per un periodo di un'annualità +RECEIVED = RICEV.SCAD ## Restituisce l'ammontare ricevuto alla scadenza di un titolo interamente investito +SLN = AMMORT.COST ## Restituisce l'ammortamento a quote costanti di un bene per un singolo periodo +SYD = AMMORT.ANNUO ## Restituisce l'ammortamento a somma degli anni di un bene per un periodo specificato +TBILLEQ = BOT.EQUIV ## Restituisce il rendimento equivalente ad un'obbligazione per un Buono ordinario del Tesoro +TBILLPRICE = BOT.PREZZO ## Restituisce il prezzo di un Buono del Tesoro dal valore nominale di € 100 +TBILLYIELD = BOT.REND ## Restituisce il rendimento di un Buono del Tesoro +VDB = AMMORT.VAR ## Restituisce l'ammortamento di un bene per un periodo specificato o parziale utilizzando il metodo a doppie quote proporzionali ai valori residui +XIRR = TIR.X ## Restituisce il tasso di rendimento interno di un impiego di flussi di cassa +XNPV = VAN.X ## Restituisce il valore attuale netto di un impiego di flussi di cassa non necessariamente periodici +YIELD = REND ## Restituisce il rendimento di un titolo che frutta interessi periodici +YIELDDISC = REND.TITOLI.SCONT ## Restituisce il rendimento annuale di un titolo scontato, ad esempio un Buono del Tesoro +YIELDMAT = REND.SCAD ## Restituisce il rendimento annuo di un titolo che paga interessi alla scadenza + + +## +## Information functions Funzioni relative alle informazioni +## +CELL = CELLA ## Restituisce le informazioni sulla formattazione, la posizione o i contenuti di una cella +ERROR.TYPE = ERRORE.TIPO ## Restituisce un numero che corrisponde a un tipo di errore +INFO = INFO ## Restituisce le informazioni sull'ambiente operativo corrente +ISBLANK = VAL.VUOTO ## Restituisce VERO se il valore è vuoto +ISERR = VAL.ERR ## Restituisce VERO se il valore è un valore di errore qualsiasi tranne #N/D +ISERROR = VAL.ERRORE ## Restituisce VERO se il valore è un valore di errore qualsiasi +ISEVEN = VAL.PARI ## Restituisce VERO se il numero è pari +ISLOGICAL = VAL.LOGICO ## Restituisce VERO se il valore è un valore logico +ISNA = VAL.NON.DISP ## Restituisce VERO se il valore è un valore di errore #N/D +ISNONTEXT = VAL.NON.TESTO ## Restituisce VERO se il valore non è in formato testo +ISNUMBER = VAL.NUMERO ## Restituisce VERO se il valore è un numero +ISODD = VAL.DISPARI ## Restituisce VERO se il numero è dispari +ISREF = VAL.RIF ## Restituisce VERO se il valore è un riferimento +ISTEXT = VAL.TESTO ## Restituisce VERO se il valore è in formato testo +N = NUM ## Restituisce un valore convertito in numero +NA = NON.DISP ## Restituisce il valore di errore #N/D +TYPE = TIPO ## Restituisce un numero che indica il tipo di dati relativi a un valore + + +## +## Logical functions Funzioni logiche +## +AND = E ## Restituisce VERO se tutti gli argomenti sono VERO +FALSE = FALSO ## Restituisce il valore logico FALSO +IF = SE ## Specifica un test logico da eseguire +IFERROR = SE.ERRORE ## Restituisce un valore specificato se una formula fornisce un errore come risultato; in caso contrario, restituisce il risultato della formula +NOT = NON ## Inverte la logica degli argomenti +OR = O ## Restituisce VERO se un argomento qualsiasi è VERO +TRUE = VERO ## Restituisce il valore logico VERO + + +## +## Lookup and reference functions Funzioni di ricerca e di riferimento +## +ADDRESS = INDIRIZZO ## Restituisce un riferimento come testo in una singola cella di un foglio di lavoro +AREAS = AREE ## Restituisce il numero di aree in un riferimento +CHOOSE = SCEGLI ## Sceglie un valore da un elenco di valori +COLUMN = RIF.COLONNA ## Restituisce il numero di colonna di un riferimento +COLUMNS = COLONNE ## Restituisce il numero di colonne in un riferimento +HLOOKUP = CERCA.ORIZZ ## Effettua una ricerca nella riga superiore di una matrice e restituisce il valore della cella specificata +HYPERLINK = COLLEG.IPERTESTUALE ## Crea un collegamento che apre un documento memorizzato in un server di rete, una rete Intranet o Internet +INDEX = INDICE ## Utilizza un indice per scegliere un valore da un riferimento o da una matrice +INDIRECT = INDIRETTO ## Restituisce un riferimento specificato da un valore testo +LOOKUP = CERCA ## Ricerca i valori in un vettore o in una matrice +MATCH = CONFRONTA ## Ricerca i valori in un riferimento o in una matrice +OFFSET = SCARTO ## Restituisce uno scarto di riferimento da un riferimento dato +ROW = RIF.RIGA ## Restituisce il numero di riga di un riferimento +ROWS = RIGHE ## Restituisce il numero delle righe in un riferimento +RTD = DATITEMPOREALE ## Recupera dati in tempo reale da un programma che supporta l'automazione COM (automazione: Metodo per utilizzare gli oggetti di un'applicazione da un'altra applicazione o da un altro strumento di sviluppo. Precedentemente nota come automazione OLE, l'automazione è uno standard del settore e una caratteristica del modello COM (Component Object Model).) +TRANSPOSE = MATR.TRASPOSTA ## Restituisce la trasposizione di una matrice +VLOOKUP = CERCA.VERT ## Effettua una ricerca nella prima colonna di una matrice e si sposta attraverso la riga per restituire il valore di una cella + + +## +## Math and trigonometry functions Funzioni matematiche e trigonometriche +## +ABS = ASS ## Restituisce il valore assoluto di un numero. +ACOS = ARCCOS ## Restituisce l'arcocoseno di un numero +ACOSH = ARCCOSH ## Restituisce l'inverso del coseno iperbolico di un numero +ASIN = ARCSEN ## Restituisce l'arcoseno di un numero +ASINH = ARCSENH ## Restituisce l'inverso del seno iperbolico di un numero +ATAN = ARCTAN ## Restituisce l'arcotangente di un numero +ATAN2 = ARCTAN.2 ## Restituisce l'arcotangente delle coordinate x e y specificate +ATANH = ARCTANH ## Restituisce l'inverso della tangente iperbolica di un numero +CEILING = ARROTONDA.ECCESSO ## Arrotonda un numero per eccesso all'intero più vicino o al multiplo più vicino a peso +COMBIN = COMBINAZIONE ## Restituisce il numero di combinazioni possibili per un numero assegnato di elementi +COS = COS ## Restituisce il coseno dell'angolo specificato +COSH = COSH ## Restituisce il coseno iperbolico di un numero +DEGREES = GRADI ## Converte i radianti in gradi +EVEN = PARI ## Arrotonda il valore assoluto di un numero per eccesso al più vicino intero pari +EXP = ESP ## Restituisce il numero e elevato alla potenza di num +FACT = FATTORIALE ## Restituisce il fattoriale di un numero +FACTDOUBLE = FATT.DOPPIO ## Restituisce il fattoriale doppio di un numero +FLOOR = ARROTONDA.DIFETTO ## Arrotonda un numero per difetto al multiplo più vicino a zero +GCD = MCD ## Restituisce il massimo comune divisore +INT = INT ## Arrotonda un numero per difetto al numero intero più vicino +LCM = MCM ## Restituisce il minimo comune multiplo +LN = LN ## Restituisce il logaritmo naturale di un numero +LOG = LOG ## Restituisce il logaritmo di un numero in una specificata base +LOG10 = LOG10 ## Restituisce il logaritmo in base 10 di un numero +MDETERM = MATR.DETERM ## Restituisce il determinante di una matrice +MINVERSE = MATR.INVERSA ## Restituisce l'inverso di una matrice +MMULT = MATR.PRODOTTO ## Restituisce il prodotto di due matrici +MOD = RESTO ## Restituisce il resto della divisione +MROUND = ARROTONDA.MULTIPLO ## Restituisce un numero arrotondato al multiplo desiderato +MULTINOMIAL = MULTINOMIALE ## Restituisce il multinomiale di un insieme di numeri +ODD = DISPARI ## Arrotonda un numero per eccesso al più vicino intero dispari +PI = PI.GRECO ## Restituisce il valore di pi greco +POWER = POTENZA ## Restituisce il risultato di un numero elevato a potenza +PRODUCT = PRODOTTO ## Moltiplica i suoi argomenti +QUOTIENT = QUOZIENTE ## Restituisce la parte intera di una divisione +RADIANS = RADIANTI ## Converte i gradi in radianti +RAND = CASUALE ## Restituisce un numero casuale compreso tra 0 e 1 +RANDBETWEEN = CASUALE.TRA ## Restituisce un numero casuale compreso tra i numeri specificati +ROMAN = ROMANO ## Restituisce il numero come numero romano sotto forma di testo +ROUND = ARROTONDA ## Arrotonda il numero al numero di cifre specificato +ROUNDDOWN = ARROTONDA.PER.DIF ## Arrotonda il valore assoluto di un numero per difetto +ROUNDUP = ARROTONDA.PER.ECC ## Arrotonda il valore assoluto di un numero per eccesso +SERIESSUM = SOMMA.SERIE ## Restituisce la somma di una serie di potenze in base alla formula +SIGN = SEGNO ## Restituisce il segno di un numero +SIN = SEN ## Restituisce il seno di un dato angolo +SINH = SENH ## Restituisce il seno iperbolico di un numero +SQRT = RADQ ## Restituisce una radice quadrata +SQRTPI = RADQ.PI.GRECO ## Restituisce la radice quadrata di un numero (numero * pi greco) +SUBTOTAL = SUBTOTALE ## Restituisce un subtotale in un elenco o in un database +SUM = SOMMA ## Somma i suoi argomenti +SUMIF = SOMMA.SE ## Somma le celle specificate da un dato criterio +SUMIFS = SOMMA.PIÙ.SE ## Somma le celle in un intervallo che soddisfano più criteri +SUMPRODUCT = MATR.SOMMA.PRODOTTO ## Restituisce la somma dei prodotti dei componenti corrispondenti della matrice +SUMSQ = SOMMA.Q ## Restituisce la somma dei quadrati degli argomenti +SUMX2MY2 = SOMMA.DIFF.Q ## Restituisce la somma della differenza dei quadrati dei corrispondenti elementi in due matrici +SUMX2PY2 = SOMMA.SOMMA.Q ## Restituisce la somma della somma dei quadrati dei corrispondenti elementi in due matrici +SUMXMY2 = SOMMA.Q.DIFF ## Restituisce la somma dei quadrati delle differenze dei corrispondenti elementi in due matrici +TAN = TAN ## Restituisce la tangente di un numero +TANH = TANH ## Restituisce la tangente iperbolica di un numero +TRUNC = TRONCA ## Tronca la parte decimale di un numero + + +## +## Statistical functions Funzioni statistiche +## +AVEDEV = MEDIA.DEV ## Restituisce la media delle deviazioni assolute delle coordinate rispetto alla loro media +AVERAGE = MEDIA ## Restituisce la media degli argomenti +AVERAGEA = MEDIA.VALORI ## Restituisce la media degli argomenti, inclusi i numeri, il testo e i valori logici +AVERAGEIF = MEDIA.SE ## Restituisce la media aritmetica di tutte le celle in un intervallo che soddisfano un determinato criterio +AVERAGEIFS = MEDIA.PIÙ.SE ## Restituisce la media aritmetica di tutte le celle che soddisfano più criteri +BETADIST = DISTRIB.BETA ## Restituisce la funzione di distribuzione cumulativa beta +BETAINV = INV.BETA ## Restituisce l'inverso della funzione di distribuzione cumulativa per una distribuzione beta specificata +BINOMDIST = DISTRIB.BINOM ## Restituisce la distribuzione binomiale per il termine individuale +CHIDIST = DISTRIB.CHI ## Restituisce la probabilità a una coda per la distribuzione del chi quadrato +CHIINV = INV.CHI ## Restituisce l'inverso della probabilità ad una coda per la distribuzione del chi quadrato +CHITEST = TEST.CHI ## Restituisce il test per l'indipendenza +CONFIDENCE = CONFIDENZA ## Restituisce l'intervallo di confidenza per una popolazione +CORREL = CORRELAZIONE ## Restituisce il coefficiente di correlazione tra due insiemi di dati +COUNT = CONTA.NUMERI ## Conta la quantità di numeri nell'elenco di argomenti +COUNTA = CONTA.VALORI ## Conta il numero di valori nell'elenco di argomenti +COUNTBLANK = CONTA.VUOTE ## Conta il numero di celle vuote all'interno di un intervallo +COUNTIF = CONTA.SE ## Conta il numero di celle all'interno di un intervallo che soddisfa i criteri specificati +COUNTIFS = CONTA.PIÙ.SE ## Conta il numero di celle in un intervallo che soddisfano più criteri. +COVAR = COVARIANZA ## Calcola la covarianza, la media dei prodotti delle deviazioni accoppiate +CRITBINOM = CRIT.BINOM ## Restituisce il più piccolo valore per il quale la distribuzione cumulativa binomiale risulta maggiore o uguale ad un valore di criterio +DEVSQ = DEV.Q ## Restituisce la somma dei quadrati delle deviazioni +EXPONDIST = DISTRIB.EXP ## Restituisce la distribuzione esponenziale +FDIST = DISTRIB.F ## Restituisce la distribuzione di probabilità F +FINV = INV.F ## Restituisce l'inverso della distribuzione della probabilità F +FISHER = FISHER ## Restituisce la trasformazione di Fisher +FISHERINV = INV.FISHER ## Restituisce l'inverso della trasformazione di Fisher +FORECAST = PREVISIONE ## Restituisce i valori lungo una tendenza lineare +FREQUENCY = FREQUENZA ## Restituisce la distribuzione di frequenza come matrice verticale +FTEST = TEST.F ## Restituisce il risultato di un test F +GAMMADIST = DISTRIB.GAMMA ## Restituisce la distribuzione gamma +GAMMAINV = INV.GAMMA ## Restituisce l'inverso della distribuzione cumulativa gamma +GAMMALN = LN.GAMMA ## Restituisce il logaritmo naturale della funzione gamma, G(x) +GEOMEAN = MEDIA.GEOMETRICA ## Restituisce la media geometrica +GROWTH = CRESCITA ## Restituisce i valori lungo una linea di tendenza esponenziale +HARMEAN = MEDIA.ARMONICA ## Restituisce la media armonica +HYPGEOMDIST = DISTRIB.IPERGEOM ## Restituisce la distribuzione ipergeometrica +INTERCEPT = INTERCETTA ## Restituisce l'intercetta della retta di regressione lineare +KURT = CURTOSI ## Restituisce la curtosi di un insieme di dati +LARGE = GRANDE ## Restituisce il k-esimo valore più grande in un insieme di dati +LINEST = REGR.LIN ## Restituisce i parametri di una tendenza lineare +LOGEST = REGR.LOG ## Restituisce i parametri di una linea di tendenza esponenziale +LOGINV = INV.LOGNORM ## Restituisce l'inverso di una distribuzione lognormale +LOGNORMDIST = DISTRIB.LOGNORM ## Restituisce la distribuzione lognormale cumulativa +MAX = MAX ## Restituisce il valore massimo in un elenco di argomenti +MAXA = MAX.VALORI ## Restituisce il valore massimo in un elenco di argomenti, inclusi i numeri, il testo e i valori logici +MEDIAN = MEDIANA ## Restituisce la mediana dei numeri specificati +MIN = MIN ## Restituisce il valore minimo in un elenco di argomenti +MINA = MIN.VALORI ## Restituisce il più piccolo valore in un elenco di argomenti, inclusi i numeri, il testo e i valori logici +MODE = MODA ## Restituisce il valore più comune in un insieme di dati +NEGBINOMDIST = DISTRIB.BINOM.NEG ## Restituisce la distribuzione binomiale negativa +NORMDIST = DISTRIB.NORM ## Restituisce la distribuzione cumulativa normale +NORMINV = INV.NORM ## Restituisce l'inverso della distribuzione cumulativa normale standard +NORMSDIST = DISTRIB.NORM.ST ## Restituisce la distribuzione cumulativa normale standard +NORMSINV = INV.NORM.ST ## Restituisce l'inverso della distribuzione cumulativa normale +PEARSON = PEARSON ## Restituisce il coefficiente del momento di correlazione di Pearson +PERCENTILE = PERCENTILE ## Restituisce il k-esimo dato percentile di valori in un intervallo +PERCENTRANK = PERCENT.RANGO ## Restituisce il rango di un valore in un insieme di dati come percentuale +PERMUT = PERMUTAZIONE ## Restituisce il numero delle permutazioni per un determinato numero di oggetti +POISSON = POISSON ## Restituisce la distribuzione di Poisson +PROB = PROBABILITÀ ## Calcola la probabilità che dei valori in un intervallo siano compresi tra due limiti +QUARTILE = QUARTILE ## Restituisce il quartile di un insieme di dati +RANK = RANGO ## Restituisce il rango di un numero in un elenco di numeri +RSQ = RQ ## Restituisce la radice quadrata del coefficiente di momento di correlazione di Pearson +SKEW = ASIMMETRIA ## Restituisce il grado di asimmetria di una distribuzione +SLOPE = PENDENZA ## Restituisce la pendenza di una retta di regressione lineare +SMALL = PICCOLO ## Restituisce il k-esimo valore più piccolo in un insieme di dati +STANDARDIZE = NORMALIZZA ## Restituisce un valore normalizzato +STDEV = DEV.ST ## Restituisce una stima della deviazione standard sulla base di un campione +STDEVA = DEV.ST.VALORI ## Restituisce una stima della deviazione standard sulla base di un campione, inclusi i numeri, il testo e i valori logici +STDEVP = DEV.ST.POP ## Calcola la deviazione standard sulla base di un'intera popolazione +STDEVPA = DEV.ST.POP.VALORI ## Calcola la deviazione standard sulla base sull'intera popolazione, inclusi i numeri, il testo e i valori logici +STEYX = ERR.STD.YX ## Restituisce l'errore standard del valore previsto per y per ogni valore x nella regressione +TDIST = DISTRIB.T ## Restituisce la distribuzione t di Student +TINV = INV.T ## Restituisce l'inversa della distribuzione t di Student +TREND = TENDENZA ## Restituisce i valori lungo una linea di tendenza lineare +TRIMMEAN = MEDIA.TRONCATA ## Restituisce la media della parte interna di un insieme di dati +TTEST = TEST.T ## Restituisce la probabilità associata ad un test t di Student +VAR = VAR ## Stima la varianza sulla base di un campione +VARA = VAR.VALORI ## Stima la varianza sulla base di un campione, inclusi i numeri, il testo e i valori logici +VARP = VAR.POP ## Calcola la varianza sulla base dell'intera popolazione +VARPA = VAR.POP.VALORI ## Calcola la deviazione standard sulla base sull'intera popolazione, inclusi i numeri, il testo e i valori logici +WEIBULL = WEIBULL ## Restituisce la distribuzione di Weibull +ZTEST = TEST.Z ## Restituisce il valore di probabilità a una coda per un test z + + +## +## Text functions Funzioni di testo +## +ASC = ASC ## Modifica le lettere inglesi o il katakana a doppio byte all'interno di una stringa di caratteri in caratteri a singolo byte +BAHTTEXT = BAHTTESTO ## Converte un numero in testo, utilizzando il formato valuta ß (baht) +CHAR = CODICE.CARATT ## Restituisce il carattere specificato dal numero di codice +CLEAN = LIBERA ## Elimina dal testo tutti i caratteri che non è possibile stampare +CODE = CODICE ## Restituisce il codice numerico del primo carattere di una stringa di testo +CONCATENATE = CONCATENA ## Unisce diversi elementi di testo in un unico elemento di testo +DOLLAR = VALUTA ## Converte un numero in testo, utilizzando il formato valuta € (euro) +EXACT = IDENTICO ## Verifica se due valori di testo sono uguali +FIND = TROVA ## Rileva un valore di testo all'interno di un altro (distinzione tra maiuscole e minuscole) +FINDB = TROVA.B ## Rileva un valore di testo all'interno di un altro (distinzione tra maiuscole e minuscole) +FIXED = FISSO ## Formatta un numero come testo con un numero fisso di decimali +JIS = ORDINAMENTO.JIS ## Modifica le lettere inglesi o i caratteri katakana a byte singolo all'interno di una stringa di caratteri in caratteri a byte doppio. +LEFT = SINISTRA ## Restituisce il carattere più a sinistra di un valore di testo +LEFTB = SINISTRA.B ## Restituisce il carattere più a sinistra di un valore di testo +LEN = LUNGHEZZA ## Restituisce il numero di caratteri di una stringa di testo +LENB = LUNB ## Restituisce il numero di caratteri di una stringa di testo +LOWER = MINUSC ## Converte il testo in lettere minuscole +MID = MEDIA ## Restituisce un numero specifico di caratteri di una stringa di testo a partire dalla posizione specificata +MIDB = MEDIA.B ## Restituisce un numero specifico di caratteri di una stringa di testo a partire dalla posizione specificata +PHONETIC = FURIGANA ## Estrae i caratteri fonetici (furigana) da una stringa di testo. +PROPER = MAIUSC.INIZ ## Converte in maiuscolo la prima lettera di ogni parola di un valore di testo +REPLACE = RIMPIAZZA ## Sostituisce i caratteri all'interno di un testo +REPLACEB = SOSTITUISCI.B ## Sostituisce i caratteri all'interno di un testo +REPT = RIPETI ## Ripete un testo per un dato numero di volte +RIGHT = DESTRA ## Restituisce il carattere più a destra di un valore di testo +RIGHTB = DESTRA.B ## Restituisce il carattere più a destra di un valore di testo +SEARCH = RICERCA ## Rileva un valore di testo all'interno di un altro (non è sensibile alle maiuscole e minuscole) +SEARCHB = CERCA.B ## Rileva un valore di testo all'interno di un altro (non è sensibile alle maiuscole e minuscole) +SUBSTITUTE = SOSTITUISCI ## Sostituisce il nuovo testo al testo contenuto in una stringa +T = T ## Converte gli argomenti in testo +TEXT = TESTO ## Formatta un numero e lo converte in testo +TRIM = ANNULLA.SPAZI ## Elimina gli spazi dal testo +UPPER = MAIUSC ## Converte il testo in lettere maiuscole +VALUE = VALORE ## Converte un argomento di testo in numero diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/nl/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/nl/config new file mode 100644 index 0000000..8376022 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/nl/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) + +## +NULL = #LEEG! +DIV0 = #DEEL/0! +VALUE = #WAARDE! +REF = #VERW! +NAME = #NAAM? +NUM = #GETAL! +NA = #N/B diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/nl/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/nl/functions new file mode 100644 index 0000000..2518f42 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/nl/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Automatiseringsfuncties en functies in invoegtoepassingen +## +GETPIVOTDATA = DRAAITABEL.OPHALEN ## Geeft gegevens uit een draaitabelrapport als resultaat + + +## +## Cube functions Kubusfuncties +## +CUBEKPIMEMBER = KUBUSKPILID ## Retourneert de naam, eigenschap en waarde van een KPI (prestatie-indicator) en geeft de naam en de eigenschap in de cel weer. Een KPI is een meetbare waarde, zoals de maandelijkse brutowinst of de omzet per kwartaal per werknemer, die wordt gebruikt om de prestaties van een organisatie te bewaken +CUBEMEMBER = KUBUSLID ## Retourneert een lid of tupel in een kubushiërarchie. Wordt gebruikt om te controleren of het lid of de tupel in de kubus aanwezig is +CUBEMEMBERPROPERTY = KUBUSLIDEIGENSCHAP ## Retourneert de waarde van een lideigenschap in de kubus. Wordt gebruikt om te controleren of de lidnaam in de kubus bestaat en retourneert de opgegeven eigenschap voor dit lid +CUBERANKEDMEMBER = KUBUSGERANGCHIKTLID ## Retourneert het zoveelste, gerangschikte lid in een set. Wordt gebruikt om een of meer elementen in een set te retourneren, zoals de tien beste verkopers of de tien beste studenten +CUBESET = KUBUSSET ## Definieert een berekende set leden of tupels door een ingestelde expressie naar de kubus op de server te sturen, alwaar de set wordt gemaakt en vervolgens wordt geretourneerd naar Microsoft Office Excel +CUBESETCOUNT = KUBUSSETAANTAL ## Retourneert het aantal onderdelen in een set +CUBEVALUE = KUBUSWAARDE ## Retourneert een samengestelde waarde van een kubus + + +## +## Database functions Databasefuncties +## +DAVERAGE = DBGEMIDDELDE ## Berekent de gemiddelde waarde in geselecteerde databasegegevens +DCOUNT = DBAANTAL ## Telt de cellen met getallen in een database +DCOUNTA = DBAANTALC ## Telt de niet-lege cellen in een database +DGET = DBLEZEN ## Retourneert één record dat voldoet aan de opgegeven criteria uit een database +DMAX = DBMAX ## Retourneert de maximumwaarde in de geselecteerde databasegegevens +DMIN = DBMIN ## Retourneert de minimumwaarde in de geselecteerde databasegegevens +DPRODUCT = DBPRODUCT ## Vermenigvuldigt de waarden in een bepaald veld van de records die voldoen aan de criteria in een database +DSTDEV = DBSTDEV ## Maakt een schatting van de standaarddeviatie op basis van een steekproef uit geselecteerde databasegegevens +DSTDEVP = DBSTDEVP ## Berekent de standaarddeviatie op basis van de volledige populatie van geselecteerde databasegegevens +DSUM = DBSOM ## Telt de getallen uit een kolom records in de database op die voldoen aan de criteria +DVAR = DBVAR ## Maakt een schatting van de variantie op basis van een steekproef uit geselecteerde databasegegevens +DVARP = DBVARP ## Berekent de variantie op basis van de volledige populatie van geselecteerde databasegegevens + + +## +## Date and time functions Datum- en tijdfuncties +## +DATE = DATUM ## Geeft als resultaat het seriële getal van een opgegeven datum +DATEVALUE = DATUMWAARDE ## Converteert een datum in de vorm van tekst naar een serieel getal +DAY = DAG ## Converteert een serieel getal naar een dag van de maand +DAYS360 = DAGEN360 ## Berekent het aantal dagen tussen twee datums op basis van een jaar met 360 dagen +EDATE = ZELFDE.DAG ## Geeft als resultaat het seriële getal van een datum die het opgegeven aantal maanden voor of na de begindatum ligt +EOMONTH = LAATSTE.DAG ## Geeft als resultaat het seriële getal van de laatste dag van de maand voor of na het opgegeven aantal maanden +HOUR = UUR ## Converteert een serieel getal naar uren +MINUTE = MINUUT ## Converteert een serieel naar getal minuten +MONTH = MAAND ## Converteert een serieel getal naar een maand +NETWORKDAYS = NETTO.WERKDAGEN ## Geeft als resultaat het aantal hele werkdagen tussen twee datums +NOW = NU ## Geeft als resultaat het seriële getal van de huidige datum en tijd +SECOND = SECONDE ## Converteert een serieel getal naar seconden +TIME = TIJD ## Geeft als resultaat het seriële getal van een bepaald tijdstip +TIMEVALUE = TIJDWAARDE ## Converteert de tijd in de vorm van tekst naar een serieel getal +TODAY = VANDAAG ## Geeft als resultaat het seriële getal van de huidige datum +WEEKDAY = WEEKDAG ## Converteert een serieel getal naar een weekdag +WEEKNUM = WEEKNUMMER ## Converteert een serieel getal naar een weeknummer +WORKDAY = WERKDAG ## Geeft als resultaat het seriële getal van de datum voor of na een bepaald aantal werkdagen +YEAR = JAAR ## Converteert een serieel getal naar een jaar +YEARFRAC = JAAR.DEEL ## Geeft als resultaat het gedeelte van het jaar, uitgedrukt in het aantal hele dagen tussen begindatum en einddatum + + +## +## Engineering functions Technische functies +## +BESSELI = BESSEL.Y ## Geeft als resultaat de gewijzigde Bessel-functie In(x) +BESSELJ = BESSEL.J ## Geeft als resultaat de Bessel-functie Jn(x) +BESSELK = BESSEL.K ## Geeft als resultaat de gewijzigde Bessel-functie Kn(x) +BESSELY = BESSEL.Y ## Geeft als resultaat de gewijzigde Bessel-functie Yn(x) +BIN2DEC = BIN.N.DEC ## Converteert een binair getal naar een decimaal getal +BIN2HEX = BIN.N.HEX ## Converteert een binair getal naar een hexadecimaal getal +BIN2OCT = BIN.N.OCT ## Converteert een binair getal naar een octaal getal +COMPLEX = COMPLEX ## Converteert reële en imaginaire coëfficiënten naar een complex getal +CONVERT = CONVERTEREN ## Converteert een getal in de ene maateenheid naar een getal in een andere maateenheid +DEC2BIN = DEC.N.BIN ## Converteert een decimaal getal naar een binair getal +DEC2HEX = DEC.N.HEX ## Converteert een decimaal getal naar een hexadecimaal getal +DEC2OCT = DEC.N.OCT ## Converteert een decimaal getal naar een octaal getal +DELTA = DELTA ## Test of twee waarden gelijk zijn +ERF = FOUTFUNCTIE ## Geeft als resultaat de foutfunctie +ERFC = FOUT.COMPLEMENT ## Geeft als resultaat de complementaire foutfunctie +GESTEP = GROTER.DAN ## Test of een getal groter is dan de drempelwaarde +HEX2BIN = HEX.N.BIN ## Converteert een hexadecimaal getal naar een binair getal +HEX2DEC = HEX.N.DEC ## Converteert een hexadecimaal getal naar een decimaal getal +HEX2OCT = HEX.N.OCT ## Converteert een hexadecimaal getal naar een octaal getal +IMABS = C.ABS ## Geeft als resultaat de absolute waarde (modulus) van een complex getal +IMAGINARY = C.IM.DEEL ## Geeft als resultaat de imaginaire coëfficiënt van een complex getal +IMARGUMENT = C.ARGUMENT ## Geeft als resultaat het argument thèta, een hoek uitgedrukt in radialen +IMCONJUGATE = C.TOEGEVOEGD ## Geeft als resultaat het complexe toegevoegde getal van een complex getal +IMCOS = C.COS ## Geeft als resultaat de cosinus van een complex getal +IMDIV = C.QUOTIENT ## Geeft als resultaat het quotiënt van twee complexe getallen +IMEXP = C.EXP ## Geeft als resultaat de exponent van een complex getal +IMLN = C.LN ## Geeft als resultaat de natuurlijke logaritme van een complex getal +IMLOG10 = C.LOG10 ## Geeft als resultaat de logaritme met grondtal 10 van een complex getal +IMLOG2 = C.LOG2 ## Geeft als resultaat de logaritme met grondtal 2 van een complex getal +IMPOWER = C.MACHT ## Geeft als resultaat een complex getal dat is verheven tot de macht van een geheel getal +IMPRODUCT = C.PRODUCT ## Geeft als resultaat het product van complexe getallen +IMREAL = C.REEEL.DEEL ## Geeft als resultaat de reële coëfficiënt van een complex getal +IMSIN = C.SIN ## Geeft als resultaat de sinus van een complex getal +IMSQRT = C.WORTEL ## Geeft als resultaat de vierkantswortel van een complex getal +IMSUB = C.VERSCHIL ## Geeft als resultaat het verschil tussen twee complexe getallen +IMSUM = C.SOM ## Geeft als resultaat de som van complexe getallen +OCT2BIN = OCT.N.BIN ## Converteert een octaal getal naar een binair getal +OCT2DEC = OCT.N.DEC ## Converteert een octaal getal naar een decimaal getal +OCT2HEX = OCT.N.HEX ## Converteert een octaal getal naar een hexadecimaal getal + + +## +## Financial functions Financiële functies +## +ACCRINT = SAMENG.RENTE ## Berekent de opgelopen rente voor een waardepapier waarvan de rente periodiek wordt uitgekeerd +ACCRINTM = SAMENG.RENTE.V ## Berekent de opgelopen rente voor een waardepapier waarvan de rente op de vervaldatum wordt uitgekeerd +AMORDEGRC = AMORDEGRC ## Geeft als resultaat de afschrijving voor elke boekingsperiode door een afschrijvingscoëfficiënt toe te passen +AMORLINC = AMORLINC ## Berekent de afschrijving voor elke boekingsperiode +COUPDAYBS = COUP.DAGEN.BB ## Berekent het aantal dagen vanaf het begin van de coupontermijn tot de stortingsdatum +COUPDAYS = COUP.DAGEN ## Geeft als resultaat het aantal dagen in de coupontermijn waarin de stortingsdatum valt +COUPDAYSNC = COUP.DAGEN.VV ## Geeft als resultaat het aantal dagen vanaf de stortingsdatum tot de volgende couponvervaldatum +COUPNCD = COUP.DATUM.NB ## Geeft als resultaat de volgende coupondatum na de stortingsdatum +COUPNUM = COUP.AANTAL ## Geeft als resultaat het aantal coupons dat nog moet worden uitbetaald tussen de stortingsdatum en de vervaldatum +COUPPCD = COUP.DATUM.VB ## Geeft als resultaat de vorige couponvervaldatum vóór de stortingsdatum +CUMIPMT = CUM.RENTE ## Geeft als resultaat de cumulatieve rente die tussen twee termijnen is uitgekeerd +CUMPRINC = CUM.HOOFDSOM ## Geeft als resultaat de cumulatieve hoofdsom van een lening die tussen twee termijnen is terugbetaald +DB = DB ## Geeft als resultaat de afschrijving van activa voor een bepaalde periode met behulp van de 'fixed declining balance'-methode +DDB = DDB ## Geeft als resultaat de afschrijving van activa over een bepaalde termijn met behulp van de 'double declining balance'-methode of een andere methode die u opgeeft +DISC = DISCONTO ## Geeft als resultaat het discontopercentage voor een waardepapier +DOLLARDE = EURO.DE ## Converteert een prijs in euro's, uitgedrukt in een breuk, naar een prijs in euro's, uitgedrukt in een decimaal getal +DOLLARFR = EURO.BR ## Converteert een prijs in euro's, uitgedrukt in een decimaal getal, naar een prijs in euro's, uitgedrukt in een breuk +DURATION = DUUR ## Geeft als resultaat de gewogen gemiddelde looptijd voor een waardepapier met periodieke rentebetalingen +EFFECT = EFFECT.RENTE ## Geeft als resultaat het effectieve jaarlijkse rentepercentage +FV = TW ## Geeft als resultaat de toekomstige waarde van een investering +FVSCHEDULE = TOEK.WAARDE2 ## Geeft als resultaat de toekomstige waarde van een bepaalde hoofdsom na het toepassen van een reeks samengestelde rentepercentages +INTRATE = RENTEPERCENTAGE ## Geeft als resultaat het rentepercentage voor een volgestort waardepapier +IPMT = IBET ## Geeft als resultaat de te betalen rente voor een investering over een bepaalde termijn +IRR = IR ## Geeft als resultaat de interne rentabiliteit voor een reeks cashflows +ISPMT = ISBET ## Geeft als resultaat de rente die is betaald tijdens een bepaalde termijn van een investering +MDURATION = AANG.DUUR ## Geeft als resultaat de aangepaste Macauley-looptijd voor een waardepapier, aangenomen dat de nominale waarde € 100 bedraagt +MIRR = GIR ## Geeft als resultaat de interne rentabiliteit voor een serie cashflows, waarbij voor betalingen een ander rentepercentage geldt dan voor inkomsten +NOMINAL = NOMINALE.RENTE ## Geeft als resultaat het nominale jaarlijkse rentepercentage +NPER = NPER ## Geeft als resultaat het aantal termijnen van een investering +NPV = NHW ## Geeft als resultaat de netto huidige waarde van een investering op basis van een reeks periodieke cashflows en een discontopercentage +ODDFPRICE = AFW.ET.PRIJS ## Geeft als resultaat de prijs per € 100 nominale waarde voor een waardepapier met een afwijkende eerste termijn +ODDFYIELD = AFW.ET.REND ## Geeft als resultaat het rendement voor een waardepapier met een afwijkende eerste termijn +ODDLPRICE = AFW.LT.PRIJS ## Geeft als resultaat de prijs per € 100 nominale waarde voor een waardepapier met een afwijkende laatste termijn +ODDLYIELD = AFW.LT.REND ## Geeft als resultaat het rendement voor een waardepapier met een afwijkende laatste termijn +PMT = BET ## Geeft als resultaat de periodieke betaling voor een annuïteit +PPMT = PBET ## Geeft als resultaat de afbetaling op de hoofdsom voor een bepaalde termijn +PRICE = PRIJS.NOM ## Geeft als resultaat de prijs per € 100 nominale waarde voor een waardepapier waarvan de rente periodiek wordt uitgekeerd +PRICEDISC = PRIJS.DISCONTO ## Geeft als resultaat de prijs per € 100 nominale waarde voor een verdisconteerd waardepapier +PRICEMAT = PRIJS.VERVALDAG ## Geeft als resultaat de prijs per € 100 nominale waarde voor een waardepapier waarvan de rente wordt uitgekeerd op de vervaldatum +PV = HW ## Geeft als resultaat de huidige waarde van een investering +RATE = RENTE ## Geeft als resultaat het periodieke rentepercentage voor een annuïteit +RECEIVED = OPBRENGST ## Geeft als resultaat het bedrag dat op de vervaldatum wordt uitgekeerd voor een volgestort waardepapier +SLN = LIN.AFSCHR ## Geeft als resultaat de lineaire afschrijving van activa over één termijn +SYD = SYD ## Geeft als resultaat de afschrijving van activa over een bepaalde termijn met behulp van de 'Sum-Of-Years-Digits'-methode +TBILLEQ = SCHATK.OBL ## Geeft als resultaat het rendement op schatkistpapier, dat op dezelfde manier wordt berekend als het rendement op obligaties +TBILLPRICE = SCHATK.PRIJS ## Bepaalt de prijs per € 100 nominale waarde voor schatkistpapier +TBILLYIELD = SCHATK.REND ## Berekent het rendement voor schatkistpapier +VDB = VDB ## Geeft als resultaat de afschrijving van activa over een gehele of gedeeltelijke termijn met behulp van de 'declining balance'-methode +XIRR = IR.SCHEMA ## Berekent de interne rentabiliteit voor een betalingsschema van cashflows +XNPV = NHW2 ## Berekent de huidige nettowaarde voor een betalingsschema van cashflows +YIELD = RENDEMENT ## Geeft als resultaat het rendement voor een waardepapier waarvan de rente periodiek wordt uitgekeerd +YIELDDISC = REND.DISCONTO ## Geeft als resultaat het jaarlijkse rendement voor een verdisconteerd waardepapier, bijvoorbeeld schatkistpapier +YIELDMAT = REND.VERVAL ## Geeft als resultaat het jaarlijkse rendement voor een waardepapier waarvan de rente wordt uitgekeerd op de vervaldatum + + +## +## Information functions Informatiefuncties +## +CELL = CEL ## Geeft als resultaat informatie over de opmaak, locatie of inhoud van een cel +ERROR.TYPE = TYPE.FOUT ## Geeft als resultaat een getal dat overeenkomt met een van de foutwaarden van Microsoft Excel +INFO = INFO ## Geeft als resultaat informatie over de huidige besturingsomgeving +ISBLANK = ISLEEG ## Geeft als resultaat WAAR als de waarde leeg is +ISERR = ISFOUT2 ## Geeft als resultaat WAAR als de waarde een foutwaarde is, met uitzondering van #N/B +ISERROR = ISFOUT ## Geeft als resultaat WAAR als de waarde een foutwaarde is +ISEVEN = IS.EVEN ## Geeft als resultaat WAAR als het getal even is +ISLOGICAL = ISLOGISCH ## Geeft als resultaat WAAR als de waarde een logische waarde is +ISNA = ISNB ## Geeft als resultaat WAAR als de waarde de foutwaarde #N/B is +ISNONTEXT = ISGEENTEKST ## Geeft als resultaat WAAR als de waarde geen tekst is +ISNUMBER = ISGETAL ## Geeft als resultaat WAAR als de waarde een getal is +ISODD = IS.ONEVEN ## Geeft als resultaat WAAR als het getal oneven is +ISREF = ISVERWIJZING ## Geeft als resultaat WAAR als de waarde een verwijzing is +ISTEXT = ISTEKST ## Geeft als resultaat WAAR als de waarde tekst is +N = N ## Geeft als resultaat een waarde die is geconverteerd naar een getal +NA = NB ## Geeft als resultaat de foutwaarde #N/B +TYPE = TYPE ## Geeft als resultaat een getal dat het gegevenstype van een waarde aangeeft + + +## +## Logical functions Logische functies +## +AND = EN ## Geeft als resultaat WAAR als alle argumenten WAAR zijn +FALSE = ONWAAR ## Geeft als resultaat de logische waarde ONWAAR +IF = ALS ## Geeft een logische test aan +IFERROR = ALS.FOUT ## Retourneert een waarde die u opgeeft als een formule een fout oplevert, anders wordt het resultaat van de formule geretourneerd +NOT = NIET ## Keert de logische waarde van het argument om +OR = OF ## Geeft als resultaat WAAR als minimaal een van de argumenten WAAR is +TRUE = WAAR ## Geeft als resultaat de logische waarde WAAR + + +## +## Lookup and reference functions Zoek- en verwijzingsfuncties +## +ADDRESS = ADRES ## Geeft als resultaat een verwijzing, in de vorm van tekst, naar één bepaalde cel in een werkblad +AREAS = BEREIKEN ## Geeft als resultaat het aantal bereiken in een verwijzing +CHOOSE = KIEZEN ## Kiest een waarde uit een lijst met waarden +COLUMN = KOLOM ## Geeft als resultaat het kolomnummer van een verwijzing +COLUMNS = KOLOMMEN ## Geeft als resultaat het aantal kolommen in een verwijzing +HLOOKUP = HORIZ.ZOEKEN ## Zoekt in de bovenste rij van een matrix naar een bepaalde waarde en geeft als resultaat de gevonden waarde in de opgegeven cel +HYPERLINK = HYPERLINK ## Maakt een snelkoppeling of een sprong waarmee een document wordt geopend dat is opgeslagen op een netwerkserver, een intranet of op internet +INDEX = INDEX ## Kiest met een index een waarde uit een verwijzing of een matrix +INDIRECT = INDIRECT ## Geeft als resultaat een verwijzing die wordt aangegeven met een tekstwaarde +LOOKUP = ZOEKEN ## Zoekt naar bepaalde waarden in een vector of een matrix +MATCH = VERGELIJKEN ## Zoekt naar bepaalde waarden in een verwijzing of een matrix +OFFSET = VERSCHUIVING ## Geeft als resultaat een nieuwe verwijzing die is verschoven ten opzichte van een bepaalde verwijzing +ROW = RIJ ## Geeft als resultaat het rijnummer van een verwijzing +ROWS = RIJEN ## Geeft als resultaat het aantal rijen in een verwijzing +RTD = RTG ## Haalt realtimegegevens op uit een programma dat COM-automatisering (automatisering: een methode waarmee de ene toepassing objecten van een andere toepassing of ontwikkelprogramma kan besturen. Automatisering werd vroeger OLE-automatisering genoemd. Automatisering is een industrienorm die deel uitmaakt van het Component Object Model (COM).) ondersteunt +TRANSPOSE = TRANSPONEREN ## Geeft als resultaat de getransponeerde van een matrix +VLOOKUP = VERT.ZOEKEN ## Zoekt in de meest linkse kolom van een matrix naar een bepaalde waarde en geeft als resultaat de waarde in de opgegeven cel + + +## +## Math and trigonometry functions Wiskundige en trigonometrische functies +## +ABS = ABS ## Geeft als resultaat de absolute waarde van een getal +ACOS = BOOGCOS ## Geeft als resultaat de boogcosinus van een getal +ACOSH = BOOGCOSH ## Geeft als resultaat de inverse cosinus hyperbolicus van een getal +ASIN = BOOGSIN ## Geeft als resultaat de boogsinus van een getal +ASINH = BOOGSINH ## Geeft als resultaat de inverse sinus hyperbolicus van een getal +ATAN = BOOGTAN ## Geeft als resultaat de boogtangens van een getal +ATAN2 = BOOGTAN2 ## Geeft als resultaat de boogtangens van de x- en y-coördinaten +ATANH = BOOGTANH ## Geeft als resultaat de inverse tangens hyperbolicus van een getal +CEILING = AFRONDEN.BOVEN ## Rondt de absolute waarde van een getal naar boven af op het dichtstbijzijnde gehele getal of het dichtstbijzijnde significante veelvoud +COMBIN = COMBINATIES ## Geeft als resultaat het aantal combinaties voor een bepaald aantal objecten +COS = COS ## Geeft als resultaat de cosinus van een getal +COSH = COSH ## Geeft als resultaat de cosinus hyperbolicus van een getal +DEGREES = GRADEN ## Converteert radialen naar graden +EVEN = EVEN ## Rondt het getal af op het dichtstbijzijnde gehele even getal +EXP = EXP ## Verheft e tot de macht van een bepaald getal +FACT = FACULTEIT ## Geeft als resultaat de faculteit van een getal +FACTDOUBLE = DUBBELE.FACULTEIT ## Geeft als resultaat de dubbele faculteit van een getal +FLOOR = AFRONDEN.BENEDEN ## Rondt de absolute waarde van een getal naar beneden af +GCD = GGD ## Geeft als resultaat de grootste gemene deler +INT = INTEGER ## Rondt een getal naar beneden af op het dichtstbijzijnde gehele getal +LCM = KGV ## Geeft als resultaat het kleinste gemene veelvoud +LN = LN ## Geeft als resultaat de natuurlijke logaritme van een getal +LOG = LOG ## Geeft als resultaat de logaritme met het opgegeven grondtal van een getal +LOG10 = LOG10 ## Geeft als resultaat de logaritme met grondtal 10 van een getal +MDETERM = DETERMINANTMAT ## Geeft als resultaat de determinant van een matrix +MINVERSE = INVERSEMAT ## Geeft als resultaat de inverse van een matrix +MMULT = PRODUCTMAT ## Geeft als resultaat het product van twee matrices +MOD = REST ## Geeft als resultaat het restgetal van een deling +MROUND = AFRONDEN.N.VEELVOUD ## Geeft als resultaat een getal afgerond op het gewenste veelvoud +MULTINOMIAL = MULTINOMIAAL ## Geeft als resultaat de multinomiaalcoëfficiënt van een reeks getallen +ODD = ONEVEN ## Rondt de absolute waarde van het getal naar boven af op het dichtstbijzijnde gehele oneven getal +PI = PI ## Geeft als resultaat de waarde van pi +POWER = MACHT ## Verheft een getal tot een macht +PRODUCT = PRODUCT ## Vermenigvuldigt de argumenten met elkaar +QUOTIENT = QUOTIENT ## Geeft als resultaat de uitkomst van een deling als geheel getal +RADIANS = RADIALEN ## Converteert graden naar radialen +RAND = ASELECT ## Geeft als resultaat een willekeurig getal tussen 0 en 1 +RANDBETWEEN = ASELECTTUSSEN ## Geeft een willekeurig getal tussen de getallen die u hebt opgegeven +ROMAN = ROMEINS ## Converteert een Arabisch getal naar een Romeins getal en geeft het resultaat weer in de vorm van tekst +ROUND = AFRONDEN ## Rondt een getal af op het opgegeven aantal decimalen +ROUNDDOWN = AFRONDEN.NAAR.BENEDEN ## Rondt de absolute waarde van een getal naar beneden af +ROUNDUP = AFRONDEN.NAAR.BOVEN ## Rondt de absolute waarde van een getal naar boven af +SERIESSUM = SOM.MACHTREEKS ## Geeft als resultaat de som van een machtreeks die is gebaseerd op de formule +SIGN = POS.NEG ## Geeft als resultaat het teken van een getal +SIN = SIN ## Geeft als resultaat de sinus van de opgegeven hoek +SINH = SINH ## Geeft als resultaat de sinus hyperbolicus van een getal +SQRT = WORTEL ## Geeft als resultaat de positieve vierkantswortel van een getal +SQRTPI = WORTEL.PI ## Geeft als resultaat de vierkantswortel van (getal * pi) +SUBTOTAL = SUBTOTAAL ## Geeft als resultaat een subtotaal voor een bereik +SUM = SOM ## Telt de argumenten op +SUMIF = SOM.ALS ## Telt de getallen bij elkaar op die voldoen aan een bepaald criterium +SUMIFS = SOMMEN.ALS ## Telt de cellen in een bereik op die aan meerdere criteria voldoen +SUMPRODUCT = SOMPRODUCT ## Geeft als resultaat de som van de producten van de corresponderende matrixelementen +SUMSQ = KWADRATENSOM ## Geeft als resultaat de som van de kwadraten van de argumenten +SUMX2MY2 = SOM.X2MINY2 ## Geeft als resultaat de som van het verschil tussen de kwadraten van corresponderende waarden in twee matrices +SUMX2PY2 = SOM.X2PLUSY2 ## Geeft als resultaat de som van de kwadratensom van corresponderende waarden in twee matrices +SUMXMY2 = SOM.XMINY.2 ## Geeft als resultaat de som van de kwadraten van de verschillen tussen de corresponderende waarden in twee matrices +TAN = TAN ## Geeft als resultaat de tangens van een getal +TANH = TANH ## Geeft als resultaat de tangens hyperbolicus van een getal +TRUNC = GEHEEL ## Kapt een getal af tot een geheel getal + + +## +## Statistical functions Statistische functies +## +AVEDEV = GEM.DEVIATIE ## Geeft als resultaat het gemiddelde van de absolute deviaties van gegevenspunten ten opzichte van hun gemiddelde waarde +AVERAGE = GEMIDDELDE ## Geeft als resultaat het gemiddelde van de argumenten +AVERAGEA = GEMIDDELDEA ## Geeft als resultaat het gemiddelde van de argumenten, inclusief getallen, tekst en logische waarden +AVERAGEIF = GEMIDDELDE.ALS ## Geeft het gemiddelde (rekenkundig gemiddelde) als resultaat van alle cellen in een bereik die voldoen aan de opgegeven criteria +AVERAGEIFS = GEMIDDELDEN.ALS ## Geeft het gemiddelde (rekenkundig gemiddelde) als resultaat van alle cellen die aan meerdere criteria voldoen +BETADIST = BETA.VERD ## Geeft als resultaat de cumulatieve bèta-verdelingsfunctie +BETAINV = BETA.INV ## Geeft als resultaat de inverse van de cumulatieve verdelingsfunctie voor een gegeven bèta-verdeling +BINOMDIST = BINOMIALE.VERD ## Geeft als resultaat de binomiale verdeling +CHIDIST = CHI.KWADRAAT ## Geeft als resultaat de eenzijdige kans van de chi-kwadraatverdeling +CHIINV = CHI.KWADRAAT.INV ## Geeft als resultaat de inverse van een eenzijdige kans van de chi-kwadraatverdeling +CHITEST = CHI.TOETS ## Geeft als resultaat de onafhankelijkheidstoets +CONFIDENCE = BETROUWBAARHEID ## Geeft als resultaat het betrouwbaarheidsinterval van een gemiddelde waarde voor de elementen van een populatie +CORREL = CORRELATIE ## Geeft als resultaat de correlatiecoëfficiënt van twee gegevensverzamelingen +COUNT = AANTAL ## Telt het aantal getallen in de argumentenlijst +COUNTA = AANTALARG ## Telt het aantal waarden in de argumentenlijst +COUNTBLANK = AANTAL.LEGE.CELLEN ## Telt het aantal lege cellen in een bereik +COUNTIF = AANTAL.ALS ## Telt in een bereik het aantal cellen die voldoen aan een bepaald criterium +COUNTIFS = AANTALLEN.ALS ## Telt in een bereik het aantal cellen die voldoen aan meerdere criteria +COVAR = COVARIANTIE ## Geeft als resultaat de covariantie, het gemiddelde van de producten van de gepaarde deviaties +CRITBINOM = CRIT.BINOM ## Geeft als resultaat de kleinste waarde waarvoor de binomiale verdeling kleiner is dan of gelijk is aan het criterium +DEVSQ = DEV.KWAD ## Geeft als resultaat de som van de deviaties in het kwadraat +EXPONDIST = EXPON.VERD ## Geeft als resultaat de exponentiële verdeling +FDIST = F.VERDELING ## Geeft als resultaat de F-verdeling +FINV = F.INVERSE ## Geeft als resultaat de inverse van de F-verdeling +FISHER = FISHER ## Geeft als resultaat de Fisher-transformatie +FISHERINV = FISHER.INV ## Geeft als resultaat de inverse van de Fisher-transformatie +FORECAST = VOORSPELLEN ## Geeft als resultaat een waarde op basis van een lineaire trend +FREQUENCY = FREQUENTIE ## Geeft als resultaat een frequentieverdeling in de vorm van een verticale matrix +FTEST = F.TOETS ## Geeft als resultaat een F-toets +GAMMADIST = GAMMA.VERD ## Geeft als resultaat de gamma-verdeling +GAMMAINV = GAMMA.INV ## Geeft als resultaat de inverse van de cumulatieve gamma-verdeling +GAMMALN = GAMMA.LN ## Geeft als resultaat de natuurlijke logaritme van de gamma-functie, G(x) +GEOMEAN = MEETK.GEM ## Geeft als resultaat het meetkundige gemiddelde +GROWTH = GROEI ## Geeft als resultaat de waarden voor een exponentiële trend +HARMEAN = HARM.GEM ## Geeft als resultaat het harmonische gemiddelde +HYPGEOMDIST = HYPERGEO.VERD ## Geeft als resultaat de hypergeometrische verdeling +INTERCEPT = SNIJPUNT ## Geeft als resultaat het snijpunt van de lineaire regressielijn met de y-as +KURT = KURTOSIS ## Geeft als resultaat de kurtosis van een gegevensverzameling +LARGE = GROOTSTE ## Geeft als resultaat de op k-1 na grootste waarde in een gegevensverzameling +LINEST = LIJNSCH ## Geeft als resultaat de parameters van een lineaire trend +LOGEST = LOGSCH ## Geeft als resultaat de parameters van een exponentiële trend +LOGINV = LOG.NORM.INV ## Geeft als resultaat de inverse van de logaritmische normale verdeling +LOGNORMDIST = LOG.NORM.VERD ## Geeft als resultaat de cumulatieve logaritmische normale verdeling +MAX = MAX ## Geeft als resultaat de maximumwaarde in een lijst met argumenten +MAXA = MAXA ## Geeft als resultaat de maximumwaarde in een lijst met argumenten, inclusief getallen, tekst en logische waarden +MEDIAN = MEDIAAN ## Geeft als resultaat de mediaan van de opgegeven getallen +MIN = MIN ## Geeft als resultaat de minimumwaarde in een lijst met argumenten +MINA = MINA ## Geeft als resultaat de minimumwaarde in een lijst met argumenten, inclusief getallen, tekst en logische waarden +MODE = MODUS ## Geeft als resultaat de meest voorkomende waarde in een gegevensverzameling +NEGBINOMDIST = NEG.BINOM.VERD ## Geeft als resultaat de negatieve binomiaalverdeling +NORMDIST = NORM.VERD ## Geeft als resultaat de cumulatieve normale verdeling +NORMINV = NORM.INV ## Geeft als resultaat de inverse van de cumulatieve standaardnormale verdeling +NORMSDIST = STAND.NORM.VERD ## Geeft als resultaat de cumulatieve standaardnormale verdeling +NORMSINV = STAND.NORM.INV ## Geeft als resultaat de inverse van de cumulatieve normale verdeling +PEARSON = PEARSON ## Geeft als resultaat de correlatiecoëfficiënt van Pearson +PERCENTILE = PERCENTIEL ## Geeft als resultaat het k-de percentiel van waarden in een bereik +PERCENTRANK = PERCENT.RANG ## Geeft als resultaat de positie, in procenten uitgedrukt, van een waarde in de rangorde van een gegevensverzameling +PERMUT = PERMUTATIES ## Geeft als resultaat het aantal permutaties voor een gegeven aantal objecten +POISSON = POISSON ## Geeft als resultaat de Poisson-verdeling +PROB = KANS ## Geeft als resultaat de kans dat waarden zich tussen twee grenzen bevinden +QUARTILE = KWARTIEL ## Geeft als resultaat het kwartiel van een gegevensverzameling +RANK = RANG ## Geeft als resultaat het rangnummer van een getal in een lijst getallen +RSQ = R.KWADRAAT ## Geeft als resultaat het kwadraat van de Pearson-correlatiecoëfficiënt +SKEW = SCHEEFHEID ## Geeft als resultaat de mate van asymmetrie van een verdeling +SLOPE = RICHTING ## Geeft als resultaat de richtingscoëfficiënt van een lineaire regressielijn +SMALL = KLEINSTE ## Geeft als resultaat de op k-1 na kleinste waarde in een gegevensverzameling +STANDARDIZE = NORMALISEREN ## Geeft als resultaat een genormaliseerde waarde +STDEV = STDEV ## Maakt een schatting van de standaarddeviatie op basis van een steekproef +STDEVA = STDEVA ## Maakt een schatting van de standaarddeviatie op basis van een steekproef, inclusief getallen, tekst en logische waarden +STDEVP = STDEVP ## Berekent de standaarddeviatie op basis van de volledige populatie +STDEVPA = STDEVPA ## Berekent de standaarddeviatie op basis van de volledige populatie, inclusief getallen, tekst en logische waarden +STEYX = STAND.FOUT.YX ## Geeft als resultaat de standaardfout in de voorspelde y-waarde voor elke x in een regressie +TDIST = T.VERD ## Geeft als resultaat de Student T-verdeling +TINV = T.INV ## Geeft als resultaat de inverse van de Student T-verdeling +TREND = TREND ## Geeft als resultaat de waarden voor een lineaire trend +TRIMMEAN = GETRIMD.GEM ## Geeft als resultaat het gemiddelde van waarden in een gegevensverzameling +TTEST = T.TOETS ## Geeft als resultaat de kans met behulp van de Student T-toets +VAR = VAR ## Maakt een schatting van de variantie op basis van een steekproef +VARA = VARA ## Maakt een schatting van de variantie op basis van een steekproef, inclusief getallen, tekst en logische waarden +VARP = VARP ## Berekent de variantie op basis van de volledige populatie +VARPA = VARPA ## Berekent de standaarddeviatie op basis van de volledige populatie, inclusief getallen, tekst en logische waarden +WEIBULL = WEIBULL ## Geeft als resultaat de Weibull-verdeling +ZTEST = Z.TOETS ## Geeft als resultaat de eenzijdige kanswaarde van een Z-toets + + +## +## Text functions Tekstfuncties +## +ASC = ASC ## Wijzigt Nederlandse letters of katakanatekens over de volle breedte (dubbel-bytetekens) binnen een tekenreeks in tekens over de halve breedte (enkel-bytetekens) +BAHTTEXT = BAHT.TEKST ## Converteert een getal naar tekst met de valutanotatie ß (baht) +CHAR = TEKEN ## Geeft als resultaat het teken dat hoort bij de opgegeven code +CLEAN = WISSEN.CONTROL ## Verwijdert alle niet-afdrukbare tekens uit een tekst +CODE = CODE ## Geeft als resultaat de numerieke code voor het eerste teken in een tekenreeks +CONCATENATE = TEKST.SAMENVOEGEN ## Voegt verschillende tekstfragmenten samen tot één tekstfragment +DOLLAR = EURO ## Converteert een getal naar tekst met de valutanotatie € (euro) +EXACT = GELIJK ## Controleert of twee tekenreeksen identiek zijn +FIND = VIND.ALLES ## Zoekt een bepaalde tekenreeks in een tekst (waarbij onderscheid wordt gemaakt tussen hoofdletters en kleine letters) +FINDB = VIND.ALLES.B ## Zoekt een bepaalde tekenreeks in een tekst (waarbij onderscheid wordt gemaakt tussen hoofdletters en kleine letters) +FIXED = VAST ## Maakt een getal als tekst met een vast aantal decimalen op +JIS = JIS ## Wijzigt Nederlandse letters of katakanatekens over de halve breedte (enkel-bytetekens) binnen een tekenreeks in tekens over de volle breedte (dubbel-bytetekens) +LEFT = LINKS ## Geeft als resultaat de meest linkse tekens in een tekenreeks +LEFTB = LINKSB ## Geeft als resultaat de meest linkse tekens in een tekenreeks +LEN = LENGTE ## Geeft als resultaat het aantal tekens in een tekenreeks +LENB = LENGTEB ## Geeft als resultaat het aantal tekens in een tekenreeks +LOWER = KLEINE.LETTERS ## Zet tekst om in kleine letters +MID = MIDDEN ## Geeft als resultaat een bepaald aantal tekens van een tekenreeks vanaf de positie die u opgeeft +MIDB = DEELB ## Geeft als resultaat een bepaald aantal tekens van een tekenreeks vanaf de positie die u opgeeft +PHONETIC = FONETISCH ## Haalt de fonetische tekens (furigana) uit een tekenreeks op +PROPER = BEGINLETTERS ## Zet de eerste letter van elk woord in een tekst om in een hoofdletter +REPLACE = VERVANG ## Vervangt tekens binnen een tekst +REPLACEB = VERVANGENB ## Vervangt tekens binnen een tekst +REPT = HERHALING ## Herhaalt een tekst een aantal malen +RIGHT = RECHTS ## Geeft als resultaat de meest rechtse tekens in een tekenreeks +RIGHTB = RECHTSB ## Geeft als resultaat de meest rechtse tekens in een tekenreeks +SEARCH = VIND.SPEC ## Zoekt een bepaalde tekenreeks in een tekst (waarbij geen onderscheid wordt gemaakt tussen hoofdletters en kleine letters) +SEARCHB = VIND.SPEC.B ## Zoekt een bepaalde tekenreeks in een tekst (waarbij geen onderscheid wordt gemaakt tussen hoofdletters en kleine letters) +SUBSTITUTE = SUBSTITUEREN ## Vervangt oude tekst door nieuwe tekst in een tekenreeks +T = T ## Converteert de argumenten naar tekst +TEXT = TEKST ## Maakt een getal op en converteert het getal naar tekst +TRIM = SPATIES.WISSEN ## Verwijdert de spaties uit een tekst +UPPER = HOOFDLETTERS ## Zet tekst om in hoofdletters +VALUE = WAARDE ## Converteert tekst naar een getal diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/no/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/no/config new file mode 100644 index 0000000..c7f4152 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/no/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = kr + + +## +## Excel Error Codes (For future use) + +## +NULL = #NULL! +DIV0 = #DIV/0! +VALUE = #VERDI! +REF = #REF! +NAME = #NAVN? +NUM = #NUM! +NA = #I/T diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/no/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/no/functions new file mode 100644 index 0000000..ab2a379 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/no/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Funksjonene Tillegg og Automatisering +## +GETPIVOTDATA = HENTPIVOTDATA ## Returnerer data som er lagret i en pivottabellrapport + + +## +## Cube functions Kubefunksjoner +## +CUBEKPIMEMBER = KUBEKPIMEDLEM ## Returnerer navnet, egenskapen og målet for en viktig ytelsesindikator (KPI), og viser navnet og egenskapen i cellen. En KPI er en målbar enhet, for eksempel månedlig bruttoinntjening eller kvartalsvis inntjening per ansatt, og brukes til å overvåke ytelsen i en organisasjon. +CUBEMEMBER = KUBEMEDLEM ## Returnerer et medlem eller en tuppel i et kubehierarki. Brukes til å validere at medlemmet eller tuppelen finnes i kuben. +CUBEMEMBERPROPERTY = KUBEMEDLEMEGENSKAP ## Returnerer verdien til en medlemsegenskap i kuben. Brukes til å validere at et medlemsnavn finnes i kuben, og til å returnere den angitte egenskapen for dette medlemmet. +CUBERANKEDMEMBER = KUBERANGERTMEDLEM ## Returnerer det n-te, eller rangerte, medlemmet i et sett. Brukes til å returnere ett eller flere elementer i et sett, for eksempel de 10 beste studentene. +CUBESET = KUBESETT ## Definerer et beregnet sett av medlemmer eller tuppeler ved å sende et settuttrykk til kuben på serveren, noe som oppretter settet og deretter returnerer dette settet til Microsoft Office Excel. +CUBESETCOUNT = KUBESETTANTALL ## Returnerer antallet elementer i et sett. +CUBEVALUE = KUBEVERDI ## Returnerer en aggregert verdi fra en kube. + + +## +## Database functions Databasefunksjoner +## +DAVERAGE = DGJENNOMSNITT ## Returnerer gjennomsnittet av merkede databaseposter +DCOUNT = DANTALL ## Teller celler som inneholder tall i en database +DCOUNTA = DANTALLA ## Teller celler som ikke er tomme i en database +DGET = DHENT ## Trekker ut fra en database en post som oppfyller angitte vilkår +DMAX = DMAKS ## Returnerer maksimumsverdien fra merkede databaseposter +DMIN = DMIN ## Returnerer minimumsverdien fra merkede databaseposter +DPRODUCT = DPRODUKT ## Multipliserer verdiene i et bestemt felt med poster som oppfyller vilkårene i en database +DSTDEV = DSTDAV ## Estimerer standardavviket basert på et utvalg av merkede databaseposter +DSTDEVP = DSTAVP ## Beregner standardavviket basert på at merkede databaseposter utgjør hele populasjonen +DSUM = DSUMMER ## Legger til tallene i feltkolonnen med poster, i databasen som oppfyller vilkårene +DVAR = DVARIANS ## Estimerer variansen basert på et utvalg av merkede databaseposter +DVARP = DVARIANSP ## Beregner variansen basert på at merkede databaseposter utgjør hele populasjonen + + +## +## Date and time functions Dato- og tidsfunksjoner +## +DATE = DATO ## Returnerer serienummeret som svarer til en bestemt dato +DATEVALUE = DATOVERDI ## Konverterer en dato med tekstformat til et serienummer +DAY = DAG ## Konverterer et serienummer til en dag i måneden +DAYS360 = DAGER360 ## Beregner antall dager mellom to datoer basert på et år med 360 dager +EDATE = DAG.ETTER ## Returnerer serienummeret som svarer til datoen som er det indikerte antall måneder før eller etter startdatoen +EOMONTH = MÅNEDSSLUTT ## Returnerer serienummeret som svarer til siste dag i måneden, før eller etter et angitt antall måneder +HOUR = TIME ## Konverterer et serienummer til en time +MINUTE = MINUTT ## Konverterer et serienummer til et minutt +MONTH = MÅNED ## Konverterer et serienummer til en måned +NETWORKDAYS = NETT.ARBEIDSDAGER ## Returnerer antall hele arbeidsdager mellom to datoer +NOW = NÅ ## Returnerer serienummeret som svarer til gjeldende dato og klokkeslett +SECOND = SEKUND ## Konverterer et serienummer til et sekund +TIME = TID ## Returnerer serienummeret som svarer til et bestemt klokkeslett +TIMEVALUE = TIDSVERDI ## Konverterer et klokkeslett i tekstformat til et serienummer +TODAY = IDAG ## Returnerer serienummeret som svarer til dagens dato +WEEKDAY = UKEDAG ## Konverterer et serienummer til en ukedag +WEEKNUM = UKENR ## Konverterer et serienummer til et tall som representerer hvilket nummer uken har i et år +WORKDAY = ARBEIDSDAG ## Returnerer serienummeret som svarer til datoen før eller etter et angitt antall arbeidsdager +YEAR = ÅR ## Konverterer et serienummer til et år +YEARFRAC = ÅRDEL ## Returnerer brøkdelen for året, som svarer til antall hele dager mellom startdato og sluttdato + + +## +## Engineering functions Tekniske funksjoner +## +BESSELI = BESSELI ## Returnerer den endrede Bessel-funksjonen In(x) +BESSELJ = BESSELJ ## Returnerer Bessel-funksjonen Jn(x) +BESSELK = BESSELK ## Returnerer den endrede Bessel-funksjonen Kn(x) +BESSELY = BESSELY ## Returnerer Bessel-funksjonen Yn(x) +BIN2DEC = BINTILDES ## Konverterer et binært tall til et desimaltall +BIN2HEX = BINTILHEKS ## Konverterer et binært tall til et heksadesimaltall +BIN2OCT = BINTILOKT ## Konverterer et binært tall til et oktaltall +COMPLEX = KOMPLEKS ## Konverterer reelle og imaginære koeffisienter til et komplekst tall +CONVERT = KONVERTER ## Konverterer et tall fra ett målsystem til et annet +DEC2BIN = DESTILBIN ## Konverterer et desimaltall til et binærtall +DEC2HEX = DESTILHEKS ## Konverterer et heltall i 10-tallsystemet til et heksadesimalt tall +DEC2OCT = DESTILOKT ## Konverterer et heltall i 10-tallsystemet til et oktaltall +DELTA = DELTA ## Undersøker om to verdier er like +ERF = FEILF ## Returnerer feilfunksjonen +ERFC = FEILFK ## Returnerer den komplementære feilfunksjonen +GESTEP = GRENSEVERDI ## Tester om et tall er større enn en terskelverdi +HEX2BIN = HEKSTILBIN ## Konverterer et heksadesimaltall til et binært tall +HEX2DEC = HEKSTILDES ## Konverterer et heksadesimalt tall til et heltall i 10-tallsystemet +HEX2OCT = HEKSTILOKT ## Konverterer et heksadesimalt tall til et oktaltall +IMABS = IMABS ## Returnerer absoluttverdien (koeffisienten) til et komplekst tall +IMAGINARY = IMAGINÆR ## Returnerer den imaginære koeffisienten til et komplekst tall +IMARGUMENT = IMARGUMENT ## Returnerer argumentet theta, som er en vinkel uttrykt i radianer +IMCONJUGATE = IMKONJUGERT ## Returnerer den komplekse konjugaten til et komplekst tall +IMCOS = IMCOS ## Returnerer cosinus til et komplekst tall +IMDIV = IMDIV ## Returnerer kvotienten til to komplekse tall +IMEXP = IMEKSP ## Returnerer eksponenten til et komplekst tall +IMLN = IMLN ## Returnerer den naturlige logaritmen for et komplekst tall +IMLOG10 = IMLOG10 ## Returnerer logaritmen med grunntall 10 for et komplekst tall +IMLOG2 = IMLOG2 ## Returnerer logaritmen med grunntall 2 for et komplekst tall +IMPOWER = IMOPPHØY ## Returnerer et komplekst tall opphøyd til en heltallspotens +IMPRODUCT = IMPRODUKT ## Returnerer produktet av komplekse tall +IMREAL = IMREELL ## Returnerer den reelle koeffisienten til et komplekst tall +IMSIN = IMSIN ## Returnerer sinus til et komplekst tall +IMSQRT = IMROT ## Returnerer kvadratroten av et komplekst tall +IMSUB = IMSUB ## Returnerer differansen mellom to komplekse tall +IMSUM = IMSUMMER ## Returnerer summen av komplekse tall +OCT2BIN = OKTTILBIN ## Konverterer et oktaltall til et binært tall +OCT2DEC = OKTTILDES ## Konverterer et oktaltall til et desimaltall +OCT2HEX = OKTTILHEKS ## Konverterer et oktaltall til et heksadesimaltall + + +## +## Financial functions Økonomiske funksjoner +## +ACCRINT = PÅLØPT.PERIODISK.RENTE ## Returnerer påløpte renter for et verdipapir som betaler periodisk rente +ACCRINTM = PÅLØPT.FORFALLSRENTE ## Returnerer den påløpte renten for et verdipapir som betaler rente ved forfall +AMORDEGRC = AMORDEGRC ## Returnerer avskrivningen for hver regnskapsperiode ved hjelp av en avskrivingskoeffisient +AMORLINC = AMORLINC ## Returnerer avskrivingen for hver regnskapsperiode +COUPDAYBS = OBLIG.DAGER.FF ## Returnerer antall dager fra begynnelsen av den rentebærende perioden til innløsningsdatoen +COUPDAYS = OBLIG.DAGER ## Returnerer antall dager i den rentebærende perioden som inneholder innløsningsdatoen +COUPDAYSNC = OBLIG.DAGER.NF ## Returnerer antall dager fra betalingsdato til neste renteinnbetalingsdato +COUPNCD = OBLIG.DAGER.EF ## Returnerer obligasjonsdatoen som kommer etter oppgjørsdatoen +COUPNUM = OBLIG.ANTALL ## Returnerer antall obligasjoner som skal betales mellom oppgjørsdatoen og forfallsdatoen +COUPPCD = OBLIG.DAG.FORRIGE ## Returnerer obligasjonsdatoen som kommer før oppgjørsdatoen +CUMIPMT = SAMLET.RENTE ## Returnerer den kumulative renten som er betalt mellom to perioder +CUMPRINC = SAMLET.HOVEDSTOL ## Returnerer den kumulative hovedstolen som er betalt for et lån mellom to perioder +DB = DAVSKR ## Returnerer avskrivningen for et aktivum i en angitt periode, foretatt med fast degressiv avskrivning +DDB = DEGRAVS ## Returnerer avskrivningen for et aktivum for en gitt periode, ved hjelp av dobbel degressiv avskrivning eller en metode som du selv angir +DISC = DISKONTERT ## Returnerer diskonteringsraten for et verdipapir +DOLLARDE = DOLLARDE ## Konverterer en valutapris uttrykt som en brøk, til en valutapris uttrykt som et desimaltall +DOLLARFR = DOLLARBR ## Konverterer en valutapris uttrykt som et desimaltall, til en valutapris uttrykt som en brøk +DURATION = VARIGHET ## Returnerer årlig varighet for et verdipapir med renter som betales periodisk +EFFECT = EFFEKTIV.RENTE ## Returnerer den effektive årlige rentesatsen +FV = SLUTTVERDI ## Returnerer fremtidig verdi for en investering +FVSCHEDULE = SVPLAN ## Returnerer den fremtidige verdien av en inngående hovedstol etter å ha anvendt en serie med sammensatte rentesatser +INTRATE = RENTESATS ## Returnerer rentefoten av et fullfinansiert verdipapir +IPMT = RAVDRAG ## Returnerer betalte renter på en investering for en gitt periode +IRR = IR ## Returnerer internrenten for en serie kontantstrømmer +ISPMT = ER.AVDRAG ## Beregner renten som er betalt for en investering i løpet av en bestemt periode +MDURATION = MVARIGHET ## Returnerer Macauleys modifiserte varighet for et verdipapir med en antatt pålydende verdi på kr 100,00 +MIRR = MODIR ## Returnerer internrenten der positive og negative kontantstrømmer finansieres med forskjellige satser +NOMINAL = NOMINELL ## Returnerer årlig nominell rentesats +NPER = PERIODER ## Returnerer antall perioder for en investering +NPV = NNV ## Returnerer netto nåverdi for en investering, basert på en serie periodiske kontantstrømmer og en rentesats +ODDFPRICE = AVVIKFP.PRIS ## Returnerer pris pålydende kr 100 for et verdipapir med en odde første periode +ODDFYIELD = AVVIKFP.AVKASTNING ## Returnerer avkastingen for et verdipapir med en odde første periode +ODDLPRICE = AVVIKSP.PRIS ## Returnerer pris pålydende kr 100 for et verdipapir med en odde siste periode +ODDLYIELD = AVVIKSP.AVKASTNING ## Returnerer avkastingen for et verdipapir med en odde siste periode +PMT = AVDRAG ## Returnerer periodisk betaling for en annuitet +PPMT = AMORT ## Returnerer betalingen på hovedstolen for en investering i en gitt periode +PRICE = PRIS ## Returnerer prisen per pålydende kr 100 for et verdipapir som gir periodisk avkastning +PRICEDISC = PRIS.DISKONTERT ## Returnerer prisen per pålydende kr 100 for et diskontert verdipapir +PRICEMAT = PRIS.FORFALL ## Returnerer prisen per pålydende kr 100 av et verdipapir som betaler rente ved forfall +PV = NÅVERDI ## Returnerer nåverdien av en investering +RATE = RENTE ## Returnerer rentesatsen per periode for en annuitet +RECEIVED = MOTTATT.AVKAST ## Returnerer summen som mottas ved forfallsdato for et fullinvestert verdipapir +SLN = LINAVS ## Returnerer den lineære avskrivningen for et aktivum i én periode +SYD = ÅRSAVS ## Returnerer årsavskrivningen for et aktivum i en angitt periode +TBILLEQ = TBILLEKV ## Returnerer den obligasjonsekvivalente avkastningen for en statsobligasjon +TBILLPRICE = TBILLPRIS ## Returnerer prisen per pålydende kr 100 for en statsobligasjon +TBILLYIELD = TBILLAVKASTNING ## Returnerer avkastningen til en statsobligasjon +VDB = VERDIAVS ## Returnerer avskrivningen for et aktivum i en angitt periode eller delperiode, ved hjelp av degressiv avskrivning +XIRR = XIR ## Returnerer internrenten for en serie kontantstrømmer som ikke nødvendigvis er periodiske +XNPV = XNNV ## Returnerer netto nåverdi for en serie kontantstrømmer som ikke nødvendigvis er periodiske +YIELD = AVKAST ## Returnerer avkastningen på et verdipapir som betaler periodisk rente +YIELDDISC = AVKAST.DISKONTERT ## Returnerer årlig avkastning for et diskontert verdipapir, for eksempel en statskasseveksel +YIELDMAT = AVKAST.FORFALL ## Returnerer den årlige avkastningen for et verdipapir som betaler rente ved forfallsdato + + +## +## Information functions Informasjonsfunksjoner +## +CELL = CELLE ## Returnerer informasjon om formatering, plassering eller innholdet til en celle +ERROR.TYPE = FEIL.TYPE ## Returnerer et tall som svarer til en feiltype +INFO = INFO ## Returnerer informasjon om gjeldende operativmiljø +ISBLANK = ERTOM ## Returnerer SANN hvis verdien er tom +ISERR = ERFEIL ## Returnerer SANN hvis verdien er en hvilken som helst annen feilverdi enn #I/T +ISERROR = ERFEIL ## Returnerer SANN hvis verdien er en hvilken som helst feilverdi +ISEVEN = ERPARTALL ## Returnerer SANN hvis tallet er et partall +ISLOGICAL = ERLOGISK ## Returnerer SANN hvis verdien er en logisk verdi +ISNA = ERIT ## Returnerer SANN hvis verdien er feilverdien #I/T +ISNONTEXT = ERIKKETEKST ## Returnerer SANN hvis verdien ikke er tekst +ISNUMBER = ERTALL ## Returnerer SANN hvis verdien er et tall +ISODD = ERODDETALL ## Returnerer SANN hvis tallet er et oddetall +ISREF = ERREF ## Returnerer SANN hvis verdien er en referanse +ISTEXT = ERTEKST ## Returnerer SANN hvis verdien er tekst +N = N ## Returnerer en verdi som er konvertert til et tall +NA = IT ## Returnerer feilverdien #I/T +TYPE = VERDITYPE ## Returnerer et tall som indikerer datatypen til en verdi + + +## +## Logical functions Logiske funksjoner +## +AND = OG ## Returnerer SANN hvis alle argumentene er lik SANN +FALSE = USANN ## Returnerer den logiske verdien USANN +IF = HVIS ## Angir en logisk test som skal utføres +IFERROR = HVISFEIL ## Returnerer en verdi du angir hvis en formel evaluerer til en feil. Ellers returnerer den resultatet av formelen. +NOT = IKKE ## Reverserer logikken til argumentet +OR = ELLER ## Returnerer SANN hvis ett eller flere argumenter er lik SANN +TRUE = SANN ## Returnerer den logiske verdien SANN + + +## +## Lookup and reference functions Oppslag- og referansefunksjoner +## +ADDRESS = ADRESSE ## Returnerer en referanse som tekst til en enkelt celle i et regneark +AREAS = OMRÅDER ## Returnerer antall områder i en referanse +CHOOSE = VELG ## Velger en verdi fra en liste med verdier +COLUMN = KOLONNE ## Returnerer kolonnenummeret for en referanse +COLUMNS = KOLONNER ## Returnerer antall kolonner i en referanse +HLOOKUP = FINN.KOLONNE ## Leter i den øverste raden i en matrise og returnerer verdien for den angitte cellen +HYPERLINK = HYPERKOBLING ## Oppretter en snarvei eller et hopp som åpner et dokument som er lagret på en nettverksserver, et intranett eller Internett +INDEX = INDEKS ## Bruker en indeks til å velge en verdi fra en referanse eller matrise +INDIRECT = INDIREKTE ## Returnerer en referanse angitt av en tekstverdi +LOOKUP = SLÅ.OPP ## Slår opp verdier i en vektor eller matrise +MATCH = SAMMENLIGNE ## Slår opp verdier i en referanse eller matrise +OFFSET = FORSKYVNING ## Returnerer en referanseforskyvning fra en gitt referanse +ROW = RAD ## Returnerer radnummeret for en referanse +ROWS = RADER ## Returnerer antall rader i en referanse +RTD = RTD ## Henter sanntidsdata fra et program som støtter COM-automatisering (automatisering: En måte å arbeide på med programobjekter fra et annet program- eller utviklingsverktøy. Tidligere kalt OLE-automatisering. Automatisering er en bransjestandard og en funksjon i Component Object Model (COM).) +TRANSPOSE = TRANSPONER ## Returnerer transponeringen av en matrise +VLOOKUP = FINN.RAD ## Leter i den første kolonnen i en matrise og flytter bortover raden for å returnere verdien til en celle + + +## +## Math and trigonometry functions Matematikk- og trigonometrifunksjoner +## +ABS = ABS ## Returnerer absoluttverdien til et tall +ACOS = ARCCOS ## Returnerer arcus cosinus til et tall +ACOSH = ARCCOSH ## Returnerer den inverse hyperbolske cosinus til et tall +ASIN = ARCSIN ## Returnerer arcus sinus til et tall +ASINH = ARCSINH ## Returnerer den inverse hyperbolske sinus til et tall +ATAN = ARCTAN ## Returnerer arcus tangens til et tall +ATAN2 = ARCTAN2 ## Returnerer arcus tangens fra x- og y-koordinater +ATANH = ARCTANH ## Returnerer den inverse hyperbolske tangens til et tall +CEILING = AVRUND.GJELDENDE.MULTIPLUM ## Runder av et tall til nærmeste heltall eller til nærmeste signifikante multiplum +COMBIN = KOMBINASJON ## Returnerer antall kombinasjoner for ett gitt antall objekter +COS = COS ## Returnerer cosinus til et tall +COSH = COSH ## Returnerer den hyperbolske cosinus til et tall +DEGREES = GRADER ## Konverterer radianer til grader +EVEN = AVRUND.TIL.PARTALL ## Runder av et tall oppover til nærmeste heltall som er et partall +EXP = EKSP ## Returnerer e opphøyd i en angitt potens +FACT = FAKULTET ## Returnerer fakultet til et tall +FACTDOUBLE = DOBBELFAKT ## Returnerer et talls doble fakultet +FLOOR = AVRUND.GJELDENDE.MULTIPLUM.NED ## Avrunder et tall nedover, mot null +GCD = SFF ## Returnerer høyeste felles divisor +INT = HELTALL ## Avrunder et tall nedover til nærmeste heltall +LCM = MFM ## Returnerer minste felles multiplum +LN = LN ## Returnerer den naturlige logaritmen til et tall +LOG = LOG ## Returnerer logaritmen for et tall til et angitt grunntall +LOG10 = LOG10 ## Returnerer logaritmen med grunntall 10 for et tall +MDETERM = MDETERM ## Returnerer matrisedeterminanten til en matrise +MINVERSE = MINVERS ## Returnerer den inverse matrisen til en matrise +MMULT = MMULT ## Returnerer matriseproduktet av to matriser +MOD = REST ## Returnerer resten fra en divisjon +MROUND = MRUND ## Returnerer et tall avrundet til det ønskede multiplum +MULTINOMIAL = MULTINOMINELL ## Returnerer det multinominelle for et sett med tall +ODD = AVRUND.TIL.ODDETALL ## Runder av et tall oppover til nærmeste heltall som er et oddetall +PI = PI ## Returnerer verdien av pi +POWER = OPPHØYD.I ## Returnerer resultatet av et tall opphøyd i en potens +PRODUCT = PRODUKT ## Multipliserer argumentene +QUOTIENT = KVOTIENT ## Returnerer heltallsdelen av en divisjon +RADIANS = RADIANER ## Konverterer grader til radianer +RAND = TILFELDIG ## Returnerer et tilfeldig tall mellom 0 og 1 +RANDBETWEEN = TILFELDIGMELLOM ## Returnerer et tilfeldig tall innenfor et angitt område +ROMAN = ROMERTALL ## Konverterer vanlige tall til romertall, som tekst +ROUND = AVRUND ## Avrunder et tall til et angitt antall sifre +ROUNDDOWN = AVRUND.NED ## Avrunder et tall nedover, mot null +ROUNDUP = AVRUND.OPP ## Runder av et tall oppover, bort fra null +SERIESSUM = SUMMER.REKKE ## Returnerer summen av en geometrisk rekke, basert på formelen +SIGN = FORTEGN ## Returnerer fortegnet for et tall +SIN = SIN ## Returnerer sinus til en gitt vinkel +SINH = SINH ## Returnerer den hyperbolske sinus til et tall +SQRT = ROT ## Returnerer en positiv kvadratrot +SQRTPI = ROTPI ## Returnerer kvadratroten av (tall * pi) +SUBTOTAL = DELSUM ## Returnerer en delsum i en liste eller database +SUM = SUMMER ## Legger sammen argumentene +SUMIF = SUMMERHVIS ## Legger sammen cellene angitt ved et gitt vilkår +SUMIFS = SUMMER.HVIS.SETT ## Legger sammen cellene i et område som oppfyller flere vilkår +SUMPRODUCT = SUMMERPRODUKT ## Returnerer summen av produktene av tilsvarende matrisekomponenter +SUMSQ = SUMMERKVADRAT ## Returnerer kvadratsummen av argumentene +SUMX2MY2 = SUMMERX2MY2 ## Returnerer summen av differansen av kvadratene for tilsvarende verdier i to matriser +SUMX2PY2 = SUMMERX2PY2 ## Returnerer summen av kvadratsummene for tilsvarende verdier i to matriser +SUMXMY2 = SUMMERXMY2 ## Returnerer summen av kvadratene av differansen for tilsvarende verdier i to matriser +TAN = TAN ## Returnerer tangens for et tall +TANH = TANH ## Returnerer den hyperbolske tangens for et tall +TRUNC = AVKORT ## Korter av et tall til et heltall + + +## +## Statistical functions Statistiske funksjoner +## +AVEDEV = GJENNOMSNITTSAVVIK ## Returnerer datapunktenes gjennomsnittlige absoluttavvik fra middelverdien +AVERAGE = GJENNOMSNITT ## Returnerer gjennomsnittet for argumentene +AVERAGEA = GJENNOMSNITTA ## Returnerer gjennomsnittet for argumentene, inkludert tall, tekst og logiske verdier +AVERAGEIF = GJENNOMSNITTHVIS ## Returnerer gjennomsnittet (aritmetisk gjennomsnitt) av alle cellene i et område som oppfyller et bestemt vilkår +AVERAGEIFS = GJENNOMSNITT.HVIS.SETT ## Returnerer gjennomsnittet (aritmetisk middelverdi) av alle celler som oppfyller flere vilkår. +BETADIST = BETA.FORDELING ## Returnerer den kumulative betafordelingsfunksjonen +BETAINV = INVERS.BETA.FORDELING ## Returnerer den inverse verdien til fordelingsfunksjonen for en angitt betafordeling +BINOMDIST = BINOM.FORDELING ## Returnerer den individuelle binomiske sannsynlighetsfordelingen +CHIDIST = KJI.FORDELING ## Returnerer den ensidige sannsynligheten for en kjikvadrert fordeling +CHIINV = INVERS.KJI.FORDELING ## Returnerer den inverse av den ensidige sannsynligheten for den kjikvadrerte fordelingen +CHITEST = KJI.TEST ## Utfører testen for uavhengighet +CONFIDENCE = KONFIDENS ## Returnerer konfidensintervallet til gjennomsnittet for en populasjon +CORREL = KORRELASJON ## Returnerer korrelasjonskoeffisienten mellom to datasett +COUNT = ANTALL ## Teller hvor mange tall som er i argumentlisten +COUNTA = ANTALLA ## Teller hvor mange verdier som er i argumentlisten +COUNTBLANK = TELLBLANKE ## Teller antall tomme celler i et område. +COUNTIF = ANTALL.HVIS ## Teller antall celler i et område som oppfyller gitte vilkår +COUNTIFS = ANTALL.HVIS.SETT ## Teller antallet ikke-tomme celler i et område som oppfyller flere vilkår +COVAR = KOVARIANS ## Returnerer kovariansen, gjennomsnittet av produktene av parvise avvik +CRITBINOM = GRENSE.BINOM ## Returnerer den minste verdien der den kumulative binomiske fordelingen er mindre enn eller lik en vilkårsverdi +DEVSQ = AVVIK.KVADRERT ## Returnerer summen av kvadrerte avvik +EXPONDIST = EKSP.FORDELING ## Returnerer eksponentialfordelingen +FDIST = FFORDELING ## Returnerer F-sannsynlighetsfordelingen +FINV = FFORDELING.INVERS ## Returnerer den inverse av den sannsynlige F-fordelingen +FISHER = FISHER ## Returnerer Fisher-transformasjonen +FISHERINV = FISHERINV ## Returnerer den inverse av Fisher-transformasjonen +FORECAST = PROGNOSE ## Returnerer en verdi langs en lineær trend +FREQUENCY = FREKVENS ## Returnerer en frekvensdistribusjon som en loddrett matrise +FTEST = FTEST ## Returnerer resultatet av en F-test +GAMMADIST = GAMMAFORDELING ## Returnerer gammafordelingen +GAMMAINV = GAMMAINV ## Returnerer den inverse av den gammakumulative fordelingen +GAMMALN = GAMMALN ## Returnerer den naturlige logaritmen til gammafunksjonen G(x) +GEOMEAN = GJENNOMSNITT.GEOMETRISK ## Returnerer den geometriske middelverdien +GROWTH = VEKST ## Returnerer verdier langs en eksponentiell trend +HARMEAN = GJENNOMSNITT.HARMONISK ## Returnerer den harmoniske middelverdien +HYPGEOMDIST = HYPGEOM.FORDELING ## Returnerer den hypergeometriske fordelingen +INTERCEPT = SKJÆRINGSPUNKT ## Returnerer skjæringspunktet til den lineære regresjonslinjen +KURT = KURT ## Returnerer kurtosen til et datasett +LARGE = N.STØRST ## Returnerer den n-te største verdien i et datasett +LINEST = RETTLINJE ## Returnerer parameterne til en lineær trend +LOGEST = KURVE ## Returnerer parameterne til en eksponentiell trend +LOGINV = LOGINV ## Returnerer den inverse lognormale fordelingen +LOGNORMDIST = LOGNORMFORD ## Returnerer den kumulative lognormale fordelingen +MAX = STØRST ## Returnerer maksimumsverdien i en argumentliste +MAXA = MAKSA ## Returnerer maksimumsverdien i en argumentliste, inkludert tall, tekst og logiske verdier +MEDIAN = MEDIAN ## Returnerer medianen til tallene som er gitt +MIN = MIN ## Returnerer minimumsverdien i en argumentliste +MINA = MINA ## Returnerer den minste verdien i en argumentliste, inkludert tall, tekst og logiske verdier +MODE = MODUS ## Returnerer den vanligste verdien i et datasett +NEGBINOMDIST = NEGBINOM.FORDELING ## Returnerer den negative binomiske fordelingen +NORMDIST = NORMALFORDELING ## Returnerer den kumulative normalfordelingen +NORMINV = NORMINV ## Returnerer den inverse kumulative normalfordelingen +NORMSDIST = NORMSFORDELING ## Returnerer standard kumulativ normalfordeling +NORMSINV = NORMSINV ## Returnerer den inverse av den den kumulative standard normalfordelingen +PEARSON = PEARSON ## Returnerer produktmomentkorrelasjonskoeffisienten, Pearson +PERCENTILE = PERSENTIL ## Returnerer den n-te persentil av verdiene i et område +PERCENTRANK = PROSENTDEL ## Returnerer prosentrangeringen av en verdi i et datasett +PERMUT = PERMUTER ## Returnerer antall permutasjoner for et gitt antall objekter +POISSON = POISSON ## Returnerer Poissons sannsynlighetsfordeling +PROB = SANNSYNLIG ## Returnerer sannsynligheten for at verdier i et område ligger mellom to grenser +QUARTILE = KVARTIL ## Returnerer kvartilen til et datasett +RANK = RANG ## Returnerer rangeringen av et tall, eller plassen tallet har i en rekke +RSQ = RKVADRAT ## Returnerer kvadratet av produktmomentkorrelasjonskoeffisienten (Pearsons r) +SKEW = SKJEVFORDELING ## Returnerer skjevheten i en fordeling +SLOPE = STIGNINGSTALL ## Returnerer stigningtallet for den lineære regresjonslinjen +SMALL = N.MINST ## Returnerer den n-te minste verdien i et datasett +STANDARDIZE = NORMALISER ## Returnerer en normalisert verdi +STDEV = STDAV ## Estimere standardavvik på grunnlag av et utvalg +STDEVA = STDAVVIKA ## Estimerer standardavvik basert på et utvalg, inkludert tall, tekst og logiske verdier +STDEVP = STDAVP ## Beregner standardavvik basert på hele populasjonen +STDEVPA = STDAVVIKPA ## Beregner standardavvik basert på hele populasjonen, inkludert tall, tekst og logiske verdier +STEYX = STANDARDFEIL ## Returnerer standardfeilen for den predikerte y-verdien for hver x i regresjonen +TDIST = TFORDELING ## Returnerer en Student t-fordeling +TINV = TINV ## Returnerer den inverse Student t-fordelingen +TREND = TREND ## Returnerer verdier langs en lineær trend +TRIMMEAN = TRIMMET.GJENNOMSNITT ## Returnerer den interne middelverdien til et datasett +TTEST = TTEST ## Returnerer sannsynligheten assosiert med en Student t-test +VAR = VARIANS ## Estimerer varians basert på et utvalg +VARA = VARIANSA ## Estimerer varians basert på et utvalg, inkludert tall, tekst og logiske verdier +VARP = VARIANSP ## Beregner varians basert på hele populasjonen +VARPA = VARIANSPA ## Beregner varians basert på hele populasjonen, inkludert tall, tekst og logiske verdier +WEIBULL = WEIBULL.FORDELING ## Returnerer Weibull-fordelingen +ZTEST = ZTEST ## Returnerer den ensidige sannsynlighetsverdien for en z-test + + +## +## Text functions Tekstfunksjoner +## +ASC = STIGENDE ## Endrer fullbreddes (dobbeltbyte) engelske bokstaver eller katakana i en tegnstreng, til halvbreddes (enkeltbyte) tegn +BAHTTEXT = BAHTTEKST ## Konverterer et tall til tekst, og bruker valutaformatet ß (baht) +CHAR = TEGNKODE ## Returnerer tegnet som svarer til kodenummeret +CLEAN = RENSK ## Fjerner alle tegn som ikke kan skrives ut, fra teksten +CODE = KODE ## Returnerer en numerisk kode for det første tegnet i en tekststreng +CONCATENATE = KJEDE.SAMMEN ## Slår sammen flere tekstelementer til ett tekstelement +DOLLAR = VALUTA ## Konverterer et tall til tekst, og bruker valutaformatet $ (dollar) +EXACT = EKSAKT ## Kontrollerer om to tekstverdier er like +FIND = FINN ## Finner en tekstverdi inne i en annen (skiller mellom store og små bokstaver) +FINDB = FINNB ## Finner en tekstverdi inne i en annen (skiller mellom store og små bokstaver) +FIXED = FASTSATT ## Formaterer et tall som tekst med et bestemt antall desimaler +JIS = JIS ## Endrer halvbreddes (enkeltbyte) engelske bokstaver eller katakana i en tegnstreng, til fullbreddes (dobbeltbyte) tegn +LEFT = VENSTRE ## Returnerer tegnene lengst til venstre i en tekstverdi +LEFTB = VENSTREB ## Returnerer tegnene lengst til venstre i en tekstverdi +LEN = LENGDE ## Returnerer antall tegn i en tekststreng +LENB = LENGDEB ## Returnerer antall tegn i en tekststreng +LOWER = SMÅ ## Konverterer tekst til små bokstaver +MID = DELTEKST ## Returnerer et angitt antall tegn fra en tekststreng, og begynner fra posisjonen du angir +MIDB = DELTEKSTB ## Returnerer et angitt antall tegn fra en tekststreng, og begynner fra posisjonen du angir +PHONETIC = FURIGANA ## Trekker ut fonetiske tegn (furigana) fra en tekststreng +PROPER = STOR.FORBOKSTAV ## Gir den første bokstaven i hvert ord i en tekstverdi stor forbokstav +REPLACE = ERSTATT ## Erstatter tegn i en tekst +REPLACEB = ERSTATTB ## Erstatter tegn i en tekst +REPT = GJENTA ## Gjentar tekst et gitt antall ganger +RIGHT = HØYRE ## Returnerer tegnene lengst til høyre i en tekstverdi +RIGHTB = HØYREB ## Returnerer tegnene lengst til høyre i en tekstverdi +SEARCH = SØK ## Finner en tekstverdi inne i en annen (skiller ikke mellom store og små bokstaver) +SEARCHB = SØKB ## Finner en tekstverdi inne i en annen (skiller ikke mellom store og små bokstaver) +SUBSTITUTE = BYTT.UT ## Bytter ut gammel tekst med ny tekst i en tekststreng +T = T ## Konverterer argumentene til tekst +TEXT = TEKST ## Formaterer et tall og konverterer det til tekst +TRIM = TRIMME ## Fjerner mellomrom fra tekst +UPPER = STORE ## Konverterer tekst til store bokstaver +VALUE = VERDI ## Konverterer et tekstargument til et tall diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pl/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pl/config new file mode 100644 index 0000000..00f8b9a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pl/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = zł + + +## +## Excel Error Codes (For future use) + +## +NULL = #ZERO! +DIV0 = #DZIEL/0! +VALUE = #ARG! +REF = #ADR! +NAME = #NAZWA? +NUM = #LICZBA! +NA = #N/D! diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pl/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pl/functions new file mode 100644 index 0000000..907a4ff --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pl/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Funkcje dodatków i automatyzacji +## +GETPIVOTDATA = WEŹDANETABELI ## Zwraca dane przechowywane w raporcie tabeli przestawnej. + + +## +## Cube functions Funkcje modułów +## +CUBEKPIMEMBER = ELEMENT.KPI.MODUŁU ## Zwraca nazwę, właściwość i miarę kluczowego wskaźnika wydajności (KPI) oraz wyświetla nazwę i właściwość w komórce. Wskaźnik KPI jest miarą ilościową, taką jak miesięczny zysk brutto lub kwartalna fluktuacja pracowników, używaną do monitorowania wydajności organizacji. +CUBEMEMBER = ELEMENT.MODUŁU ## Zwraca element lub krotkę z hierarchii modułu. Służy do sprawdzania, czy element lub krotka istnieje w module. +CUBEMEMBERPROPERTY = WŁAŚCIWOŚĆ.ELEMENTU.MODUŁU ## Zwraca wartość właściwości elementu w module. Służy do sprawdzania, czy nazwa elementu istnieje w module, i zwracania określonej właściwości dla tego elementu. +CUBERANKEDMEMBER = USZEREGOWANY.ELEMENT.MODUŁU ## Zwraca n-ty (albo uszeregowany) element zestawu. Służy do zwracania elementu lub elementów zestawu, na przykład najlepszego sprzedawcy lub 10 najlepszych studentów. +CUBESET = ZESTAW.MODUŁÓW ## Definiuje obliczony zestaw elementów lub krotek, wysyłając wyrażenie zestawu do serwera modułu, który tworzy zestaw i zwraca go do programu Microsoft Office Excel. +CUBESETCOUNT = LICZNIK.MODUŁÓW.ZESTAWU ## Zwraca liczbę elementów zestawu. +CUBEVALUE = WARTOŚĆ.MODUŁU ## Zwraca zagregowaną wartość z modułu. + + +## +## Database functions Funkcje baz danych +## +DAVERAGE = BD.ŚREDNIA ## Zwraca wartość średniej wybranych wpisów bazy danych. +DCOUNT = BD.ILE.REKORDÓW ## Zlicza komórki zawierające liczby w bazie danych. +DCOUNTA = BD.ILE.REKORDÓW.A ## Zlicza niepuste komórki w bazie danych. +DGET = BD.POLE ## Wyodrębnia z bazy danych jeden rekord spełniający określone kryteria. +DMAX = BD.MAX ## Zwraca wartość maksymalną z wybranych wpisów bazy danych. +DMIN = BD.MIN ## Zwraca wartość minimalną z wybranych wpisów bazy danych. +DPRODUCT = BD.ILOCZYN ## Mnoży wartości w konkretnym, spełniającym kryteria polu rekordów bazy danych. +DSTDEV = BD.ODCH.STANDARD ## Szacuje odchylenie standardowe na podstawie próbki z wybranych wpisów bazy danych. +DSTDEVP = BD.ODCH.STANDARD.POPUL ## Oblicza odchylenie standardowe na podstawie całej populacji wybranych wpisów bazy danych. +DSUM = BD.SUMA ## Dodaje liczby w kolumnie pól rekordów bazy danych, które spełniają kryteria. +DVAR = BD.WARIANCJA ## Szacuje wariancję na podstawie próbki z wybranych wpisów bazy danych. +DVARP = BD.WARIANCJA.POPUL ## Oblicza wariancję na podstawie całej populacji wybranych wpisów bazy danych. + + +## +## Date and time functions Funkcje dat, godzin i czasu +## +DATE = DATA ## Zwraca liczbę seryjną dla wybranej daty. +DATEVALUE = DATA.WARTOŚĆ ## Konwertuje datę w formie tekstu na liczbę seryjną. +DAY = DZIEŃ ## Konwertuje liczbę seryjną na dzień miesiąca. +DAYS360 = DNI.360 ## Oblicza liczbę dni między dwiema datami na podstawie roku 360-dniowego. +EDATE = UPŁDNI ## Zwraca liczbę seryjną daty jako wskazaną liczbę miesięcy przed określoną datą początkową lub po niej. +EOMONTH = EOMONTH ## Zwraca liczbę seryjną ostatniego dnia miesiąca przed określoną liczbą miesięcy lub po niej. +HOUR = GODZINA ## Konwertuje liczbę seryjną na godzinę. +MINUTE = MINUTA ## Konwertuje liczbę seryjną na minutę. +MONTH = MIESIĄC ## Konwertuje liczbę seryjną na miesiąc. +NETWORKDAYS = NETWORKDAYS ## Zwraca liczbę pełnych dni roboczych między dwiema datami. +NOW = TERAZ ## Zwraca liczbę seryjną bieżącej daty i godziny. +SECOND = SEKUNDA ## Konwertuje liczbę seryjną na sekundę. +TIME = CZAS ## Zwraca liczbę seryjną określonego czasu. +TIMEVALUE = CZAS.WARTOŚĆ ## Konwertuje czas w formie tekstu na liczbę seryjną. +TODAY = DZIŚ ## Zwraca liczbę seryjną dla daty bieżącej. +WEEKDAY = DZIEŃ.TYG ## Konwertuje liczbę seryjną na dzień tygodnia. +WEEKNUM = WEEKNUM ## Konwertuje liczbę seryjną na liczbę reprezentującą numer tygodnia w roku. +WORKDAY = WORKDAY ## Zwraca liczbę seryjną dla daty przed określoną liczbą dni roboczych lub po niej. +YEAR = ROK ## Konwertuje liczbę seryjną na rok. +YEARFRAC = YEARFRAC ## Zwraca część roku reprezentowaną przez pełną liczbę dni między datą początkową a datą końcową. + + +## +## Engineering functions Funkcje inżynierskie +## +BESSELI = BESSELI ## Zwraca wartość zmodyfikowanej funkcji Bessela In(x). +BESSELJ = BESSELJ ## Zwraca wartość funkcji Bessela Jn(x). +BESSELK = BESSELK ## Zwraca wartość zmodyfikowanej funkcji Bessela Kn(x). +BESSELY = BESSELY ## Zwraca wartość funkcji Bessela Yn(x). +BIN2DEC = BIN2DEC ## Konwertuje liczbę w postaci dwójkowej na liczbę w postaci dziesiętnej. +BIN2HEX = BIN2HEX ## Konwertuje liczbę w postaci dwójkowej na liczbę w postaci szesnastkowej. +BIN2OCT = BIN2OCT ## Konwertuje liczbę w postaci dwójkowej na liczbę w postaci ósemkowej. +COMPLEX = COMPLEX ## Konwertuje część rzeczywistą i urojoną na liczbę zespoloną. +CONVERT = CONVERT ## Konwertuje liczbę z jednego systemu miar na inny. +DEC2BIN = DEC2BIN ## Konwertuje liczbę w postaci dziesiętnej na postać dwójkową. +DEC2HEX = DEC2HEX ## Konwertuje liczbę w postaci dziesiętnej na liczbę w postaci szesnastkowej. +DEC2OCT = DEC2OCT ## Konwertuje liczbę w postaci dziesiętnej na liczbę w postaci ósemkowej. +DELTA = DELTA ## Sprawdza, czy dwie wartości są równe. +ERF = ERF ## Zwraca wartość funkcji błędu. +ERFC = ERFC ## Zwraca wartość komplementarnej funkcji błędu. +GESTEP = GESTEP ## Sprawdza, czy liczba jest większa niż wartość progowa. +HEX2BIN = HEX2BIN ## Konwertuje liczbę w postaci szesnastkowej na liczbę w postaci dwójkowej. +HEX2DEC = HEX2DEC ## Konwertuje liczbę w postaci szesnastkowej na liczbę w postaci dziesiętnej. +HEX2OCT = HEX2OCT ## Konwertuje liczbę w postaci szesnastkowej na liczbę w postaci ósemkowej. +IMABS = IMABS ## Zwraca wartość bezwzględną (moduł) liczby zespolonej. +IMAGINARY = IMAGINARY ## Zwraca wartość części urojonej liczby zespolonej. +IMARGUMENT = IMARGUMENT ## Zwraca wartość argumentu liczby zespolonej, przy czym kąt wyrażony jest w radianach. +IMCONJUGATE = IMCONJUGATE ## Zwraca wartość liczby sprzężonej danej liczby zespolonej. +IMCOS = IMCOS ## Zwraca wartość cosinusa liczby zespolonej. +IMDIV = IMDIV ## Zwraca wartość ilorazu dwóch liczb zespolonych. +IMEXP = IMEXP ## Zwraca postać wykładniczą liczby zespolonej. +IMLN = IMLN ## Zwraca wartość logarytmu naturalnego liczby zespolonej. +IMLOG10 = IMLOG10 ## Zwraca wartość logarytmu dziesiętnego liczby zespolonej. +IMLOG2 = IMLOG2 ## Zwraca wartość logarytmu liczby zespolonej przy podstawie 2. +IMPOWER = IMPOWER ## Zwraca wartość liczby zespolonej podniesionej do potęgi całkowitej. +IMPRODUCT = IMPRODUCT ## Zwraca wartość iloczynu liczb zespolonych. +IMREAL = IMREAL ## Zwraca wartość części rzeczywistej liczby zespolonej. +IMSIN = IMSIN ## Zwraca wartość sinusa liczby zespolonej. +IMSQRT = IMSQRT ## Zwraca wartość pierwiastka kwadratowego z liczby zespolonej. +IMSUB = IMSUB ## Zwraca wartość różnicy dwóch liczb zespolonych. +IMSUM = IMSUM ## Zwraca wartość sumy liczb zespolonych. +OCT2BIN = OCT2BIN ## Konwertuje liczbę w postaci ósemkowej na liczbę w postaci dwójkowej. +OCT2DEC = OCT2DEC ## Konwertuje liczbę w postaci ósemkowej na liczbę w postaci dziesiętnej. +OCT2HEX = OCT2HEX ## Konwertuje liczbę w postaci ósemkowej na liczbę w postaci szesnastkowej. + + +## +## Financial functions Funkcje finansowe +## +ACCRINT = ACCRINT ## Zwraca narosłe odsetki dla papieru wartościowego z oprocentowaniem okresowym. +ACCRINTM = ACCRINTM ## Zwraca narosłe odsetki dla papieru wartościowego z oprocentowaniem w terminie wykupu. +AMORDEGRC = AMORDEGRC ## Zwraca amortyzację dla każdego okresu rozliczeniowego z wykorzystaniem współczynnika amortyzacji. +AMORLINC = AMORLINC ## Zwraca amortyzację dla każdego okresu rozliczeniowego. +COUPDAYBS = COUPDAYBS ## Zwraca liczbę dni od początku okresu dywidendy do dnia rozliczeniowego. +COUPDAYS = COUPDAYS ## Zwraca liczbę dni w okresie dywidendy, z uwzględnieniem dnia rozliczeniowego. +COUPDAYSNC = COUPDAYSNC ## Zwraca liczbę dni od dnia rozliczeniowego do daty następnego dnia dywidendy. +COUPNCD = COUPNCD ## Zwraca dzień następnej dywidendy po dniu rozliczeniowym. +COUPNUM = COUPNUM ## Zwraca liczbę dywidend płatnych między dniem rozliczeniowym a dniem wykupu. +COUPPCD = COUPPCD ## Zwraca dzień poprzedniej dywidendy przed dniem rozliczeniowym. +CUMIPMT = CUMIPMT ## Zwraca wartość procentu składanego płatnego między dwoma okresami. +CUMPRINC = CUMPRINC ## Zwraca wartość kapitału skumulowanego spłaty pożyczki między dwoma okresami. +DB = DB ## Zwraca amortyzację środka trwałego w danym okresie metodą degresywną z zastosowaniem stałej bazowej. +DDB = DDB ## Zwraca amortyzację środka trwałego za podany okres metodą degresywną z zastosowaniem podwójnej bazowej lub metodą określoną przez użytkownika. +DISC = DISC ## Zwraca wartość stopy dyskontowej papieru wartościowego. +DOLLARDE = DOLLARDE ## Konwertuje cenę w postaci ułamkowej na cenę wyrażoną w postaci dziesiętnej. +DOLLARFR = DOLLARFR ## Konwertuje cenę wyrażoną w postaci dziesiętnej na cenę wyrażoną w postaci ułamkowej. +DURATION = DURATION ## Zwraca wartość rocznego przychodu z papieru wartościowego o okresowych wypłatach oprocentowania. +EFFECT = EFFECT ## Zwraca wartość efektywnej rocznej stopy procentowej. +FV = FV ## Zwraca przyszłą wartość lokaty. +FVSCHEDULE = FVSCHEDULE ## Zwraca przyszłą wartość kapitału początkowego wraz z szeregiem procentów składanych. +INTRATE = INTRATE ## Zwraca wartość stopy procentowej papieru wartościowego całkowicie ulokowanego. +IPMT = IPMT ## Zwraca wysokość spłaty oprocentowania lokaty za dany okres. +IRR = IRR ## Zwraca wartość wewnętrznej stopy zwrotu dla serii przepływów gotówkowych. +ISPMT = ISPMT ## Oblicza wysokość spłaty oprocentowania za dany okres lokaty. +MDURATION = MDURATION ## Zwraca wartość zmodyfikowanego okresu Macauleya dla papieru wartościowego o założonej wartości nominalnej 100 zł. +MIRR = MIRR ## Zwraca wartość wewnętrznej stopy zwrotu dla przypadku, gdy dodatnie i ujemne przepływy gotówkowe mają różne stopy. +NOMINAL = NOMINAL ## Zwraca wysokość nominalnej rocznej stopy procentowej. +NPER = NPER ## Zwraca liczbę okresów dla lokaty. +NPV = NPV ## Zwraca wartość bieżącą netto lokaty na podstawie szeregu okresowych przepływów gotówkowych i stopy dyskontowej. +ODDFPRICE = ODDFPRICE ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego z nietypowym pierwszym okresem. +ODDFYIELD = ODDFYIELD ## Zwraca rentowność papieru wartościowego z nietypowym pierwszym okresem. +ODDLPRICE = ODDLPRICE ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego z nietypowym ostatnim okresem. +ODDLYIELD = ODDLYIELD ## Zwraca rentowność papieru wartościowego z nietypowym ostatnim okresem. +PMT = PMT ## Zwraca wartość okresowej płatności raty rocznej. +PPMT = PPMT ## Zwraca wysokość spłaty kapitału w przypadku lokaty dla danego okresu. +PRICE = PRICE ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego z oprocentowaniem okresowym. +PRICEDISC = PRICEDISC ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego zdyskontowanego. +PRICEMAT = PRICEMAT ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego z oprocentowaniem w terminie wykupu. +PV = PV ## Zwraca wartość bieżącą lokaty. +RATE = RATE ## Zwraca wysokość stopy procentowej w okresie raty rocznej. +RECEIVED = RECEIVED ## Zwraca wartość kapitału otrzymanego przy wykupie papieru wartościowego całkowicie ulokowanego. +SLN = SLN ## Zwraca amortyzację środka trwałego za jeden okres metodą liniową. +SYD = SYD ## Zwraca amortyzację środka trwałego za dany okres metodą sumy cyfr lat amortyzacji. +TBILLEQ = TBILLEQ ## Zwraca rentowność ekwiwalentu obligacji dla bonu skarbowego. +TBILLPRICE = TBILLPRICE ## Zwraca cenę za 100 zł wartości nominalnej bonu skarbowego. +TBILLYIELD = TBILLYIELD ## Zwraca rentowność bonu skarbowego. +VDB = VDB ## Oblicza amortyzację środka trwałego w danym okresie lub jego części metodą degresywną. +XIRR = XIRR ## Zwraca wartość wewnętrznej stopy zwrotu dla serii rozłożonych w czasie przepływów gotówkowych, niekoniecznie okresowych. +XNPV = XNPV ## Zwraca wartość bieżącą netto dla serii rozłożonych w czasie przepływów gotówkowych, niekoniecznie okresowych. +YIELD = YIELD ## Zwraca rentowność papieru wartościowego z oprocentowaniem okresowym. +YIELDDISC = YIELDDISC ## Zwraca roczną rentowność zdyskontowanego papieru wartościowego, na przykład bonu skarbowego. +YIELDMAT = YIELDMAT ## Zwraca roczną rentowność papieru wartościowego oprocentowanego przy wykupie. + + +## +## Information functions Funkcje informacyjne +## +CELL = KOMÓRKA ## Zwraca informacje o formacie, położeniu lub zawartości komórki. +ERROR.TYPE = NR.BŁĘDU ## Zwraca liczbę odpowiadającą typowi błędu. +INFO = INFO ## Zwraca informację o aktualnym środowisku pracy. +ISBLANK = CZY.PUSTA ## Zwraca wartość PRAWDA, jeśli wartość jest pusta. +ISERR = CZY.BŁ ## Zwraca wartość PRAWDA, jeśli wartość jest dowolną wartością błędu, z wyjątkiem #N/D!. +ISERROR = CZY.BŁĄD ## Zwraca wartość PRAWDA, jeśli wartość jest dowolną wartością błędu. +ISEVEN = ISEVEN ## Zwraca wartość PRAWDA, jeśli liczba jest parzysta. +ISLOGICAL = CZY.LOGICZNA ## Zwraca wartość PRAWDA, jeśli wartość jest wartością logiczną. +ISNA = CZY.BRAK ## Zwraca wartość PRAWDA, jeśli wartość jest wartością błędu #N/D!. +ISNONTEXT = CZY.NIE.TEKST ## Zwraca wartość PRAWDA, jeśli wartość nie jest tekstem. +ISNUMBER = CZY.LICZBA ## Zwraca wartość PRAWDA, jeśli wartość jest liczbą. +ISODD = ISODD ## Zwraca wartość PRAWDA, jeśli liczba jest nieparzysta. +ISREF = CZY.ADR ## Zwraca wartość PRAWDA, jeśli wartość jest odwołaniem. +ISTEXT = CZY.TEKST ## Zwraca wartość PRAWDA, jeśli wartość jest tekstem. +N = L ## Zwraca wartość przekonwertowaną na postać liczbową. +NA = BRAK ## Zwraca wartość błędu #N/D!. +TYPE = TYP ## Zwraca liczbę wskazującą typ danych wartości. + + +## +## Logical functions Funkcje logiczne +## +AND = ORAZ ## Zwraca wartość PRAWDA, jeśli wszystkie argumenty mają wartość PRAWDA. +FALSE = FAŁSZ ## Zwraca wartość logiczną FAŁSZ. +IF = JEŻELI ## Określa warunek logiczny do sprawdzenia. +IFERROR = JEŻELI.BŁĄD ## Zwraca określoną wartość, jeśli wynikiem obliczenia formuły jest błąd; w przeciwnym przypadku zwraca wynik formuły. +NOT = NIE ## Odwraca wartość logiczną argumentu. +OR = LUB ## Zwraca wartość PRAWDA, jeśli co najmniej jeden z argumentów ma wartość PRAWDA. +TRUE = PRAWDA ## Zwraca wartość logiczną PRAWDA. + + +## +## Lookup and reference functions Funkcje wyszukiwania i odwołań +## +ADDRESS = ADRES ## Zwraca odwołanie do jednej komórki w arkuszu jako wartość tekstową. +AREAS = OBSZARY ## Zwraca liczbę obszarów występujących w odwołaniu. +CHOOSE = WYBIERZ ## Wybiera wartość z listy wartości. +COLUMN = NR.KOLUMNY ## Zwraca numer kolumny z odwołania. +COLUMNS = LICZBA.KOLUMN ## Zwraca liczbę kolumn dla danego odwołania. +HLOOKUP = WYSZUKAJ.POZIOMO ## Przegląda górny wiersz tablicy i zwraca wartość wskazanej komórki. +HYPERLINK = HIPERŁĄCZE ## Tworzy skrót lub skok, który pozwala otwierać dokument przechowywany na serwerze sieciowym, w sieci intranet lub w Internecie. +INDEX = INDEKS ## Używa indeksu do wybierania wartości z odwołania lub tablicy. +INDIRECT = ADR.POŚR ## Zwraca odwołanie określone przez wartość tekstową. +LOOKUP = WYSZUKAJ ## Wyszukuje wartości w wektorze lub tablicy. +MATCH = PODAJ.POZYCJĘ ## Wyszukuje wartości w odwołaniu lub w tablicy. +OFFSET = PRZESUNIĘCIE ## Zwraca adres przesunięty od danego odwołania. +ROW = WIERSZ ## Zwraca numer wiersza odwołania. +ROWS = ILE.WIERSZY ## Zwraca liczbę wierszy dla danego odwołania. +RTD = RTD ## Pobiera dane w czasie rzeczywistym z programu obsługującego automatyzację COM (Automatyzacja: Sposób pracy z obiektami aplikacji pochodzącymi z innej aplikacji lub narzędzia projektowania. Nazywana wcześniej Automatyzacją OLE, Automatyzacja jest standardem przemysłowym i funkcją obiektowego modelu składników (COM, Component Object Model).). +TRANSPOSE = TRANSPONUJ ## Zwraca transponowaną tablicę. +VLOOKUP = WYSZUKAJ.PIONOWO ## Przeszukuje pierwszą kolumnę tablicy i przechodzi wzdłuż wiersza, aby zwrócić wartość komórki. + + +## +## Math and trigonometry functions Funkcje matematyczne i trygonometryczne +## +ABS = MODUŁ.LICZBY ## Zwraca wartość absolutną liczby. +ACOS = ACOS ## Zwraca arcus cosinus liczby. +ACOSH = ACOSH ## Zwraca arcus cosinus hiperboliczny liczby. +ASIN = ASIN ## Zwraca arcus sinus liczby. +ASINH = ASINH ## Zwraca arcus sinus hiperboliczny liczby. +ATAN = ATAN ## Zwraca arcus tangens liczby. +ATAN2 = ATAN2 ## Zwraca arcus tangens liczby na podstawie współrzędnych x i y. +ATANH = ATANH ## Zwraca arcus tangens hiperboliczny liczby. +CEILING = ZAOKR.W.GÓRĘ ## Zaokrągla liczbę do najbliższej liczby całkowitej lub do najbliższej wielokrotności dokładności. +COMBIN = KOMBINACJE ## Zwraca liczbę kombinacji dla danej liczby obiektów. +COS = COS ## Zwraca cosinus liczby. +COSH = COSH ## Zwraca cosinus hiperboliczny liczby. +DEGREES = STOPNIE ## Konwertuje radiany na stopnie. +EVEN = ZAOKR.DO.PARZ ## Zaokrągla liczbę w górę do najbliższej liczby parzystej. +EXP = EXP ## Zwraca wartość liczby e podniesionej do potęgi określonej przez podaną liczbę. +FACT = SILNIA ## Zwraca silnię liczby. +FACTDOUBLE = FACTDOUBLE ## Zwraca podwójną silnię liczby. +FLOOR = ZAOKR.W.DÓŁ ## Zaokrągla liczbę w dół, w kierunku zera. +GCD = GCD ## Zwraca największy wspólny dzielnik. +INT = ZAOKR.DO.CAŁK ## Zaokrągla liczbę w dół do najbliższej liczby całkowitej. +LCM = LCM ## Zwraca najmniejszą wspólną wielokrotność. +LN = LN ## Zwraca logarytm naturalny podanej liczby. +LOG = LOG ## Zwraca logarytm danej liczby przy zadanej podstawie. +LOG10 = LOG10 ## Zwraca logarytm dziesiętny liczby. +MDETERM = WYZNACZNIK.MACIERZY ## Zwraca wyznacznik macierzy tablicy. +MINVERSE = MACIERZ.ODW ## Zwraca odwrotność macierzy tablicy. +MMULT = MACIERZ.ILOCZYN ## Zwraca iloczyn macierzy dwóch tablic. +MOD = MOD ## Zwraca resztę z dzielenia. +MROUND = MROUND ## Zwraca liczbę zaokrągloną do żądanej wielokrotności. +MULTINOMIAL = MULTINOMIAL ## Zwraca wielomian dla zbioru liczb. +ODD = ZAOKR.DO.NPARZ ## Zaokrągla liczbę w górę do najbliższej liczby nieparzystej. +PI = PI ## Zwraca wartość liczby Pi. +POWER = POTĘGA ## Zwraca liczbę podniesioną do potęgi. +PRODUCT = ILOCZYN ## Mnoży argumenty. +QUOTIENT = QUOTIENT ## Zwraca iloraz (całkowity). +RADIANS = RADIANY ## Konwertuje stopnie na radiany. +RAND = LOS ## Zwraca liczbę pseudolosową z zakresu od 0 do 1. +RANDBETWEEN = RANDBETWEEN ## Zwraca liczbę pseudolosową z zakresu określonego przez podane argumenty. +ROMAN = RZYMSKIE ## Konwertuje liczbę arabską na rzymską jako tekst. +ROUND = ZAOKR ## Zaokrągla liczbę do określonej liczby cyfr. +ROUNDDOWN = ZAOKR.DÓŁ ## Zaokrągla liczbę w dół, w kierunku zera. +ROUNDUP = ZAOKR.GÓRA ## Zaokrągla liczbę w górę, w kierunku od zera. +SERIESSUM = SERIESSUM ## Zwraca sumę szeregu potęgowego na podstawie wzoru. +SIGN = ZNAK.LICZBY ## Zwraca znak liczby. +SIN = SIN ## Zwraca sinus danego kąta. +SINH = SINH ## Zwraca sinus hiperboliczny liczby. +SQRT = PIERWIASTEK ## Zwraca dodatni pierwiastek kwadratowy. +SQRTPI = SQRTPI ## Zwraca pierwiastek kwadratowy iloczynu (liczba * Pi). +SUBTOTAL = SUMY.POŚREDNIE ## Zwraca sumę częściową listy lub bazy danych. +SUM = SUMA ## Dodaje argumenty. +SUMIF = SUMA.JEŻELI ## Dodaje komórki określone przez podane kryterium. +SUMIFS = SUMA.WARUNKÓW ## Dodaje komórki w zakresie, które spełniają wiele kryteriów. +SUMPRODUCT = SUMA.ILOCZYNÓW ## Zwraca sumę iloczynów odpowiednich elementów tablicy. +SUMSQ = SUMA.KWADRATÓW ## Zwraca sumę kwadratów argumentów. +SUMX2MY2 = SUMA.X2.M.Y2 ## Zwraca sumę różnic kwadratów odpowiednich wartości w dwóch tablicach. +SUMX2PY2 = SUMA.X2.P.Y2 ## Zwraca sumę sum kwadratów odpowiednich wartości w dwóch tablicach. +SUMXMY2 = SUMA.XMY.2 ## Zwraca sumę kwadratów różnic odpowiednich wartości w dwóch tablicach. +TAN = TAN ## Zwraca tangens liczby. +TANH = TANH ## Zwraca tangens hiperboliczny liczby. +TRUNC = LICZBA.CAŁK ## Przycina liczbę do wartości całkowitej. + + +## +## Statistical functions Funkcje statystyczne +## +AVEDEV = ODCH.ŚREDNIE ## Zwraca średnią wartość odchyleń absolutnych punktów danych od ich wartości średniej. +AVERAGE = ŚREDNIA ## Zwraca wartość średnią argumentów. +AVERAGEA = ŚREDNIA.A ## Zwraca wartość średnią argumentów, z uwzględnieniem liczb, tekstów i wartości logicznych. +AVERAGEIF = ŚREDNIA.JEŻELI ## Zwraca średnią (średnią arytmetyczną) wszystkich komórek w zakresie, które spełniają podane kryteria. +AVERAGEIFS = ŚREDNIA.WARUNKÓW ## Zwraca średnią (średnią arytmetyczną) wszystkich komórek, które spełniają jedno lub więcej kryteriów. +BETADIST = ROZKŁAD.BETA ## Zwraca skumulowaną funkcję gęstości prawdopodobieństwa beta. +BETAINV = ROZKŁAD.BETA.ODW ## Zwraca odwrotność skumulowanej funkcji gęstości prawdopodobieństwa beta. +BINOMDIST = ROZKŁAD.DWUM ## Zwraca pojedynczy składnik dwumianowego rozkładu prawdopodobieństwa. +CHIDIST = ROZKŁAD.CHI ## Zwraca wartość jednostronnego prawdopodobieństwa rozkładu chi-kwadrat. +CHIINV = ROZKŁAD.CHI.ODW ## Zwraca odwrotność wartości jednostronnego prawdopodobieństwa rozkładu chi-kwadrat. +CHITEST = TEST.CHI ## Zwraca test niezależności. +CONFIDENCE = UFNOŚĆ ## Zwraca interwał ufności dla średniej populacji. +CORREL = WSP.KORELACJI ## Zwraca współczynnik korelacji dwóch zbiorów danych. +COUNT = ILE.LICZB ## Zlicza liczby znajdujące się na liście argumentów. +COUNTA = ILE.NIEPUSTYCH ## Zlicza wartości znajdujące się na liście argumentów. +COUNTBLANK = LICZ.PUSTE ## Zwraca liczbę pustych komórek w pewnym zakresie. +COUNTIF = LICZ.JEŻELI ## Zlicza komórki wewnątrz zakresu, które spełniają podane kryteria. +COUNTIFS = LICZ.WARUNKI ## Zlicza komórki wewnątrz zakresu, które spełniają wiele kryteriów. +COVAR = KOWARIANCJA ## Zwraca kowariancję, czyli średnią wartość iloczynów odpowiednich odchyleń. +CRITBINOM = PRÓG.ROZKŁAD.DWUM ## Zwraca najmniejszą wartość, dla której skumulowany rozkład dwumianowy jest mniejszy niż wartość kryterium lub równy jej. +DEVSQ = ODCH.KWADRATOWE ## Zwraca sumę kwadratów odchyleń. +EXPONDIST = ROZKŁAD.EXP ## Zwraca rozkład wykładniczy. +FDIST = ROZKŁAD.F ## Zwraca rozkład prawdopodobieństwa F. +FINV = ROZKŁAD.F.ODW ## Zwraca odwrotność rozkładu prawdopodobieństwa F. +FISHER = ROZKŁAD.FISHER ## Zwraca transformację Fishera. +FISHERINV = ROZKŁAD.FISHER.ODW ## Zwraca odwrotność transformacji Fishera. +FORECAST = REGLINX ## Zwraca wartość trendu liniowego. +FREQUENCY = CZĘSTOŚĆ ## Zwraca rozkład częstotliwości jako tablicę pionową. +FTEST = TEST.F ## Zwraca wynik testu F. +GAMMADIST = ROZKŁAD.GAMMA ## Zwraca rozkład gamma. +GAMMAINV = ROZKŁAD.GAMMA.ODW ## Zwraca odwrotność skumulowanego rozkładu gamma. +GAMMALN = ROZKŁAD.LIN.GAMMA ## Zwraca logarytm naturalny funkcji gamma, Γ(x). +GEOMEAN = ŚREDNIA.GEOMETRYCZNA ## Zwraca średnią geometryczną. +GROWTH = REGEXPW ## Zwraca wartości trendu wykładniczego. +HARMEAN = ŚREDNIA.HARMONICZNA ## Zwraca średnią harmoniczną. +HYPGEOMDIST = ROZKŁAD.HIPERGEOM ## Zwraca rozkład hipergeometryczny. +INTERCEPT = ODCIĘTA ## Zwraca punkt przecięcia osi pionowej z linią regresji liniowej. +KURT = KURTOZA ## Zwraca kurtozę zbioru danych. +LARGE = MAX.K ## Zwraca k-tą największą wartość ze zbioru danych. +LINEST = REGLINP ## Zwraca parametry trendu liniowego. +LOGEST = REGEXPP ## Zwraca parametry trendu wykładniczego. +LOGINV = ROZKŁAD.LOG.ODW ## Zwraca odwrotność rozkładu logarytmu naturalnego. +LOGNORMDIST = ROZKŁAD.LOG ## Zwraca skumulowany rozkład logarytmu naturalnego. +MAX = MAX ## Zwraca maksymalną wartość listy argumentów. +MAXA = MAX.A ## Zwraca maksymalną wartość listy argumentów, z uwzględnieniem liczb, tekstów i wartości logicznych. +MEDIAN = MEDIANA ## Zwraca medianę podanych liczb. +MIN = MIN ## Zwraca minimalną wartość listy argumentów. +MINA = MIN.A ## Zwraca najmniejszą wartość listy argumentów, z uwzględnieniem liczb, tekstów i wartości logicznych. +MODE = WYST.NAJCZĘŚCIEJ ## Zwraca wartość najczęściej występującą w zbiorze danych. +NEGBINOMDIST = ROZKŁAD.DWUM.PRZEC ## Zwraca ujemny rozkład dwumianowy. +NORMDIST = ROZKŁAD.NORMALNY ## Zwraca rozkład normalny skumulowany. +NORMINV = ROZKŁAD.NORMALNY.ODW ## Zwraca odwrotność rozkładu normalnego skumulowanego. +NORMSDIST = ROZKŁAD.NORMALNY.S ## Zwraca standardowy rozkład normalny skumulowany. +NORMSINV = ROZKŁAD.NORMALNY.S.ODW ## Zwraca odwrotność standardowego rozkładu normalnego skumulowanego. +PEARSON = PEARSON ## Zwraca współczynnik korelacji momentu iloczynu Pearsona. +PERCENTILE = PERCENTYL ## Wyznacza k-ty percentyl wartości w zakresie. +PERCENTRANK = PROCENT.POZYCJA ## Zwraca procentową pozycję wartości w zbiorze danych. +PERMUT = PERMUTACJE ## Zwraca liczbę permutacji dla danej liczby obiektów. +POISSON = ROZKŁAD.POISSON ## Zwraca rozkład Poissona. +PROB = PRAWDPD ## Zwraca prawdopodobieństwo, że wartości w zakresie leżą pomiędzy dwiema granicami. +QUARTILE = KWARTYL ## Wyznacza kwartyl zbioru danych. +RANK = POZYCJA ## Zwraca pozycję liczby na liście liczb. +RSQ = R.KWADRAT ## Zwraca kwadrat współczynnika korelacji momentu iloczynu Pearsona. +SKEW = SKOŚNOŚĆ ## Zwraca skośność rozkładu. +SLOPE = NACHYLENIE ## Zwraca nachylenie linii regresji liniowej. +SMALL = MIN.K ## Zwraca k-tą najmniejszą wartość ze zbioru danych. +STANDARDIZE = NORMALIZUJ ## Zwraca wartość znormalizowaną. +STDEV = ODCH.STANDARDOWE ## Szacuje odchylenie standardowe na podstawie próbki. +STDEVA = ODCH.STANDARDOWE.A ## Szacuje odchylenie standardowe na podstawie próbki, z uwzględnieniem liczb, tekstów i wartości logicznych. +STDEVP = ODCH.STANDARD.POPUL ## Oblicza odchylenie standardowe na podstawie całej populacji. +STDEVPA = ODCH.STANDARD.POPUL.A ## Oblicza odchylenie standardowe na podstawie całej populacji, z uwzględnieniem liczb, teksów i wartości logicznych. +STEYX = REGBŁSTD ## Zwraca błąd standardowy przewidzianej wartości y dla każdej wartości x w regresji. +TDIST = ROZKŁAD.T ## Zwraca rozkład t-Studenta. +TINV = ROZKŁAD.T.ODW ## Zwraca odwrotność rozkładu t-Studenta. +TREND = REGLINW ## Zwraca wartości trendu liniowego. +TRIMMEAN = ŚREDNIA.WEWN ## Zwraca średnią wartość dla wnętrza zbioru danych. +TTEST = TEST.T ## Zwraca prawdopodobieństwo związane z testem t-Studenta. +VAR = WARIANCJA ## Szacuje wariancję na podstawie próbki. +VARA = WARIANCJA.A ## Szacuje wariancję na podstawie próbki, z uwzględnieniem liczb, tekstów i wartości logicznych. +VARP = WARIANCJA.POPUL ## Oblicza wariancję na podstawie całej populacji. +VARPA = WARIANCJA.POPUL.A ## Oblicza wariancję na podstawie całej populacji, z uwzględnieniem liczb, tekstów i wartości logicznych. +WEIBULL = ROZKŁAD.WEIBULL ## Zwraca rozkład Weibulla. +ZTEST = TEST.Z ## Zwraca wartość jednostronnego prawdopodobieństwa testu z. + + +## +## Text functions Funkcje tekstowe +## +ASC = ASC ## Zamienia litery angielskie lub katakana o pełnej szerokości (dwubajtowe) w ciągu znaków na znaki o szerokości połówkowej (jednobajtowe). +BAHTTEXT = BAHTTEXT ## Konwertuje liczbę na tekst, stosując format walutowy ß (baht). +CHAR = ZNAK ## Zwraca znak o podanym numerze kodu. +CLEAN = OCZYŚĆ ## Usuwa z tekstu wszystkie znaki, które nie mogą być drukowane. +CODE = KOD ## Zwraca kod numeryczny pierwszego znaku w ciągu tekstowym. +CONCATENATE = ZŁĄCZ.TEKSTY ## Łączy kilka oddzielnych tekstów w jeden tekst. +DOLLAR = KWOTA ## Konwertuje liczbę na tekst, stosując format walutowy $ (dolar). +EXACT = PORÓWNAJ ## Sprawdza identyczność dwóch wartości tekstowych. +FIND = ZNAJDŹ ## Znajduje jedną wartość tekstową wewnątrz innej (z uwzględnieniem wielkich i małych liter). +FINDB = ZNAJDŹB ## Znajduje jedną wartość tekstową wewnątrz innej (z uwzględnieniem wielkich i małych liter). +FIXED = ZAOKR.DO.TEKST ## Formatuje liczbę jako tekst przy stałej liczbie miejsc dziesiętnych. +JIS = JIS ## Zmienia litery angielskie lub katakana o szerokości połówkowej (jednobajtowe) w ciągu znaków na znaki o pełnej szerokości (dwubajtowe). +LEFT = LEWY ## Zwraca skrajne lewe znaki z wartości tekstowej. +LEFTB = LEWYB ## Zwraca skrajne lewe znaki z wartości tekstowej. +LEN = DŁ ## Zwraca liczbę znaków ciągu tekstowego. +LENB = DŁ.B ## Zwraca liczbę znaków ciągu tekstowego. +LOWER = LITERY.MAŁE ## Konwertuje wielkie litery tekstu na małe litery. +MID = FRAGMENT.TEKSTU ## Zwraca określoną liczbę znaków z ciągu tekstowego, zaczynając od zadanej pozycji. +MIDB = FRAGMENT.TEKSTU.B ## Zwraca określoną liczbę znaków z ciągu tekstowego, zaczynając od zadanej pozycji. +PHONETIC = PHONETIC ## Wybiera znaki fonetyczne (furigana) z ciągu tekstowego. +PROPER = Z.WIELKIEJ.LITERY ## Zastępuje pierwszą literę każdego wyrazu tekstu wielką literą. +REPLACE = ZASTĄP ## Zastępuje znaki w tekście. +REPLACEB = ZASTĄP.B ## Zastępuje znaki w tekście. +REPT = POWT ## Powiela tekst daną liczbę razy. +RIGHT = PRAWY ## Zwraca skrajne prawe znaki z wartości tekstowej. +RIGHTB = PRAWYB ## Zwraca skrajne prawe znaki z wartości tekstowej. +SEARCH = SZUKAJ.TEKST ## Wyszukuje jedną wartość tekstową wewnątrz innej (bez uwzględniania wielkości liter). +SEARCHB = SZUKAJ.TEKST.B ## Wyszukuje jedną wartość tekstową wewnątrz innej (bez uwzględniania wielkości liter). +SUBSTITUTE = PODSTAW ## Podstawia nowy tekst w miejsce poprzedniego tekstu w ciągu tekstowym. +T = T ## Konwertuje argumenty na tekst. +TEXT = TEKST ## Formatuje liczbę i konwertuje ją na tekst. +TRIM = USUŃ.ZBĘDNE.ODSTĘPY ## Usuwa spacje z tekstu. +UPPER = LITERY.WIELKIE ## Konwertuje znaki tekstu na wielkie litery. +VALUE = WARTOŚĆ ## Konwertuje argument tekstowy na liczbę. diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/br/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/br/config new file mode 100644 index 0000000..904f99f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/br/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = R$ + + +## +## Excel Error Codes (For future use) + +## +NULL = #NULO! +DIV0 = #DIV/0! +VALUE = #VALOR! +REF = #REF! +NAME = #NOME? +NUM = #NÚM! +NA = #N/D diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/br/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/br/functions new file mode 100644 index 0000000..a062a7f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/br/functions @@ -0,0 +1,408 @@ +## +## Add-in and Automation functions Funções Suplemento e Automação +## +GETPIVOTDATA = INFODADOSTABELADINÂMICA ## Retorna os dados armazenados em um relatório de tabela dinâmica + + +## +## Cube functions Funções de Cubo +## +CUBEKPIMEMBER = MEMBROKPICUBO ## Retorna o nome de um KPI (indicador de desempenho-chave), uma propriedade e uma medida e exibe o nome e a propriedade na célula. Um KPI é uma medida quantificável, como o lucro bruto mensal ou a rotatividade trimestral dos funcionários, usada para monitorar o desempenho de uma organização. +CUBEMEMBER = MEMBROCUBO ## Retorna um membro ou tupla em uma hierarquia de cubo. Use para validar se o membro ou tupla existe no cubo. +CUBEMEMBERPROPERTY = PROPRIEDADEMEMBROCUBO ## Retorna o valor da propriedade de um membro no cubo. Usada para validar a existência do nome do membro no cubo e para retornar a propriedade especificada para esse membro. +CUBERANKEDMEMBER = MEMBROCLASSIFICADOCUBO ## Retorna o enésimo membro, ou o membro ordenado, em um conjunto. Use para retornar um ou mais elementos em um conjunto, assim como o melhor vendedor ou os dez melhores alunos. +CUBESET = CONJUNTOCUBO ## Define um conjunto calculado de membros ou tuplas enviando uma expressão do conjunto para o cubo no servidor, que cria o conjunto e o retorna para o Microsoft Office Excel. +CUBESETCOUNT = CONTAGEMCONJUNTOCUBO ## Retorna o número de itens em um conjunto. +CUBEVALUE = VALORCUBO ## Retorna um valor agregado de um cubo. + + +## +## Database functions Funções de banco de dados +## +DAVERAGE = BDMÉDIA ## Retorna a média das entradas selecionadas de um banco de dados +DCOUNT = BDCONTAR ## Conta as células que contêm números em um banco de dados +DCOUNTA = BDCONTARA ## Conta células não vazias em um banco de dados +DGET = BDEXTRAIR ## Extrai de um banco de dados um único registro que corresponde a um critério específico +DMAX = BDMÁX ## Retorna o valor máximo de entradas selecionadas de um banco de dados +DMIN = BDMÍN ## Retorna o valor mínimo de entradas selecionadas de um banco de dados +DPRODUCT = BDMULTIPL ## Multiplica os valores em um campo específico de registros que correspondem ao critério em um banco de dados +DSTDEV = BDEST ## Estima o desvio padrão com base em uma amostra de entradas selecionadas de um banco de dados +DSTDEVP = BDDESVPA ## Calcula o desvio padrão com base na população inteira de entradas selecionadas de um banco de dados +DSUM = BDSOMA ## Adiciona os números à coluna de campos de registros do banco de dados que correspondem ao critério +DVAR = BDVAREST ## Estima a variância com base em uma amostra de entradas selecionadas de um banco de dados +DVARP = BDVARP ## Calcula a variância com base na população inteira de entradas selecionadas de um banco de dados + + +## +## Date and time functions Funções de data e hora +## +DATE = DATA ## Retorna o número de série de uma data específica +DATEVALUE = DATA.VALOR ## Converte uma data na forma de texto para um número de série +DAY = DIA ## Converte um número de série em um dia do mês +DAYS360 = DIAS360 ## Calcula o número de dias entre duas datas com base em um ano de 360 dias +EDATE = DATAM ## Retorna o número de série da data que é o número indicado de meses antes ou depois da data inicial +EOMONTH = FIMMÊS ## Retorna o número de série do último dia do mês antes ou depois de um número especificado de meses +HOUR = HORA ## Converte um número de série em uma hora +MINUTE = MINUTO ## Converte um número de série em um minuto +MONTH = MÊS ## Converte um número de série em um mês +NETWORKDAYS = DIATRABALHOTOTAL ## Retorna o número de dias úteis inteiros entre duas datas +NOW = AGORA ## Retorna o número de série seqüencial da data e hora atuais +SECOND = SEGUNDO ## Converte um número de série em um segundo +TIME = HORA ## Retorna o número de série de uma hora específica +TIMEVALUE = VALOR.TEMPO ## Converte um horário na forma de texto para um número de série +TODAY = HOJE ## Retorna o número de série da data de hoje +WEEKDAY = DIA.DA.SEMANA ## Converte um número de série em um dia da semana +WEEKNUM = NÚMSEMANA ## Converte um número de série em um número que representa onde a semana cai numericamente em um ano +WORKDAY = DIATRABALHO ## Retorna o número de série da data antes ou depois de um número específico de dias úteis +YEAR = ANO ## Converte um número de série em um ano +YEARFRAC = FRAÇÃOANO ## Retorna a fração do ano que representa o número de dias entre data_inicial e data_final + + +## +## Engineering functions Funções de engenharia +## +BESSELI = BESSELI ## Retorna a função de Bessel In(x) modificada +BESSELJ = BESSELJ ## Retorna a função de Bessel Jn(x) +BESSELK = BESSELK ## Retorna a função de Bessel Kn(x) modificada +BESSELY = BESSELY ## Retorna a função de Bessel Yn(x) +BIN2DEC = BIN2DEC ## Converte um número binário em decimal +BIN2HEX = BIN2HEX ## Converte um número binário em hexadecimal +BIN2OCT = BIN2OCT ## Converte um número binário em octal +COMPLEX = COMPLEX ## Converte coeficientes reais e imaginários e um número complexo +CONVERT = CONVERTER ## Converte um número de um sistema de medida para outro +DEC2BIN = DECABIN ## Converte um número decimal em binário +DEC2HEX = DECAHEX ## Converte um número decimal em hexadecimal +DEC2OCT = DECAOCT ## Converte um número decimal em octal +DELTA = DELTA ## Testa se dois valores são iguais +ERF = FUNERRO ## Retorna a função de erro +ERFC = FUNERROCOMPL ## Retorna a função de erro complementar +GESTEP = DEGRAU ## Testa se um número é maior do que um valor limite +HEX2BIN = HEXABIN ## Converte um número hexadecimal em binário +HEX2DEC = HEXADEC ## Converte um número hexadecimal em decimal +HEX2OCT = HEXAOCT ## Converte um número hexadecimal em octal +IMABS = IMABS ## Retorna o valor absoluto (módulo) de um número complexo +IMAGINARY = IMAGINÁRIO ## Retorna o coeficiente imaginário de um número complexo +IMARGUMENT = IMARG ## Retorna o argumento teta, um ângulo expresso em radianos +IMCONJUGATE = IMCONJ ## Retorna o conjugado complexo de um número complexo +IMCOS = IMCOS ## Retorna o cosseno de um número complexo +IMDIV = IMDIV ## Retorna o quociente de dois números complexos +IMEXP = IMEXP ## Retorna o exponencial de um número complexo +IMLN = IMLN ## Retorna o logaritmo natural de um número complexo +IMLOG10 = IMLOG10 ## Retorna o logaritmo de base 10 de um número complexo +IMLOG2 = IMLOG2 ## Retorna o logaritmo de base 2 de um número complexo +IMPOWER = IMPOT ## Retorna um número complexo elevado a uma potência inteira +IMPRODUCT = IMPROD ## Retorna o produto de números complexos +IMREAL = IMREAL ## Retorna o coeficiente real de um número complexo +IMSIN = IMSENO ## Retorna o seno de um número complexo +IMSQRT = IMRAIZ ## Retorna a raiz quadrada de um número complexo +IMSUB = IMSUBTR ## Retorna a diferença entre dois números complexos +IMSUM = IMSOMA ## Retorna a soma de números complexos +OCT2BIN = OCTABIN ## Converte um número octal em binário +OCT2DEC = OCTADEC ## Converte um número octal em decimal +OCT2HEX = OCTAHEX ## Converte um número octal em hexadecimal + + +## +## Financial functions Funções financeiras +## +ACCRINT = JUROSACUM ## Retorna a taxa de juros acumulados de um título que paga uma taxa periódica de juros +ACCRINTM = JUROSACUMV ## Retorna os juros acumulados de um título que paga juros no vencimento +AMORDEGRC = AMORDEGRC ## Retorna a depreciação para cada período contábil usando o coeficiente de depreciação +AMORLINC = AMORLINC ## Retorna a depreciação para cada período contábil +COUPDAYBS = CUPDIASINLIQ ## Retorna o número de dias do início do período de cupom até a data de liquidação +COUPDAYS = CUPDIAS ## Retorna o número de dias no período de cupom que contém a data de quitação +COUPDAYSNC = CUPDIASPRÓX ## Retorna o número de dias da data de liquidação até a data do próximo cupom +COUPNCD = CUPDATAPRÓX ## Retorna a próxima data de cupom após a data de quitação +COUPNUM = CUPNÚM ## Retorna o número de cupons pagáveis entre as datas de quitação e vencimento +COUPPCD = CUPDATAANT ## Retorna a data de cupom anterior à data de quitação +CUMIPMT = PGTOJURACUM ## Retorna os juros acumulados pagos entre dois períodos +CUMPRINC = PGTOCAPACUM ## Retorna o capital acumulado pago sobre um empréstimo entre dois períodos +DB = BD ## Retorna a depreciação de um ativo para um período especificado, usando o método de balanço de declínio fixo +DDB = BDD ## Retorna a depreciação de um ativo com relação a um período especificado usando o método de saldos decrescentes duplos ou qualquer outro método especificado por você +DISC = DESC ## Retorna a taxa de desconto de um título +DOLLARDE = MOEDADEC ## Converte um preço em formato de moeda, na forma fracionária, em um preço na forma decimal +DOLLARFR = MOEDAFRA ## Converte um preço, apresentado na forma decimal, em um preço apresentado na forma fracionária +DURATION = DURAÇÃO ## Retorna a duração anual de um título com pagamentos de juros periódicos +EFFECT = EFETIVA ## Retorna a taxa de juros anual efetiva +FV = VF ## Retorna o valor futuro de um investimento +FVSCHEDULE = VFPLANO ## Retorna o valor futuro de um capital inicial após a aplicação de uma série de taxas de juros compostas +INTRATE = TAXAJUROS ## Retorna a taxa de juros de um título totalmente investido +IPMT = IPGTO ## Retorna o pagamento de juros para um investimento em um determinado período +IRR = TIR ## Retorna a taxa interna de retorno de uma série de fluxos de caixa +ISPMT = ÉPGTO ## Calcula os juros pagos durante um período específico de um investimento +MDURATION = MDURAÇÃO ## Retorna a duração de Macauley modificada para um título com um valor de paridade equivalente a R$ 100 +MIRR = MTIR ## Calcula a taxa interna de retorno em que fluxos de caixa positivos e negativos são financiados com diferentes taxas +NOMINAL = NOMINAL ## Retorna a taxa de juros nominal anual +NPER = NPER ## Retorna o número de períodos de um investimento +NPV = VPL ## Retorna o valor líquido atual de um investimento com base em uma série de fluxos de caixa periódicos e em uma taxa de desconto +ODDFPRICE = PREÇOPRIMINC ## Retorna o preço por R$ 100 de valor nominal de um título com um primeiro período indefinido +ODDFYIELD = LUCROPRIMINC ## Retorna o rendimento de um título com um primeiro período indefinido +ODDLPRICE = PREÇOÚLTINC ## Retorna o preço por R$ 100 de valor nominal de um título com um último período de cupom indefinido +ODDLYIELD = LUCROÚLTINC ## Retorna o rendimento de um título com um último período indefinido +PMT = PGTO ## Retorna o pagamento periódico de uma anuidade +PPMT = PPGTO ## Retorna o pagamento de capital para determinado período de investimento +PRICE = PREÇO ## Retorna a preço por R$ 100,00 de valor nominal de um título que paga juros periódicos +PRICEDISC = PREÇODESC ## Retorna o preço por R$ 100,00 de valor nominal de um título descontado +PRICEMAT = PREÇOVENC ## Retorna o preço por R$ 100,00 de valor nominal de um título que paga juros no vencimento +PV = VP ## Retorna o valor presente de um investimento +RATE = TAXA ## Retorna a taxa de juros por período de uma anuidade +RECEIVED = RECEBER ## Retorna a quantia recebida no vencimento de um título totalmente investido +SLN = DPD ## Retorna a depreciação em linha reta de um ativo durante um período +SYD = SDA ## Retorna a depreciação dos dígitos da soma dos anos de um ativo para um período especificado +TBILLEQ = OTN ## Retorna o rendimento de um título equivalente a uma obrigação do Tesouro +TBILLPRICE = OTNVALOR ## Retorna o preço por R$ 100,00 de valor nominal de uma obrigação do Tesouro +TBILLYIELD = OTNLUCRO ## Retorna o rendimento de uma obrigação do Tesouro +VDB = BDV ## Retorna a depreciação de um ativo para um período especificado ou parcial usando um método de balanço declinante +XIRR = XTIR ## Fornece a taxa interna de retorno para um programa de fluxos de caixa que não é necessariamente periódico +XNPV = XVPL ## Retorna o valor presente líquido de um programa de fluxos de caixa que não é necessariamente periódico +YIELD = LUCRO ## Retorna o lucro de um título que paga juros periódicos +YIELDDISC = LUCRODESC ## Retorna o rendimento anual de um título descontado. Por exemplo, uma obrigação do Tesouro +YIELDMAT = LUCROVENC ## Retorna o lucro anual de um título que paga juros no vencimento + + +## +## Information functions Funções de informação +## +CELL = CÉL ## Retorna informações sobre formatação, localização ou conteúdo de uma célula +ERROR.TYPE = TIPO.ERRO ## Retorna um número correspondente a um tipo de erro +INFO = INFORMAÇÃO ## Retorna informações sobre o ambiente operacional atual +ISBLANK = ÉCÉL.VAZIA ## Retorna VERDADEIRO se o valor for vazio +ISERR = ÉERRO ## Retorna VERDADEIRO se o valor for um valor de erro diferente de #N/D +ISERROR = ÉERROS ## Retorna VERDADEIRO se o valor for um valor de erro +ISEVEN = ÉPAR ## Retorna VERDADEIRO se o número for par +ISLOGICAL = ÉLÓGICO ## Retorna VERDADEIRO se o valor for um valor lógico +ISNA = É.NÃO.DISP ## Retorna VERDADEIRO se o valor for o valor de erro #N/D +ISNONTEXT = É.NÃO.TEXTO ## Retorna VERDADEIRO se o valor for diferente de texto +ISNUMBER = ÉNÚM ## Retorna VERDADEIRO se o valor for um número +ISODD = ÉIMPAR ## Retorna VERDADEIRO se o número for ímpar +ISREF = ÉREF ## Retorna VERDADEIRO se o valor for uma referência +ISTEXT = ÉTEXTO ## Retorna VERDADEIRO se o valor for texto +N = N ## Retorna um valor convertido em um número +NA = NÃO.DISP ## Retorna o valor de erro #N/D +TYPE = TIPO ## Retorna um número indicando o tipo de dados de um valor + + +## +## Logical functions Funções lógicas +## +AND = E ## Retorna VERDADEIRO se todos os seus argumentos forem VERDADEIROS +FALSE = FALSO ## Retorna o valor lógico FALSO +IF = SE ## Especifica um teste lógico a ser executado +IFERROR = SEERRO ## Retornará um valor que você especifica se uma fórmula for avaliada para um erro; do contrário, retornará o resultado da fórmula +NOT = NÃO ## Inverte o valor lógico do argumento +OR = OU ## Retorna VERDADEIRO se um dos argumentos for VERDADEIRO +TRUE = VERDADEIRO ## Retorna o valor lógico VERDADEIRO + + +## +## Lookup and reference functions Funções de pesquisa e referência +## +ADDRESS = ENDEREÇO ## Retorna uma referência como texto para uma única célula em uma planilha +AREAS = ÁREAS ## Retorna o número de áreas em uma referência +CHOOSE = ESCOLHER ## Escolhe um valor a partir de uma lista de valores +COLUMN = COL ## Retorna o número da coluna de uma referência +COLUMNS = COLS ## Retorna o número de colunas em uma referência +HLOOKUP = PROCH ## Procura na linha superior de uma matriz e retorna o valor da célula especificada +HYPERLINK = HYPERLINK ## Cria um atalho ou salto que abre um documento armazenado em um servidor de rede, uma intranet ou na Internet +INDEX = ÍNDICE ## Usa um índice para escolher um valor de uma referência ou matriz +INDIRECT = INDIRETO ## Retorna uma referência indicada por um valor de texto +LOOKUP = PROC ## Procura valores em um vetor ou em uma matriz +MATCH = CORRESP ## Procura valores em uma referência ou em uma matriz +OFFSET = DESLOC ## Retorna um deslocamento de referência com base em uma determinada referência +ROW = LIN ## Retorna o número da linha de uma referência +ROWS = LINS ## Retorna o número de linhas em uma referência +RTD = RTD ## Recupera dados em tempo real de um programa que ofereça suporte a automação COM (automação: uma forma de trabalhar com objetos de um aplicativo a partir de outro aplicativo ou ferramenta de desenvolvimento. Chamada inicialmente de automação OLE, a automação é um padrão industrial e um recurso do modelo de objeto componente (COM).) +TRANSPOSE = TRANSPOR ## Retorna a transposição de uma matriz +VLOOKUP = PROCV ## Procura na primeira coluna de uma matriz e move ao longo da linha para retornar o valor de uma célula + + +## +## Math and trigonometry functions Funções matemáticas e trigonométricas +## +ABS = ABS ## Retorna o valor absoluto de um número +ACOS = ACOS ## Retorna o arco cosseno de um número +ACOSH = ACOSH ## Retorna o cosseno hiperbólico inverso de um número +ASIN = ASEN ## Retorna o arco seno de um número +ASINH = ASENH ## Retorna o seno hiperbólico inverso de um número +ATAN = ATAN ## Retorna o arco tangente de um número +ATAN2 = ATAN2 ## Retorna o arco tangente das coordenadas x e y especificadas +ATANH = ATANH ## Retorna a tangente hiperbólica inversa de um número +CEILING = TETO ## Arredonda um número para o inteiro mais próximo ou para o múltiplo mais próximo de significância +COMBIN = COMBIN ## Retorna o número de combinações de um determinado número de objetos +COS = COS ## Retorna o cosseno de um número +COSH = COSH ## Retorna o cosseno hiperbólico de um número +DEGREES = GRAUS ## Converte radianos em graus +EVEN = PAR ## Arredonda um número para cima até o inteiro par mais próximo +EXP = EXP ## Retorna e elevado à potência de um número especificado +FACT = FATORIAL ## Retorna o fatorial de um número +FACTDOUBLE = FATDUPLO ## Retorna o fatorial duplo de um número +FLOOR = ARREDMULTB ## Arredonda um número para baixo até zero +GCD = MDC ## Retorna o máximo divisor comum +INT = INT ## Arredonda um número para baixo até o número inteiro mais próximo +LCM = MMC ## Retorna o mínimo múltiplo comum +LN = LN ## Retorna o logaritmo natural de um número +LOG = LOG ## Retorna o logaritmo de um número de uma base especificada +LOG10 = LOG10 ## Retorna o logaritmo de base 10 de um número +MDETERM = MATRIZ.DETERM ## Retorna o determinante de uma matriz de uma variável do tipo matriz +MINVERSE = MATRIZ.INVERSO ## Retorna a matriz inversa de uma matriz +MMULT = MATRIZ.MULT ## Retorna o produto de duas matrizes +MOD = RESTO ## Retorna o resto da divisão +MROUND = MARRED ## Retorna um número arredondado ao múltiplo desejado +MULTINOMIAL = MULTINOMIAL ## Retorna o multinomial de um conjunto de números +ODD = ÍMPAR ## Arredonda um número para cima até o inteiro ímpar mais próximo +PI = PI ## Retorna o valor de Pi +POWER = POTÊNCIA ## Fornece o resultado de um número elevado a uma potência +PRODUCT = MULT ## Multiplica seus argumentos +QUOTIENT = QUOCIENTE ## Retorna a parte inteira de uma divisão +RADIANS = RADIANOS ## Converte graus em radianos +RAND = ALEATÓRIO ## Retorna um número aleatório entre 0 e 1 +RANDBETWEEN = ALEATÓRIOENTRE ## Retorna um número aleatório entre os números especificados +ROMAN = ROMANO ## Converte um algarismo arábico em romano, como texto +ROUND = ARRED ## Arredonda um número até uma quantidade especificada de dígitos +ROUNDDOWN = ARREDONDAR.PARA.BAIXO ## Arredonda um número para baixo até zero +ROUNDUP = ARREDONDAR.PARA.CIMA ## Arredonda um número para cima, afastando-o de zero +SERIESSUM = SOMASEQÜÊNCIA ## Retorna a soma de uma série polinomial baseada na fórmula +SIGN = SINAL ## Retorna o sinal de um número +SIN = SEN ## Retorna o seno de um ângulo dado +SINH = SENH ## Retorna o seno hiperbólico de um número +SQRT = RAIZ ## Retorna uma raiz quadrada positiva +SQRTPI = RAIZPI ## Retorna a raiz quadrada de (núm* pi) +SUBTOTAL = SUBTOTAL ## Retorna um subtotal em uma lista ou em um banco de dados +SUM = SOMA ## Soma seus argumentos +SUMIF = SOMASE ## Adiciona as células especificadas por um determinado critério +SUMIFS = SOMASE ## Adiciona as células em um intervalo que atende a vários critérios +SUMPRODUCT = SOMARPRODUTO ## Retorna a soma dos produtos de componentes correspondentes de matrizes +SUMSQ = SOMAQUAD ## Retorna a soma dos quadrados dos argumentos +SUMX2MY2 = SOMAX2DY2 ## Retorna a soma da diferença dos quadrados dos valores correspondentes em duas matrizes +SUMX2PY2 = SOMAX2SY2 ## Retorna a soma da soma dos quadrados dos valores correspondentes em duas matrizes +SUMXMY2 = SOMAXMY2 ## Retorna a soma dos quadrados das diferenças dos valores correspondentes em duas matrizes +TAN = TAN ## Retorna a tangente de um número +TANH = TANH ## Retorna a tangente hiperbólica de um número +TRUNC = TRUNCAR ## Trunca um número para um inteiro + + +## +## Statistical functions Funções estatísticas +## +AVEDEV = DESV.MÉDIO ## Retorna a média aritmética dos desvios médios dos pontos de dados a partir de sua média +AVERAGE = MÉDIA ## Retorna a média dos argumentos +AVERAGEA = MÉDIAA ## Retorna a média dos argumentos, inclusive números, texto e valores lógicos +AVERAGEIF = MÉDIASE ## Retorna a média (média aritmética) de todas as células em um intervalo que atendem a um determinado critério +AVERAGEIFS = MÉDIASES ## Retorna a média (média aritmética) de todas as células que atendem a múltiplos critérios. +BETADIST = DISTBETA ## Retorna a função de distribuição cumulativa beta +BETAINV = BETA.ACUM.INV ## Retorna o inverso da função de distribuição cumulativa para uma distribuição beta especificada +BINOMDIST = DISTRBINOM ## Retorna a probabilidade de distribuição binomial do termo individual +CHIDIST = DIST.QUI ## Retorna a probabilidade unicaudal da distribuição qui-quadrada +CHIINV = INV.QUI ## Retorna o inverso da probabilidade uni-caudal da distribuição qui-quadrada +CHITEST = TESTE.QUI ## Retorna o teste para independência +CONFIDENCE = INT.CONFIANÇA ## Retorna o intervalo de confiança para uma média da população +CORREL = CORREL ## Retorna o coeficiente de correlação entre dois conjuntos de dados +COUNT = CONT.NÚM ## Calcula quantos números há na lista de argumentos +COUNTA = CONT.VALORES ## Calcula quantos valores há na lista de argumentos +COUNTBLANK = CONTAR.VAZIO ## Conta o número de células vazias no intervalo especificado +COUNTIF = CONT.SE ## Calcula o número de células não vazias em um intervalo que corresponde a determinados critérios +COUNTIFS = CONT.SES ## Conta o número de células dentro de um intervalo que atende a múltiplos critérios +COVAR = COVAR ## Retorna a covariância, a média dos produtos dos desvios pares +CRITBINOM = CRIT.BINOM ## Retorna o menor valor para o qual a distribuição binomial cumulativa é menor ou igual ao valor padrão +DEVSQ = DESVQ ## Retorna a soma dos quadrados dos desvios +EXPONDIST = DISTEXPON ## Retorna a distribuição exponencial +FDIST = DISTF ## Retorna a distribuição de probabilidade F +FINV = INVF ## Retorna o inverso da distribuição de probabilidades F +FISHER = FISHER ## Retorna a transformação Fisher +FISHERINV = FISHERINV ## Retorna o inverso da transformação Fisher +FORECAST = PREVISÃO ## Retorna um valor ao longo de uma linha reta +FREQUENCY = FREQÜÊNCIA ## Retorna uma distribuição de freqüência como uma matriz vertical +FTEST = TESTEF ## Retorna o resultado de um teste F +GAMMADIST = DISTGAMA ## Retorna a distribuição gama +GAMMAINV = INVGAMA ## Retorna o inverso da distribuição cumulativa gama +GAMMALN = LNGAMA ## Retorna o logaritmo natural da função gama, G(x) +GEOMEAN = MÉDIA.GEOMÉTRICA ## Retorna a média geométrica +GROWTH = CRESCIMENTO ## Retorna valores ao longo de uma tendência exponencial +HARMEAN = MÉDIA.HARMÔNICA ## Retorna a média harmônica +HYPGEOMDIST = DIST.HIPERGEOM ## Retorna a distribuição hipergeométrica +INTERCEPT = INTERCEPÇÃO ## Retorna a intercepção da linha de regressão linear +KURT = CURT ## Retorna a curtose de um conjunto de dados +LARGE = MAIOR ## Retorna o maior valor k-ésimo de um conjunto de dados +LINEST = PROJ.LIN ## Retorna os parâmetros de uma tendência linear +LOGEST = PROJ.LOG ## Retorna os parâmetros de uma tendência exponencial +LOGINV = INVLOG ## Retorna o inverso da distribuição lognormal +LOGNORMDIST = DIST.LOGNORMAL ## Retorna a distribuição lognormal cumulativa +MAX = MÁXIMO ## Retorna o valor máximo em uma lista de argumentos +MAXA = MÁXIMOA ## Retorna o maior valor em uma lista de argumentos, inclusive números, texto e valores lógicos +MEDIAN = MED ## Retorna a mediana dos números indicados +MIN = MÍNIMO ## Retorna o valor mínimo em uma lista de argumentos +MINA = MÍNIMOA ## Retorna o menor valor em uma lista de argumentos, inclusive números, texto e valores lógicos +MODE = MODO ## Retorna o valor mais comum em um conjunto de dados +NEGBINOMDIST = DIST.BIN.NEG ## Retorna a distribuição binomial negativa +NORMDIST = DIST.NORM ## Retorna a distribuição cumulativa normal +NORMINV = INV.NORM ## Retorna o inverso da distribuição cumulativa normal +NORMSDIST = DIST.NORMP ## Retorna a distribuição cumulativa normal padrão +NORMSINV = INV.NORMP ## Retorna o inverso da distribuição cumulativa normal padrão +PEARSON = PEARSON ## Retorna o coeficiente de correlação do momento do produto Pearson +PERCENTILE = PERCENTIL ## Retorna o k-ésimo percentil de valores em um intervalo +PERCENTRANK = ORDEM.PORCENTUAL ## Retorna a ordem percentual de um valor em um conjunto de dados +PERMUT = PERMUT ## Retorna o número de permutações de um determinado número de objetos +POISSON = POISSON ## Retorna a distribuição Poisson +PROB = PROB ## Retorna a probabilidade de valores em um intervalo estarem entre dois limites +QUARTILE = QUARTIL ## Retorna o quartil do conjunto de dados +RANK = ORDEM ## Retorna a posição de um número em uma lista de números +RSQ = RQUAD ## Retorna o quadrado do coeficiente de correlação do momento do produto de Pearson +SKEW = DISTORÇÃO ## Retorna a distorção de uma distribuição +SLOPE = INCLINAÇÃO ## Retorna a inclinação da linha de regressão linear +SMALL = MENOR ## Retorna o menor valor k-ésimo do conjunto de dados +STANDARDIZE = PADRONIZAR ## Retorna um valor normalizado +STDEV = DESVPAD ## Estima o desvio padrão com base em uma amostra +STDEVA = DESVPADA ## Estima o desvio padrão com base em uma amostra, inclusive números, texto e valores lógicos +STDEVP = DESVPADP ## Calcula o desvio padrão com base na população total +STDEVPA = DESVPADPA ## Calcula o desvio padrão com base na população total, inclusive números, texto e valores lógicos +STEYX = EPADYX ## Retorna o erro padrão do valor-y previsto para cada x da regressão +TDIST = DISTT ## Retorna a distribuição t de Student +TINV = INVT ## Retorna o inverso da distribuição t de Student +TREND = TENDÊNCIA ## Retorna valores ao longo de uma tendência linear +TRIMMEAN = MÉDIA.INTERNA ## Retorna a média do interior de um conjunto de dados +TTEST = TESTET ## Retorna a probabilidade associada ao teste t de Student +VAR = VAR ## Estima a variância com base em uma amostra +VARA = VARA ## Estima a variância com base em uma amostra, inclusive números, texto e valores lógicos +VARP = VARP ## Calcula a variância com base na população inteira +VARPA = VARPA ## Calcula a variância com base na população total, inclusive números, texto e valores lógicos +WEIBULL = WEIBULL ## Retorna a distribuição Weibull +ZTEST = TESTEZ ## Retorna o valor de probabilidade uni-caudal de um teste-z + + +## +## Text functions Funções de texto +## +ASC = ASC ## Altera letras do inglês ou katakana de largura total (bytes duplos) dentro de uma seqüência de caracteres para caracteres de meia largura (byte único) +BAHTTEXT = BAHTTEXT ## Converte um número em um texto, usando o formato de moeda ß (baht) +CHAR = CARACT ## Retorna o caractere especificado pelo número de código +CLEAN = TIRAR ## Remove todos os caracteres do texto que não podem ser impressos +CODE = CÓDIGO ## Retorna um código numérico para o primeiro caractere de uma seqüência de caracteres de texto +CONCATENATE = CONCATENAR ## Agrupa vários itens de texto em um único item de texto +DOLLAR = MOEDA ## Converte um número em texto, usando o formato de moeda $ (dólar) +EXACT = EXATO ## Verifica se dois valores de texto são idênticos +FIND = PROCURAR ## Procura um valor de texto dentro de outro (diferencia maiúsculas de minúsculas) +FINDB = PROCURARB ## Procura um valor de texto dentro de outro (diferencia maiúsculas de minúsculas) +FIXED = DEF.NÚM.DEC ## Formata um número como texto com um número fixo de decimais +JIS = JIS ## Altera letras do inglês ou katakana de meia largura (byte único) dentro de uma seqüência de caracteres para caracteres de largura total (bytes duplos) +LEFT = ESQUERDA ## Retorna os caracteres mais à esquerda de um valor de texto +LEFTB = ESQUERDAB ## Retorna os caracteres mais à esquerda de um valor de texto +LEN = NÚM.CARACT ## Retorna o número de caracteres em uma seqüência de texto +LENB = NÚM.CARACTB ## Retorna o número de caracteres em uma seqüência de texto +LOWER = MINÚSCULA ## Converte texto para minúsculas +MID = EXT.TEXTO ## Retorna um número específico de caracteres de uma seqüência de texto começando na posição especificada +MIDB = EXT.TEXTOB ## Retorna um número específico de caracteres de uma seqüência de texto começando na posição especificada +PHONETIC = FONÉTICA ## Extrai os caracteres fonéticos (furigana) de uma seqüência de caracteres de texto +PROPER = PRI.MAIÚSCULA ## Coloca a primeira letra de cada palavra em maiúscula em um valor de texto +REPLACE = MUDAR ## Muda os caracteres dentro do texto +REPLACEB = MUDARB ## Muda os caracteres dentro do texto +REPT = REPT ## Repete o texto um determinado número de vezes +RIGHT = DIREITA ## Retorna os caracteres mais à direita de um valor de texto +RIGHTB = DIREITAB ## Retorna os caracteres mais à direita de um valor de texto +SEARCH = LOCALIZAR ## Localiza um valor de texto dentro de outro (não diferencia maiúsculas de minúsculas) +SEARCHB = LOCALIZARB ## Localiza um valor de texto dentro de outro (não diferencia maiúsculas de minúsculas) +SUBSTITUTE = SUBSTITUIR ## Substitui um novo texto por um texto antigo em uma seqüência de texto +T = T ## Converte os argumentos em texto +TEXT = TEXTO ## Formata um número e o converte em texto +TRIM = ARRUMAR ## Remove espaços do texto +UPPER = MAIÚSCULA ## Converte o texto em maiúsculas +VALUE = VALOR ## Converte um argumento de texto em um número diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/config new file mode 100644 index 0000000..cd85c17 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = € + + +## +## Excel Error Codes (For future use) + +## +NULL = #NULO! +DIV0 = #DIV/0! +VALUE = #VALOR! +REF = #REF! +NAME = #NOME? +NUM = #NÚM! +NA = #N/D diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/functions new file mode 100644 index 0000000..ba4eb47 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/pt/functions @@ -0,0 +1,408 @@ +## +## Add-in and Automation functions Funções de Suplemento e Automatização +## +GETPIVOTDATA = OBTERDADOSDIN ## Devolve dados armazenados num relatório de Tabela Dinâmica + + +## +## Cube functions Funções de cubo +## +CUBEKPIMEMBER = MEMBROKPICUBO ## Devolve o nome, propriedade e medição de um KPI (key performance indicator) e apresenta o nome e a propriedade na célula. Um KPI é uma medida quantificável, como, por exemplo, o lucro mensal bruto ou a rotatividade trimestral de pessoal, utilizada para monitorizar o desempenho de uma organização. +CUBEMEMBER = MEMBROCUBO ## Devolve um membro ou cadeia de identificação numa hierarquia de cubo. Utilizada para validar a existência do membro ou cadeia de identificação no cubo. +CUBEMEMBERPROPERTY = PROPRIEDADEMEMBROCUBO ## Devolve o valor de uma propriedade de membro no cubo. Utilizada para validar a existência de um nome de membro no cubo e para devolver a propriedade especificada para esse membro. +CUBERANKEDMEMBER = MEMBROCLASSIFICADOCUBO ## Devolve o enésimo ou a classificação mais alta num conjunto. Utilizada para devolver um ou mais elementos num conjunto, tal como o melhor vendedor ou os 10 melhores alunos. +CUBESET = CONJUNTOCUBO ## Define um conjunto calculado de membros ou cadeias de identificação enviando uma expressão de conjunto para o cubo no servidor, que cria o conjunto e, em seguida, devolve o conjunto ao Microsoft Office Excel. +CUBESETCOUNT = CONTARCONJUNTOCUBO ## Devolve o número de itens num conjunto. +CUBEVALUE = VALORCUBO ## Devolve um valor agregado do cubo. + + +## +## Database functions Funções de base de dados +## +DAVERAGE = BDMÉDIA ## Devolve a média das entradas da base de dados seleccionadas +DCOUNT = BDCONTAR ## Conta as células que contêm números numa base de dados +DCOUNTA = BDCONTAR.VAL ## Conta as células que não estejam em branco numa base de dados +DGET = BDOBTER ## Extrai de uma base de dados um único registo que corresponde aos critérios especificados +DMAX = BDMÁX ## Devolve o valor máximo das entradas da base de dados seleccionadas +DMIN = BDMÍN ## Devolve o valor mínimo das entradas da base de dados seleccionadas +DPRODUCT = BDMULTIPL ## Multiplica os valores de um determinado campo de registos que correspondem aos critérios numa base de dados +DSTDEV = BDDESVPAD ## Calcula o desvio-padrão com base numa amostra de entradas da base de dados seleccionadas +DSTDEVP = BDDESVPADP ## Calcula o desvio-padrão com base na população total das entradas da base de dados seleccionadas +DSUM = BDSOMA ## Adiciona os números na coluna de campo dos registos de base de dados que correspondem aos critérios +DVAR = BDVAR ## Calcula a variância com base numa amostra das entradas de base de dados seleccionadas +DVARP = BDVARP ## Calcula a variância com base na população total das entradas de base de dados seleccionadas + + +## +## Date and time functions Funções de data e hora +## +DATE = DATA ## Devolve o número de série de uma determinada data +DATEVALUE = DATA.VALOR ## Converte uma data em forma de texto num número de série +DAY = DIA ## Converte um número de série num dia do mês +DAYS360 = DIAS360 ## Calcula o número de dias entre duas datas com base num ano com 360 dias +EDATE = DATAM ## Devolve um número de série de data que corresponde ao número de meses indicado antes ou depois da data de início +EOMONTH = FIMMÊS ## Devolve o número de série do último dia do mês antes ou depois de um número de meses especificado +HOUR = HORA ## Converte um número de série numa hora +MINUTE = MINUTO ## Converte um número de série num minuto +MONTH = MÊS ## Converte um número de série num mês +NETWORKDAYS = DIATRABALHOTOTAL ## Devolve o número total de dias úteis entre duas datas +NOW = AGORA ## Devolve o número de série da data e hora actuais +SECOND = SEGUNDO ## Converte um número de série num segundo +TIME = TEMPO ## Devolve o número de série de um determinado tempo +TIMEVALUE = VALOR.TEMPO ## Converte um tempo em forma de texto num número de série +TODAY = HOJE ## Devolve o número de série da data actual +WEEKDAY = DIA.SEMANA ## Converte um número de série num dia da semana +WEEKNUM = NÚMSEMANA ## Converte um número de série num número que representa o número da semana num determinado ano +WORKDAY = DIA.TRABALHO ## Devolve o número de série da data antes ou depois de um número de dias úteis especificado +YEAR = ANO ## Converte um número de série num ano +YEARFRAC = FRACÇÃOANO ## Devolve a fracção de ano que representa o número de dias inteiros entre a data_de_início e a data_de_fim + + +## +## Engineering functions Funções de engenharia +## +BESSELI = BESSELI ## Devolve a função de Bessel modificada In(x) +BESSELJ = BESSELJ ## Devolve a função de Bessel Jn(x) +BESSELK = BESSELK ## Devolve a função de Bessel modificada Kn(x) +BESSELY = BESSELY ## Devolve a função de Bessel Yn(x) +BIN2DEC = BINADEC ## Converte um número binário em decimal +BIN2HEX = BINAHEX ## Converte um número binário em hexadecimal +BIN2OCT = BINAOCT ## Converte um número binário em octal +COMPLEX = COMPLEXO ## Converte coeficientes reais e imaginários num número complexo +CONVERT = CONVERTER ## Converte um número de um sistema de medida noutro +DEC2BIN = DECABIN ## Converte um número decimal em binário +DEC2HEX = DECAHEX ## Converte um número decimal em hexadecimal +DEC2OCT = DECAOCT ## Converte um número decimal em octal +DELTA = DELTA ## Testa se dois valores são iguais +ERF = FUNCERRO ## Devolve a função de erro +ERFC = FUNCERROCOMPL ## Devolve a função de erro complementar +GESTEP = DEGRAU ## Testa se um número é maior do que um valor limite +HEX2BIN = HEXABIN ## Converte um número hexadecimal em binário +HEX2DEC = HEXADEC ## Converte um número hexadecimal em decimal +HEX2OCT = HEXAOCT ## Converte um número hexadecimal em octal +IMABS = IMABS ## Devolve o valor absoluto (módulo) de um número complexo +IMAGINARY = IMAGINÁRIO ## Devolve o coeficiente imaginário de um número complexo +IMARGUMENT = IMARG ## Devolve o argumento Teta, um ângulo expresso em radianos +IMCONJUGATE = IMCONJ ## Devolve o conjugado complexo de um número complexo +IMCOS = IMCOS ## Devolve o co-seno de um número complexo +IMDIV = IMDIV ## Devolve o quociente de dois números complexos +IMEXP = IMEXP ## Devolve o exponencial de um número complexo +IMLN = IMLN ## Devolve o logaritmo natural de um número complexo +IMLOG10 = IMLOG10 ## Devolve o logaritmo de base 10 de um número complexo +IMLOG2 = IMLOG2 ## Devolve o logaritmo de base 2 de um número complexo +IMPOWER = IMPOT ## Devolve um número complexo elevado a uma potência inteira +IMPRODUCT = IMPROD ## Devolve o produto de números complexos +IMREAL = IMREAL ## Devolve o coeficiente real de um número complexo +IMSIN = IMSENO ## Devolve o seno de um número complexo +IMSQRT = IMRAIZ ## Devolve a raiz quadrada de um número complexo +IMSUB = IMSUBTR ## Devolve a diferença entre dois números complexos +IMSUM = IMSOMA ## Devolve a soma de números complexos +OCT2BIN = OCTABIN ## Converte um número octal em binário +OCT2DEC = OCTADEC ## Converte um número octal em decimal +OCT2HEX = OCTAHEX ## Converte um número octal em hexadecimal + + +## +## Financial functions Funções financeiras +## +ACCRINT = JUROSACUM ## Devolve os juros acumulados de um título que paga juros periódicos +ACCRINTM = JUROSACUMV ## Devolve os juros acumulados de um título que paga juros no vencimento +AMORDEGRC = AMORDEGRC ## Devolve a depreciação correspondente a cada período contabilístico utilizando um coeficiente de depreciação +AMORLINC = AMORLINC ## Devolve a depreciação correspondente a cada período contabilístico +COUPDAYBS = CUPDIASINLIQ ## Devolve o número de dias entre o início do período do cupão e a data de regularização +COUPDAYS = CUPDIAS ## Devolve o número de dias no período do cupão que contém a data de regularização +COUPDAYSNC = CUPDIASPRÓX ## Devolve o número de dias entre a data de regularização e a data do cupão seguinte +COUPNCD = CUPDATAPRÓX ## Devolve a data do cupão seguinte após a data de regularização +COUPNUM = CUPNÚM ## Devolve o número de cupões a serem pagos entre a data de regularização e a data de vencimento +COUPPCD = CUPDATAANT ## Devolve a data do cupão anterior antes da data de regularização +CUMIPMT = PGTOJURACUM ## Devolve os juros cumulativos pagos entre dois períodos +CUMPRINC = PGTOCAPACUM ## Devolve o capital cumulativo pago a título de empréstimo entre dois períodos +DB = BD ## Devolve a depreciação de um activo relativo a um período especificado utilizando o método das quotas degressivas fixas +DDB = BDD ## Devolve a depreciação de um activo relativo a um período especificado utilizando o método das quotas degressivas duplas ou qualquer outro método especificado +DISC = DESC ## Devolve a taxa de desconto de um título +DOLLARDE = MOEDADEC ## Converte um preço em unidade monetária, expresso como uma fracção, num preço em unidade monetária, expresso como um número decimal +DOLLARFR = MOEDAFRA ## Converte um preço em unidade monetária, expresso como um número decimal, num preço em unidade monetária, expresso como uma fracção +DURATION = DURAÇÃO ## Devolve a duração anual de um título com pagamentos de juros periódicos +EFFECT = EFECTIVA ## Devolve a taxa de juros anual efectiva +FV = VF ## Devolve o valor futuro de um investimento +FVSCHEDULE = VFPLANO ## Devolve o valor futuro de um capital inicial após a aplicação de uma série de taxas de juro compostas +INTRATE = TAXAJUROS ## Devolve a taxa de juros de um título investido na totalidade +IPMT = IPGTO ## Devolve o pagamento dos juros de um investimento durante um determinado período +IRR = TIR ## Devolve a taxa de rentabilidade interna para uma série de fluxos monetários +ISPMT = É.PGTO ## Calcula os juros pagos durante um período específico de um investimento +MDURATION = MDURAÇÃO ## Devolve a duração modificada de Macauley de um título com um valor de paridade equivalente a € 100 +MIRR = MTIR ## Devolve a taxa interna de rentabilidade em que os fluxos monetários positivos e negativos são financiados com taxas diferentes +NOMINAL = NOMINAL ## Devolve a taxa de juros nominal anual +NPER = NPER ## Devolve o número de períodos de um investimento +NPV = VAL ## Devolve o valor actual líquido de um investimento com base numa série de fluxos monetários periódicos e numa taxa de desconto +ODDFPRICE = PREÇOPRIMINC ## Devolve o preço por € 100 do valor nominal de um título com um período inicial incompleto +ODDFYIELD = LUCROPRIMINC ## Devolve o lucro de um título com um período inicial incompleto +ODDLPRICE = PREÇOÚLTINC ## Devolve o preço por € 100 do valor nominal de um título com um período final incompleto +ODDLYIELD = LUCROÚLTINC ## Devolve o lucro de um título com um período final incompleto +PMT = PGTO ## Devolve o pagamento periódico de uma anuidade +PPMT = PPGTO ## Devolve o pagamento sobre o capital de um investimento num determinado período +PRICE = PREÇO ## Devolve o preço por € 100 do valor nominal de um título que paga juros periódicos +PRICEDISC = PREÇODESC ## Devolve o preço por € 100 do valor nominal de um título descontado +PRICEMAT = PREÇOVENC ## Devolve o preço por € 100 do valor nominal de um título que paga juros no vencimento +PV = VA ## Devolve o valor actual de um investimento +RATE = TAXA ## Devolve a taxa de juros por período de uma anuidade +RECEIVED = RECEBER ## Devolve o montante recebido no vencimento de um título investido na totalidade +SLN = AMORT ## Devolve uma depreciação linear de um activo durante um período +SYD = AMORTD ## Devolve a depreciação por algarismos da soma dos anos de um activo durante um período especificado +TBILLEQ = OTN ## Devolve o lucro de um título equivalente a uma Obrigação do Tesouro +TBILLPRICE = OTNVALOR ## Devolve o preço por € 100 de valor nominal de uma Obrigação do Tesouro +TBILLYIELD = OTNLUCRO ## Devolve o lucro de uma Obrigação do Tesouro +VDB = BDV ## Devolve a depreciação de um activo relativo a um período específico ou parcial utilizando um método de quotas degressivas +XIRR = XTIR ## Devolve a taxa interna de rentabilidade de um plano de fluxos monetários que não seja necessariamente periódica +XNPV = XVAL ## Devolve o valor actual líquido de um plano de fluxos monetários que não seja necessariamente periódico +YIELD = LUCRO ## Devolve o lucro de um título que paga juros periódicos +YIELDDISC = LUCRODESC ## Devolve o lucro anual de um título emitido abaixo do valor nominal, por exemplo, uma Obrigação do Tesouro +YIELDMAT = LUCROVENC ## Devolve o lucro anual de um título que paga juros na data de vencimento + + +## +## Information functions Funções de informação +## +CELL = CÉL ## Devolve informações sobre a formatação, localização ou conteúdo de uma célula +ERROR.TYPE = TIPO.ERRO ## Devolve um número correspondente a um tipo de erro +INFO = INFORMAÇÃO ## Devolve informações sobre o ambiente de funcionamento actual +ISBLANK = É.CÉL.VAZIA ## Devolve VERDADEIRO se o valor estiver em branco +ISERR = É.ERROS ## Devolve VERDADEIRO se o valor for um valor de erro diferente de #N/D +ISERROR = É.ERRO ## Devolve VERDADEIRO se o valor for um valor de erro +ISEVEN = ÉPAR ## Devolve VERDADEIRO se o número for par +ISLOGICAL = É.LÓGICO ## Devolve VERDADEIRO se o valor for lógico +ISNA = É.NÃO.DISP ## Devolve VERDADEIRO se o valor for o valor de erro #N/D +ISNONTEXT = É.NÃO.TEXTO ## Devolve VERDADEIRO se o valor não for texto +ISNUMBER = É.NÚM ## Devolve VERDADEIRO se o valor for um número +ISODD = ÉÍMPAR ## Devolve VERDADEIRO se o número for ímpar +ISREF = É.REF ## Devolve VERDADEIRO se o valor for uma referência +ISTEXT = É.TEXTO ## Devolve VERDADEIRO se o valor for texto +N = N ## Devolve um valor convertido num número +NA = NÃO.DISP ## Devolve o valor de erro #N/D +TYPE = TIPO ## Devolve um número que indica o tipo de dados de um valor + + +## +## Logical functions Funções lógicas +## +AND = E ## Devolve VERDADEIRO se todos os respectivos argumentos corresponderem a VERDADEIRO +FALSE = FALSO ## Devolve o valor lógico FALSO +IF = SE ## Especifica um teste lógico a ser executado +IFERROR = SE.ERRO ## Devolve um valor definido pelo utilizador se ocorrer um erro na fórmula, e devolve o resultado da fórmula se não ocorrer nenhum erro +NOT = NÃO ## Inverte a lógica do respectivo argumento +OR = OU ## Devolve VERDADEIRO se qualquer argumento for VERDADEIRO +TRUE = VERDADEIRO ## Devolve o valor lógico VERDADEIRO + + +## +## Lookup and reference functions Funções de pesquisa e referência +## +ADDRESS = ENDEREÇO ## Devolve uma referência a uma única célula numa folha de cálculo como texto +AREAS = ÁREAS ## Devolve o número de áreas numa referência +CHOOSE = SELECCIONAR ## Selecciona um valor a partir de uma lista de valores +COLUMN = COL ## Devolve o número da coluna de uma referência +COLUMNS = COLS ## Devolve o número de colunas numa referência +HLOOKUP = PROCH ## Procura na linha superior de uma matriz e devolve o valor da célula indicada +HYPERLINK = HIPERLIGAÇÃO ## Cria um atalho ou hiperligação que abre um documento armazenado num servidor de rede, numa intranet ou na Internet +INDEX = ÍNDICE ## Utiliza um índice para escolher um valor de uma referência ou de uma matriz +INDIRECT = INDIRECTO ## Devolve uma referência indicada por um valor de texto +LOOKUP = PROC ## Procura valores num vector ou numa matriz +MATCH = CORRESP ## Procura valores numa referência ou numa matriz +OFFSET = DESLOCAMENTO ## Devolve o deslocamento de referência de uma determinada referência +ROW = LIN ## Devolve o número da linha de uma referência +ROWS = LINS ## Devolve o número de linhas numa referência +RTD = RTD ## Obtém dados em tempo real a partir de um programa que suporte automatização COM (automatização: modo de trabalhar com objectos de uma aplicação a partir de outra aplicação ou ferramenta de desenvolvimento. Anteriormente conhecida como automatização OLE, a automatização é uma norma da indústria de software e uma funcionalidade COM (Component Object Model).) +TRANSPOSE = TRANSPOR ## Devolve a transposição de uma matriz +VLOOKUP = PROCV ## Procura na primeira coluna de uma matriz e percorre a linha para devolver o valor de uma célula + + +## +## Math and trigonometry functions Funções matemáticas e trigonométricas +## +ABS = ABS ## Devolve o valor absoluto de um número +ACOS = ACOS ## Devolve o arco de co-seno de um número +ACOSH = ACOSH ## Devolve o co-seno hiperbólico inverso de um número +ASIN = ASEN ## Devolve o arco de seno de um número +ASINH = ASENH ## Devolve o seno hiperbólico inverso de um número +ATAN = ATAN ## Devolve o arco de tangente de um número +ATAN2 = ATAN2 ## Devolve o arco de tangente das coordenadas x e y +ATANH = ATANH ## Devolve a tangente hiperbólica inversa de um número +CEILING = ARRED.EXCESSO ## Arredonda um número para o número inteiro mais próximo ou para o múltiplo de significância mais próximo +COMBIN = COMBIN ## Devolve o número de combinações de um determinado número de objectos +COS = COS ## Devolve o co-seno de um número +COSH = COSH ## Devolve o co-seno hiperbólico de um número +DEGREES = GRAUS ## Converte radianos em graus +EVEN = PAR ## Arredonda um número por excesso para o número inteiro mais próximo +EXP = EXP ## Devolve e elevado à potência de um determinado número +FACT = FACTORIAL ## Devolve o factorial de um número +FACTDOUBLE = FACTDUPLO ## Devolve o factorial duplo de um número +FLOOR = ARRED.DEFEITO ## Arredonda um número por defeito até zero +GCD = MDC ## Devolve o maior divisor comum +INT = INT ## Arredonda um número por defeito para o número inteiro mais próximo +LCM = MMC ## Devolve o mínimo múltiplo comum +LN = LN ## Devolve o logaritmo natural de um número +LOG = LOG ## Devolve o logaritmo de um número com uma base especificada +LOG10 = LOG10 ## Devolve o logaritmo de base 10 de um número +MDETERM = MATRIZ.DETERM ## Devolve o determinante matricial de uma matriz +MINVERSE = MATRIZ.INVERSA ## Devolve o inverso matricial de uma matriz +MMULT = MATRIZ.MULT ## Devolve o produto matricial de duas matrizes +MOD = RESTO ## Devolve o resto da divisão +MROUND = MARRED ## Devolve um número arredondado para o múltiplo pretendido +MULTINOMIAL = POLINOMIAL ## Devolve o polinomial de um conjunto de números +ODD = ÍMPAR ## Arredonda por excesso um número para o número inteiro ímpar mais próximo +PI = PI ## Devolve o valor de pi +POWER = POTÊNCIA ## Devolve o resultado de um número elevado a uma potência +PRODUCT = PRODUTO ## Multiplica os respectivos argumentos +QUOTIENT = QUOCIENTE ## Devolve a parte inteira de uma divisão +RADIANS = RADIANOS ## Converte graus em radianos +RAND = ALEATÓRIO ## Devolve um número aleatório entre 0 e 1 +RANDBETWEEN = ALEATÓRIOENTRE ## Devolve um número aleatório entre os números especificados +ROMAN = ROMANO ## Converte um número árabe em romano, como texto +ROUND = ARRED ## Arredonda um número para um número de dígitos especificado +ROUNDDOWN = ARRED.PARA.BAIXO ## Arredonda um número por defeito até zero +ROUNDUP = ARRED.PARA.CIMA ## Arredonda um número por excesso, afastando-o de zero +SERIESSUM = SOMASÉRIE ## Devolve a soma de uma série de potências baseada na fórmula +SIGN = SINAL ## Devolve o sinal de um número +SIN = SEN ## Devolve o seno de um determinado ângulo +SINH = SENH ## Devolve o seno hiperbólico de um número +SQRT = RAIZQ ## Devolve uma raiz quadrada positiva +SQRTPI = RAIZPI ## Devolve a raiz quadrada de (núm * pi) +SUBTOTAL = SUBTOTAL ## Devolve um subtotal numa lista ou base de dados +SUM = SOMA ## Adiciona os respectivos argumentos +SUMIF = SOMA.SE ## Adiciona as células especificadas por um determinado critério +SUMIFS = SOMA.SE.S ## Adiciona as células num intervalo que cumpre vários critérios +SUMPRODUCT = SOMARPRODUTO ## Devolve a soma dos produtos de componentes de matrizes correspondentes +SUMSQ = SOMARQUAD ## Devolve a soma dos quadrados dos argumentos +SUMX2MY2 = SOMAX2DY2 ## Devolve a soma da diferença dos quadrados dos valores correspondentes em duas matrizes +SUMX2PY2 = SOMAX2SY2 ## Devolve a soma da soma dos quadrados dos valores correspondentes em duas matrizes +SUMXMY2 = SOMAXMY2 ## Devolve a soma dos quadrados da diferença dos valores correspondentes em duas matrizes +TAN = TAN ## Devolve a tangente de um número +TANH = TANH ## Devolve a tangente hiperbólica de um número +TRUNC = TRUNCAR ## Trunca um número para um número inteiro + + +## +## Statistical functions Funções estatísticas +## +AVEDEV = DESV.MÉDIO ## Devolve a média aritmética dos desvios absolutos à média dos pontos de dados +AVERAGE = MÉDIA ## Devolve a média dos respectivos argumentos +AVERAGEA = MÉDIAA ## Devolve uma média dos respectivos argumentos, incluindo números, texto e valores lógicos +AVERAGEIF = MÉDIA.SE ## Devolve a média aritmética de todas as células num intervalo que cumprem determinado critério +AVERAGEIFS = MÉDIA.SE.S ## Devolve a média aritmética de todas as células que cumprem múltiplos critérios +BETADIST = DISTBETA ## Devolve a função de distribuição cumulativa beta +BETAINV = BETA.ACUM.INV ## Devolve o inverso da função de distribuição cumulativa relativamente a uma distribuição beta específica +BINOMDIST = DISTRBINOM ## Devolve a probabilidade de distribuição binomial de termo individual +CHIDIST = DIST.CHI ## Devolve a probabilidade unicaudal da distribuição qui-quadrada +CHIINV = INV.CHI ## Devolve o inverso da probabilidade unicaudal da distribuição qui-quadrada +CHITEST = TESTE.CHI ## Devolve o teste para independência +CONFIDENCE = INT.CONFIANÇA ## Devolve o intervalo de confiança correspondente a uma média de população +CORREL = CORREL ## Devolve o coeficiente de correlação entre dois conjuntos de dados +COUNT = CONTAR ## Conta os números que existem na lista de argumentos +COUNTA = CONTAR.VAL ## Conta os valores que existem na lista de argumentos +COUNTBLANK = CONTAR.VAZIO ## Conta o número de células em branco num intervalo +COUNTIF = CONTAR.SE ## Calcula o número de células num intervalo que corresponde aos critérios determinados +COUNTIFS = CONTAR.SE.S ## Conta o número de células num intervalo que cumprem múltiplos critérios +COVAR = COVAR ## Devolve a covariância, que é a média dos produtos de desvios de pares +CRITBINOM = CRIT.BINOM ## Devolve o menor valor em que a distribuição binomial cumulativa é inferior ou igual a um valor de critério +DEVSQ = DESVQ ## Devolve a soma dos quadrados dos desvios +EXPONDIST = DISTEXPON ## Devolve a distribuição exponencial +FDIST = DISTF ## Devolve a distribuição da probabilidade F +FINV = INVF ## Devolve o inverso da distribuição da probabilidade F +FISHER = FISHER ## Devolve a transformação Fisher +FISHERINV = FISHERINV ## Devolve o inverso da transformação Fisher +FORECAST = PREVISÃO ## Devolve um valor ao longo de uma tendência linear +FREQUENCY = FREQUÊNCIA ## Devolve uma distribuição de frequência como uma matriz vertical +FTEST = TESTEF ## Devolve o resultado de um teste F +GAMMADIST = DISTGAMA ## Devolve a distribuição gama +GAMMAINV = INVGAMA ## Devolve o inverso da distribuição gama cumulativa +GAMMALN = LNGAMA ## Devolve o logaritmo natural da função gama, Γ(x) +GEOMEAN = MÉDIA.GEOMÉTRICA ## Devolve a média geométrica +GROWTH = CRESCIMENTO ## Devolve valores ao longo de uma tendência exponencial +HARMEAN = MÉDIA.HARMÓNICA ## Devolve a média harmónica +HYPGEOMDIST = DIST.HIPERGEOM ## Devolve a distribuição hipergeométrica +INTERCEPT = INTERCEPTAR ## Devolve a intercepção da linha de regressão linear +KURT = CURT ## Devolve a curtose de um conjunto de dados +LARGE = MAIOR ## Devolve o maior valor k-ésimo de um conjunto de dados +LINEST = PROJ.LIN ## Devolve os parâmetros de uma tendência linear +LOGEST = PROJ.LOG ## Devolve os parâmetros de uma tendência exponencial +LOGINV = INVLOG ## Devolve o inverso da distribuição normal logarítmica +LOGNORMDIST = DIST.NORMALLOG ## Devolve a distribuição normal logarítmica cumulativa +MAX = MÁXIMO ## Devolve o valor máximo numa lista de argumentos +MAXA = MÁXIMOA ## Devolve o valor máximo numa lista de argumentos, incluindo números, texto e valores lógicos +MEDIAN = MED ## Devolve a mediana dos números indicados +MIN = MÍNIMO ## Devolve o valor mínimo numa lista de argumentos +MINA = MÍNIMOA ## Devolve o valor mínimo numa lista de argumentos, incluindo números, texto e valores lógicos +MODE = MODA ## Devolve o valor mais comum num conjunto de dados +NEGBINOMDIST = DIST.BIN.NEG ## Devolve a distribuição binominal negativa +NORMDIST = DIST.NORM ## Devolve a distribuição cumulativa normal +NORMINV = INV.NORM ## Devolve o inverso da distribuição cumulativa normal +NORMSDIST = DIST.NORMP ## Devolve a distribuição cumulativa normal padrão +NORMSINV = INV.NORMP ## Devolve o inverso da distribuição cumulativa normal padrão +PEARSON = PEARSON ## Devolve o coeficiente de correlação momento/produto de Pearson +PERCENTILE = PERCENTIL ## Devolve o k-ésimo percentil de valores num intervalo +PERCENTRANK = ORDEM.PERCENTUAL ## Devolve a ordem percentual de um valor num conjunto de dados +PERMUT = PERMUTAR ## Devolve o número de permutações de um determinado número de objectos +POISSON = POISSON ## Devolve a distribuição de Poisson +PROB = PROB ## Devolve a probabilidade dos valores num intervalo se encontrarem entre dois limites +QUARTILE = QUARTIL ## Devolve o quartil de um conjunto de dados +RANK = ORDEM ## Devolve a ordem de um número numa lista numérica +RSQ = RQUAD ## Devolve o quadrado do coeficiente de correlação momento/produto de Pearson +SKEW = DISTORÇÃO ## Devolve a distorção de uma distribuição +SLOPE = DECLIVE ## Devolve o declive da linha de regressão linear +SMALL = MENOR ## Devolve o menor valor de k-ésimo de um conjunto de dados +STANDARDIZE = NORMALIZAR ## Devolve um valor normalizado +STDEV = DESVPAD ## Calcula o desvio-padrão com base numa amostra +STDEVA = DESVPADA ## Calcula o desvio-padrão com base numa amostra, incluindo números, texto e valores lógicos +STDEVP = DESVPADP ## Calcula o desvio-padrão com base na população total +STDEVPA = DESVPADPA ## Calcula o desvio-padrão com base na população total, incluindo números, texto e valores lógicos +STEYX = EPADYX ## Devolve o erro-padrão do valor de y previsto para cada x na regressão +TDIST = DISTT ## Devolve a distribuição t de Student +TINV = INVT ## Devolve o inverso da distribuição t de Student +TREND = TENDÊNCIA ## Devolve valores ao longo de uma tendência linear +TRIMMEAN = MÉDIA.INTERNA ## Devolve a média do interior de um conjunto de dados +TTEST = TESTET ## Devolve a probabilidade associada ao teste t de Student +VAR = VAR ## Calcula a variância com base numa amostra +VARA = VARA ## Calcula a variância com base numa amostra, incluindo números, texto e valores lógicos +VARP = VARP ## Calcula a variância com base na população total +VARPA = VARPA ## Calcula a variância com base na população total, incluindo números, texto e valores lógicos +WEIBULL = WEIBULL ## Devolve a distribuição Weibull +ZTEST = TESTEZ ## Devolve o valor de probabilidade unicaudal de um teste-z + + +## +## Text functions Funções de texto +## +ASC = ASC ## Altera letras ou katakana de largura total (byte duplo) numa cadeia de caracteres para caracteres de largura média (byte único) +BAHTTEXT = TEXTO.BAHT ## Converte um número em texto, utilizando o formato monetário ß (baht) +CHAR = CARÁCT ## Devolve o carácter especificado pelo número de código +CLEAN = LIMPAR ## Remove do texto todos os caracteres não imprimíveis +CODE = CÓDIGO ## Devolve um código numérico correspondente ao primeiro carácter numa cadeia de texto +CONCATENATE = CONCATENAR ## Agrupa vários itens de texto num único item de texto +DOLLAR = MOEDA ## Converte um número em texto, utilizando o formato monetário € (Euro) +EXACT = EXACTO ## Verifica se dois valores de texto são idênticos +FIND = LOCALIZAR ## Localiza um valor de texto dentro de outro (sensível às maiúsculas e minúsculas) +FINDB = LOCALIZARB ## Localiza um valor de texto dentro de outro (sensível às maiúsculas e minúsculas) +FIXED = FIXA ## Formata um número como texto com um número fixo de decimais +JIS = JIS ## Altera letras ou katakana de largura média (byte único) numa cadeia de caracteres para caracteres de largura total (byte duplo) +LEFT = ESQUERDA ## Devolve os caracteres mais à esquerda de um valor de texto +LEFTB = ESQUERDAB ## Devolve os caracteres mais à esquerda de um valor de texto +LEN = NÚM.CARACT ## Devolve o número de caracteres de uma cadeia de texto +LENB = NÚM.CARACTB ## Devolve o número de caracteres de uma cadeia de texto +LOWER = MINÚSCULAS ## Converte o texto em minúsculas +MID = SEG.TEXTO ## Devolve um número específico de caracteres de uma cadeia de texto, a partir da posição especificada +MIDB = SEG.TEXTOB ## Devolve um número específico de caracteres de uma cadeia de texto, a partir da posição especificada +PHONETIC = FONÉTICA ## Retira os caracteres fonéticos (furigana) de uma cadeia de texto +PROPER = INICIAL.MAIÚSCULA ## Coloca em maiúsculas a primeira letra de cada palavra de um valor de texto +REPLACE = SUBSTITUIR ## Substitui caracteres no texto +REPLACEB = SUBSTITUIRB ## Substitui caracteres no texto +REPT = REPETIR ## Repete texto um determinado número de vezes +RIGHT = DIREITA ## Devolve os caracteres mais à direita de um valor de texto +RIGHTB = DIREITAB ## Devolve os caracteres mais à direita de um valor de texto +SEARCH = PROCURAR ## Localiza um valor de texto dentro de outro (não sensível a maiúsculas e minúsculas) +SEARCHB = PROCURARB ## Localiza um valor de texto dentro de outro (não sensível a maiúsculas e minúsculas) +SUBSTITUTE = SUBST ## Substitui texto novo por texto antigo numa cadeia de texto +T = T ## Converte os respectivos argumentos em texto +TEXT = TEXTO ## Formata um número e converte-o em texto +TRIM = COMPACTAR ## Remove espaços do texto +UPPER = MAIÚSCULAS ## Converte texto em maiúsculas +VALUE = VALOR ## Converte um argumento de texto num número diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/config new file mode 100644 index 0000000..9ee9e6c --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = р + + +## +## Excel Error Codes (For future use) + +## +NULL = #ПУСТО! +DIV0 = #ДЕЛ/0! +VALUE = #ЗНАЧ! +REF = #ССЫЛ! +NAME = #ИМЯ? +NUM = #ЧИСЛО! +NA = #Н/Д diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/functions new file mode 100644 index 0000000..3597dbf --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/ru/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from information provided by web-junior (http://www.web-junior.net/) +## +## + + +## +## Add-in and Automation functions Функции надстроек и автоматизации +## +GETPIVOTDATA = ПОЛУЧИТЬ.ДАННЫЕ.СВОДНОЙ.ТАБЛИЦЫ ## Возвращает данные, хранящиеся в отчете сводной таблицы. + + +## +## Cube functions Функции Куб +## +CUBEKPIMEMBER = КУБЭЛЕМЕНТКИП ## Возвращает свойство ключевого индикатора производительности «(КИП)» и отображает имя «КИП» в ячейке. «КИП» представляет собой количественную величину, такую как ежемесячная валовая прибыль или ежеквартальная текучесть кадров, используемой для контроля эффективности работы организации. +CUBEMEMBER = КУБЭЛЕМЕНТ ## Возвращает элемент или кортеж из куба. Используется для проверки существования элемента или кортежа в кубе. +CUBEMEMBERPROPERTY = КУБСВОЙСТВОЭЛЕМЕНТА ## Возвращает значение свойства элемента из куба. Используется для проверки существования имени элемента в кубе и возвращает указанное свойство для этого элемента. +CUBERANKEDMEMBER = КУБПОРЭЛЕМЕНТ ## Возвращает n-ый или ранжированный элемент в множество. Используется для возвращения одного или нескольких элементов в множество, например, лучшего продавца или 10 лучших студентов. +CUBESET = КУБМНОЖ ## Определяет вычислительное множество элементов или кортежей, отправляя на сервер выражение, которое создает множество, а затем возвращает его в Microsoft Office Excel. +CUBESETCOUNT = КУБЧИСЛОЭЛМНОЖ ## Возвращает число элементов множества. +CUBEVALUE = КУБЗНАЧЕНИЕ ## Возвращает обобщенное значение из куба. + + +## +## Database functions Функции для работы с базами данных +## +DAVERAGE = ДСРЗНАЧ ## Возвращает среднее значение выбранных записей базы данных. +DCOUNT = БСЧЁТ ## Подсчитывает количество числовых ячеек в базе данных. +DCOUNTA = БСЧЁТА ## Подсчитывает количество непустых ячеек в базе данных. +DGET = БИЗВЛЕЧЬ ## Извлекает из базы данных одну запись, удовлетворяющую заданному условию. +DMAX = ДМАКС ## Возвращает максимальное значение среди выделенных записей базы данных. +DMIN = ДМИН ## Возвращает минимальное значение среди выделенных записей базы данных. +DPRODUCT = БДПРОИЗВЕД ## Перемножает значения определенного поля в записях базы данных, удовлетворяющих условию. +DSTDEV = ДСТАНДОТКЛ ## Оценивает стандартное отклонение по выборке для выделенных записей базы данных. +DSTDEVP = ДСТАНДОТКЛП ## Вычисляет стандартное отклонение по генеральной совокупности для выделенных записей базы данных +DSUM = БДСУММ ## Суммирует числа в поле для записей базы данных, удовлетворяющих условию. +DVAR = БДДИСП ## Оценивает дисперсию по выборке из выделенных записей базы данных +DVARP = БДДИСПП ## Вычисляет дисперсию по генеральной совокупности для выделенных записей базы данных + + +## +## Date and time functions Функции даты и времени +## +DATE = ДАТА ## Возвращает заданную дату в числовом формате. +DATEVALUE = ДАТАЗНАЧ ## Преобразует дату из текстового формата в числовой формат. +DAY = ДЕНЬ ## Преобразует дату в числовом формате в день месяца. +DAYS360 = ДНЕЙ360 ## Вычисляет количество дней между двумя датами на основе 360-дневного года. +EDATE = ДАТАМЕС ## Возвращает дату в числовом формате, отстоящую на заданное число месяцев вперед или назад от начальной даты. +EOMONTH = КОНМЕСЯЦА ## Возвращает дату в числовом формате для последнего дня месяца, отстоящего вперед или назад на заданное число месяцев. +HOUR = ЧАС ## Преобразует дату в числовом формате в часы. +MINUTE = МИНУТЫ ## Преобразует дату в числовом формате в минуты. +MONTH = МЕСЯЦ ## Преобразует дату в числовом формате в месяцы. +NETWORKDAYS = ЧИСТРАБДНИ ## Возвращает количество рабочих дней между двумя датами. +NOW = ТДАТА ## Возвращает текущую дату и время в числовом формате. +SECOND = СЕКУНДЫ ## Преобразует дату в числовом формате в секунды. +TIME = ВРЕМЯ ## Возвращает заданное время в числовом формате. +TIMEVALUE = ВРЕМЗНАЧ ## Преобразует время из текстового формата в числовой формат. +TODAY = СЕГОДНЯ ## Возвращает текущую дату в числовом формате. +WEEKDAY = ДЕНЬНЕД ## Преобразует дату в числовом формате в день недели. +WEEKNUM = НОМНЕДЕЛИ ## Преобразует числовое представление в число, которое указывает, на какую неделю года приходится указанная дата. +WORKDAY = РАБДЕНЬ ## Возвращает дату в числовом формате, отстоящую вперед или назад на заданное количество рабочих дней. +YEAR = ГОД ## Преобразует дату в числовом формате в год. +YEARFRAC = ДОЛЯГОДА ## Возвращает долю года, которую составляет количество дней между начальной и конечной датами. + + +## +## Engineering functions Инженерные функции +## +BESSELI = БЕССЕЛЬ.I ## Возвращает модифицированную функцию Бесселя In(x). +BESSELJ = БЕССЕЛЬ.J ## Возвращает функцию Бесселя Jn(x). +BESSELK = БЕССЕЛЬ.K ## Возвращает модифицированную функцию Бесселя Kn(x). +BESSELY = БЕССЕЛЬ.Y ## Возвращает функцию Бесселя Yn(x). +BIN2DEC = ДВ.В.ДЕС ## Преобразует двоичное число в десятичное. +BIN2HEX = ДВ.В.ШЕСТН ## Преобразует двоичное число в шестнадцатеричное. +BIN2OCT = ДВ.В.ВОСЬМ ## Преобразует двоичное число в восьмеричное. +COMPLEX = КОМПЛЕКСН ## Преобразует коэффициенты при вещественной и мнимой частях комплексного числа в комплексное число. +CONVERT = ПРЕОБР ## Преобразует число из одной системы единиц измерения в другую. +DEC2BIN = ДЕС.В.ДВ ## Преобразует десятичное число в двоичное. +DEC2HEX = ДЕС.В.ШЕСТН ## Преобразует десятичное число в шестнадцатеричное. +DEC2OCT = ДЕС.В.ВОСЬМ ## Преобразует десятичное число в восьмеричное. +DELTA = ДЕЛЬТА ## Проверяет равенство двух значений. +ERF = ФОШ ## Возвращает функцию ошибки. +ERFC = ДФОШ ## Возвращает дополнительную функцию ошибки. +GESTEP = ПОРОГ ## Проверяет, не превышает ли данное число порогового значения. +HEX2BIN = ШЕСТН.В.ДВ ## Преобразует шестнадцатеричное число в двоичное. +HEX2DEC = ШЕСТН.В.ДЕС ## Преобразует шестнадцатеричное число в десятичное. +HEX2OCT = ШЕСТН.В.ВОСЬМ ## Преобразует шестнадцатеричное число в восьмеричное. +IMABS = МНИМ.ABS ## Возвращает абсолютную величину (модуль) комплексного числа. +IMAGINARY = МНИМ.ЧАСТЬ ## Возвращает коэффициент при мнимой части комплексного числа. +IMARGUMENT = МНИМ.АРГУМЕНТ ## Возвращает значение аргумента комплексного числа (тета) — угол, выраженный в радианах. +IMCONJUGATE = МНИМ.СОПРЯЖ ## Возвращает комплексно-сопряженное комплексное число. +IMCOS = МНИМ.COS ## Возвращает косинус комплексного числа. +IMDIV = МНИМ.ДЕЛ ## Возвращает частное от деления двух комплексных чисел. +IMEXP = МНИМ.EXP ## Возвращает экспоненту комплексного числа. +IMLN = МНИМ.LN ## Возвращает натуральный логарифм комплексного числа. +IMLOG10 = МНИМ.LOG10 ## Возвращает обычный (десятичный) логарифм комплексного числа. +IMLOG2 = МНИМ.LOG2 ## Возвращает двоичный логарифм комплексного числа. +IMPOWER = МНИМ.СТЕПЕНЬ ## Возвращает комплексное число, возведенное в целую степень. +IMPRODUCT = МНИМ.ПРОИЗВЕД ## Возвращает произведение от 2 до 29 комплексных чисел. +IMREAL = МНИМ.ВЕЩ ## Возвращает коэффициент при вещественной части комплексного числа. +IMSIN = МНИМ.SIN ## Возвращает синус комплексного числа. +IMSQRT = МНИМ.КОРЕНЬ ## Возвращает значение квадратного корня из комплексного числа. +IMSUB = МНИМ.РАЗН ## Возвращает разность двух комплексных чисел. +IMSUM = МНИМ.СУММ ## Возвращает сумму комплексных чисел. +OCT2BIN = ВОСЬМ.В.ДВ ## Преобразует восьмеричное число в двоичное. +OCT2DEC = ВОСЬМ.В.ДЕС ## Преобразует восьмеричное число в десятичное. +OCT2HEX = ВОСЬМ.В.ШЕСТН ## Преобразует восьмеричное число в шестнадцатеричное. + + +## +## Financial functions Финансовые функции +## +ACCRINT = НАКОПДОХОД ## Возвращает накопленный процент по ценным бумагам с периодической выплатой процентов. +ACCRINTM = НАКОПДОХОДПОГАШ ## Возвращает накопленный процент по ценным бумагам, проценты по которым выплачиваются в срок погашения. +AMORDEGRC = АМОРУМ ## Возвращает величину амортизации для каждого периода, используя коэффициент амортизации. +AMORLINC = АМОРУВ ## Возвращает величину амортизации для каждого периода. +COUPDAYBS = ДНЕЙКУПОНДО ## Возвращает количество дней от начала действия купона до даты соглашения. +COUPDAYS = ДНЕЙКУПОН ## Возвращает число дней в периоде купона, содержащем дату соглашения. +COUPDAYSNC = ДНЕЙКУПОНПОСЛЕ ## Возвращает число дней от даты соглашения до срока следующего купона. +COUPNCD = ДАТАКУПОНПОСЛЕ ## Возвращает следующую дату купона после даты соглашения. +COUPNUM = ЧИСЛКУПОН ## Возвращает количество купонов, которые могут быть оплачены между датой соглашения и сроком вступления в силу. +COUPPCD = ДАТАКУПОНДО ## Возвращает предыдущую дату купона перед датой соглашения. +CUMIPMT = ОБЩПЛАТ ## Возвращает общую выплату, произведенную между двумя периодическими выплатами. +CUMPRINC = ОБЩДОХОД ## Возвращает общую выплату по займу между двумя периодами. +DB = ФУО ## Возвращает величину амортизации актива для заданного периода, рассчитанную методом фиксированного уменьшения остатка. +DDB = ДДОБ ## Возвращает величину амортизации актива за данный период, используя метод двойного уменьшения остатка или иной явно указанный метод. +DISC = СКИДКА ## Возвращает норму скидки для ценных бумаг. +DOLLARDE = РУБЛЬ.ДЕС ## Преобразует цену в рублях, выраженную в виде дроби, в цену в рублях, выраженную десятичным числом. +DOLLARFR = РУБЛЬ.ДРОБЬ ## Преобразует цену в рублях, выраженную десятичным числом, в цену в рублях, выраженную в виде дроби. +DURATION = ДЛИТ ## Возвращает ежегодную продолжительность действия ценных бумаг с периодическими выплатами по процентам. +EFFECT = ЭФФЕКТ ## Возвращает действующие ежегодные процентные ставки. +FV = БС ## Возвращает будущую стоимость инвестиции. +FVSCHEDULE = БЗРАСПИС ## Возвращает будущую стоимость первоначальной основной суммы после начисления ряда сложных процентов. +INTRATE = ИНОРМА ## Возвращает процентную ставку для полностью инвестированных ценных бумаг. +IPMT = ПРПЛТ ## Возвращает величину выплаты прибыли на вложения за данный период. +IRR = ВСД ## Возвращает внутреннюю ставку доходности для ряда потоков денежных средств. +ISPMT = ПРОЦПЛАТ ## Вычисляет выплаты за указанный период инвестиции. +MDURATION = МДЛИТ ## Возвращает модифицированную длительность Маколея для ценных бумаг с предполагаемой номинальной стоимостью 100 рублей. +MIRR = МВСД ## Возвращает внутреннюю ставку доходности, при которой положительные и отрицательные денежные потоки имеют разные значения ставки. +NOMINAL = НОМИНАЛ ## Возвращает номинальную годовую процентную ставку. +NPER = КПЕР ## Возвращает общее количество периодов выплаты для данного вклада. +NPV = ЧПС ## Возвращает чистую приведенную стоимость инвестиции, основанной на серии периодических денежных потоков и ставке дисконтирования. +ODDFPRICE = ЦЕНАПЕРВНЕРЕГ ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг с нерегулярным первым периодом. +ODDFYIELD = ДОХОДПЕРВНЕРЕГ ## Возвращает доход по ценным бумагам с нерегулярным первым периодом. +ODDLPRICE = ЦЕНАПОСЛНЕРЕГ ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг с нерегулярным последним периодом. +ODDLYIELD = ДОХОДПОСЛНЕРЕГ ## Возвращает доход по ценным бумагам с нерегулярным последним периодом. +PMT = ПЛТ ## Возвращает величину выплаты за один период аннуитета. +PPMT = ОСПЛТ ## Возвращает величину выплат в погашение основной суммы по инвестиции за заданный период. +PRICE = ЦЕНА ## Возвращает цену за 100 рублей нарицательной стоимости ценных бумаг, по которым производится периодическая выплата процентов. +PRICEDISC = ЦЕНАСКИДКА ## Возвращает цену за 100 рублей номинальной стоимости ценных бумаг, на которые сделана скидка. +PRICEMAT = ЦЕНАПОГАШ ## Возвращает цену за 100 рублей номинальной стоимости ценных бумаг, проценты по которым выплачиваются в срок погашения. +PV = ПС ## Возвращает приведенную (к текущему моменту) стоимость инвестиции. +RATE = СТАВКА ## Возвращает процентную ставку по аннуитету за один период. +RECEIVED = ПОЛУЧЕНО ## Возвращает сумму, полученную к сроку погашения полностью обеспеченных ценных бумаг. +SLN = АПЛ ## Возвращает величину линейной амортизации актива за один период. +SYD = АСЧ ## Возвращает величину амортизации актива за данный период, рассчитанную методом суммы годовых чисел. +TBILLEQ = РАВНОКЧЕК ## Возвращает эквивалентный облигации доход по казначейскому чеку. +TBILLPRICE = ЦЕНАКЧЕК ## Возвращает цену за 100 рублей нарицательной стоимости для казначейского чека. +TBILLYIELD = ДОХОДКЧЕК ## Возвращает доход по казначейскому чеку. +VDB = ПУО ## Возвращает величину амортизации актива для указанного или частичного периода при использовании метода сокращающегося баланса. +XIRR = ЧИСТВНДОХ ## Возвращает внутреннюю ставку доходности для графика денежных потоков, которые не обязательно носят периодический характер. +XNPV = ЧИСТНЗ ## Возвращает чистую приведенную стоимость для денежных потоков, которые не обязательно являются периодическими. +YIELD = ДОХОД ## Возвращает доход от ценных бумаг, по которым производятся периодические выплаты процентов. +YIELDDISC = ДОХОДСКИДКА ## Возвращает годовой доход по ценным бумагам, на которые сделана скидка (пример — казначейские чеки). +YIELDMAT = ДОХОДПОГАШ ## Возвращает годовой доход от ценных бумаг, проценты по которым выплачиваются в срок погашения. + + +## +## Information functions Информационные функции +## +CELL = ЯЧЕЙКА ## Возвращает информацию о формате, расположении или содержимом ячейки. +ERROR.TYPE = ТИП.ОШИБКИ ## Возвращает числовой код, соответствующий типу ошибки. +INFO = ИНФОРМ ## Возвращает информацию о текущей операционной среде. +ISBLANK = ЕПУСТО ## Возвращает значение ИСТИНА, если аргумент является ссылкой на пустую ячейку. +ISERR = ЕОШ ## Возвращает значение ИСТИНА, если аргумент ссылается на любое значение ошибки, кроме #Н/Д. +ISERROR = ЕОШИБКА ## Возвращает значение ИСТИНА, если аргумент ссылается на любое значение ошибки. +ISEVEN = ЕЧЁТН ## Возвращает значение ИСТИНА, если значение аргумента является четным числом. +ISLOGICAL = ЕЛОГИЧ ## Возвращает значение ИСТИНА, если аргумент ссылается на логическое значение. +ISNA = ЕНД ## Возвращает значение ИСТИНА, если аргумент ссылается на значение ошибки #Н/Д. +ISNONTEXT = ЕНЕТЕКСТ ## Возвращает значение ИСТИНА, если значение аргумента не является текстом. +ISNUMBER = ЕЧИСЛО ## Возвращает значение ИСТИНА, если аргумент ссылается на число. +ISODD = ЕНЕЧЁТ ## Возвращает значение ИСТИНА, если значение аргумента является нечетным числом. +ISREF = ЕССЫЛКА ## Возвращает значение ИСТИНА, если значение аргумента является ссылкой. +ISTEXT = ЕТЕКСТ ## Возвращает значение ИСТИНА, если значение аргумента является текстом. +N = Ч ## Возвращает значение, преобразованное в число. +NA = НД ## Возвращает значение ошибки #Н/Д. +TYPE = ТИП ## Возвращает число, обозначающее тип данных значения. + + +## +## Logical functions Логические функции +## +AND = И ## Renvoie VRAI si tous ses arguments sont VRAI. +FALSE = ЛОЖЬ ## Возвращает логическое значение ЛОЖЬ. +IF = ЕСЛИ ## Выполняет проверку условия. +IFERROR = ЕСЛИОШИБКА ## Возвращает введённое значение, если вычисление по формуле вызывает ошибку; в противном случае функция возвращает результат вычисления. +NOT = НЕ ## Меняет логическое значение своего аргумента на противоположное. +OR = ИЛИ ## Возвращает значение ИСТИНА, если хотя бы один аргумент имеет значение ИСТИНА. +TRUE = ИСТИНА ## Возвращает логическое значение ИСТИНА. + + +## +## Lookup and reference functions Функции ссылки и поиска +## +ADDRESS = АДРЕС ## Возвращает ссылку на отдельную ячейку листа в виде текста. +AREAS = ОБЛАСТИ ## Возвращает количество областей в ссылке. +CHOOSE = ВЫБОР ## Выбирает значение из списка значений по индексу. +COLUMN = СТОЛБЕЦ ## Возвращает номер столбца, на который указывает ссылка. +COLUMNS = ЧИСЛСТОЛБ ## Возвращает количество столбцов в ссылке. +HLOOKUP = ГПР ## Ищет в первой строке массива и возвращает значение отмеченной ячейки +HYPERLINK = ГИПЕРССЫЛКА ## Создает ссылку, открывающую документ, который находится на сервере сети, в интрасети или в Интернете. +INDEX = ИНДЕКС ## Использует индекс для выбора значения из ссылки или массива. +INDIRECT = ДВССЫЛ ## Возвращает ссылку, заданную текстовым значением. +LOOKUP = ПРОСМОТР ## Ищет значения в векторе или массиве. +MATCH = ПОИСКПОЗ ## Ищет значения в ссылке или массиве. +OFFSET = СМЕЩ ## Возвращает смещение ссылки относительно заданной ссылки. +ROW = СТРОКА ## Возвращает номер строки, определяемой ссылкой. +ROWS = ЧСТРОК ## Возвращает количество строк в ссылке. +RTD = ДРВ ## Извлекает данные реального времени из программ, поддерживающих автоматизацию COM (Программирование объектов. Стандартное средство для работы с объектами некоторого приложения из другого приложения или средства разработки. Программирование объектов (ранее называемое программированием OLE) является функцией модели COM (Component Object Model, модель компонентных объектов).). +TRANSPOSE = ТРАНСП ## Возвращает транспонированный массив. +VLOOKUP = ВПР ## Ищет значение в первом столбце массива и возвращает значение из ячейки в найденной строке и указанном столбце. + + +## +## Math and trigonometry functions Математические и тригонометрические функции +## +ABS = ABS ## Возвращает модуль (абсолютную величину) числа. +ACOS = ACOS ## Возвращает арккосинус числа. +ACOSH = ACOSH ## Возвращает гиперболический арккосинус числа. +ASIN = ASIN ## Возвращает арксинус числа. +ASINH = ASINH ## Возвращает гиперболический арксинус числа. +ATAN = ATAN ## Возвращает арктангенс числа. +ATAN2 = ATAN2 ## Возвращает арктангенс для заданных координат x и y. +ATANH = ATANH ## Возвращает гиперболический арктангенс числа. +CEILING = ОКРВВЕРХ ## Округляет число до ближайшего целого или до ближайшего кратного указанному значению. +COMBIN = ЧИСЛКОМБ ## Возвращает количество комбинаций для заданного числа объектов. +COS = COS ## Возвращает косинус числа. +COSH = COSH ## Возвращает гиперболический косинус числа. +DEGREES = ГРАДУСЫ ## Преобразует радианы в градусы. +EVEN = ЧЁТН ## Округляет число до ближайшего четного целого. +EXP = EXP ## Возвращает число e, возведенное в указанную степень. +FACT = ФАКТР ## Возвращает факториал числа. +FACTDOUBLE = ДВФАКТР ## Возвращает двойной факториал числа. +FLOOR = ОКРВНИЗ ## Округляет число до ближайшего меньшего по модулю значения. +GCD = НОД ## Возвращает наибольший общий делитель. +INT = ЦЕЛОЕ ## Округляет число до ближайшего меньшего целого. +LCM = НОК ## Возвращает наименьшее общее кратное. +LN = LN ## Возвращает натуральный логарифм числа. +LOG = LOG ## Возвращает логарифм числа по заданному основанию. +LOG10 = LOG10 ## Возвращает десятичный логарифм числа. +MDETERM = МОПРЕД ## Возвращает определитель матрицы массива. +MINVERSE = МОБР ## Возвращает обратную матрицу массива. +MMULT = МУМНОЖ ## Возвращает произведение матриц двух массивов. +MOD = ОСТАТ ## Возвращает остаток от деления. +MROUND = ОКРУГЛТ ## Возвращает число, округленное с требуемой точностью. +MULTINOMIAL = МУЛЬТИНОМ ## Возвращает мультиномиальный коэффициент множества чисел. +ODD = НЕЧЁТ ## Округляет число до ближайшего нечетного целого. +PI = ПИ ## Возвращает число пи. +POWER = СТЕПЕНЬ ## Возвращает результат возведения числа в степень. +PRODUCT = ПРОИЗВЕД ## Возвращает произведение аргументов. +QUOTIENT = ЧАСТНОЕ ## Возвращает целую часть частного при делении. +RADIANS = РАДИАНЫ ## Преобразует градусы в радианы. +RAND = СЛЧИС ## Возвращает случайное число в интервале от 0 до 1. +RANDBETWEEN = СЛУЧМЕЖДУ ## Возвращает случайное число в интервале между двумя заданными числами. +ROMAN = РИМСКОЕ ## Преобразует арабские цифры в римские в виде текста. +ROUND = ОКРУГЛ ## Округляет число до указанного количества десятичных разрядов. +ROUNDDOWN = ОКРУГЛВНИЗ ## Округляет число до ближайшего меньшего по модулю значения. +ROUNDUP = ОКРУГЛВВЕРХ ## Округляет число до ближайшего большего по модулю значения. +SERIESSUM = РЯД.СУММ ## Возвращает сумму степенного ряда, вычисленную по формуле. +SIGN = ЗНАК ## Возвращает знак числа. +SIN = SIN ## Возвращает синус заданного угла. +SINH = SINH ## Возвращает гиперболический синус числа. +SQRT = КОРЕНЬ ## Возвращает положительное значение квадратного корня. +SQRTPI = КОРЕНЬПИ ## Возвращает квадратный корень из значения выражения (число * ПИ). +SUBTOTAL = ПРОМЕЖУТОЧНЫЕ.ИТОГИ ## Возвращает промежуточный итог в списке или базе данных. +SUM = СУММ ## Суммирует аргументы. +SUMIF = СУММЕСЛИ ## Суммирует ячейки, удовлетворяющие заданному условию. +SUMIFS = СУММЕСЛИМН ## Суммирует диапазон ячеек, удовлетворяющих нескольким условиям. +SUMPRODUCT = СУММПРОИЗВ ## Возвращает сумму произведений соответствующих элементов массивов. +SUMSQ = СУММКВ ## Возвращает сумму квадратов аргументов. +SUMX2MY2 = СУММРАЗНКВ ## Возвращает сумму разностей квадратов соответствующих значений в двух массивах. +SUMX2PY2 = СУММСУММКВ ## Возвращает сумму сумм квадратов соответствующих элементов двух массивов. +SUMXMY2 = СУММКВРАЗН ## Возвращает сумму квадратов разностей соответствующих значений в двух массивах. +TAN = TAN ## Возвращает тангенс числа. +TANH = TANH ## Возвращает гиперболический тангенс числа. +TRUNC = ОТБР ## Отбрасывает дробную часть числа. + + +## +## Statistical functions Статистические функции +## +AVEDEV = СРОТКЛ ## Возвращает среднее арифметическое абсолютных значений отклонений точек данных от среднего. +AVERAGE = СРЗНАЧ ## Возвращает среднее арифметическое аргументов. +AVERAGEA = СРЗНАЧА ## Возвращает среднее арифметическое аргументов, включая числа, текст и логические значения. +AVERAGEIF = СРЗНАЧЕСЛИ ## Возвращает среднее значение (среднее арифметическое) всех ячеек в диапазоне, которые удовлетворяют данному условию. +AVERAGEIFS = СРЗНАЧЕСЛИМН ## Возвращает среднее значение (среднее арифметическое) всех ячеек, которые удовлетворяют нескольким условиям. +BETADIST = БЕТАРАСП ## Возвращает интегральную функцию бета-распределения. +BETAINV = БЕТАОБР ## Возвращает обратную интегральную функцию указанного бета-распределения. +BINOMDIST = БИНОМРАСП ## Возвращает отдельное значение биномиального распределения. +CHIDIST = ХИ2РАСП ## Возвращает одностороннюю вероятность распределения хи-квадрат. +CHIINV = ХИ2ОБР ## Возвращает обратное значение односторонней вероятности распределения хи-квадрат. +CHITEST = ХИ2ТЕСТ ## Возвращает тест на независимость. +CONFIDENCE = ДОВЕРИТ ## Возвращает доверительный интервал для среднего значения по генеральной совокупности. +CORREL = КОРРЕЛ ## Возвращает коэффициент корреляции между двумя множествами данных. +COUNT = СЧЁТ ## Подсчитывает количество чисел в списке аргументов. +COUNTA = СЧЁТЗ ## Подсчитывает количество значений в списке аргументов. +COUNTBLANK = СЧИТАТЬПУСТОТЫ ## Подсчитывает количество пустых ячеек в диапазоне +COUNTIF = СЧЁТЕСЛИ ## Подсчитывает количество ячеек в диапазоне, удовлетворяющих заданному условию +COUNTIFS = СЧЁТЕСЛИМН ## Подсчитывает количество ячеек внутри диапазона, удовлетворяющих нескольким условиям. +COVAR = КОВАР ## Возвращает ковариацию, среднее произведений парных отклонений +CRITBINOM = КРИТБИНОМ ## Возвращает наименьшее значение, для которого интегральное биномиальное распределение меньше или равно заданному критерию. +DEVSQ = КВАДРОТКЛ ## Возвращает сумму квадратов отклонений. +EXPONDIST = ЭКСПРАСП ## Возвращает экспоненциальное распределение. +FDIST = FРАСП ## Возвращает F-распределение вероятности. +FINV = FРАСПОБР ## Возвращает обратное значение для F-распределения вероятности. +FISHER = ФИШЕР ## Возвращает преобразование Фишера. +FISHERINV = ФИШЕРОБР ## Возвращает обратное преобразование Фишера. +FORECAST = ПРЕДСКАЗ ## Возвращает значение линейного тренда. +FREQUENCY = ЧАСТОТА ## Возвращает распределение частот в виде вертикального массива. +FTEST = ФТЕСТ ## Возвращает результат F-теста. +GAMMADIST = ГАММАРАСП ## Возвращает гамма-распределение. +GAMMAINV = ГАММАОБР ## Возвращает обратное гамма-распределение. +GAMMALN = ГАММАНЛОГ ## Возвращает натуральный логарифм гамма функции, Γ(x). +GEOMEAN = СРГЕОМ ## Возвращает среднее геометрическое. +GROWTH = РОСТ ## Возвращает значения в соответствии с экспоненциальным трендом. +HARMEAN = СРГАРМ ## Возвращает среднее гармоническое. +HYPGEOMDIST = ГИПЕРГЕОМЕТ ## Возвращает гипергеометрическое распределение. +INTERCEPT = ОТРЕЗОК ## Возвращает отрезок, отсекаемый на оси линией линейной регрессии. +KURT = ЭКСЦЕСС ## Возвращает эксцесс множества данных. +LARGE = НАИБОЛЬШИЙ ## Возвращает k-ое наибольшее значение в множестве данных. +LINEST = ЛИНЕЙН ## Возвращает параметры линейного тренда. +LOGEST = ЛГРФПРИБЛ ## Возвращает параметры экспоненциального тренда. +LOGINV = ЛОГНОРМОБР ## Возвращает обратное логарифмическое нормальное распределение. +LOGNORMDIST = ЛОГНОРМРАСП ## Возвращает интегральное логарифмическое нормальное распределение. +MAX = МАКС ## Возвращает наибольшее значение в списке аргументов. +MAXA = МАКСА ## Возвращает наибольшее значение в списке аргументов, включая числа, текст и логические значения. +MEDIAN = МЕДИАНА ## Возвращает медиану заданных чисел. +MIN = МИН ## Возвращает наименьшее значение в списке аргументов. +MINA = МИНА ## Возвращает наименьшее значение в списке аргументов, включая числа, текст и логические значения. +MODE = МОДА ## Возвращает значение моды множества данных. +NEGBINOMDIST = ОТРБИНОМРАСП ## Возвращает отрицательное биномиальное распределение. +NORMDIST = НОРМРАСП ## Возвращает нормальную функцию распределения. +NORMINV = НОРМОБР ## Возвращает обратное нормальное распределение. +NORMSDIST = НОРМСТРАСП ## Возвращает стандартное нормальное интегральное распределение. +NORMSINV = НОРМСТОБР ## Возвращает обратное значение стандартного нормального распределения. +PEARSON = ПИРСОН ## Возвращает коэффициент корреляции Пирсона. +PERCENTILE = ПЕРСЕНТИЛЬ ## Возвращает k-ую персентиль для значений диапазона. +PERCENTRANK = ПРОЦЕНТРАНГ ## Возвращает процентную норму значения в множестве данных. +PERMUT = ПЕРЕСТ ## Возвращает количество перестановок для заданного числа объектов. +POISSON = ПУАССОН ## Возвращает распределение Пуассона. +PROB = ВЕРОЯТНОСТЬ ## Возвращает вероятность того, что значение из диапазона находится внутри заданных пределов. +QUARTILE = КВАРТИЛЬ ## Возвращает квартиль множества данных. +RANK = РАНГ ## Возвращает ранг числа в списке чисел. +RSQ = КВПИРСОН ## Возвращает квадрат коэффициента корреляции Пирсона. +SKEW = СКОС ## Возвращает асимметрию распределения. +SLOPE = НАКЛОН ## Возвращает наклон линии линейной регрессии. +SMALL = НАИМЕНЬШИЙ ## Возвращает k-ое наименьшее значение в множестве данных. +STANDARDIZE = НОРМАЛИЗАЦИЯ ## Возвращает нормализованное значение. +STDEV = СТАНДОТКЛОН ## Оценивает стандартное отклонение по выборке. +STDEVA = СТАНДОТКЛОНА ## Оценивает стандартное отклонение по выборке, включая числа, текст и логические значения. +STDEVP = СТАНДОТКЛОНП ## Вычисляет стандартное отклонение по генеральной совокупности. +STDEVPA = СТАНДОТКЛОНПА ## Вычисляет стандартное отклонение по генеральной совокупности, включая числа, текст и логические значения. +STEYX = СТОШYX ## Возвращает стандартную ошибку предсказанных значений y для каждого значения x в регрессии. +TDIST = СТЬЮДРАСП ## Возвращает t-распределение Стьюдента. +TINV = СТЬЮДРАСПОБР ## Возвращает обратное t-распределение Стьюдента. +TREND = ТЕНДЕНЦИЯ ## Возвращает значения в соответствии с линейным трендом. +TRIMMEAN = УРЕЗСРЕДНЕЕ ## Возвращает среднее внутренности множества данных. +TTEST = ТТЕСТ ## Возвращает вероятность, соответствующую критерию Стьюдента. +VAR = ДИСП ## Оценивает дисперсию по выборке. +VARA = ДИСПА ## Оценивает дисперсию по выборке, включая числа, текст и логические значения. +VARP = ДИСПР ## Вычисляет дисперсию для генеральной совокупности. +VARPA = ДИСПРА ## Вычисляет дисперсию для генеральной совокупности, включая числа, текст и логические значения. +WEIBULL = ВЕЙБУЛЛ ## Возвращает распределение Вейбулла. +ZTEST = ZТЕСТ ## Возвращает двустороннее P-значение z-теста. + + +## +## Text functions Текстовые функции +## +ASC = ASC ## Для языков с двухбайтовыми наборами знаков (например, катакана) преобразует полноширинные (двухбайтовые) знаки в полуширинные (однобайтовые). +BAHTTEXT = БАТТЕКСТ ## Преобразует число в текст, используя денежный формат ß (БАТ). +CHAR = СИМВОЛ ## Возвращает знак с заданным кодом. +CLEAN = ПЕЧСИМВ ## Удаляет все непечатаемые знаки из текста. +CODE = КОДСИМВ ## Возвращает числовой код первого знака в текстовой строке. +CONCATENATE = СЦЕПИТЬ ## Объединяет несколько текстовых элементов в один. +DOLLAR = РУБЛЬ ## Преобразует число в текст, используя денежный формат. +EXACT = СОВПАД ## Проверяет идентичность двух текстовых значений. +FIND = НАЙТИ ## Ищет вхождения одного текстового значения в другом (с учетом регистра). +FINDB = НАЙТИБ ## Ищет вхождения одного текстового значения в другом (с учетом регистра). +FIXED = ФИКСИРОВАННЫЙ ## Форматирует число и преобразует его в текст с заданным числом десятичных знаков. +JIS = JIS ## Для языков с двухбайтовыми наборами знаков (например, катакана) преобразует полуширинные (однобайтовые) знаки в текстовой строке в полноширинные (двухбайтовые). +LEFT = ЛЕВСИМВ ## Возвращает крайние слева знаки текстового значения. +LEFTB = ЛЕВБ ## Возвращает крайние слева знаки текстового значения. +LEN = ДЛСТР ## Возвращает количество знаков в текстовой строке. +LENB = ДЛИНБ ## Возвращает количество знаков в текстовой строке. +LOWER = СТРОЧН ## Преобразует все буквы текста в строчные. +MID = ПСТР ## Возвращает заданное число знаков из строки текста, начиная с указанной позиции. +MIDB = ПСТРБ ## Возвращает заданное число знаков из строки текста, начиная с указанной позиции. +PHONETIC = PHONETIC ## Извлекает фонетические (фуригана) знаки из текстовой строки. +PROPER = ПРОПНАЧ ## Преобразует первую букву в каждом слове текста в прописную. +REPLACE = ЗАМЕНИТЬ ## Заменяет знаки в тексте. +REPLACEB = ЗАМЕНИТЬБ ## Заменяет знаки в тексте. +REPT = ПОВТОР ## Повторяет текст заданное число раз. +RIGHT = ПРАВСИМВ ## Возвращает крайние справа знаки текстовой строки. +RIGHTB = ПРАВБ ## Возвращает крайние справа знаки текстовой строки. +SEARCH = ПОИСК ## Ищет вхождения одного текстового значения в другом (без учета регистра). +SEARCHB = ПОИСКБ ## Ищет вхождения одного текстового значения в другом (без учета регистра). +SUBSTITUTE = ПОДСТАВИТЬ ## Заменяет в текстовой строке старый текст новым. +T = Т ## Преобразует аргументы в текст. +TEXT = ТЕКСТ ## Форматирует число и преобразует его в текст. +TRIM = СЖПРОБЕЛЫ ## Удаляет из текста пробелы. +UPPER = ПРОПИСН ## Преобразует все буквы текста в прописные. +VALUE = ЗНАЧЕН ## Преобразует текстовый аргумент в число. diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/sv/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/sv/config new file mode 100644 index 0000000..bf72cc4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/sv/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = kr + + +## +## Excel Error Codes (For future use) + +## +NULL = #Skärning! +DIV0 = #Division/0! +VALUE = #Värdefel! +REF = #Referens! +NAME = #Namn? +NUM = #Ogiltigt! +NA = #Saknas! diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/sv/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/sv/functions new file mode 100644 index 0000000..73b2deb --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/sv/functions @@ -0,0 +1,408 @@ +## +## Add-in and Automation functions Tilläggs- och automatiseringsfunktioner +## +GETPIVOTDATA = HÄMTA.PIVOTDATA ## Returnerar data som lagrats i en pivottabellrapport + + +## +## Cube functions Kubfunktioner +## +CUBEKPIMEMBER = KUBKPIMEDLEM ## Returnerar namn, egenskap och mått för en KPI och visar namnet och egenskapen i cellen. En KPI, eller prestandaindikator, är ett kvantifierbart mått, t.ex. månatlig bruttovinst eller personalomsättning per kvartal, som används för att analysera ett företags resultat. +CUBEMEMBER = KUBMEDLEM ## Returnerar en medlem eller ett par i en kubhierarki. Används för att verifiera att medlemmen eller paret finns i kuben. +CUBEMEMBERPROPERTY = KUBMEDLEMSEGENSKAP ## Returnerar värdet för en medlemsegenskap i kuben. Används för att verifiera att ett medlemsnamn finns i kuben, samt för att returnera den angivna egenskapen för medlemmen. +CUBERANKEDMEMBER = KUBRANGORDNADMEDLEM ## Returnerar den n:te, eller rangordnade, medlemmen i en uppsättning. Används för att returnera ett eller flera element i en uppsättning, till exempelvis den bästa försäljaren eller de tio bästa eleverna. +CUBESET = KUBINSTÄLLNING ## Definierar en beräknad uppsättning medlemmar eller par genom att skicka ett bestämt uttryck till kuben på servern, som skapar uppsättningen och sedan returnerar den till Microsoft Office Excel. +CUBESETCOUNT = KUBINSTÄLLNINGANTAL ## Returnerar antalet objekt i en uppsättning. +CUBEVALUE = KUBVÄRDE ## Returnerar ett mängdvärde från en kub. + + +## +## Database functions Databasfunktioner +## +DAVERAGE = DMEDEL ## Returnerar medelvärdet av databasposterna +DCOUNT = DANTAL ## Räknar antalet celler som innehåller tal i en databas +DCOUNTA = DANTALV ## Räknar ifyllda celler i en databas +DGET = DHÄMTA ## Hämtar en enstaka post från en databas som uppfyller de angivna villkoren +DMAX = DMAX ## Returnerar det största värdet från databasposterna +DMIN = DMIN ## Returnerar det minsta värdet från databasposterna +DPRODUCT = DPRODUKT ## Multiplicerar värdena i ett visst fält i poster som uppfyller villkoret +DSTDEV = DSTDAV ## Uppskattar standardavvikelsen baserat på ett urval av databasposterna +DSTDEVP = DSTDAVP ## Beräknar standardavvikelsen utifrån hela populationen av valda databasposter +DSUM = DSUMMA ## Summerar talen i kolumnfält i databasposter som uppfyller villkoret +DVAR = DVARIANS ## Uppskattar variansen baserat på ett urval av databasposterna +DVARP = DVARIANSP ## Beräknar variansen utifrån hela populationen av valda databasposter + + +## +## Date and time functions Tid- och datumfunktioner +## +DATE = DATUM ## Returnerar ett serienummer för ett visst datum +DATEVALUE = DATUMVÄRDE ## Konverterar ett datum i textformat till ett serienummer +DAY = DAG ## Konverterar ett serienummer till dag i månaden +DAYS360 = DAGAR360 ## Beräknar antalet dagar mellan två datum baserat på ett 360-dagarsår +EDATE = EDATUM ## Returnerar serienumret för ett datum som infaller ett visst antal månader före eller efter startdatumet +EOMONTH = SLUTMÅNAD ## Returnerar serienumret för sista dagen i månaden ett visst antal månader tidigare eller senare +HOUR = TIMME ## Konverterar ett serienummer till en timme +MINUTE = MINUT ## Konverterar ett serienummer till en minut +MONTH = MÅNAD ## Konverterar ett serienummer till en månad +NETWORKDAYS = NETTOARBETSDAGAR ## Returnerar antalet hela arbetsdagar mellan två datum +NOW = NU ## Returnerar serienumret för dagens datum och aktuell tid +SECOND = SEKUND ## Konverterar ett serienummer till en sekund +TIME = KLOCKSLAG ## Returnerar serienumret för en viss tid +TIMEVALUE = TIDVÄRDE ## Konverterar en tid i textformat till ett serienummer +TODAY = IDAG ## Returnerar serienumret för dagens datum +WEEKDAY = VECKODAG ## Konverterar ett serienummer till en dag i veckan +WEEKNUM = VECKONR ## Konverterar ett serienummer till ett veckonummer +WORKDAY = ARBETSDAGAR ## Returnerar serienumret för ett datum ett visst antal arbetsdagar tidigare eller senare +YEAR = ÅR ## Konverterar ett serienummer till ett år +YEARFRAC = ÅRDEL ## Returnerar en del av ett år som representerar antalet hela dagar mellan start- och slutdatum + + +## +## Engineering functions Tekniska funktioner +## +BESSELI = BESSELI ## Returnerar den modifierade Bessel-funktionen In(x) +BESSELJ = BESSELJ ## Returnerar Bessel-funktionen Jn(x) +BESSELK = BESSELK ## Returnerar den modifierade Bessel-funktionen Kn(x) +BESSELY = BESSELY ## Returnerar Bessel-funktionen Yn(x) +BIN2DEC = BIN.TILL.DEC ## Omvandlar ett binärt tal till decimalt +BIN2HEX = BIN.TILL.HEX ## Omvandlar ett binärt tal till hexadecimalt +BIN2OCT = BIN.TILL.OKT ## Omvandlar ett binärt tal till oktalt +COMPLEX = KOMPLEX ## Omvandlar reella och imaginära koefficienter till ett komplext tal +CONVERT = KONVERTERA ## Omvandlar ett tal från ett måttsystem till ett annat +DEC2BIN = DEC.TILL.BIN ## Omvandlar ett decimalt tal till binärt +DEC2HEX = DEC.TILL.HEX ## Omvandlar ett decimalt tal till hexadecimalt +DEC2OCT = DEC.TILL.OKT ## Omvandlar ett decimalt tal till oktalt +DELTA = DELTA ## Testar om två värden är lika +ERF = FELF ## Returnerar felfunktionen +ERFC = FELFK ## Returnerar den komplementära felfunktionen +GESTEP = SLSTEG ## Testar om ett tal är större än ett tröskelvärde +HEX2BIN = HEX.TILL.BIN ## Omvandlar ett hexadecimalt tal till binärt +HEX2DEC = HEX.TILL.DEC ## Omvandlar ett hexadecimalt tal till decimalt +HEX2OCT = HEX.TILL.OKT ## Omvandlar ett hexadecimalt tal till oktalt +IMABS = IMABS ## Returnerar absolutvärdet (modulus) för ett komplext tal +IMAGINARY = IMAGINÄR ## Returnerar den imaginära koefficienten för ett komplext tal +IMARGUMENT = IMARGUMENT ## Returnerar det komplexa talets argument, en vinkel uttryckt i radianer +IMCONJUGATE = IMKONJUGAT ## Returnerar det komplexa talets konjugat +IMCOS = IMCOS ## Returnerar cosinus för ett komplext tal +IMDIV = IMDIV ## Returnerar kvoten för två komplexa tal +IMEXP = IMEUPPHÖJT ## Returnerar exponenten för ett komplext tal +IMLN = IMLN ## Returnerar den naturliga logaritmen för ett komplext tal +IMLOG10 = IMLOG10 ## Returnerar 10-logaritmen för ett komplext tal +IMLOG2 = IMLOG2 ## Returnerar 2-logaritmen för ett komplext tal +IMPOWER = IMUPPHÖJT ## Returnerar ett komplext tal upphöjt till en exponent +IMPRODUCT = IMPRODUKT ## Returnerar produkten av komplexa tal +IMREAL = IMREAL ## Returnerar den reella koefficienten för ett komplext tal +IMSIN = IMSIN ## Returnerar sinus för ett komplext tal +IMSQRT = IMROT ## Returnerar kvadratroten av ett komplext tal +IMSUB = IMDIFF ## Returnerar differensen mellan två komplexa tal +IMSUM = IMSUM ## Returnerar summan av komplexa tal +OCT2BIN = OKT.TILL.BIN ## Omvandlar ett oktalt tal till binärt +OCT2DEC = OKT.TILL.DEC ## Omvandlar ett oktalt tal till decimalt +OCT2HEX = OKT.TILL.HEX ## Omvandlar ett oktalt tal till hexadecimalt + + +## +## Financial functions Finansiella funktioner +## +ACCRINT = UPPLRÄNTA ## Returnerar den upplupna räntan för värdepapper med periodisk ränta +ACCRINTM = UPPLOBLRÄNTA ## Returnerar den upplupna räntan för ett värdepapper som ger avkastning på förfallodagen +AMORDEGRC = AMORDEGRC ## Returnerar avskrivningen för varje redovisningsperiod med hjälp av en avskrivningskoefficient +AMORLINC = AMORLINC ## Returnerar avskrivningen för varje redovisningsperiod +COUPDAYBS = KUPDAGBB ## Returnerar antal dagar från början av kupongperioden till likviddagen +COUPDAYS = KUPDAGARS ## Returnerar antalet dagar i kupongperioden som innehåller betalningsdatumet +COUPDAYSNC = KUPDAGNK ## Returnerar antalet dagar från betalningsdatumet till nästa kupongdatum +COUPNCD = KUPNKD ## Returnerar nästa kupongdatum efter likviddagen +COUPNUM = KUPANT ## Returnerar kuponger som förfaller till betalning mellan likviddagen och förfallodagen +COUPPCD = KUPFKD ## Returnerar föregående kupongdatum före likviddagen +CUMIPMT = KUMRÄNTA ## Returnerar den ackumulerade räntan som betalats mellan två perioder +CUMPRINC = KUMPRIS ## Returnerar det ackumulerade kapitalbeloppet som betalats på ett lån mellan två perioder +DB = DB ## Returnerar avskrivningen för en tillgång under en angiven tid enligt metoden för fast degressiv avskrivning +DDB = DEGAVSKR ## Returnerar en tillgångs värdeminskning under en viss period med hjälp av dubbel degressiv avskrivning eller någon annan metod som du anger +DISC = DISK ## Returnerar diskonteringsräntan för ett värdepapper +DOLLARDE = DECTAL ## Omvandlar ett pris uttryckt som ett bråk till ett decimaltal +DOLLARFR = BRÅK ## Omvandlar ett pris i kronor uttryckt som ett decimaltal till ett bråk +DURATION = LÖPTID ## Returnerar den årliga löptiden för en säkerhet med periodiska räntebetalningar +EFFECT = EFFRÄNTA ## Returnerar den årliga effektiva räntesatsen +FV = SLUTVÄRDE ## Returnerar det framtida värdet på en investering +FVSCHEDULE = FÖRRÄNTNING ## Returnerar det framtida värdet av ett begynnelsekapital beräknat på olika räntenivåer +INTRATE = ÅRSRÄNTA ## Returnerar räntesatsen för ett betalt värdepapper +IPMT = RBETALNING ## Returnerar räntedelen av en betalning för en given period +IRR = IR ## Returnerar internräntan för en serie betalningar +ISPMT = RALÅN ## Beräknar räntan som har betalats under en specifik betalningsperiod +MDURATION = MLÖPTID ## Returnerar den modifierade Macauley-löptiden för ett värdepapper med det antagna nominella värdet 100 kr +MIRR = MODIR ## Returnerar internräntan där positiva och negativa betalningar finansieras med olika räntor +NOMINAL = NOMRÄNTA ## Returnerar den årliga nominella räntesatsen +NPER = PERIODER ## Returnerar antalet perioder för en investering +NPV = NETNUVÄRDE ## Returnerar nuvärdet av en serie periodiska betalningar vid en given diskonteringsränta +ODDFPRICE = UDDAFPRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper med en udda första period +ODDFYIELD = UDDAFAVKASTNING ## Returnerar avkastningen för en säkerhet med en udda första period +ODDLPRICE = UDDASPRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper med en udda sista period +ODDLYIELD = UDDASAVKASTNING ## Returnerar avkastningen för en säkerhet med en udda sista period +PMT = BETALNING ## Returnerar den periodiska betalningen för en annuitet +PPMT = AMORT ## Returnerar amorteringsdelen av en annuitetsbetalning för en given period +PRICE = PRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper som ger periodisk ränta +PRICEDISC = PRISDISK ## Returnerar priset per 100 kr nominellt värde för ett diskonterat värdepapper +PRICEMAT = PRISFÖRF ## Returnerar priset per 100 kr nominellt värde för ett värdepapper som ger ränta på förfallodagen +PV = PV ## Returnerar nuvärdet av en serie lika stora periodiska betalningar +RATE = RÄNTA ## Returnerar räntesatsen per period i en annuitet +RECEIVED = BELOPP ## Returnerar beloppet som utdelas på förfallodagen för ett betalat värdepapper +SLN = LINAVSKR ## Returnerar den linjära avskrivningen för en tillgång under en period +SYD = ÅRSAVSKR ## Returnerar den årliga avskrivningssumman för en tillgång under en angiven period +TBILLEQ = SSVXEKV ## Returnerar avkastningen motsvarande en obligation för en statsskuldväxel +TBILLPRICE = SSVXPRIS ## Returnerar priset per 100 kr nominellt värde för en statsskuldväxel +TBILLYIELD = SSVXRÄNTA ## Returnerar avkastningen för en statsskuldväxel +VDB = VDEGRAVSKR ## Returnerar avskrivningen för en tillgång under en angiven period (med degressiv avskrivning) +XIRR = XIRR ## Returnerar internräntan för en serie betalningar som inte nödvändigtvis är periodiska +XNPV = XNUVÄRDE ## Returnerar det nuvarande nettovärdet för en serie betalningar som inte nödvändigtvis är periodiska +YIELD = NOMAVK ## Returnerar avkastningen för ett värdepapper som ger periodisk ränta +YIELDDISC = NOMAVKDISK ## Returnerar den årliga avkastningen för diskonterade värdepapper, exempelvis en statsskuldväxel +YIELDMAT = NOMAVKFÖRF ## Returnerar den årliga avkastningen för ett värdepapper som ger ränta på förfallodagen + + +## +## Information functions Informationsfunktioner +## +CELL = CELL ## Returnerar information om formatering, plats och innehåll i en cell +ERROR.TYPE = FEL.TYP ## Returnerar ett tal som motsvarar ett felvärde +INFO = INFO ## Returnerar information om operativsystemet +ISBLANK = ÄRREF ## Returnerar SANT om värdet är tomt +ISERR = Ä ## Returnerar SANT om värdet är ett felvärde annat än #SAKNAS! +ISERROR = ÄRFEL ## Returnerar SANT om värdet är ett felvärde +ISEVEN = ÄRJÄMN ## Returnerar SANT om talet är jämnt +ISLOGICAL = ÄREJTEXT ## Returnerar SANT om värdet är ett logiskt värde +ISNA = ÄRLOGISK ## Returnerar SANT om värdet är felvärdet #SAKNAS! +ISNONTEXT = ÄRSAKNAD ## Returnerar SANT om värdet inte är text +ISNUMBER = ÄRTAL ## Returnerar SANT om värdet är ett tal +ISODD = ÄRUDDA ## Returnerar SANT om talet är udda +ISREF = ÄRTOM ## Returnerar SANT om värdet är en referens +ISTEXT = ÄRTEXT ## Returnerar SANT om värdet är text +N = N ## Returnerar ett värde omvandlat till ett tal +NA = SAKNAS ## Returnerar felvärdet #SAKNAS! +TYPE = VÄRDETYP ## Returnerar ett tal som anger värdets datatyp + + +## +## Logical functions Logiska funktioner +## +AND = OCH ## Returnerar SANT om alla argument är sanna +FALSE = FALSKT ## Returnerar det logiska värdet FALSKT +IF = OM ## Anger vilket logiskt test som ska utföras +IFERROR = OMFEL ## Returnerar ett värde som du anger om en formel utvärderar till ett fel; annars returneras resultatet av formeln +NOT = ICKE ## Inverterar logiken för argumenten +OR = ELLER ## Returnerar SANT om något argument är SANT +TRUE = SANT ## Returnerar det logiska värdet SANT + + +## +## Lookup and reference functions Sök- och referensfunktioner +## +ADDRESS = ADRESS ## Returnerar en referens som text till en enstaka cell i ett kalkylblad +AREAS = OMRÅDEN ## Returnerar antalet områden i en referens +CHOOSE = VÄLJ ## Väljer ett värde i en lista över värden +COLUMN = KOLUMN ## Returnerar kolumnnumret för en referens +COLUMNS = KOLUMNER ## Returnerar antalet kolumner i en referens +HLOOKUP = LETAKOLUMN ## Söker i den översta raden i en matris och returnerar värdet för angiven cell +HYPERLINK = HYPERLÄNK ## Skapar en genväg eller ett hopp till ett dokument i nätverket, i ett intranät eller på Internet +INDEX = INDEX ## Använder ett index för ett välja ett värde i en referens eller matris +INDIRECT = INDIREKT ## Returnerar en referens som anges av ett textvärde +LOOKUP = LETAUPP ## Letar upp värden i en vektor eller matris +MATCH = PASSA ## Letar upp värden i en referens eller matris +OFFSET = FÖRSKJUTNING ## Returnerar en referens förskjuten i förhållande till en given referens +ROW = RAD ## Returnerar radnumret för en referens +ROWS = RADER ## Returnerar antalet rader i en referens +RTD = RTD ## Hämtar realtidsdata från ett program som stöder COM-automation (Automation: Ett sätt att arbeta med ett programs objekt från ett annat program eller utvecklingsverktyg. Detta kallades tidigare för OLE Automation, och är en branschstandard och ingår i Component Object Model (COM).) +TRANSPOSE = TRANSPONERA ## Transponerar en matris +VLOOKUP = LETARAD ## Letar i den första kolumnen i en matris och flyttar över raden för att returnera värdet för en cell + + +## +## Math and trigonometry functions Matematiska och trigonometriska funktioner +## +ABS = ABS ## Returnerar absolutvärdet av ett tal +ACOS = ARCCOS ## Returnerar arcus cosinus för ett tal +ACOSH = ARCCOSH ## Returnerar inverterad hyperbolisk cosinus för ett tal +ASIN = ARCSIN ## Returnerar arcus cosinus för ett tal +ASINH = ARCSINH ## Returnerar hyperbolisk arcus sinus för ett tal +ATAN = ARCTAN ## Returnerar arcus tangens för ett tal +ATAN2 = ARCTAN2 ## Returnerar arcus tangens för en x- och en y- koordinat +ATANH = ARCTANH ## Returnerar hyperbolisk arcus tangens för ett tal +CEILING = RUNDA.UPP ## Avrundar ett tal till närmaste heltal eller närmaste signifikanta multipel +COMBIN = KOMBIN ## Returnerar antalet kombinationer för ett givet antal objekt +COS = COS ## Returnerar cosinus för ett tal +COSH = COSH ## Returnerar hyperboliskt cosinus för ett tal +DEGREES = GRADER ## Omvandlar radianer till grader +EVEN = JÄMN ## Avrundar ett tal uppåt till närmaste heltal +EXP = EXP ## Returnerar e upphöjt till ett givet tal +FACT = FAKULTET ## Returnerar fakulteten för ett tal +FACTDOUBLE = DUBBELFAKULTET ## Returnerar dubbelfakulteten för ett tal +FLOOR = RUNDA.NED ## Avrundar ett tal nedåt mot noll +GCD = SGD ## Returnerar den största gemensamma nämnaren +INT = HELTAL ## Avrundar ett tal nedåt till närmaste heltal +LCM = MGM ## Returnerar den minsta gemensamma multipeln +LN = LN ## Returnerar den naturliga logaritmen för ett tal +LOG = LOG ## Returnerar logaritmen för ett tal för en given bas +LOG10 = LOG10 ## Returnerar 10-logaritmen för ett tal +MDETERM = MDETERM ## Returnerar matrisen som är avgörandet av en matris +MINVERSE = MINVERT ## Returnerar matrisinversen av en matris +MMULT = MMULT ## Returnerar matrisprodukten av två matriser +MOD = REST ## Returnerar resten vid en division +MROUND = MAVRUNDA ## Returnerar ett tal avrundat till en given multipel +MULTINOMIAL = MULTINOMIAL ## Returnerar multinomialen för en uppsättning tal +ODD = UDDA ## Avrundar ett tal uppåt till närmaste udda heltal +PI = PI ## Returnerar värdet pi +POWER = UPPHÖJT.TILL ## Returnerar resultatet av ett tal upphöjt till en exponent +PRODUCT = PRODUKT ## Multiplicerar argumenten +QUOTIENT = KVOT ## Returnerar heltalsdelen av en division +RADIANS = RADIANER ## Omvandlar grader till radianer +RAND = SLUMP ## Returnerar ett slumptal mellan 0 och 1 +RANDBETWEEN = SLUMP.MELLAN ## Returnerar ett slumptal mellan de tal som du anger +ROMAN = ROMERSK ## Omvandlar vanliga (arabiska) siffror till romerska som text +ROUND = AVRUNDA ## Avrundar ett tal till ett angivet antal siffror +ROUNDDOWN = AVRUNDA.NEDÅT ## Avrundar ett tal nedåt mot noll +ROUNDUP = AVRUNDA.UPPÅT ## Avrundar ett tal uppåt, från noll +SERIESSUM = SERIESUMMA ## Returnerar summan av en potensserie baserat på formeln +SIGN = TECKEN ## Returnerar tecknet för ett tal +SIN = SIN ## Returnerar sinus för en given vinkel +SINH = SINH ## Returnerar hyperbolisk sinus för ett tal +SQRT = ROT ## Returnerar den positiva kvadratroten +SQRTPI = ROTPI ## Returnerar kvadratroten för (tal * pi) +SUBTOTAL = DELSUMMA ## Returnerar en delsumma i en lista eller databas +SUM = SUMMA ## Summerar argumenten +SUMIF = SUMMA.OM ## Summerar celler enligt ett angivet villkor +SUMIFS = SUMMA.OMF ## Lägger till cellerna i ett område som uppfyller flera kriterier +SUMPRODUCT = PRODUKTSUMMA ## Returnerar summan av produkterna i motsvarande matriskomponenter +SUMSQ = KVADRATSUMMA ## Returnerar summan av argumentens kvadrater +SUMX2MY2 = SUMMAX2MY2 ## Returnerar summan av differensen mellan kvadraterna för motsvarande värden i två matriser +SUMX2PY2 = SUMMAX2PY2 ## Returnerar summan av summan av kvadraterna av motsvarande värden i två matriser +SUMXMY2 = SUMMAXMY2 ## Returnerar summan av kvadraten av skillnaden mellan motsvarande värden i två matriser +TAN = TAN ## Returnerar tangens för ett tal +TANH = TANH ## Returnerar hyperbolisk tangens för ett tal +TRUNC = AVKORTA ## Avkortar ett tal till ett heltal + + +## +## Statistical functions Statistiska funktioner +## +AVEDEV = MEDELAVV ## Returnerar medelvärdet för datapunkters absoluta avvikelse från deras medelvärde +AVERAGE = MEDEL ## Returnerar medelvärdet av argumenten +AVERAGEA = AVERAGEA ## Returnerar medelvärdet av argumenten, inklusive tal, text och logiska värden +AVERAGEIF = MEDELOM ## Returnerar medelvärdet (aritmetiskt medelvärde) för alla celler i ett område som uppfyller ett givet kriterium +AVERAGEIFS = MEDELOMF ## Returnerar medelvärdet (det aritmetiska medelvärdet) för alla celler som uppfyller flera villkor. +BETADIST = BETAFÖRD ## Returnerar den kumulativa betafördelningsfunktionen +BETAINV = BETAINV ## Returnerar inversen till den kumulativa fördelningsfunktionen för en viss betafördelning +BINOMDIST = BINOMFÖRD ## Returnerar den individuella binomialfördelningen +CHIDIST = CHI2FÖRD ## Returnerar den ensidiga sannolikheten av c2-fördelningen +CHIINV = CHI2INV ## Returnerar inversen av chi2-fördelningen +CHITEST = CHI2TEST ## Returnerar oberoendetesten +CONFIDENCE = KONFIDENS ## Returnerar konfidensintervallet för en populations medelvärde +CORREL = KORREL ## Returnerar korrelationskoefficienten mellan två datamängder +COUNT = ANTAL ## Räknar hur många tal som finns bland argumenten +COUNTA = ANTALV ## Räknar hur många värden som finns bland argumenten +COUNTBLANK = ANTAL.TOMMA ## Räknar antalet tomma celler i ett område +COUNTIF = ANTAL.OM ## Räknar antalet celler i ett område som uppfyller angivna villkor. +COUNTIFS = ANTAL.OMF ## Räknar antalet celler i ett område som uppfyller flera villkor. +COVAR = KOVAR ## Returnerar kovariansen, d.v.s. medelvärdet av produkterna för parade avvikelser +CRITBINOM = KRITBINOM ## Returnerar det minsta värdet för vilket den kumulativa binomialfördelningen är mindre än eller lika med ett villkorsvärde +DEVSQ = KVADAVV ## Returnerar summan av kvadrater på avvikelser +EXPONDIST = EXPONFÖRD ## Returnerar exponentialfördelningen +FDIST = FFÖRD ## Returnerar F-sannolikhetsfördelningen +FINV = FINV ## Returnerar inversen till F-sannolikhetsfördelningen +FISHER = FISHER ## Returnerar Fisher-transformationen +FISHERINV = FISHERINV ## Returnerar inversen till Fisher-transformationen +FORECAST = PREDIKTION ## Returnerar ett värde längs en linjär trendlinje +FREQUENCY = FREKVENS ## Returnerar en frekvensfördelning som en lodrät matris +FTEST = FTEST ## Returnerar resultatet av en F-test +GAMMADIST = GAMMAFÖRD ## Returnerar gammafördelningen +GAMMAINV = GAMMAINV ## Returnerar inversen till den kumulativa gammafördelningen +GAMMALN = GAMMALN ## Returnerar den naturliga logaritmen för gammafunktionen, G(x) +GEOMEAN = GEOMEDEL ## Returnerar det geometriska medelvärdet +GROWTH = EXPTREND ## Returnerar värden längs en exponentiell trend +HARMEAN = HARMMEDEL ## Returnerar det harmoniska medelvärdet +HYPGEOMDIST = HYPGEOMFÖRD ## Returnerar den hypergeometriska fördelningen +INTERCEPT = SKÄRNINGSPUNKT ## Returnerar skärningspunkten för en linjär regressionslinje +KURT = TOPPIGHET ## Returnerar toppigheten av en mängd data +LARGE = STÖRSTA ## Returnerar det n:te största värdet i en mängd data +LINEST = REGR ## Returnerar parametrar till en linjär trendlinje +LOGEST = EXPREGR ## Returnerar parametrarna i en exponentiell trend +LOGINV = LOGINV ## Returnerar inversen till den lognormala fördelningen +LOGNORMDIST = LOGNORMFÖRD ## Returnerar den kumulativa lognormala fördelningen +MAX = MAX ## Returnerar det största värdet i en lista av argument +MAXA = MAXA ## Returnerar det största värdet i en lista av argument, inklusive tal, text och logiska värden +MEDIAN = MEDIAN ## Returnerar medianen för angivna tal +MIN = MIN ## Returnerar det minsta värdet i en lista med argument +MINA = MINA ## Returnerar det minsta värdet i en lista över argument, inklusive tal, text och logiska värden +MODE = TYPVÄRDE ## Returnerar det vanligaste värdet i en datamängd +NEGBINOMDIST = NEGBINOMFÖRD ## Returnerar den negativa binomialfördelningen +NORMDIST = NORMFÖRD ## Returnerar den kumulativa normalfördelningen +NORMINV = NORMINV ## Returnerar inversen till den kumulativa normalfördelningen +NORMSDIST = NORMSFÖRD ## Returnerar den kumulativa standardnormalfördelningen +NORMSINV = NORMSINV ## Returnerar inversen till den kumulativa standardnormalfördelningen +PEARSON = PEARSON ## Returnerar korrelationskoefficienten till Pearsons momentprodukt +PERCENTILE = PERCENTIL ## Returnerar den n:te percentilen av värden i ett område +PERCENTRANK = PROCENTRANG ## Returnerar procentrangen för ett värde i en datamängd +PERMUT = PERMUT ## Returnerar antal permutationer för ett givet antal objekt +POISSON = POISSON ## Returnerar Poisson-fördelningen +PROB = SANNOLIKHET ## Returnerar sannolikheten att värden i ett område ligger mellan två gränser +QUARTILE = KVARTIL ## Returnerar kvartilen av en mängd data +RANK = RANG ## Returnerar rangordningen för ett tal i en lista med tal +RSQ = RKV ## Returnerar kvadraten av Pearsons produktmomentkorrelationskoefficient +SKEW = SNEDHET ## Returnerar snedheten för en fördelning +SLOPE = LUTNING ## Returnerar lutningen på en linjär regressionslinje +SMALL = MINSTA ## Returnerar det n:te minsta värdet i en mängd data +STANDARDIZE = STANDARDISERA ## Returnerar ett normaliserat värde +STDEV = STDAV ## Uppskattar standardavvikelsen baserat på ett urval +STDEVA = STDEVA ## Uppskattar standardavvikelsen baserat på ett urval, inklusive tal, text och logiska värden +STDEVP = STDAVP ## Beräknar standardavvikelsen baserat på hela populationen +STDEVPA = STDEVPA ## Beräknar standardavvikelsen baserat på hela populationen, inklusive tal, text och logiska värden +STEYX = STDFELYX ## Returnerar standardfelet för ett förutspått y-värde för varje x-värde i regressionen +TDIST = TFÖRD ## Returnerar Students t-fördelning +TINV = TINV ## Returnerar inversen till Students t-fördelning +TREND = TREND ## Returnerar värden längs en linjär trend +TRIMMEAN = TRIMMEDEL ## Returnerar medelvärdet av mittpunkterna i en datamängd +TTEST = TTEST ## Returnerar sannolikheten beräknad ur Students t-test +VAR = VARIANS ## Uppskattar variansen baserat på ett urval +VARA = VARA ## Uppskattar variansen baserat på ett urval, inklusive tal, text och logiska värden +VARP = VARIANSP ## Beräknar variansen baserat på hela populationen +VARPA = VARPA ## Beräknar variansen baserat på hela populationen, inklusive tal, text och logiska värden +WEIBULL = WEIBULL ## Returnerar Weibull-fördelningen +ZTEST = ZTEST ## Returnerar det ensidiga sannolikhetsvärdet av ett z-test + + +## +## Text functions Textfunktioner +## +ASC = ASC ## Ändrar helbredds (dubbel byte) engelska bokstäver eller katakana inom en teckensträng till tecken med halvt breddsteg (enkel byte) +BAHTTEXT = BAHTTEXT ## Omvandlar ett tal till text med valutaformatet ß (baht) +CHAR = TECKENKOD ## Returnerar tecknet som anges av kod +CLEAN = STÄDA ## Tar bort alla icke utskrivbara tecken i en text +CODE = KOD ## Returnerar en numerisk kod för det första tecknet i en textsträng +CONCATENATE = SAMMANFOGA ## Sammanfogar flera textdelar till en textsträng +DOLLAR = VALUTA ## Omvandlar ett tal till text med valutaformat +EXACT = EXAKT ## Kontrollerar om två textvärden är identiska +FIND = HITTA ## Hittar en text i en annan (skiljer på gemener och versaler) +FINDB = HITTAB ## Hittar en text i en annan (skiljer på gemener och versaler) +FIXED = FASTTAL ## Formaterar ett tal som text med ett fast antal decimaler +JIS = JIS ## Ändrar halvbredds (enkel byte) engelska bokstäver eller katakana inom en teckensträng till tecken med helt breddsteg (dubbel byte) +LEFT = VÄNSTER ## Returnerar tecken längst till vänster i en sträng +LEFTB = VÄNSTERB ## Returnerar tecken längst till vänster i en sträng +LEN = LÄNGD ## Returnerar antalet tecken i en textsträng +LENB = LÄNGDB ## Returnerar antalet tecken i en textsträng +LOWER = GEMENER ## Omvandlar text till gemener +MID = EXTEXT ## Returnerar angivet antal tecken från en text med början vid den position som du anger +MIDB = EXTEXTB ## Returnerar angivet antal tecken från en text med början vid den position som du anger +PHONETIC = PHONETIC ## Returnerar de fonetiska (furigana) tecknen i en textsträng +PROPER = INITIAL ## Ändrar första bokstaven i varje ord i ett textvärde till versal +REPLACE = ERSÄTT ## Ersätter tecken i text +REPLACEB = ERSÄTTB ## Ersätter tecken i text +REPT = REP ## Upprepar en text ett bestämt antal gånger +RIGHT = HÖGER ## Returnerar tecken längst till höger i en sträng +RIGHTB = HÖGERB ## Returnerar tecken längst till höger i en sträng +SEARCH = SÖK ## Hittar ett textvärde i ett annat (skiljer inte på gemener och versaler) +SEARCHB = SÖKB ## Hittar ett textvärde i ett annat (skiljer inte på gemener och versaler) +SUBSTITUTE = BYT.UT ## Ersätter gammal text med ny text i en textsträng +T = T ## Omvandlar argumenten till text +TEXT = TEXT ## Formaterar ett tal och omvandlar det till text +TRIM = RENSA ## Tar bort blanksteg från text +UPPER = VERSALER ## Omvandlar text till versaler +VALUE = TEXTNUM ## Omvandlar ett textargument till ett tal diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/tr/config b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/tr/config new file mode 100644 index 0000000..266e000 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/tr/config @@ -0,0 +1,24 @@ +## +## PhpSpreadsheet +## + +ArgumentSeparator = ; + + +## +## (For future use) +## +currencySymbol = YTL + + +## +## Excel Error Codes (For future use) + +## +NULL = #BOŞ! +DIV0 = #SAYI/0! +VALUE = #DEĞER! +REF = #BAŞV! +NAME = #AD? +NUM = #SAYI! +NA = #YOK diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/tr/functions b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/tr/functions new file mode 100644 index 0000000..f03563a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/locale/tr/functions @@ -0,0 +1,416 @@ +## +## PhpSpreadsheet +## +## Data in this file derived from https://www.excel-function-translation.com/ +## +## + + +## +## Add-in and Automation functions Eklenti ve Otomasyon fonksiyonları +## +GETPIVOTDATA = ÖZETVERİAL ## Bir Özet Tablo raporunda saklanan verileri verir. + + +## +## Cube functions Küp işlevleri +## +CUBEKPIMEMBER = KÜPKPIÜYE ## Kilit performans göstergesi (KPI-Key Performance Indicator) adını, özelliğini ve ölçüsünü verir ve hücredeki ad ve özelliği gösterir. KPI, bir kurumun performansını izlemek için kullanılan aylık brüt kâr ya da üç aylık çalışan giriş çıkışları gibi ölçülebilen bir birimdir. +CUBEMEMBER = KÜPÜYE ## Bir küp hiyerarşisinde bir üyeyi veya kaydı verir. Üye veya kaydın küpte varolduğunu doğrulamak için kullanılır. +CUBEMEMBERPROPERTY = KÜPÜYEÖZELLİĞİ ## Bir küpte bir üyenin özelliğinin değerini verir. Küp içinde üye adının varlığını doğrulamak ve bu üyenin belli özelliklerini getirmek için kullanılır. +CUBERANKEDMEMBER = KÜPÜYESIRASI ## Bir küme içindeki üyenin derecesini veya kaçıncı olduğunu verir. En iyi satış elemanı, veya en iyi on öğrenci gibi bir kümedeki bir veya daha fazla öğeyi getirmek için kullanılır. +CUBESET = KÜPKÜME ## Kümeyi oluşturan ve ardından bu kümeyi Microsoft Office Excel'e getiren sunucudaki küpe küme ifadelerini göndererek hesaplanan üye veya kayıt kümesini tanımlar. +CUBESETCOUNT = KÜPKÜMESAY ## Bir kümedeki öğelerin sayısını getirir. +CUBEVALUE = KÜPDEĞER ## Bir küpten toplam değeri getirir. + + +## +## Database functions Veritabanı işlevleri +## +DAVERAGE = VSEÇORT ## Seçili veritabanı girdilerinin ortalamasını verir. +DCOUNT = VSEÇSAY ## Veritabanında sayı içeren hücre sayısını hesaplar. +DCOUNTA = VSEÇSAYDOLU ## Veritabanındaki boş olmayan hücreleri sayar. +DGET = VAL ## Veritabanından, belirtilen ölçütlerle eşleşen tek bir rapor çıkarır. +DMAX = VSEÇMAK ## Seçili veritabanı girişlerinin en yüksek değerini verir. +DMIN = VSEÇMİN ## Seçili veritabanı girişlerinin en düşük değerini verir. +DPRODUCT = VSEÇÇARP ## Kayıtların belli bir alanında bulunan, bir veritabanındaki ölçütlerle eşleşen değerleri çarpar. +DSTDEV = VSEÇSTDSAPMA ## Seçili veritabanı girişlerinden oluşan bir örneğe dayanarak, standart sapmayı tahmin eder. +DSTDEVP = VSEÇSTDSAPMAS ## Standart sapmayı, seçili veritabanı girişlerinin tüm popülasyonunu esas alarak hesaplar. +DSUM = VSEÇTOPLA ## Kayıtların alan sütununda bulunan, ölçütle eşleşen sayıları toplar. +DVAR = VSEÇVAR ## Seçili veritabanı girişlerinden oluşan bir örneği esas alarak farkı tahmin eder. +DVARP = VSEÇVARS ## Seçili veritabanı girişlerinin tüm popülasyonunu esas alarak farkı hesaplar. + + +## +## Date and time functions Tarih ve saat işlevleri +## +DATE = TARİH ## Belirli bir tarihin seri numarasını verir. +DATEVALUE = TARİHSAYISI ## Metin biçimindeki bir tarihi seri numarasına dönüştürür. +DAY = GÜN ## Seri numarasını, ayın bir gününe dönüştürür. +DAYS360 = GÜN360 ## İki tarih arasındaki gün sayısını, 360 günlük yılı esas alarak hesaplar. +EDATE = SERİTARİH ## Başlangıç tarihinden itibaren, belirtilen ay sayısından önce veya sonraki tarihin seri numarasını verir. +EOMONTH = SERİAY ## Belirtilen sayıda ay önce veya sonraki ayın son gününün seri numarasını verir. +HOUR = SAAT ## Bir seri numarasını saate dönüştürür. +MINUTE = DAKİKA ## Bir seri numarasını dakikaya dönüştürür. +MONTH = AY ## Bir seri numarasını aya dönüştürür. +NETWORKDAYS = TAMİŞGÜNÜ ## İki tarih arasındaki tam çalışma günlerinin sayısını verir. +NOW = ŞİMDİ ## Geçerli tarihin ve saatin seri numarasını verir. +SECOND = SANİYE ## Bir seri numarasını saniyeye dönüştürür. +TIME = ZAMAN ## Belirli bir zamanın seri numarasını verir. +TIMEVALUE = ZAMANSAYISI ## Metin biçimindeki zamanı seri numarasına dönüştürür. +TODAY = BUGÜN ## Bugünün tarihini seri numarasına dönüştürür. +WEEKDAY = HAFTANINGÜNÜ ## Bir seri numarasını, haftanın gününe dönüştürür. +WEEKNUM = HAFTASAY ## Dizisel değerini, haftanın yıl içinde bulunduğu konumu sayısal olarak gösteren sayıya dönüştürür. +WORKDAY = İŞGÜNÜ ## Belirtilen sayıda çalışma günü öncesinin ya da sonrasının tarihinin seri numarasını verir. +YEAR = YIL ## Bir seri numarasını yıla dönüştürür. +YEARFRAC = YILORAN ## Başlangıç_tarihi ve bitiş_tarihi arasındaki tam günleri gösteren yıl kesrini verir. + + +## +## Engineering functions Mühendislik işlevleri +## +BESSELI = BESSELI ## Değiştirilmiş Bessel fonksiyonu In(x)'i verir. +BESSELJ = BESSELJ ## Bessel fonksiyonu Jn(x)'i verir. +BESSELK = BESSELK ## Değiştirilmiş Bessel fonksiyonu Kn(x)'i verir. +BESSELY = BESSELY ## Bessel fonksiyonu Yn(x)'i verir. +BIN2DEC = BIN2DEC ## İkili bir sayıyı, ondalık sayıya dönüştürür. +BIN2HEX = BIN2HEX ## İkili bir sayıyı, onaltılıya dönüştürür. +BIN2OCT = BIN2OCT ## İkili bir sayıyı, sekizliye dönüştürür. +COMPLEX = KARMAŞIK ## Gerçek ve sanal katsayıları, karmaşık sayıya dönüştürür. +CONVERT = ÇEVİR ## Bir sayıyı, bir ölçüm sisteminden bir başka ölçüm sistemine dönüştürür. +DEC2BIN = DEC2BIN ## Ondalık bir sayıyı, ikiliye dönüştürür. +DEC2HEX = DEC2HEX ## Ondalık bir sayıyı, onaltılıya dönüştürür. +DEC2OCT = DEC2OCT ## Ondalık bir sayıyı sekizliğe dönüştürür. +DELTA = DELTA ## İki değerin eşit olup olmadığını sınar. +ERF = HATAİŞLEV ## Hata işlevini verir. +ERFC = TÜMHATAİŞLEV ## Tümleyici hata işlevini verir. +GESTEP = BESINIR ## Bir sayının eşik değerinden büyük olup olmadığını sınar. +HEX2BIN = HEX2BIN ## Onaltılı bir sayıyı ikiliye dönüştürür. +HEX2DEC = HEX2DEC ## Onaltılı bir sayıyı ondalığa dönüştürür. +HEX2OCT = HEX2OCT ## Onaltılı bir sayıyı sekizliğe dönüştürür. +IMABS = SANMUTLAK ## Karmaşık bir sayının mutlak değerini (modül) verir. +IMAGINARY = SANAL ## Karmaşık bir sayının sanal katsayısını verir. +IMARGUMENT = SANBAĞ_DEĞİŞKEN ## Radyanlarla belirtilen bir açı olan teta bağımsız değişkenini verir. +IMCONJUGATE = SANEŞLENEK ## Karmaşık bir sayının karmaşık eşleniğini verir. +IMCOS = SANCOS ## Karmaşık bir sayının kosinüsünü verir. +IMDIV = SANBÖL ## İki karmaşık sayının bölümünü verir. +IMEXP = SANÜS ## Karmaşık bir sayının üssünü verir. +IMLN = SANLN ## Karmaşık bir sayının doğal logaritmasını verir. +IMLOG10 = SANLOG10 ## Karmaşık bir sayının, 10 tabanında logaritmasını verir. +IMLOG2 = SANLOG2 ## Karmaşık bir sayının 2 tabanında logaritmasını verir. +IMPOWER = SANÜSSÜ ## Karmaşık bir sayıyı, bir tamsayı üssüne yükseltilmiş olarak verir. +IMPRODUCT = SANÇARP ## Karmaşık sayıların çarpımını verir. +IMREAL = SANGERÇEK ## Karmaşık bir sayının, gerçek katsayısını verir. +IMSIN = SANSIN ## Karmaşık bir sayının sinüsünü verir. +IMSQRT = SANKAREKÖK ## Karmaşık bir sayının karekökünü verir. +IMSUB = SANÇIKAR ## İki karmaşık sayının farkını verir. +IMSUM = SANTOPLA ## Karmaşık sayıların toplamını verir. +OCT2BIN = OCT2BIN ## Sekizli bir sayıyı ikiliye dönüştürür. +OCT2DEC = OCT2DEC ## Sekizli bir sayıyı ondalığa dönüştürür. +OCT2HEX = OCT2HEX ## Sekizli bir sayıyı onaltılıya dönüştürür. + + +## +## Financial functions Finansal fonksiyonlar +## +ACCRINT = GERÇEKFAİZ ## Dönemsel faiz ödeyen hisse senedine ilişkin tahakkuk eden faizi getirir. +ACCRINTM = GERÇEKFAİZV ## Vadesinde ödeme yapan bir tahvilin tahakkuk etmiş faizini verir. +AMORDEGRC = AMORDEGRC ## Yıpranma katsayısı kullanarak her hesap döneminin değer kaybını verir. +AMORLINC = AMORLINC ## Her hesap dönemi içindeki yıpranmayı verir. +COUPDAYBS = KUPONGÜNBD ## Kupon süresinin başlangıcından alış tarihine kadar olan süredeki gün sayısını verir. +COUPDAYS = KUPONGÜN ## Kupon süresindeki, gün sayısını, alış tarihini de içermek üzere, verir. +COUPDAYSNC = KUPONGÜNDSK ## Alış tarihinden bir sonraki kupon tarihine kadar olan gün sayısını verir. +COUPNCD = KUPONGÜNSKT ## Alış tarihinden bir sonraki kupon tarihini verir. +COUPNUM = KUPONSAYI ## Alış tarihiyle vade tarihi arasında ödenecek kuponların sayısını verir. +COUPPCD = KUPONGÜNÖKT ## Alış tarihinden bir önceki kupon tarihini verir. +CUMIPMT = AİÇVERİMORANI ## İki dönem arasında ödenen kümülatif faizi verir. +CUMPRINC = ANA_PARA_ÖDEMESİ ## İki dönem arasında bir borç üzerine ödenen birikimli temeli verir. +DB = AZALANBAKİYE ## Bir malın belirtilen bir süre içindeki yıpranmasını, sabit azalan bakiye yöntemini kullanarak verir. +DDB = ÇİFTAZALANBAKİYE ## Bir malın belirtilen bir süre içindeki yıpranmasını, çift azalan bakiye yöntemi ya da sizin belirttiğiniz başka bir yöntemi kullanarak verir. +DISC = İNDİRİM ## Bir tahvilin indirim oranını verir. +DOLLARDE = LİRAON ## Kesir olarak tanımlanmış lira fiyatını, ondalık sayı olarak tanımlanmış lira fiyatına dönüştürür. +DOLLARFR = LİRAKES ## Ondalık sayı olarak tanımlanmış lira fiyatını, kesir olarak tanımlanmış lira fiyatına dönüştürür. +DURATION = SÜRE ## Belli aralıklarla faiz ödemesi yapan bir tahvilin yıllık süresini verir. +EFFECT = ETKİN ## Efektif yıllık faiz oranını verir. +FV = ANBD ## Bir yatırımın gelecekteki değerini verir. +FVSCHEDULE = GDPROGRAM ## Bir seri birleşik faiz oranı uyguladıktan sonra, bir başlangıçtaki anaparanın gelecekteki değerini verir. +INTRATE = FAİZORANI ## Tam olarak yatırım yapılmış bir tahvilin faiz oranını verir. +IPMT = FAİZTUTARI ## Bir yatırımın verilen bir süre için faiz ödemesini verir. +IRR = İÇ_VERİM_ORANI ## Bir para akışı serisi için, iç verim oranını verir. +ISPMT = ISPMT ## Yatırımın belirli bir dönemi boyunca ödenen faizi hesaplar. +MDURATION = MSÜRE ## Varsayılan par değeri 10.000.000 lira olan bir tahvil için Macauley değiştirilmiş süreyi verir. +MIRR = D_İÇ_VERİM_ORANI ## Pozitif ve negatif para akışlarının farklı oranlarda finanse edildiği durumlarda, iç verim oranını verir. +NOMINAL = NOMİNAL ## Yıllık nominal faiz oranını verir. +NPER = DÖNEM_SAYISI ## Bir yatırımın dönem sayısını verir. +NPV = NBD ## Bir yatırımın bugünkü net değerini, bir dönemsel para akışları serisine ve bir indirim oranına bağlı olarak verir. +ODDFPRICE = TEKYDEĞER ## Tek bir ilk dönemi olan bir tahvilin değerini, her 100.000.000 lirada bir verir. +ODDFYIELD = TEKYÖDEME ## Tek bir ilk dönemi olan bir tahvilin ödemesini verir. +ODDLPRICE = TEKSDEĞER ## Tek bir son dönemi olan bir tahvilin fiyatını her 10.000.000 lirada bir verir. +ODDLYIELD = TEKSÖDEME ## Tek bir son dönemi olan bir tahvilin ödemesini verir. +PMT = DEVRESEL_ÖDEME ## Bir yıllık dönemsel ödemeyi verir. +PPMT = ANA_PARA_ÖDEMESİ ## Verilen bir süre için, bir yatırımın anaparasına dayanan ödemeyi verir. +PRICE = DEĞER ## Dönemsel faiz ödeyen bir tahvilin fiyatını 10.000.00 liralık değer başına verir. +PRICEDISC = DEĞERİND ## İndirimli bir tahvilin fiyatını 10.000.000 liralık nominal değer başına verir. +PRICEMAT = DEĞERVADE ## Faizini vade sonunda ödeyen bir tahvilin fiyatını 10.000.000 nominal değer başına verir. +PV = BD ## Bir yatırımın bugünkü değerini verir. +RATE = FAİZ_ORANI ## Bir yıllık dönem başına düşen faiz oranını verir. +RECEIVED = GETİRİ ## Tam olarak yatırılmış bir tahvilin vadesinin bitiminde alınan miktarı verir. +SLN = DA ## Bir malın bir dönem içindeki doğrusal yıpranmasını verir. +SYD = YAT ## Bir malın belirli bir dönem için olan amortismanını verir. +TBILLEQ = HTAHEŞ ## Bir Hazine bonosunun bono eşdeğeri ödemesini verir. +TBILLPRICE = HTAHDEĞER ## Bir Hazine bonosunun değerini, 10.000.000 liralık nominal değer başına verir. +TBILLYIELD = HTAHÖDEME ## Bir Hazine bonosunun ödemesini verir. +VDB = DAB ## Bir malın amortismanını, belirlenmiş ya da kısmi bir dönem için, bir azalan bakiye yöntemi kullanarak verir. +XIRR = AİÇVERİMORANI ## Dönemsel olması gerekmeyen bir para akışları programı için, iç verim oranını verir. +XNPV = ANBD ## Dönemsel olması gerekmeyen bir para akışları programı için, bugünkü net değeri verir. +YIELD = ÖDEME ## Belirli aralıklarla faiz ödeyen bir tahvilin ödemesini verir. +YIELDDISC = ÖDEMEİND ## İndirimli bir tahvilin yıllık ödemesini verir; örneğin, bir Hazine bonosunun. +YIELDMAT = ÖDEMEVADE ## Vadesinin bitiminde faiz ödeyen bir tahvilin yıllık ödemesini verir. + + +## +## Information functions Bilgi fonksiyonları +## +CELL = HÜCRE ## Bir hücrenin biçimlendirmesi, konumu ya da içeriği hakkında bilgi verir. +ERROR.TYPE = HATA.TİPİ ## Bir hata türüne ilişkin sayıları verir. +INFO = BİLGİ ## Geçerli işletim ortamı hakkında bilgi verir. +ISBLANK = EBOŞSA ## Değer boşsa, DOĞRU verir. +ISERR = EHATA ## Değer, #YOK dışındaki bir hata değeriyse, DOĞRU verir. +ISERROR = EHATALIYSA ## Değer, herhangi bir hata değeriyse, DOĞRU verir. +ISEVEN = ÇİFTTİR ## Sayı çiftse, DOĞRU verir. +ISLOGICAL = EMANTIKSALSA ## Değer, mantıksal bir değerse, DOĞRU verir. +ISNA = EYOKSA ## Değer, #YOK hata değeriyse, DOĞRU verir. +ISNONTEXT = EMETİNDEĞİLSE ## Değer, metin değilse, DOĞRU verir. +ISNUMBER = ESAYIYSA ## Değer, bir sayıysa, DOĞRU verir. +ISODD = TEKTİR ## Sayı tekse, DOĞRU verir. +ISREF = EREFSE ## Değer bir başvuruysa, DOĞRU verir. +ISTEXT = EMETİNSE ## Değer bir metinse DOĞRU verir. +N = N ## Sayıya dönüştürülmüş bir değer verir. +NA = YOKSAY ## #YOK hata değerini verir. +TYPE = TİP ## Bir değerin veri türünü belirten bir sayı verir. + + +## +## Logical functions Mantıksal fonksiyonlar +## +AND = VE ## Bütün bağımsız değişkenleri DOĞRU ise, DOĞRU verir. +FALSE = YANLIŞ ## YANLIŞ mantıksal değerini verir. +IF = EĞER ## Gerçekleştirilecek bir mantıksal sınama belirtir. +IFERROR = EĞERHATA ## Formül hatalıysa belirttiğiniz değeri verir; bunun dışındaki durumlarda formülün sonucunu verir. +NOT = DEĞİL ## Bağımsız değişkeninin mantığını tersine çevirir. +OR = YADA ## Bağımsız değişkenlerden herhangi birisi DOĞRU ise, DOĞRU verir. +TRUE = DOĞRU ## DOĞRU mantıksal değerini verir. + + +## +## Lookup and reference functions Arama ve Başvuru fonksiyonları +## +ADDRESS = ADRES ## Bir başvuruyu, çalışma sayfasındaki tek bir hücreye metin olarak verir. +AREAS = ALANSAY ## Renvoie le nombre de zones dans une référence. +CHOOSE = ELEMAN ## Değerler listesinden bir değer seçer. +COLUMN = SÜTUN ## Bir başvurunun sütun sayısını verir. +COLUMNS = SÜTUNSAY ## Bir başvurudaki sütunların sayısını verir. +HLOOKUP = YATAYARA ## Bir dizinin en üst satırına bakar ve belirtilen hücrenin değerini verir. +HYPERLINK = KÖPRÜ ## Bir ağ sunucusunda, bir intranette ya da Internet'te depolanan bir belgeyi açan bir kısayol ya da atlama oluşturur. +INDEX = İNDİS ## Başvurudan veya diziden bir değer seçmek için, bir dizin kullanır. +INDIRECT = DOLAYLI ## Metin değeriyle belirtilen bir başvuru verir. +LOOKUP = ARA ## Bir vektördeki veya dizideki değerleri arar. +MATCH = KAÇINCI ## Bir başvurudaki veya dizideki değerleri arar. +OFFSET = KAYDIR ## Verilen bir başvurudan, bir başvuru kaydırmayı verir. +ROW = SATIR ## Bir başvurunun satır sayısını verir. +ROWS = SATIRSAY ## Bir başvurudaki satırların sayısını verir. +RTD = RTD ## COM otomasyonunu destekleyen programdan gerçek zaman verileri alır. +TRANSPOSE = DEVRİK_DÖNÜŞÜM ## Bir dizinin devrik dönüşümünü verir. +VLOOKUP = DÜŞEYARA ## Bir dizinin ilk sütununa bakar ve bir hücrenin değerini vermek için satır boyunca hareket eder. + + +## +## Math and trigonometry functions Matematik ve trigonometri fonksiyonları +## +ABS = MUTLAK ## Bir sayının mutlak değerini verir. +ACOS = ACOS ## Bir sayının ark kosinüsünü verir. +ACOSH = ACOSH ## Bir sayının ters hiperbolik kosinüsünü verir. +ASIN = ASİN ## Bir sayının ark sinüsünü verir. +ASINH = ASİNH ## Bir sayının ters hiperbolik sinüsünü verir. +ATAN = ATAN ## Bir sayının ark tanjantını verir. +ATAN2 = ATAN2 ## Ark tanjantı, x- ve y- koordinatlarından verir. +ATANH = ATANH ## Bir sayının ters hiperbolik tanjantını verir. +CEILING = TAVANAYUVARLA ## Bir sayıyı, en yakın tamsayıya ya da en yakın katına yuvarlar. +COMBIN = KOMBİNASYON ## Verilen sayıda öğenin kombinasyon sayısını verir. +COS = COS ## Bir sayının kosinüsünü verir. +COSH = COSH ## Bir sayının hiperbolik kosinüsünü verir. +DEGREES = DERECE ## Radyanları dereceye dönüştürür. +EVEN = ÇİFT ## Bir sayıyı, en yakın daha büyük çift tamsayıya yuvarlar. +EXP = ÜS ## e'yi, verilen bir sayının üssüne yükseltilmiş olarak verir. +FACT = ÇARPINIM ## Bir sayının faktörünü verir. +FACTDOUBLE = ÇİFTFAKTÖR ## Bir sayının çift çarpınımını verir. +FLOOR = TABANAYUVARLA ## Bir sayıyı, daha küçük sayıya, sıfıra yakınsayarak yuvarlar. +GCD = OBEB ## En büyük ortak böleni verir. +INT = TAMSAYI ## Bir sayıyı aşağıya doğru en yakın tamsayıya yuvarlar. +LCM = OKEK ## En küçük ortak katı verir. +LN = LN ## Bir sayının doğal logaritmasını verir. +LOG = LOG ## Bir sayının, belirtilen bir tabandaki logaritmasını verir. +LOG10 = LOG10 ## Bir sayının 10 tabanında logaritmasını verir. +MDETERM = DETERMİNANT ## Bir dizinin dizey determinantını verir. +MINVERSE = DİZEY_TERS ## Bir dizinin dizey tersini verir. +MMULT = DÇARP ## İki dizinin dizey çarpımını verir. +MOD = MODÜLO ## Bölmeden kalanı verir. +MROUND = KYUVARLA ## İstenen kata yuvarlanmış bir sayı verir. +MULTINOMIAL = ÇOKTERİMLİ ## Bir sayılar kümesinin çok terimlisini verir. +ODD = TEK ## Bir sayıyı en yakın daha büyük tek sayıya yuvarlar. +PI = Pİ ## Pi değerini verir. +POWER = KUVVET ## Bir üsse yükseltilmiş sayının sonucunu verir. +PRODUCT = ÇARPIM ## Bağımsız değişkenlerini çarpar. +QUOTIENT = BÖLÜM ## Bir bölme işleminin tamsayı kısmını verir. +RADIANS = RADYAN ## Dereceleri radyanlara dönüştürür. +RAND = S_SAYI_ÜRET ## 0 ile 1 arasında rastgele bir sayı verir. +RANDBETWEEN = RASTGELEARALIK ## Belirttiğiniz sayılar arasında rastgele bir sayı verir. +ROMAN = ROMEN ## Bir normal rakamı, metin olarak, romen rakamına çevirir. +ROUND = YUVARLA ## Bir sayıyı, belirtilen basamak sayısına yuvarlar. +ROUNDDOWN = AŞAĞIYUVARLA ## Bir sayıyı, daha küçük sayıya, sıfıra yakınsayarak yuvarlar. +ROUNDUP = YUKARIYUVARLA ## Bir sayıyı daha büyük sayıya, sıfırdan ıraksayarak yuvarlar. +SERIESSUM = SERİTOPLA ## Bir üs serisinin toplamını, formüle bağlı olarak verir. +SIGN = İŞARET ## Bir sayının işaretini verir. +SIN = SİN ## Verilen bir açının sinüsünü verir. +SINH = SİNH ## Bir sayının hiperbolik sinüsünü verir. +SQRT = KAREKÖK ## Pozitif bir karekök verir. +SQRTPI = KAREKÖKPİ ## (* Pi sayısının) kare kökünü verir. +SUBTOTAL = ALTTOPLAM ## Bir listedeki ya da veritabanındaki bir alt toplamı verir. +SUM = TOPLA ## Bağımsız değişkenlerini toplar. +SUMIF = ETOPLA ## Verilen ölçütle belirlenen hücreleri toplar. +SUMIFS = SUMIFS ## Bir aralıktaki, birden fazla ölçüte uyan hücreleri ekler. +SUMPRODUCT = TOPLA.ÇARPIM ## İlişkili dizi bileşenlerinin çarpımlarının toplamını verir. +SUMSQ = TOPKARE ## Bağımsız değişkenlerin karelerinin toplamını verir. +SUMX2MY2 = TOPX2EY2 ## İki dizideki ilişkili değerlerin farkının toplamını verir. +SUMX2PY2 = TOPX2AY2 ## İki dizideki ilişkili değerlerin karelerinin toplamının toplamını verir. +SUMXMY2 = TOPXEY2 ## İki dizideki ilişkili değerlerin farklarının karelerinin toplamını verir. +TAN = TAN ## Bir sayının tanjantını verir. +TANH = TANH ## Bir sayının hiperbolik tanjantını verir. +TRUNC = NSAT ## Bir sayının, tamsayı durumuna gelecek şekilde, fazlalıklarını atar. + + +## +## Statistical functions İstatistiksel fonksiyonlar +## +AVEDEV = ORTSAP ## Veri noktalarının ortalamalarından mutlak sapmalarının ortalamasını verir. +AVERAGE = ORTALAMA ## Bağımsız değişkenlerinin ortalamasını verir. +AVERAGEA = ORTALAMAA ## Bağımsız değişkenlerinin, sayılar, metin ve mantıksal değerleri içermek üzere ortalamasını verir. +AVERAGEIF = EĞERORTALAMA ## Verili ölçütü karşılayan bir aralıktaki bütün hücrelerin ortalamasını (aritmetik ortalama) hesaplar. +AVERAGEIFS = EĞERLERORTALAMA ## Birden çok ölçüte uyan tüm hücrelerin ortalamasını (aritmetik ortalama) hesaplar. +BETADIST = BETADAĞ ## Beta birikimli dağılım fonksiyonunu verir. +BETAINV = BETATERS ## Belirli bir beta dağılımı için birikimli dağılım fonksiyonunun tersini verir. +BINOMDIST = BİNOMDAĞ ## Tek terimli binom dağılımı olasılığını verir. +CHIDIST = KİKAREDAĞ ## Kikare dağılımın tek kuyruklu olasılığını verir. +CHIINV = KİKARETERS ## Kikare dağılımın kuyruklu olasılığının tersini verir. +CHITEST = KİKARETEST ## Bağımsızlık sınamalarını verir. +CONFIDENCE = GÜVENİRLİK ## Bir popülasyon ortalaması için güvenirlik aralığını verir. +CORREL = KORELASYON ## İki veri kümesi arasındaki bağlantı katsayısını verir. +COUNT = BAĞ_DEĞ_SAY ## Bağımsız değişkenler listesinde kaç tane sayı bulunduğunu sayar. +COUNTA = BAĞ_DEĞ_DOLU_SAY ## Bağımsız değişkenler listesinde kaç tane değer bulunduğunu sayar. +COUNTBLANK = BOŞLUKSAY ## Aralıktaki boş hücre sayısını hesaplar. +COUNTIF = EĞERSAY ## Verilen ölçütlere uyan bir aralık içindeki hücreleri sayar. +COUNTIFS = ÇOKEĞERSAY ## Birden çok ölçüte uyan bir aralık içindeki hücreleri sayar. +COVAR = KOVARYANS ## Eşleştirilmiş sapmaların ortalaması olan kovaryansı verir. +CRITBINOM = KRİTİKBİNOM ## Birikimli binom dağılımının bir ölçüt değerinden küçük veya ölçüt değerine eşit olduğu en küçük değeri verir. +DEVSQ = SAPKARE ## Sapmaların karelerinin toplamını verir. +EXPONDIST = ÜSTELDAĞ ## Üstel dağılımı verir. +FDIST = FDAĞ ## F olasılık dağılımını verir. +FINV = FTERS ## F olasılık dağılımının tersini verir. +FISHER = FISHER ## Fisher dönüşümünü verir. +FISHERINV = FISHERTERS ## Fisher dönüşümünün tersini verir. +FORECAST = TAHMİN ## Bir doğrusal eğilim boyunca bir değer verir. +FREQUENCY = SIKLIK ## Bir sıklık dağılımını, dikey bir dizi olarak verir. +FTEST = FTEST ## Bir F-test'in sonucunu verir. +GAMMADIST = GAMADAĞ ## Gama dağılımını verir. +GAMMAINV = GAMATERS ## Gama kümülatif dağılımının tersini verir. +GAMMALN = GAMALN ## Gama fonksiyonunun (?(x)) doğal logaritmasını verir. +GEOMEAN = GEOORT ## Geometrik ortayı verir. +GROWTH = BÜYÜME ## Üstel bir eğilim boyunca değerler verir. +HARMEAN = HARORT ## Harmonik ortayı verir. +HYPGEOMDIST = HİPERGEOMDAĞ ## Hipergeometrik dağılımı verir. +INTERCEPT = KESMENOKTASI ## Doğrusal çakıştırma çizgisinin kesişme noktasını verir. +KURT = BASIKLIK ## Bir veri kümesinin basıklığını verir. +LARGE = BÜYÜK ## Bir veri kümesinde k. en büyük değeri verir. +LINEST = DOT ## Doğrusal bir eğilimin parametrelerini verir. +LOGEST = LOT ## Üstel bir eğilimin parametrelerini verir. +LOGINV = LOGTERS ## Bir lognormal dağılımının tersini verir. +LOGNORMDIST = LOGNORMDAĞ ## Birikimli lognormal dağılımını verir. +MAX = MAK ## Bir bağımsız değişkenler listesindeki en büyük değeri verir. +MAXA = MAKA ## Bir bağımsız değişkenler listesindeki, sayılar, metin ve mantıksal değerleri içermek üzere, en büyük değeri verir. +MEDIAN = ORTANCA ## Belirtilen sayıların orta değerini verir. +MIN = MİN ## Bir bağımsız değişkenler listesindeki en küçük değeri verir. +MINA = MİNA ## Bir bağımsız değişkenler listesindeki, sayılar, metin ve mantıksal değerleri de içermek üzere, en küçük değeri verir. +MODE = ENÇOK_OLAN ## Bir veri kümesindeki en sık rastlanan değeri verir. +NEGBINOMDIST = NEGBİNOMDAĞ ## Negatif binom dağılımını verir. +NORMDIST = NORMDAĞ ## Normal birikimli dağılımı verir. +NORMINV = NORMTERS ## Normal kümülatif dağılımın tersini verir. +NORMSDIST = NORMSDAĞ ## Standart normal birikimli dağılımı verir. +NORMSINV = NORMSTERS ## Standart normal birikimli dağılımın tersini verir. +PEARSON = PEARSON ## Pearson çarpım moment korelasyon katsayısını verir. +PERCENTILE = YÜZDEBİRLİK ## Bir aralık içerisinde bulunan değerlerin k. frekans toplamını verir. +PERCENTRANK = YÜZDERANK ## Bir veri kümesindeki bir değerin yüzde mertebesini verir. +PERMUT = PERMÜTASYON ## Verilen sayıda nesne için permütasyon sayısını verir. +POISSON = POISSON ## Poisson dağılımını verir. +PROB = OLASILIK ## Bir aralıktaki değerlerin iki sınır arasında olması olasılığını verir. +QUARTILE = DÖRTTEBİRLİK ## Bir veri kümesinin dörtte birliğini verir. +RANK = RANK ## Bir sayılar listesinde bir sayının mertebesini verir. +RSQ = RKARE ## Pearson çarpım moment korelasyon katsayısının karesini verir. +SKEW = ÇARPIKLIK ## Bir dağılımın çarpıklığını verir. +SLOPE = EĞİM ## Doğrusal çakışma çizgisinin eğimini verir. +SMALL = KÜÇÜK ## Bir veri kümesinde k. en küçük değeri verir. +STANDARDIZE = STANDARTLAŞTIRMA ## Normalleştirilmiş bir değer verir. +STDEV = STDSAPMA ## Bir örneğe dayanarak standart sapmayı tahmin eder. +STDEVA = STDSAPMAA ## Standart sapmayı, sayılar, metin ve mantıksal değerleri içermek üzere, bir örneğe bağlı olarak tahmin eder. +STDEVP = STDSAPMAS ## Standart sapmayı, tüm popülasyona bağlı olarak hesaplar. +STDEVPA = STDSAPMASA ## Standart sapmayı, sayılar, metin ve mantıksal değerleri içermek üzere, tüm popülasyona bağlı olarak hesaplar. +STEYX = STHYX ## Regresyondaki her x için tahmini y değerinin standart hatasını verir. +TDIST = TDAĞ ## T-dağılımını verir. +TINV = TTERS ## T-dağılımının tersini verir. +TREND = EĞİLİM ## Doğrusal bir eğilim boyunca değerler verir. +TRIMMEAN = KIRPORTALAMA ## Bir veri kümesinin içinin ortalamasını verir. +TTEST = TTEST ## T-test'le ilişkilendirilmiş olasılığı verir. +VAR = VAR ## Varyansı, bir örneğe bağlı olarak tahmin eder. +VARA = VARA ## Varyansı, sayılar, metin ve mantıksal değerleri içermek üzere, bir örneğe bağlı olarak tahmin eder. +VARP = VARS ## Varyansı, tüm popülasyona dayanarak hesaplar. +VARPA = VARSA ## Varyansı, sayılar, metin ve mantıksal değerleri içermek üzere, tüm popülasyona bağlı olarak hesaplar. +WEIBULL = WEIBULL ## Weibull dağılımını hesaplar. +ZTEST = ZTEST ## Z-testinin tek kuyruklu olasılık değerini hesaplar. + + +## +## Text functions Metin fonksiyonları +## +ASC = ASC ## Bir karakter dizesindeki çift enli (iki bayt) İngilizce harfleri veya katakanayı yarım enli (tek bayt) karakterlerle değiştirir. +BAHTTEXT = BAHTTEXT ## Sayıyı, ß (baht) para birimi biçimini kullanarak metne dönüştürür. +CHAR = DAMGA ## Kod sayısıyla belirtilen karakteri verir. +CLEAN = TEMİZ ## Metindeki bütün yazdırılamaz karakterleri kaldırır. +CODE = KOD ## Bir metin dizesindeki ilk karakter için sayısal bir kod verir. +CONCATENATE = BİRLEŞTİR ## Pek çok metin öğesini bir metin öğesi olarak birleştirir. +DOLLAR = LİRA ## Bir sayıyı YTL (yeni Türk lirası) para birimi biçimini kullanarak metne dönüştürür. +EXACT = ÖZDEŞ ## İki metin değerinin özdeş olup olmadığını anlamak için, değerleri denetler. +FIND = BUL ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlıdır). +FINDB = BULB ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlıdır). +FIXED = SAYIDÜZENLE ## Bir sayıyı, sabit sayıda ondalıkla, metin olarak biçimlendirir. +JIS = JIS ## Bir karakter dizesindeki tek enli (tek bayt) İngilizce harfleri veya katakanayı çift enli (iki bayt) karakterlerle değiştirir. +LEFT = SOL ## Bir metin değerinden en soldaki karakterleri verir. +LEFTB = SOLB ## Bir metin değerinden en soldaki karakterleri verir. +LEN = UZUNLUK ## Bir metin dizesindeki karakter sayısını verir. +LENB = UZUNLUKB ## Bir metin dizesindeki karakter sayısını verir. +LOWER = KÜÇÜKHARF ## Metni küçük harfe çevirir. +MID = ORTA ## Bir metin dizesinden belirli sayıda karakteri, belirttiğiniz konumdan başlamak üzere verir. +MIDB = ORTAB ## Bir metin dizesinden belirli sayıda karakteri, belirttiğiniz konumdan başlamak üzere verir. +PHONETIC = SES ## Metin dizesinden ses (furigana) karakterlerini ayıklar. +PROPER = YAZIM.DÜZENİ ## Bir metin değerinin her bir sözcüğünün ilk harfini büyük harfe çevirir. +REPLACE = DEĞİŞTİR ## Metnin içindeki karakterleri değiştirir. +REPLACEB = DEĞİŞTİRB ## Metnin içindeki karakterleri değiştirir. +REPT = YİNELE ## Metni belirtilen sayıda yineler. +RIGHT = SAĞ ## Bir metin değerinden en sağdaki karakterleri verir. +RIGHTB = SAĞB ## Bir metin değerinden en sağdaki karakterleri verir. +SEARCH = BUL ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlı değildir). +SEARCHB = BULB ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlı değildir). +SUBSTITUTE = YERİNEKOY ## Bir metin dizesinde, eski metnin yerine yeni metin koyar. +T = M ## Bağımsız değerlerini metne dönüştürür. +TEXT = METNEÇEVİR ## Bir sayıyı biçimlendirir ve metne dönüştürür. +TRIM = KIRP ## Metindeki boşlukları kaldırır. +UPPER = BÜYÜKHARF ## Metni büyük harfe çevirir. +VALUE = SAYIYAÇEVİR ## Bir metin bağımsız değişkenini sayıya dönüştürür. diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php new file mode 100644 index 0000000..1d28f24 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/AdvancedValueBinder.php @@ -0,0 +1,176 @@ +setValueExplicit(true, DataType::TYPE_BOOL); + + return true; + } elseif ($value == Calculation::getFALSE()) { + $cell->setValueExplicit(false, DataType::TYPE_BOOL); + + return true; + } + + // Check for number in scientific format + if (preg_match('/^' . Calculation::CALCULATION_REGEXP_NUMBER . '$/', $value)) { + $cell->setValueExplicit((float) $value, DataType::TYPE_NUMERIC); + + return true; + } + + // Check for fraction + if (preg_match('/^([+-]?)\s*(\d+)\s?\/\s*(\d+)$/', $value, $matches)) { + // Convert value to number + $value = $matches[2] / $matches[3]; + if ($matches[1] == '-') { + $value = 0 - $value; + } + $cell->setValueExplicit((float) $value, DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getNumberFormat()->setFormatCode('??/??'); + + return true; + } elseif (preg_match('/^([+-]?)(\d*) +(\d*)\s?\/\s*(\d*)$/', $value, $matches)) { + // Convert value to number + $value = $matches[2] + ($matches[3] / $matches[4]); + if ($matches[1] == '-') { + $value = 0 - $value; + } + $cell->setValueExplicit((float) $value, DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getNumberFormat()->setFormatCode('# ??/??'); + + return true; + } + + // Check for percentage + if (preg_match('/^\-?\d*\.?\d*\s?\%$/', $value)) { + // Convert value to number + $value = (float) str_replace('%', '', $value) / 100; + $cell->setValueExplicit($value, DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_PERCENTAGE_00); + + return true; + } + + // Check for currency + $currencyCode = StringHelper::getCurrencyCode(); + $decimalSeparator = StringHelper::getDecimalSeparator(); + $thousandsSeparator = StringHelper::getThousandsSeparator(); + if (preg_match('/^' . preg_quote($currencyCode, '/') . ' *(\d{1,3}(' . preg_quote($thousandsSeparator, '/') . '\d{3})*|(\d+))(' . preg_quote($decimalSeparator, '/') . '\d{2})?$/', $value)) { + // Convert value to number + $value = (float) trim(str_replace([$currencyCode, $thousandsSeparator, $decimalSeparator], ['', '', '.'], $value)); + $cell->setValueExplicit($value, DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getNumberFormat()->setFormatCode( + str_replace('$', $currencyCode, NumberFormat::FORMAT_CURRENCY_USD_SIMPLE) + ); + + return true; + } elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) { + // Convert value to number + $value = (float) trim(str_replace(['$', ','], '', $value)); + $cell->setValueExplicit($value, DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); + + return true; + } + + // Check for time without seconds e.g. '9:45', '09:45' + if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) { + // Convert value to number + [$h, $m] = explode(':', $value); + $days = $h / 24 + $m / 1440; + $cell->setValueExplicit($days, DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_TIME3); + + return true; + } + + // Check for time with seconds '9:45:59', '09:45:59' + if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) { + // Convert value to number + [$h, $m, $s] = explode(':', $value); + $days = $h / 24 + $m / 1440 + $s / 86400; + // Convert value to number + $cell->setValueExplicit($days, DataType::TYPE_NUMERIC); + // Set style + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_TIME4); + + return true; + } + + // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10' + if (($d = Date::stringToExcel($value)) !== false) { + // Convert value to number + $cell->setValueExplicit($d, DataType::TYPE_NUMERIC); + // Determine style. Either there is a time part or not. Look for ':' + if (strpos($value, ':') !== false) { + $formatCode = 'yyyy-mm-dd h:mm'; + } else { + $formatCode = 'yyyy-mm-dd'; + } + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getNumberFormat()->setFormatCode($formatCode); + + return true; + } + + // Check for newline character "\n" + if (strpos($value, "\n") !== false) { + $value = StringHelper::sanitizeUTF8($value); + $cell->setValueExplicit($value, DataType::TYPE_STRING); + // Set style + $cell->getWorksheet()->getStyle($cell->getCoordinate()) + ->getAlignment()->setWrapText(true); + + return true; + } + } + + // Not bound yet? Use parent... + return parent::bindValue($cell, $value); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php new file mode 100644 index 0000000..bae8261 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Cell.php @@ -0,0 +1,701 @@ +parent->update($this); + + return $this; + } + + public function detach() + { + $this->parent = null; + } + + public function attach(Cells $parent) + { + $this->parent = $parent; + } + + /** + * Create a new Cell. + * + * @param mixed $pValue + * @param string $pDataType + * @param Worksheet $pSheet + * + * @throws Exception + */ + public function __construct($pValue, $pDataType, Worksheet $pSheet) + { + // Initialise cell value + $this->value = $pValue; + + // Set worksheet cache + $this->parent = $pSheet->getCellCollection(); + + // Set datatype? + if ($pDataType !== null) { + if ($pDataType == DataType::TYPE_STRING2) { + $pDataType = DataType::TYPE_STRING; + } + $this->dataType = $pDataType; + } elseif (!self::getValueBinder()->bindValue($this, $pValue)) { + throw new Exception('Value could not be bound to cell.'); + } + } + + /** + * Get cell coordinate column. + * + * @return string + */ + public function getColumn() + { + return $this->parent->getCurrentColumn(); + } + + /** + * Get cell coordinate row. + * + * @return int + */ + public function getRow() + { + return $this->parent->getCurrentRow(); + } + + /** + * Get cell coordinate. + * + * @return string + */ + public function getCoordinate() + { + return $this->parent->getCurrentCoordinate(); + } + + /** + * Get cell value. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Get cell value with formatting. + * + * @return string + */ + public function getFormattedValue() + { + return (string) NumberFormat::toFormattedString( + $this->getCalculatedValue(), + $this->getStyle() + ->getNumberFormat()->getFormatCode() + ); + } + + /** + * Set cell value. + * + * Sets the value for a cell, automatically determining the datatype using the value binder + * + * @param mixed $pValue Value + * + * @throws Exception + * + * @return $this + */ + public function setValue($pValue) + { + if (!self::getValueBinder()->bindValue($this, $pValue)) { + throw new Exception('Value could not be bound to cell.'); + } + + return $this; + } + + /** + * Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder). + * + * @param mixed $pValue Value + * @param string $pDataType Explicit data type, see DataType::TYPE_* + * + * @throws Exception + * + * @return Cell + */ + public function setValueExplicit($pValue, $pDataType) + { + // set the value according to data type + switch ($pDataType) { + case DataType::TYPE_NULL: + $this->value = $pValue; + + break; + case DataType::TYPE_STRING2: + $pDataType = DataType::TYPE_STRING; + // no break + case DataType::TYPE_STRING: + // Synonym for string + case DataType::TYPE_INLINE: + // Rich text + $this->value = DataType::checkString($pValue); + + break; + case DataType::TYPE_NUMERIC: + if (is_string($pValue) && !is_numeric($pValue)) { + throw new Exception('Invalid numeric value for datatype Numeric'); + } + $this->value = 0 + $pValue; + + break; + case DataType::TYPE_FORMULA: + $this->value = (string) $pValue; + + break; + case DataType::TYPE_BOOL: + $this->value = (bool) $pValue; + + break; + case DataType::TYPE_ERROR: + $this->value = DataType::checkErrorCode($pValue); + + break; + default: + throw new Exception('Invalid datatype: ' . $pDataType); + + break; + } + + // set the datatype + $this->dataType = $pDataType; + + return $this->updateInCollection(); + } + + /** + * Get calculated cell value. + * + * @param bool $resetLog Whether the calculation engine logger should be reset or not + * + * @throws Exception + * + * @return mixed + */ + public function getCalculatedValue($resetLog = true) + { + if ($this->dataType == DataType::TYPE_FORMULA) { + try { + $result = Calculation::getInstance( + $this->getWorksheet()->getParent() + )->calculateCellValue($this, $resetLog); + // We don't yet handle array returns + if (is_array($result)) { + while (is_array($result)) { + $result = array_pop($result); + } + } + } catch (Exception $ex) { + if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) { + return $this->calculatedValue; // Fallback for calculations referencing external files. + } + + throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception( + $this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage() + ); + } + + if ($result === '#Not Yet Implemented') { + return $this->calculatedValue; // Fallback if calculation engine does not support the formula. + } + + return $result; + } elseif ($this->value instanceof RichText) { + return $this->value->getPlainText(); + } + + return $this->value; + } + + /** + * Set old calculated value (cached). + * + * @param mixed $pValue Value + * + * @return Cell + */ + public function setCalculatedValue($pValue) + { + if ($pValue !== null) { + $this->calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue; + } + + return $this->updateInCollection(); + } + + /** + * Get old calculated value (cached) + * This returns the value last calculated by MS Excel or whichever spreadsheet program was used to + * create the original spreadsheet file. + * Note that this value is not guaranteed to reflect the actual calculated value because it is + * possible that auto-calculation was disabled in the original spreadsheet, and underlying data + * values used by the formula have changed since it was last calculated. + * + * @return mixed + */ + public function getOldCalculatedValue() + { + return $this->calculatedValue; + } + + /** + * Get cell data type. + * + * @return string + */ + public function getDataType() + { + return $this->dataType; + } + + /** + * Set cell data type. + * + * @param string $pDataType see DataType::TYPE_* + * + * @return Cell + */ + public function setDataType($pDataType) + { + if ($pDataType == DataType::TYPE_STRING2) { + $pDataType = DataType::TYPE_STRING; + } + $this->dataType = $pDataType; + + return $this->updateInCollection(); + } + + /** + * Identify if the cell contains a formula. + * + * @return bool + */ + public function isFormula() + { + return $this->dataType == DataType::TYPE_FORMULA; + } + + /** + * Does this cell contain Data validation rules? + * + * @throws Exception + * + * @return bool + */ + public function hasDataValidation() + { + if (!isset($this->parent)) { + throw new Exception('Cannot check for data validation when cell is not bound to a worksheet'); + } + + return $this->getWorksheet()->dataValidationExists($this->getCoordinate()); + } + + /** + * Get Data validation rules. + * + * @throws Exception + * + * @return DataValidation + */ + public function getDataValidation() + { + if (!isset($this->parent)) { + throw new Exception('Cannot get data validation for cell that is not bound to a worksheet'); + } + + return $this->getWorksheet()->getDataValidation($this->getCoordinate()); + } + + /** + * Set Data validation rules. + * + * @param DataValidation $pDataValidation + * + * @throws Exception + * + * @return Cell + */ + public function setDataValidation(DataValidation $pDataValidation = null) + { + if (!isset($this->parent)) { + throw new Exception('Cannot set data validation for cell that is not bound to a worksheet'); + } + + $this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidation); + + return $this->updateInCollection(); + } + + /** + * Does this cell contain valid value? + * + * @return bool + */ + public function hasValidValue() + { + $validator = new DataValidator(); + + return $validator->isValid($this); + } + + /** + * Does this cell contain a Hyperlink? + * + * @throws Exception + * + * @return bool + */ + public function hasHyperlink() + { + if (!isset($this->parent)) { + throw new Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); + } + + return $this->getWorksheet()->hyperlinkExists($this->getCoordinate()); + } + + /** + * Get Hyperlink. + * + * @throws Exception + * + * @return Hyperlink + */ + public function getHyperlink() + { + if (!isset($this->parent)) { + throw new Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); + } + + return $this->getWorksheet()->getHyperlink($this->getCoordinate()); + } + + /** + * Set Hyperlink. + * + * @param Hyperlink $pHyperlink + * + * @throws Exception + * + * @return Cell + */ + public function setHyperlink(Hyperlink $pHyperlink = null) + { + if (!isset($this->parent)) { + throw new Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); + } + + $this->getWorksheet()->setHyperlink($this->getCoordinate(), $pHyperlink); + + return $this->updateInCollection(); + } + + /** + * Get cell collection. + * + * @return Cells + */ + public function getParent() + { + return $this->parent; + } + + /** + * Get parent worksheet. + * + * @return Worksheet + */ + public function getWorksheet() + { + return $this->parent->getParent(); + } + + /** + * Is this cell in a merge range. + * + * @return bool + */ + public function isInMergeRange() + { + return (bool) $this->getMergeRange(); + } + + /** + * Is this cell the master (top left cell) in a merge range (that holds the actual data value). + * + * @return bool + */ + public function isMergeRangeValueCell() + { + if ($mergeRange = $this->getMergeRange()) { + $mergeRange = Coordinate::splitRange($mergeRange); + [$startCell] = $mergeRange[0]; + if ($this->getCoordinate() === $startCell) { + return true; + } + } + + return false; + } + + /** + * If this cell is in a merge range, then return the range. + * + * @return false|string + */ + public function getMergeRange() + { + foreach ($this->getWorksheet()->getMergeCells() as $mergeRange) { + if ($this->isInRange($mergeRange)) { + return $mergeRange; + } + } + + return false; + } + + /** + * Get cell style. + * + * @return Style + */ + public function getStyle() + { + return $this->getWorksheet()->getStyle($this->getCoordinate()); + } + + /** + * Re-bind parent. + * + * @param Worksheet $parent + * + * @return Cell + */ + public function rebindParent(Worksheet $parent) + { + $this->parent = $parent->getCellCollection(); + + return $this->updateInCollection(); + } + + /** + * Is cell in a specific range? + * + * @param string $pRange Cell range (e.g. A1:A1) + * + * @return bool + */ + public function isInRange($pRange) + { + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($pRange); + + // Translate properties + $myColumn = Coordinate::columnIndexFromString($this->getColumn()); + $myRow = $this->getRow(); + + // Verify if cell is in range + return ($rangeStart[0] <= $myColumn) && ($rangeEnd[0] >= $myColumn) && + ($rangeStart[1] <= $myRow) && ($rangeEnd[1] >= $myRow); + } + + /** + * Compare 2 cells. + * + * @param Cell $a Cell a + * @param Cell $b Cell b + * + * @return int Result of comparison (always -1 or 1, never zero!) + */ + public static function compareCells(self $a, self $b) + { + if ($a->getRow() < $b->getRow()) { + return -1; + } elseif ($a->getRow() > $b->getRow()) { + return 1; + } elseif (Coordinate::columnIndexFromString($a->getColumn()) < Coordinate::columnIndexFromString($b->getColumn())) { + return -1; + } + + return 1; + } + + /** + * Get value binder to use. + * + * @return IValueBinder + */ + public static function getValueBinder() + { + if (self::$valueBinder === null) { + self::$valueBinder = new DefaultValueBinder(); + } + + return self::$valueBinder; + } + + /** + * Set value binder to use. + * + * @param IValueBinder $binder + */ + public static function setValueBinder(IValueBinder $binder) + { + self::$valueBinder = $binder; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ((is_object($value)) && ($key != 'parent')) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } + + /** + * Get index to cellXf. + * + * @return int + */ + public function getXfIndex() + { + return $this->xfIndex; + } + + /** + * Set index to cellXf. + * + * @param int $pValue + * + * @return Cell + */ + public function setXfIndex($pValue) + { + $this->xfIndex = $pValue; + + return $this->updateInCollection(); + } + + /** + * Set the formula attributes. + * + * @param mixed $pAttributes + * + * @return $this + */ + public function setFormulaAttributes($pAttributes) + { + $this->formulaAttributes = $pAttributes; + + return $this; + } + + /** + * Get the formula attributes. + */ + public function getFormulaAttributes() + { + return $this->formulaAttributes; + } + + /** + * Convert to string. + * + * @return string + */ + public function __toString() + { + return (string) $this->getValue(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php new file mode 100644 index 0000000..cc0543f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php @@ -0,0 +1,520 @@ + '') { + $worksheet .= '!'; + } + + // Create absolute coordinate + if (ctype_digit($pCoordinateString)) { + return $worksheet . '$' . $pCoordinateString; + } elseif (ctype_alpha($pCoordinateString)) { + return $worksheet . '$' . strtoupper($pCoordinateString); + } + + return $worksheet . self::absoluteCoordinate($pCoordinateString); + } + + /** + * Make string coordinate absolute. + * + * @param string $pCoordinateString e.g. 'A1' + * + * @throws Exception + * + * @return string Absolute coordinate e.g. '$A$1' + */ + public static function absoluteCoordinate($pCoordinateString) + { + if (self::coordinateIsRange($pCoordinateString)) { + throw new Exception('Cell coordinate string can not be a range of cells'); + } + + // Split out any worksheet name from the coordinate + [$worksheet, $pCoordinateString] = Worksheet::extractSheetTitle($pCoordinateString, true); + if ($worksheet > '') { + $worksheet .= '!'; + } + + // Create absolute coordinate + [$column, $row] = self::coordinateFromString($pCoordinateString); + $column = ltrim($column, '$'); + $row = ltrim($row, '$'); + + return $worksheet . '$' . $column . '$' . $row; + } + + /** + * Split range into coordinate strings. + * + * @param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4' + * + * @return array Array containing one or more arrays containing one or two coordinate strings + * e.g. ['B4','D9'] or [['B4','D9'], ['H2','O11']] + * or ['B4'] + */ + public static function splitRange($pRange) + { + // Ensure $pRange is a valid range + if (empty($pRange)) { + $pRange = self::DEFAULT_RANGE; + } + + $exploded = explode(',', $pRange); + $counter = count($exploded); + for ($i = 0; $i < $counter; ++$i) { + $exploded[$i] = explode(':', $exploded[$i]); + } + + return $exploded; + } + + /** + * Build range from coordinate strings. + * + * @param array $pRange Array containg one or more arrays containing one or two coordinate strings + * + * @throws Exception + * + * @return string String representation of $pRange + */ + public static function buildRange(array $pRange) + { + // Verify range + if (empty($pRange) || !is_array($pRange[0])) { + throw new Exception('Range does not contain any information'); + } + + // Build range + $counter = count($pRange); + for ($i = 0; $i < $counter; ++$i) { + $pRange[$i] = implode(':', $pRange[$i]); + } + + return implode(',', $pRange); + } + + /** + * Calculate range boundaries. + * + * @param string $pRange Cell range (e.g. A1:A1) + * + * @return array Range coordinates [Start Cell, End Cell] + * where Start Cell and End Cell are arrays (Column Number, Row Number) + */ + public static function rangeBoundaries($pRange) + { + // Ensure $pRange is a valid range + if (empty($pRange)) { + $pRange = self::DEFAULT_RANGE; + } + + // Uppercase coordinate + $pRange = strtoupper($pRange); + + // Extract range + if (strpos($pRange, ':') === false) { + $rangeA = $rangeB = $pRange; + } else { + [$rangeA, $rangeB] = explode(':', $pRange); + } + + // Calculate range outer borders + $rangeStart = self::coordinateFromString($rangeA); + $rangeEnd = self::coordinateFromString($rangeB); + + // Translate column into index + $rangeStart[0] = self::columnIndexFromString($rangeStart[0]); + $rangeEnd[0] = self::columnIndexFromString($rangeEnd[0]); + + return [$rangeStart, $rangeEnd]; + } + + /** + * Calculate range dimension. + * + * @param string $pRange Cell range (e.g. A1:A1) + * + * @return array Range dimension (width, height) + */ + public static function rangeDimension($pRange) + { + // Calculate range outer borders + [$rangeStart, $rangeEnd] = self::rangeBoundaries($pRange); + + return [($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1)]; + } + + /** + * Calculate range boundaries. + * + * @param string $pRange Cell range (e.g. A1:A1) + * + * @return array Range coordinates [Start Cell, End Cell] + * where Start Cell and End Cell are arrays [Column ID, Row Number] + */ + public static function getRangeBoundaries($pRange) + { + // Ensure $pRange is a valid range + if (empty($pRange)) { + $pRange = self::DEFAULT_RANGE; + } + + // Uppercase coordinate + $pRange = strtoupper($pRange); + + // Extract range + if (strpos($pRange, ':') === false) { + $rangeA = $rangeB = $pRange; + } else { + [$rangeA, $rangeB] = explode(':', $pRange); + } + + return [self::coordinateFromString($rangeA), self::coordinateFromString($rangeB)]; + } + + /** + * Column index from string. + * + * @param string $pString eg 'A' + * + * @return int Column index (A = 1) + */ + public static function columnIndexFromString($pString) + { + // Using a lookup cache adds a slight memory overhead, but boosts speed + // caching using a static within the method is faster than a class static, + // though it's additional memory overhead + static $indexCache = []; + + if (isset($indexCache[$pString])) { + return $indexCache[$pString]; + } + // It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord() + // and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant + // memory overhead either + static $columnLookup = [ + 'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13, + 'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26, + 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, + 'n' => 14, 'o' => 15, 'p' => 16, 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24, 'y' => 25, 'z' => 26, + ]; + + // We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString + // for improved performance + if (isset($pString[0])) { + if (!isset($pString[1])) { + $indexCache[$pString] = $columnLookup[$pString]; + + return $indexCache[$pString]; + } elseif (!isset($pString[2])) { + $indexCache[$pString] = $columnLookup[$pString[0]] * 26 + $columnLookup[$pString[1]]; + + return $indexCache[$pString]; + } elseif (!isset($pString[3])) { + $indexCache[$pString] = $columnLookup[$pString[0]] * 676 + $columnLookup[$pString[1]] * 26 + $columnLookup[$pString[2]]; + + return $indexCache[$pString]; + } + } + + throw new Exception('Column string index can not be ' . ((isset($pString[0])) ? 'longer than 3 characters' : 'empty')); + } + + /** + * String from column index. + * + * @param int $columnIndex Column index (A = 1) + * + * @return string + */ + public static function stringFromColumnIndex($columnIndex) + { + static $indexCache = []; + + if (!isset($indexCache[$columnIndex])) { + $indexValue = $columnIndex; + $base26 = null; + do { + $characterValue = ($indexValue % 26) ?: 26; + $indexValue = ($indexValue - $characterValue) / 26; + $base26 = chr($characterValue + 64) . ($base26 ?: ''); + } while ($indexValue > 0); + $indexCache[$columnIndex] = $base26; + } + + return $indexCache[$columnIndex]; + } + + /** + * Extract all cell references in range, which may be comprised of multiple cell ranges. + * + * @param string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25) + * + * @return array Array containing single cell references + */ + public static function extractAllCellReferencesInRange($pRange) + { + $returnValue = []; + + // Explode spaces + $cellBlocks = self::getCellBlocksFromRangeString($pRange); + foreach ($cellBlocks as $cellBlock) { + $returnValue = array_merge($returnValue, self::getReferencesForCellBlock($cellBlock)); + } + + // Sort the result by column and row + $sortKeys = []; + foreach (array_unique($returnValue) as $coord) { + $column = ''; + $row = 0; + + sscanf($coord, '%[A-Z]%d', $column, $row); + $sortKeys[sprintf('%3s%09d', $column, $row)] = $coord; + } + ksort($sortKeys); + + // Return value + return array_values($sortKeys); + } + + /** + * Get all cell references for an individual cell block. + * + * @param string $cellBlock A cell range e.g. A4:B5 + * + * @return array All individual cells in that range + */ + private static function getReferencesForCellBlock($cellBlock) + { + $returnValue = []; + + // Single cell? + if (!self::coordinateIsRange($cellBlock)) { + return (array) $cellBlock; + } + + // Range... + $ranges = self::splitRange($cellBlock); + foreach ($ranges as $range) { + // Single cell? + if (!isset($range[1])) { + $returnValue[] = $range[0]; + + continue; + } + + // Range... + [$rangeStart, $rangeEnd] = $range; + [$startColumn, $startRow] = self::coordinateFromString($rangeStart); + [$endColumn, $endRow] = self::coordinateFromString($rangeEnd); + $startColumnIndex = self::columnIndexFromString($startColumn); + $endColumnIndex = self::columnIndexFromString($endColumn); + ++$endColumnIndex; + + // Current data + $currentColumnIndex = $startColumnIndex; + $currentRow = $startRow; + + self::validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow); + + // Loop cells + while ($currentColumnIndex < $endColumnIndex) { + while ($currentRow <= $endRow) { + $returnValue[] = self::stringFromColumnIndex($currentColumnIndex) . $currentRow; + ++$currentRow; + } + ++$currentColumnIndex; + $currentRow = $startRow; + } + } + + return $returnValue; + } + + /** + * Convert an associative array of single cell coordinates to values to an associative array + * of cell ranges to values. Only adjacent cell coordinates with the same + * value will be merged. If the value is an object, it must implement the method getHashCode(). + * + * For example, this function converts: + * + * [ 'A1' => 'x', 'A2' => 'x', 'A3' => 'x', 'A4' => 'y' ] + * + * to: + * + * [ 'A1:A3' => 'x', 'A4' => 'y' ] + * + * @param array $pCoordCollection associative array mapping coordinates to values + * + * @return array associative array mapping coordinate ranges to valuea + */ + public static function mergeRangesInCollection(array $pCoordCollection) + { + $hashedValues = []; + $mergedCoordCollection = []; + + foreach ($pCoordCollection as $coord => $value) { + if (self::coordinateIsRange($coord)) { + $mergedCoordCollection[$coord] = $value; + + continue; + } + + [$column, $row] = self::coordinateFromString($coord); + $row = (int) (ltrim($row, '$')); + $hashCode = $column . '-' . (is_object($value) ? $value->getHashCode() : $value); + + if (!isset($hashedValues[$hashCode])) { + $hashedValues[$hashCode] = (object) [ + 'value' => $value, + 'col' => $column, + 'rows' => [$row], + ]; + } else { + $hashedValues[$hashCode]->rows[] = $row; + } + } + + ksort($hashedValues); + + foreach ($hashedValues as $hashedValue) { + sort($hashedValue->rows); + $rowStart = null; + $rowEnd = null; + $ranges = []; + + foreach ($hashedValue->rows as $row) { + if ($rowStart === null) { + $rowStart = $row; + $rowEnd = $row; + } elseif ($rowEnd === $row - 1) { + $rowEnd = $row; + } else { + if ($rowStart == $rowEnd) { + $ranges[] = $hashedValue->col . $rowStart; + } else { + $ranges[] = $hashedValue->col . $rowStart . ':' . $hashedValue->col . $rowEnd; + } + + $rowStart = $row; + $rowEnd = $row; + } + } + + if ($rowStart !== null) { + if ($rowStart == $rowEnd) { + $ranges[] = $hashedValue->col . $rowStart; + } else { + $ranges[] = $hashedValue->col . $rowStart . ':' . $hashedValue->col . $rowEnd; + } + } + + foreach ($ranges as $range) { + $mergedCoordCollection[$range] = $hashedValue->value; + } + } + + return $mergedCoordCollection; + } + + /** + * Get the individual cell blocks from a range string, splitting by space and removing any $ characters. + * + * @param string $pRange + * + * @return string[] + */ + private static function getCellBlocksFromRangeString($pRange) + { + return explode(' ', str_replace('$', '', strtoupper($pRange))); + } + + /** + * Check that the given range is valid, i.e. that the start column and row are not greater than the end column and + * row. + * + * @param string $cellBlock The original range, for displaying a meaningful error message + * @param int $startColumnIndex + * @param int $endColumnIndex + * @param int $currentRow + * @param int $endRow + */ + private static function validateRange($cellBlock, $startColumnIndex, $endColumnIndex, $currentRow, $endRow) + { + if ($startColumnIndex >= $endColumnIndex || $currentRow > $endRow) { + throw new Exception('Invalid range: "' . $cellBlock . '"'); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php new file mode 100644 index 0000000..ba03579 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataType.php @@ -0,0 +1,85 @@ + 0, + '#DIV/0!' => 1, + '#VALUE!' => 2, + '#REF!' => 3, + '#NAME?' => 4, + '#NUM!' => 5, + '#N/A' => 6, + ]; + + /** + * Get list of error codes. + * + * @return array + */ + public static function getErrorCodes() + { + return self::$errorCodes; + } + + /** + * Check a string that it satisfies Excel requirements. + * + * @param null|RichText|string $pValue Value to sanitize to an Excel string + * + * @return null|RichText|string Sanitized value + */ + public static function checkString($pValue) + { + if ($pValue instanceof RichText) { + // TODO: Sanitize Rich-Text string (max. character count is 32,767) + return $pValue; + } + + // string must never be longer than 32,767 characters, truncate if necessary + $pValue = StringHelper::substring($pValue, 0, 32767); + + // we require that newline is represented as "\n" in core, not as "\r\n" or "\r" + $pValue = str_replace(["\r\n", "\r"], "\n", $pValue); + + return $pValue; + } + + /** + * Check a value that it is a valid error code. + * + * @param mixed $pValue Value to sanitize to an Excel error code + * + * @return string Sanitized value + */ + public static function checkErrorCode($pValue) + { + $pValue = (string) $pValue; + + if (!isset(self::$errorCodes[$pValue])) { + $pValue = '#NULL!'; + } + + return $pValue; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidation.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidation.php new file mode 100644 index 0000000..dfeb024 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidation.php @@ -0,0 +1,481 @@ +formula1; + } + + /** + * Set Formula 1. + * + * @param string $value + * + * @return $this + */ + public function setFormula1($value) + { + $this->formula1 = $value; + + return $this; + } + + /** + * Get Formula 2. + * + * @return string + */ + public function getFormula2() + { + return $this->formula2; + } + + /** + * Set Formula 2. + * + * @param string $value + * + * @return $this + */ + public function setFormula2($value) + { + $this->formula2 = $value; + + return $this; + } + + /** + * Get Type. + * + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Set Type. + * + * @param string $value + * + * @return $this + */ + public function setType($value) + { + $this->type = $value; + + return $this; + } + + /** + * Get Error style. + * + * @return string + */ + public function getErrorStyle() + { + return $this->errorStyle; + } + + /** + * Set Error style. + * + * @param string $value see self::STYLE_* + * + * @return $this + */ + public function setErrorStyle($value) + { + $this->errorStyle = $value; + + return $this; + } + + /** + * Get Operator. + * + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Set Operator. + * + * @param string $value + * + * @return $this + */ + public function setOperator($value) + { + $this->operator = $value; + + return $this; + } + + /** + * Get Allow Blank. + * + * @return bool + */ + public function getAllowBlank() + { + return $this->allowBlank; + } + + /** + * Set Allow Blank. + * + * @param bool $value + * + * @return $this + */ + public function setAllowBlank($value) + { + $this->allowBlank = $value; + + return $this; + } + + /** + * Get Show DropDown. + * + * @return bool + */ + public function getShowDropDown() + { + return $this->showDropDown; + } + + /** + * Set Show DropDown. + * + * @param bool $value + * + * @return $this + */ + public function setShowDropDown($value) + { + $this->showDropDown = $value; + + return $this; + } + + /** + * Get Show InputMessage. + * + * @return bool + */ + public function getShowInputMessage() + { + return $this->showInputMessage; + } + + /** + * Set Show InputMessage. + * + * @param bool $value + * + * @return $this + */ + public function setShowInputMessage($value) + { + $this->showInputMessage = $value; + + return $this; + } + + /** + * Get Show ErrorMessage. + * + * @return bool + */ + public function getShowErrorMessage() + { + return $this->showErrorMessage; + } + + /** + * Set Show ErrorMessage. + * + * @param bool $value + * + * @return $this + */ + public function setShowErrorMessage($value) + { + $this->showErrorMessage = $value; + + return $this; + } + + /** + * Get Error title. + * + * @return string + */ + public function getErrorTitle() + { + return $this->errorTitle; + } + + /** + * Set Error title. + * + * @param string $value + * + * @return $this + */ + public function setErrorTitle($value) + { + $this->errorTitle = $value; + + return $this; + } + + /** + * Get Error. + * + * @return string + */ + public function getError() + { + return $this->error; + } + + /** + * Set Error. + * + * @param string $value + * + * @return $this + */ + public function setError($value) + { + $this->error = $value; + + return $this; + } + + /** + * Get Prompt title. + * + * @return string + */ + public function getPromptTitle() + { + return $this->promptTitle; + } + + /** + * Set Prompt title. + * + * @param string $value + * + * @return $this + */ + public function setPromptTitle($value) + { + $this->promptTitle = $value; + + return $this; + } + + /** + * Get Prompt. + * + * @return string + */ + public function getPrompt() + { + return $this->prompt; + } + + /** + * Set Prompt. + * + * @param string $value + * + * @return $this + */ + public function setPrompt($value) + { + $this->prompt = $value; + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->formula1 . + $this->formula2 . + $this->type . + $this->errorStyle . + $this->operator . + ($this->allowBlank ? 't' : 'f') . + ($this->showDropDown ? 't' : 'f') . + ($this->showInputMessage ? 't' : 'f') . + ($this->showErrorMessage ? 't' : 'f') . + $this->errorTitle . + $this->error . + $this->promptTitle . + $this->prompt . + __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php new file mode 100644 index 0000000..430d81b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DataValidator.php @@ -0,0 +1,77 @@ +hasDataValidation()) { + return true; + } + + $cellValue = $cell->getValue(); + $dataValidation = $cell->getDataValidation(); + + if (!$dataValidation->getAllowBlank() && ($cellValue === null || $cellValue === '')) { + return false; + } + + // TODO: write check on all cases + switch ($dataValidation->getType()) { + case DataValidation::TYPE_LIST: + return $this->isValueInList($cell); + } + + return false; + } + + /** + * Does this cell contain valid value, based on list? + * + * @param Cell $cell Cell to check the value + * + * @return bool + */ + private function isValueInList(Cell $cell) + { + $cellValue = $cell->getValue(); + $dataValidation = $cell->getDataValidation(); + + $formula1 = $dataValidation->getFormula1(); + if (!empty($formula1)) { + // inline values list + if ($formula1[0] === '"') { + return in_array(strtolower($cellValue), explode(',', strtolower(trim($formula1, '"'))), true); + } elseif (strpos($formula1, ':') > 0) { + // values list cells + $matchFormula = '=MATCH(' . $cell->getCoordinate() . ', ' . $formula1 . ', 0)'; + $calculation = Calculation::getInstance($cell->getWorksheet()->getParent()); + + try { + $result = $calculation->calculateFormula($matchFormula, $cell->getCoordinate(), $cell); + + return $result !== Functions::NA(); + } catch (Exception $ex) { + return false; + } + } + } + + return true; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DefaultValueBinder.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DefaultValueBinder.php new file mode 100644 index 0000000..cd05cf8 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/DefaultValueBinder.php @@ -0,0 +1,82 @@ +format('Y-m-d H:i:s'); + } elseif (!($value instanceof RichText)) { + $value = (string) $value; + } + } + + // Set value explicit + $cell->setValueExplicit($value, static::dataTypeForValue($value)); + + // Done! + return true; + } + + /** + * DataType for value. + * + * @param mixed $pValue + * + * @return string + */ + public static function dataTypeForValue($pValue) + { + // Match the value against a few data types + if ($pValue === null) { + return DataType::TYPE_NULL; + } elseif (is_float($pValue) || is_int($pValue)) { + return DataType::TYPE_NUMERIC; + } elseif (is_bool($pValue)) { + return DataType::TYPE_BOOL; + } elseif ($pValue === '') { + return DataType::TYPE_STRING; + } elseif ($pValue instanceof RichText) { + return DataType::TYPE_INLINE; + } elseif (is_string($pValue) && $pValue[0] === '=' && strlen($pValue) > 1) { + return DataType::TYPE_FORMULA; + } elseif (preg_match('/^[\+\-]?(\d+\\.?\d*|\d*\\.?\d+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) { + $tValue = ltrim($pValue, '+-'); + if (is_string($pValue) && $tValue[0] === '0' && strlen($tValue) > 1 && $tValue[1] !== '.') { + return DataType::TYPE_STRING; + } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) { + return DataType::TYPE_STRING; + } + + return DataType::TYPE_NUMERIC; + } elseif (is_string($pValue)) { + $errorCodes = DataType::getErrorCodes(); + if (isset($errorCodes[$pValue])) { + return DataType::TYPE_ERROR; + } + } + + return DataType::TYPE_STRING; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Hyperlink.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Hyperlink.php new file mode 100644 index 0000000..003d510 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Hyperlink.php @@ -0,0 +1,113 @@ +url = $pUrl; + $this->tooltip = $pTooltip; + } + + /** + * Get URL. + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Set URL. + * + * @param string $value + * + * @return $this + */ + public function setUrl($value) + { + $this->url = $value; + + return $this; + } + + /** + * Get tooltip. + * + * @return string + */ + public function getTooltip() + { + return $this->tooltip; + } + + /** + * Set tooltip. + * + * @param string $value + * + * @return $this + */ + public function setTooltip($value) + { + $this->tooltip = $value; + + return $this; + } + + /** + * Is this hyperlink internal? (to another worksheet). + * + * @return bool + */ + public function isInternal() + { + return strpos($this->url, 'sheet://') !== false; + } + + /** + * @return string + */ + public function getTypeHyperlink() + { + return $this->isInternal() ? '' : 'External'; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->url . + $this->tooltip . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/IValueBinder.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/IValueBinder.php new file mode 100644 index 0000000..5af9f5f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/IValueBinder.php @@ -0,0 +1,16 @@ +setValueExplicit((string) $value, DataType::TYPE_STRING); + + // Done! + return true; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Axis.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Axis.php new file mode 100644 index 0000000..66242e3 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Axis.php @@ -0,0 +1,557 @@ + self::FORMAT_CODE_GENERAL, + 'source_linked' => 1, + ]; + + /** + * Axis Options. + * + * @var array of mixed + */ + private $axisOptions = [ + 'minimum' => null, + 'maximum' => null, + 'major_unit' => null, + 'minor_unit' => null, + 'orientation' => self::ORIENTATION_NORMAL, + 'minor_tick_mark' => self::TICK_MARK_NONE, + 'major_tick_mark' => self::TICK_MARK_NONE, + 'axis_labels' => self::AXIS_LABELS_NEXT_TO, + 'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO, + 'horizontal_crosses_value' => null, + ]; + + /** + * Fill Properties. + * + * @var array of mixed + */ + private $fillProperties = [ + 'type' => self::EXCEL_COLOR_TYPE_ARGB, + 'value' => null, + 'alpha' => 0, + ]; + + /** + * Line Properties. + * + * @var array of mixed + */ + private $lineProperties = [ + 'type' => self::EXCEL_COLOR_TYPE_ARGB, + 'value' => null, + 'alpha' => 0, + ]; + + /** + * Line Style Properties. + * + * @var array of mixed + */ + private $lineStyleProperties = [ + 'width' => '9525', + 'compound' => self::LINE_STYLE_COMPOUND_SIMPLE, + 'dash' => self::LINE_STYLE_DASH_SOLID, + 'cap' => self::LINE_STYLE_CAP_FLAT, + 'join' => self::LINE_STYLE_JOIN_BEVEL, + 'arrow' => [ + 'head' => [ + 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW, + 'size' => self::LINE_STYLE_ARROW_SIZE_5, + ], + 'end' => [ + 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW, + 'size' => self::LINE_STYLE_ARROW_SIZE_8, + ], + ], + ]; + + /** + * Shadow Properties. + * + * @var array of mixed + */ + private $shadowProperties = [ + 'presets' => self::SHADOW_PRESETS_NOSHADOW, + 'effect' => null, + 'color' => [ + 'type' => self::EXCEL_COLOR_TYPE_STANDARD, + 'value' => 'black', + 'alpha' => 40, + ], + 'size' => [ + 'sx' => null, + 'sy' => null, + 'kx' => null, + ], + 'blur' => null, + 'direction' => null, + 'distance' => null, + 'algn' => null, + 'rotWithShape' => null, + ]; + + /** + * Glow Properties. + * + * @var array of mixed + */ + private $glowProperties = [ + 'size' => null, + 'color' => [ + 'type' => self::EXCEL_COLOR_TYPE_STANDARD, + 'value' => 'black', + 'alpha' => 40, + ], + ]; + + /** + * Soft Edge Properties. + * + * @var array of mixed + */ + private $softEdges = [ + 'size' => null, + ]; + + /** + * Get Series Data Type. + * + * @param mixed $format_code + * + * @return string + */ + public function setAxisNumberProperties($format_code) + { + $this->axisNumber['format'] = (string) $format_code; + $this->axisNumber['source_linked'] = 0; + } + + /** + * Get Axis Number Format Data Type. + * + * @return string + */ + public function getAxisNumberFormat() + { + return $this->axisNumber['format']; + } + + /** + * Get Axis Number Source Linked. + * + * @return string + */ + public function getAxisNumberSourceLinked() + { + return (string) $this->axisNumber['source_linked']; + } + + /** + * Set Axis Options Properties. + * + * @param string $axis_labels + * @param string $horizontal_crosses_value + * @param string $horizontal_crosses + * @param string $axis_orientation + * @param string $major_tmt + * @param string $minor_tmt + * @param string $minimum + * @param string $maximum + * @param string $major_unit + * @param string $minor_unit + */ + public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null) + { + $this->axisOptions['axis_labels'] = (string) $axis_labels; + ($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null; + ($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null; + ($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null; + ($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null; + ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null; + ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null; + ($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null; + ($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null; + ($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null; + ($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null; + } + + /** + * Get Axis Options Property. + * + * @param string $property + * + * @return string + */ + public function getAxisOptionsProperty($property) + { + return $this->axisOptions[$property]; + } + + /** + * Set Axis Orientation Property. + * + * @param string $orientation + */ + public function setAxisOrientation($orientation) + { + $this->axisOptions['orientation'] = (string) $orientation; + } + + /** + * Set Fill Property. + * + * @param string $color + * @param int $alpha + * @param string $type + */ + public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) + { + $this->fillProperties = $this->setColorProperties($color, $alpha, $type); + } + + /** + * Set Line Property. + * + * @param string $color + * @param int $alpha + * @param string $type + */ + public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) + { + $this->lineProperties = $this->setColorProperties($color, $alpha, $type); + } + + /** + * Get Fill Property. + * + * @param string $property + * + * @return string + */ + public function getFillProperty($property) + { + return $this->fillProperties[$property]; + } + + /** + * Get Line Property. + * + * @param string $property + * + * @return string + */ + public function getLineProperty($property) + { + return $this->lineProperties[$property]; + } + + /** + * Set Line Style Properties. + * + * @param float $line_width + * @param string $compound_type + * @param string $dash_type + * @param string $cap_type + * @param string $join_type + * @param string $head_arrow_type + * @param string $head_arrow_size + * @param string $end_arrow_type + * @param string $end_arrow_size + */ + public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) + { + ($line_width !== null) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null; + ($compound_type !== null) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null; + ($dash_type !== null) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null; + ($cap_type !== null) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null; + ($join_type !== null) ? $this->lineStyleProperties['join'] = (string) $join_type : null; + ($head_arrow_type !== null) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null; + ($head_arrow_size !== null) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null; + ($end_arrow_type !== null) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null; + ($end_arrow_size !== null) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null; + } + + /** + * Get Line Style Property. + * + * @param array|string $elements + * + * @return string + */ + public function getLineStyleProperty($elements) + { + return $this->getArrayElementsValue($this->lineStyleProperties, $elements); + } + + /** + * Get Line Style Arrow Excel Width. + * + * @param string $arrow + * + * @return string + */ + public function getLineStyleArrowWidth($arrow) + { + return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w'); + } + + /** + * Get Line Style Arrow Excel Length. + * + * @param string $arrow + * + * @return string + */ + public function getLineStyleArrowLength($arrow) + { + return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len'); + } + + /** + * Set Shadow Properties. + * + * @param int $sh_presets + * @param string $sh_color_value + * @param string $sh_color_type + * @param string $sh_color_alpha + * @param float $sh_blur + * @param int $sh_angle + * @param float $sh_distance + */ + public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) + { + $this->setShadowPresetsProperties((int) $sh_presets) + ->setShadowColor( + $sh_color_value === null ? $this->shadowProperties['color']['value'] : $sh_color_value, + $sh_color_alpha === null ? (int) $this->shadowProperties['color']['alpha'] : $sh_color_alpha, + $sh_color_type === null ? $this->shadowProperties['color']['type'] : $sh_color_type + ) + ->setShadowBlur($sh_blur) + ->setShadowAngle($sh_angle) + ->setShadowDistance($sh_distance); + } + + /** + * Set Shadow Color. + * + * @param int $shadow_presets + * + * @return $this + */ + private function setShadowPresetsProperties($shadow_presets) + { + $this->shadowProperties['presets'] = $shadow_presets; + $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets)); + + return $this; + } + + /** + * Set Shadow Properties from Mapped Values. + * + * @param array $properties_map + * @param mixed &$reference + * + * @return $this + */ + private function setShadowProperiesMapValues(array $properties_map, &$reference = null) + { + $base_reference = $reference; + foreach ($properties_map as $property_key => $property_val) { + if (is_array($property_val)) { + if ($reference === null) { + $reference = &$this->shadowProperties[$property_key]; + } else { + $reference = &$reference[$property_key]; + } + $this->setShadowProperiesMapValues($property_val, $reference); + } else { + if ($base_reference === null) { + $this->shadowProperties[$property_key] = $property_val; + } else { + $reference[$property_key] = $property_val; + } + } + } + + return $this; + } + + /** + * Set Shadow Color. + * + * @param string $color + * @param int $alpha + * @param string $type + * + * @return $this + */ + private function setShadowColor($color, $alpha, $type) + { + $this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type); + + return $this; + } + + /** + * Set Shadow Blur. + * + * @param float $blur + * + * @return $this + */ + private function setShadowBlur($blur) + { + if ($blur !== null) { + $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur); + } + + return $this; + } + + /** + * Set Shadow Angle. + * + * @param int $angle + * + * @return $this + */ + private function setShadowAngle($angle) + { + if ($angle !== null) { + $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle); + } + + return $this; + } + + /** + * Set Shadow Distance. + * + * @param float $distance + * + * @return $this + */ + private function setShadowDistance($distance) + { + if ($distance !== null) { + $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance); + } + + return $this; + } + + /** + * Get Shadow Property. + * + * @param string|string[] $elements + * + * @return null|array|int|string + */ + public function getShadowProperty($elements) + { + return $this->getArrayElementsValue($this->shadowProperties, $elements); + } + + /** + * Set Glow Properties. + * + * @param float $size + * @param string $color_value + * @param int $color_alpha + * @param string $color_type + */ + public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) + { + $this->setGlowSize($size) + ->setGlowColor( + $color_value === null ? $this->glowProperties['color']['value'] : $color_value, + $color_alpha === null ? (int) $this->glowProperties['color']['alpha'] : $color_alpha, + $color_type === null ? $this->glowProperties['color']['type'] : $color_type + ); + } + + /** + * Get Glow Property. + * + * @param array|string $property + * + * @return string + */ + public function getGlowProperty($property) + { + return $this->getArrayElementsValue($this->glowProperties, $property); + } + + /** + * Set Glow Color. + * + * @param float $size + * + * @return $this + */ + private function setGlowSize($size) + { + if ($size !== null) { + $this->glowProperties['size'] = $this->getExcelPointsWidth($size); + } + + return $this; + } + + /** + * Set Glow Color. + * + * @param string $color + * @param int $alpha + * @param string $type + * + * @return $this + */ + private function setGlowColor($color, $alpha, $type) + { + $this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type); + + return $this; + } + + /** + * Set Soft Edges Size. + * + * @param float $size + */ + public function setSoftEdges($size) + { + if ($size !== null) { + $softEdges['size'] = (string) $this->getExcelPointsWidth($size); + } + } + + /** + * Get Soft Edges Size. + * + * @return string + */ + public function getSoftEdgesSize() + { + return $this->softEdges['size']; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Chart.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Chart.php new file mode 100644 index 0000000..59c9ed5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Chart.php @@ -0,0 +1,680 @@ +name = $name; + $this->title = $title; + $this->legend = $legend; + $this->xAxisLabel = $xAxisLabel; + $this->yAxisLabel = $yAxisLabel; + $this->plotArea = $plotArea; + $this->plotVisibleOnly = $plotVisibleOnly; + $this->displayBlanksAs = $displayBlanksAs; + $this->xAxis = $xAxis; + $this->yAxis = $yAxis; + $this->majorGridlines = $majorGridlines; + $this->minorGridlines = $minorGridlines; + } + + /** + * Get Name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get Worksheet. + * + * @return Worksheet + */ + public function getWorksheet() + { + return $this->worksheet; + } + + /** + * Set Worksheet. + * + * @param Worksheet $pValue + * + * @return $this + */ + public function setWorksheet(Worksheet $pValue = null) + { + $this->worksheet = $pValue; + + return $this; + } + + /** + * Get Title. + * + * @return Title + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set Title. + * + * @param Title $title + * + * @return $this + */ + public function setTitle(Title $title) + { + $this->title = $title; + + return $this; + } + + /** + * Get Legend. + * + * @return Legend + */ + public function getLegend() + { + return $this->legend; + } + + /** + * Set Legend. + * + * @param Legend $legend + * + * @return $this + */ + public function setLegend(Legend $legend) + { + $this->legend = $legend; + + return $this; + } + + /** + * Get X-Axis Label. + * + * @return Title + */ + public function getXAxisLabel() + { + return $this->xAxisLabel; + } + + /** + * Set X-Axis Label. + * + * @param Title $label + * + * @return $this + */ + public function setXAxisLabel(Title $label) + { + $this->xAxisLabel = $label; + + return $this; + } + + /** + * Get Y-Axis Label. + * + * @return Title + */ + public function getYAxisLabel() + { + return $this->yAxisLabel; + } + + /** + * Set Y-Axis Label. + * + * @param Title $label + * + * @return $this + */ + public function setYAxisLabel(Title $label) + { + $this->yAxisLabel = $label; + + return $this; + } + + /** + * Get Plot Area. + * + * @return PlotArea + */ + public function getPlotArea() + { + return $this->plotArea; + } + + /** + * Get Plot Visible Only. + * + * @return bool + */ + public function getPlotVisibleOnly() + { + return $this->plotVisibleOnly; + } + + /** + * Set Plot Visible Only. + * + * @param bool $plotVisibleOnly + * + * @return $this + */ + public function setPlotVisibleOnly($plotVisibleOnly) + { + $this->plotVisibleOnly = $plotVisibleOnly; + + return $this; + } + + /** + * Get Display Blanks as. + * + * @return string + */ + public function getDisplayBlanksAs() + { + return $this->displayBlanksAs; + } + + /** + * Set Display Blanks as. + * + * @param string $displayBlanksAs + * + * @return $this + */ + public function setDisplayBlanksAs($displayBlanksAs) + { + $this->displayBlanksAs = $displayBlanksAs; + + return $this; + } + + /** + * Get yAxis. + * + * @return Axis + */ + public function getChartAxisY() + { + if ($this->yAxis !== null) { + return $this->yAxis; + } + + return new Axis(); + } + + /** + * Get xAxis. + * + * @return Axis + */ + public function getChartAxisX() + { + if ($this->xAxis !== null) { + return $this->xAxis; + } + + return new Axis(); + } + + /** + * Get Major Gridlines. + * + * @return GridLines + */ + public function getMajorGridlines() + { + if ($this->majorGridlines !== null) { + return $this->majorGridlines; + } + + return new GridLines(); + } + + /** + * Get Minor Gridlines. + * + * @return GridLines + */ + public function getMinorGridlines() + { + if ($this->minorGridlines !== null) { + return $this->minorGridlines; + } + + return new GridLines(); + } + + /** + * Set the Top Left position for the chart. + * + * @param string $cell + * @param int $xOffset + * @param int $yOffset + * + * @return $this + */ + public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null) + { + $this->topLeftCellRef = $cell; + if ($xOffset !== null) { + $this->setTopLeftXOffset($xOffset); + } + if ($yOffset !== null) { + $this->setTopLeftYOffset($yOffset); + } + + return $this; + } + + /** + * Get the top left position of the chart. + * + * @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell + */ + public function getTopLeftPosition() + { + return [ + 'cell' => $this->topLeftCellRef, + 'xOffset' => $this->topLeftXOffset, + 'yOffset' => $this->topLeftYOffset, + ]; + } + + /** + * Get the cell address where the top left of the chart is fixed. + * + * @return string + */ + public function getTopLeftCell() + { + return $this->topLeftCellRef; + } + + /** + * Set the Top Left cell position for the chart. + * + * @param string $cell + * + * @return $this + */ + public function setTopLeftCell($cell) + { + $this->topLeftCellRef = $cell; + + return $this; + } + + /** + * Set the offset position within the Top Left cell for the chart. + * + * @param int $xOffset + * @param int $yOffset + * + * @return $this + */ + public function setTopLeftOffset($xOffset, $yOffset) + { + if ($xOffset !== null) { + $this->setTopLeftXOffset($xOffset); + } + + if ($yOffset !== null) { + $this->setTopLeftYOffset($yOffset); + } + + return $this; + } + + /** + * Get the offset position within the Top Left cell for the chart. + * + * @return int[] + */ + public function getTopLeftOffset() + { + return [ + 'X' => $this->topLeftXOffset, + 'Y' => $this->topLeftYOffset, + ]; + } + + public function setTopLeftXOffset($xOffset) + { + $this->topLeftXOffset = $xOffset; + + return $this; + } + + public function getTopLeftXOffset() + { + return $this->topLeftXOffset; + } + + public function setTopLeftYOffset($yOffset) + { + $this->topLeftYOffset = $yOffset; + + return $this; + } + + public function getTopLeftYOffset() + { + return $this->topLeftYOffset; + } + + /** + * Set the Bottom Right position of the chart. + * + * @param string $cell + * @param int $xOffset + * @param int $yOffset + * + * @return $this + */ + public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null) + { + $this->bottomRightCellRef = $cell; + if ($xOffset !== null) { + $this->setBottomRightXOffset($xOffset); + } + if ($yOffset !== null) { + $this->setBottomRightYOffset($yOffset); + } + + return $this; + } + + /** + * Get the bottom right position of the chart. + * + * @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell + */ + public function getBottomRightPosition() + { + return [ + 'cell' => $this->bottomRightCellRef, + 'xOffset' => $this->bottomRightXOffset, + 'yOffset' => $this->bottomRightYOffset, + ]; + } + + public function setBottomRightCell($cell) + { + $this->bottomRightCellRef = $cell; + + return $this; + } + + /** + * Get the cell address where the bottom right of the chart is fixed. + * + * @return string + */ + public function getBottomRightCell() + { + return $this->bottomRightCellRef; + } + + /** + * Set the offset position within the Bottom Right cell for the chart. + * + * @param int $xOffset + * @param int $yOffset + * + * @return $this + */ + public function setBottomRightOffset($xOffset, $yOffset) + { + if ($xOffset !== null) { + $this->setBottomRightXOffset($xOffset); + } + + if ($yOffset !== null) { + $this->setBottomRightYOffset($yOffset); + } + + return $this; + } + + /** + * Get the offset position within the Bottom Right cell for the chart. + * + * @return int[] + */ + public function getBottomRightOffset() + { + return [ + 'X' => $this->bottomRightXOffset, + 'Y' => $this->bottomRightYOffset, + ]; + } + + public function setBottomRightXOffset($xOffset) + { + $this->bottomRightXOffset = $xOffset; + + return $this; + } + + public function getBottomRightXOffset() + { + return $this->bottomRightXOffset; + } + + public function setBottomRightYOffset($yOffset) + { + $this->bottomRightYOffset = $yOffset; + + return $this; + } + + public function getBottomRightYOffset() + { + return $this->bottomRightYOffset; + } + + public function refresh() + { + if ($this->worksheet !== null) { + $this->plotArea->refresh($this->worksheet); + } + } + + /** + * Render the chart to given file (or stream). + * + * @param string $outputDestination Name of the file render to + * + * @return bool true on success + */ + public function render($outputDestination = null) + { + if ($outputDestination == 'php://output') { + $outputDestination = null; + } + + $libraryName = Settings::getChartRenderer(); + if ($libraryName === null) { + return false; + } + + // Ensure that data series values are up-to-date before we render + $this->refresh(); + + $renderer = new $libraryName($this); + + return $renderer->render($outputDestination); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeries.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeries.php new file mode 100644 index 0000000..c20efab --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeries.php @@ -0,0 +1,390 @@ +plotType = $plotType; + $this->plotGrouping = $plotGrouping; + $this->plotOrder = $plotOrder; + $keys = array_keys($plotValues); + $this->plotValues = $plotValues; + if ((count($plotLabel) == 0) || ($plotLabel[$keys[0]] === null)) { + $plotLabel[$keys[0]] = new DataSeriesValues(); + } + $this->plotLabel = $plotLabel; + + if ((count($plotCategory) == 0) || ($plotCategory[$keys[0]] === null)) { + $plotCategory[$keys[0]] = new DataSeriesValues(); + } + $this->plotCategory = $plotCategory; + + $this->smoothLine = $smoothLine; + $this->plotStyle = $plotStyle; + + if ($plotDirection === null) { + $plotDirection = self::DIRECTION_COL; + } + $this->plotDirection = $plotDirection; + } + + /** + * Get Plot Type. + * + * @return string + */ + public function getPlotType() + { + return $this->plotType; + } + + /** + * Set Plot Type. + * + * @param string $plotType + * + * @return $this + */ + public function setPlotType($plotType) + { + $this->plotType = $plotType; + + return $this; + } + + /** + * Get Plot Grouping Type. + * + * @return string + */ + public function getPlotGrouping() + { + return $this->plotGrouping; + } + + /** + * Set Plot Grouping Type. + * + * @param string $groupingType + * + * @return $this + */ + public function setPlotGrouping($groupingType) + { + $this->plotGrouping = $groupingType; + + return $this; + } + + /** + * Get Plot Direction. + * + * @return string + */ + public function getPlotDirection() + { + return $this->plotDirection; + } + + /** + * Set Plot Direction. + * + * @param string $plotDirection + * + * @return $this + */ + public function setPlotDirection($plotDirection) + { + $this->plotDirection = $plotDirection; + + return $this; + } + + /** + * Get Plot Order. + * + * @return int[] + */ + public function getPlotOrder() + { + return $this->plotOrder; + } + + /** + * Get Plot Labels. + * + * @return array of DataSeriesValues + */ + public function getPlotLabels() + { + return $this->plotLabel; + } + + /** + * Get Plot Label by Index. + * + * @param mixed $index + * + * @return DataSeriesValues + */ + public function getPlotLabelByIndex($index) + { + $keys = array_keys($this->plotLabel); + if (in_array($index, $keys)) { + return $this->plotLabel[$index]; + } elseif (isset($keys[$index])) { + return $this->plotLabel[$keys[$index]]; + } + + return false; + } + + /** + * Get Plot Categories. + * + * @return array of DataSeriesValues + */ + public function getPlotCategories() + { + return $this->plotCategory; + } + + /** + * Get Plot Category by Index. + * + * @param mixed $index + * + * @return DataSeriesValues + */ + public function getPlotCategoryByIndex($index) + { + $keys = array_keys($this->plotCategory); + if (in_array($index, $keys)) { + return $this->plotCategory[$index]; + } elseif (isset($keys[$index])) { + return $this->plotCategory[$keys[$index]]; + } + + return false; + } + + /** + * Get Plot Style. + * + * @return null|string + */ + public function getPlotStyle() + { + return $this->plotStyle; + } + + /** + * Set Plot Style. + * + * @param null|string $plotStyle + * + * @return $this + */ + public function setPlotStyle($plotStyle) + { + $this->plotStyle = $plotStyle; + + return $this; + } + + /** + * Get Plot Values. + * + * @return array of DataSeriesValues + */ + public function getPlotValues() + { + return $this->plotValues; + } + + /** + * Get Plot Values by Index. + * + * @param mixed $index + * + * @return DataSeriesValues + */ + public function getPlotValuesByIndex($index) + { + $keys = array_keys($this->plotValues); + if (in_array($index, $keys)) { + return $this->plotValues[$index]; + } elseif (isset($keys[$index])) { + return $this->plotValues[$keys[$index]]; + } + + return false; + } + + /** + * Get Number of Plot Series. + * + * @return int + */ + public function getPlotSeriesCount() + { + return count($this->plotValues); + } + + /** + * Get Smooth Line. + * + * @return bool + */ + public function getSmoothLine() + { + return $this->smoothLine; + } + + /** + * Set Smooth Line. + * + * @param bool $smoothLine + * + * @return $this + */ + public function setSmoothLine($smoothLine) + { + $this->smoothLine = $smoothLine; + + return $this; + } + + public function refresh(Worksheet $worksheet) + { + foreach ($this->plotValues as $plotValues) { + if ($plotValues !== null) { + $plotValues->refresh($worksheet, true); + } + } + foreach ($this->plotLabel as $plotValues) { + if ($plotValues !== null) { + $plotValues->refresh($worksheet, true); + } + } + foreach ($this->plotCategory as $plotValues) { + if ($plotValues !== null) { + $plotValues->refresh($worksheet, false); + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php new file mode 100644 index 0000000..ec40cb8 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php @@ -0,0 +1,401 @@ +setDataType($dataType); + $this->dataSource = $dataSource; + $this->formatCode = $formatCode; + $this->pointCount = $pointCount; + $this->dataValues = $dataValues; + $this->pointMarker = $marker; + $this->fillColor = $fillColor; + } + + /** + * Get Series Data Type. + * + * @return string + */ + public function getDataType() + { + return $this->dataType; + } + + /** + * Set Series Data Type. + * + * @param string $dataType Datatype of this data series + * Typical values are: + * DataSeriesValues::DATASERIES_TYPE_STRING + * Normally used for axis point values + * DataSeriesValues::DATASERIES_TYPE_NUMBER + * Normally used for chart data values + * + * @throws Exception + * + * @return $this + */ + public function setDataType($dataType) + { + if (!in_array($dataType, self::$dataTypeValues)) { + throw new Exception('Invalid datatype for chart data series values'); + } + $this->dataType = $dataType; + + return $this; + } + + /** + * Get Series Data Source (formula). + * + * @return string + */ + public function getDataSource() + { + return $this->dataSource; + } + + /** + * Set Series Data Source (formula). + * + * @param string $dataSource + * + * @return $this + */ + public function setDataSource($dataSource) + { + $this->dataSource = $dataSource; + + return $this; + } + + /** + * Get Point Marker. + * + * @return string + */ + public function getPointMarker() + { + return $this->pointMarker; + } + + /** + * Set Point Marker. + * + * @param string $marker + * + * @return $this + */ + public function setPointMarker($marker) + { + $this->pointMarker = $marker; + + return $this; + } + + /** + * Get Series Format Code. + * + * @return string + */ + public function getFormatCode() + { + return $this->formatCode; + } + + /** + * Set Series Format Code. + * + * @param string $formatCode + * + * @return $this + */ + public function setFormatCode($formatCode) + { + $this->formatCode = $formatCode; + + return $this; + } + + /** + * Get Series Point Count. + * + * @return int + */ + public function getPointCount() + { + return $this->pointCount; + } + + /** + * Get fill color. + * + * @return string|string[] HEX color or array with HEX colors + */ + public function getFillColor() + { + return $this->fillColor; + } + + /** + * Set fill color for series. + * + * @param string|string[] $color HEX color or array with HEX colors + * + * @return DataSeriesValues + */ + public function setFillColor($color) + { + if (is_array($color)) { + foreach ($color as $colorValue) { + $this->validateColor($colorValue); + } + } else { + $this->validateColor($color); + } + $this->fillColor = $color; + + return $this; + } + + /** + * Method for validating hex color. + * + * @param string $color value for color + * + * @throws \Exception thrown if color is invalid + * + * @return bool true if validation was successful + */ + private function validateColor($color) + { + if (!preg_match('/^[a-f0-9]{6}$/i', $color)) { + throw new Exception(sprintf('Invalid hex color for chart series (color: "%s")', $color)); + } + + return true; + } + + /** + * Get line width for series. + * + * @return int + */ + public function getLineWidth() + { + return $this->lineWidth; + } + + /** + * Set line width for the series. + * + * @param int $width + * + * @return $this + */ + public function setLineWidth($width) + { + $minWidth = 12700; + $this->lineWidth = max($minWidth, $width); + + return $this; + } + + /** + * Identify if the Data Series is a multi-level or a simple series. + * + * @return null|bool + */ + public function isMultiLevelSeries() + { + if (count($this->dataValues) > 0) { + return is_array(array_values($this->dataValues)[0]); + } + + return null; + } + + /** + * Return the level count of a multi-level Data Series. + * + * @return int + */ + public function multiLevelCount() + { + $levelCount = 0; + foreach ($this->dataValues as $dataValueSet) { + $levelCount = max($levelCount, count($dataValueSet)); + } + + return $levelCount; + } + + /** + * Get Series Data Values. + * + * @return array of mixed + */ + public function getDataValues() + { + return $this->dataValues; + } + + /** + * Get the first Series Data value. + * + * @return mixed + */ + public function getDataValue() + { + $count = count($this->dataValues); + if ($count == 0) { + return null; + } elseif ($count == 1) { + return $this->dataValues[0]; + } + + return $this->dataValues; + } + + /** + * Set Series Data Values. + * + * @param array $dataValues + * + * @return $this + */ + public function setDataValues($dataValues) + { + $this->dataValues = Functions::flattenArray($dataValues); + $this->pointCount = count($dataValues); + + return $this; + } + + public function refresh(Worksheet $worksheet, $flatten = true) + { + if ($this->dataSource !== null) { + $calcEngine = Calculation::getInstance($worksheet->getParent()); + $newDataValues = Calculation::unwrapResult( + $calcEngine->_calculateFormulaValue( + '=' . $this->dataSource, + null, + $worksheet->getCell('A1') + ) + ); + if ($flatten) { + $this->dataValues = Functions::flattenArray($newDataValues); + foreach ($this->dataValues as &$dataValue) { + if (is_string($dataValue) && !empty($dataValue) && $dataValue[0] == '#') { + $dataValue = 0.0; + } + } + unset($dataValue); + } else { + [$worksheet, $cellRange] = Worksheet::extractSheetTitle($this->dataSource, true); + $dimensions = Coordinate::rangeDimension(str_replace('$', '', $cellRange)); + if (($dimensions[0] == 1) || ($dimensions[1] == 1)) { + $this->dataValues = Functions::flattenArray($newDataValues); + } else { + $newArray = array_values(array_shift($newDataValues)); + foreach ($newArray as $i => $newDataSet) { + $newArray[$i] = [$newDataSet]; + } + + foreach ($newDataValues as $newDataSet) { + $i = 0; + foreach ($newDataSet as $newDataVal) { + array_unshift($newArray[$i++], $newDataVal); + } + } + $this->dataValues = $newArray; + } + } + $this->pointCount = count($this->dataValues); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Exception.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Exception.php new file mode 100644 index 0000000..3f95b59 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Exception.php @@ -0,0 +1,9 @@ + [ + 'type' => self::EXCEL_COLOR_TYPE_STANDARD, + 'value' => null, + 'alpha' => 0, + ], + 'style' => [ + 'width' => '9525', + 'compound' => self::LINE_STYLE_COMPOUND_SIMPLE, + 'dash' => self::LINE_STYLE_DASH_SOLID, + 'cap' => self::LINE_STYLE_CAP_FLAT, + 'join' => self::LINE_STYLE_JOIN_BEVEL, + 'arrow' => [ + 'head' => [ + 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW, + 'size' => self::LINE_STYLE_ARROW_SIZE_5, + ], + 'end' => [ + 'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW, + 'size' => self::LINE_STYLE_ARROW_SIZE_8, + ], + ], + ], + ]; + + private $shadowProperties = [ + 'presets' => self::SHADOW_PRESETS_NOSHADOW, + 'effect' => null, + 'color' => [ + 'type' => self::EXCEL_COLOR_TYPE_STANDARD, + 'value' => 'black', + 'alpha' => 85, + ], + 'size' => [ + 'sx' => null, + 'sy' => null, + 'kx' => null, + ], + 'blur' => null, + 'direction' => null, + 'distance' => null, + 'algn' => null, + 'rotWithShape' => null, + ]; + + private $glowProperties = [ + 'size' => null, + 'color' => [ + 'type' => self::EXCEL_COLOR_TYPE_STANDARD, + 'value' => 'black', + 'alpha' => 40, + ], + ]; + + private $softEdges = [ + 'size' => null, + ]; + + /** + * Get Object State. + * + * @return bool + */ + public function getObjectState() + { + return $this->objectState; + } + + /** + * Change Object State to True. + * + * @return $this + */ + private function activateObject() + { + $this->objectState = true; + + return $this; + } + + /** + * Set Line Color Properties. + * + * @param string $value + * @param int $alpha + * @param string $type + */ + public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD) + { + $this->activateObject() + ->lineProperties['color'] = $this->setColorProperties( + $value, + $alpha, + $type + ); + } + + /** + * Set Line Color Properties. + * + * @param float $line_width + * @param string $compound_type + * @param string $dash_type + * @param string $cap_type + * @param string $join_type + * @param string $head_arrow_type + * @param string $head_arrow_size + * @param string $end_arrow_type + * @param string $end_arrow_size + */ + public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) + { + $this->activateObject(); + ($line_width !== null) + ? $this->lineProperties['style']['width'] = $this->getExcelPointsWidth((float) $line_width) + : null; + ($compound_type !== null) + ? $this->lineProperties['style']['compound'] = (string) $compound_type + : null; + ($dash_type !== null) + ? $this->lineProperties['style']['dash'] = (string) $dash_type + : null; + ($cap_type !== null) + ? $this->lineProperties['style']['cap'] = (string) $cap_type + : null; + ($join_type !== null) + ? $this->lineProperties['style']['join'] = (string) $join_type + : null; + ($head_arrow_type !== null) + ? $this->lineProperties['style']['arrow']['head']['type'] = (string) $head_arrow_type + : null; + ($head_arrow_size !== null) + ? $this->lineProperties['style']['arrow']['head']['size'] = (string) $head_arrow_size + : null; + ($end_arrow_type !== null) + ? $this->lineProperties['style']['arrow']['end']['type'] = (string) $end_arrow_type + : null; + ($end_arrow_size !== null) + ? $this->lineProperties['style']['arrow']['end']['size'] = (string) $end_arrow_size + : null; + } + + /** + * Get Line Color Property. + * + * @param string $parameter + * + * @return string + */ + public function getLineColorProperty($parameter) + { + return $this->lineProperties['color'][$parameter]; + } + + /** + * Get Line Style Property. + * + * @param array|string $elements + * + * @return string + */ + public function getLineStyleProperty($elements) + { + return $this->getArrayElementsValue($this->lineProperties['style'], $elements); + } + + /** + * Set Glow Properties. + * + * @param float $size + * @param string $color_value + * @param int $color_alpha + * @param string $color_type + */ + public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) + { + $this + ->activateObject() + ->setGlowSize($size) + ->setGlowColor($color_value, $color_alpha, $color_type); + } + + /** + * Get Glow Color Property. + * + * @param string $property + * + * @return string + */ + public function getGlowColor($property) + { + return $this->glowProperties['color'][$property]; + } + + /** + * Get Glow Size. + * + * @return string + */ + public function getGlowSize() + { + return $this->glowProperties['size']; + } + + /** + * Set Glow Size. + * + * @param float $size + * + * @return $this + */ + private function setGlowSize($size) + { + $this->glowProperties['size'] = $this->getExcelPointsWidth((float) $size); + + return $this; + } + + /** + * Set Glow Color. + * + * @param string $color + * @param int $alpha + * @param string $type + * + * @return $this + */ + private function setGlowColor($color, $alpha, $type) + { + if ($color !== null) { + $this->glowProperties['color']['value'] = (string) $color; + } + if ($alpha !== null) { + $this->glowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha); + } + if ($type !== null) { + $this->glowProperties['color']['type'] = (string) $type; + } + + return $this; + } + + /** + * Get Line Style Arrow Parameters. + * + * @param string $arrow_selector + * @param string $property_selector + * + * @return string + */ + public function getLineStyleArrowParameters($arrow_selector, $property_selector) + { + return $this->getLineStyleArrowSize($this->lineProperties['style']['arrow'][$arrow_selector]['size'], $property_selector); + } + + /** + * Set Shadow Properties. + * + * @param int $sh_presets + * @param string $sh_color_value + * @param string $sh_color_type + * @param int $sh_color_alpha + * @param string $sh_blur + * @param int $sh_angle + * @param float $sh_distance + */ + public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null) + { + $this->activateObject() + ->setShadowPresetsProperties((int) $sh_presets) + ->setShadowColor( + $sh_color_value === null ? $this->shadowProperties['color']['value'] : $sh_color_value, + $sh_color_alpha === null ? (int) $this->shadowProperties['color']['alpha'] : $this->getTrueAlpha($sh_color_alpha), + $sh_color_type === null ? $this->shadowProperties['color']['type'] : $sh_color_type + ) + ->setShadowBlur($sh_blur) + ->setShadowAngle($sh_angle) + ->setShadowDistance($sh_distance); + } + + /** + * Set Shadow Presets Properties. + * + * @param int $shadow_presets + * + * @return $this + */ + private function setShadowPresetsProperties($shadow_presets) + { + $this->shadowProperties['presets'] = $shadow_presets; + $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets)); + + return $this; + } + + /** + * Set Shadow Properties Values. + * + * @param array $properties_map + * @param mixed &$reference + * + * @return $this + */ + private function setShadowProperiesMapValues(array $properties_map, &$reference = null) + { + $base_reference = $reference; + foreach ($properties_map as $property_key => $property_val) { + if (is_array($property_val)) { + if ($reference === null) { + $reference = &$this->shadowProperties[$property_key]; + } else { + $reference = &$reference[$property_key]; + } + $this->setShadowProperiesMapValues($property_val, $reference); + } else { + if ($base_reference === null) { + $this->shadowProperties[$property_key] = $property_val; + } else { + $reference[$property_key] = $property_val; + } + } + } + + return $this; + } + + /** + * Set Shadow Color. + * + * @param string $color + * @param int $alpha + * @param string $type + * + * @return $this + */ + private function setShadowColor($color, $alpha, $type) + { + if ($color !== null) { + $this->shadowProperties['color']['value'] = (string) $color; + } + if ($alpha !== null) { + $this->shadowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha); + } + if ($type !== null) { + $this->shadowProperties['color']['type'] = (string) $type; + } + + return $this; + } + + /** + * Set Shadow Blur. + * + * @param float $blur + * + * @return $this + */ + private function setShadowBlur($blur) + { + if ($blur !== null) { + $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur); + } + + return $this; + } + + /** + * Set Shadow Angle. + * + * @param int $angle + * + * @return $this + */ + private function setShadowAngle($angle) + { + if ($angle !== null) { + $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle); + } + + return $this; + } + + /** + * Set Shadow Distance. + * + * @param float $distance + * + * @return $this + */ + private function setShadowDistance($distance) + { + if ($distance !== null) { + $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance); + } + + return $this; + } + + /** + * Get Shadow Property. + * + * @param string|string[] $elements + * + * @return string + */ + public function getShadowProperty($elements) + { + return $this->getArrayElementsValue($this->shadowProperties, $elements); + } + + /** + * Set Soft Edges Size. + * + * @param float $size + */ + public function setSoftEdgesSize($size) + { + if ($size !== null) { + $this->activateObject(); + $this->softEdges['size'] = (string) $this->getExcelPointsWidth($size); + } + } + + /** + * Get Soft Edges Size. + * + * @return string + */ + public function getSoftEdgesSize() + { + return $this->softEdges['size']; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Layout.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Layout.php new file mode 100644 index 0000000..3e989c6 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Layout.php @@ -0,0 +1,483 @@ +layoutTarget = $layout['layoutTarget']; + } + if (isset($layout['xMode'])) { + $this->xMode = $layout['xMode']; + } + if (isset($layout['yMode'])) { + $this->yMode = $layout['yMode']; + } + if (isset($layout['x'])) { + $this->xPos = (float) $layout['x']; + } + if (isset($layout['y'])) { + $this->yPos = (float) $layout['y']; + } + if (isset($layout['w'])) { + $this->width = (float) $layout['w']; + } + if (isset($layout['h'])) { + $this->height = (float) $layout['h']; + } + } + + /** + * Get Layout Target. + * + * @return string + */ + public function getLayoutTarget() + { + return $this->layoutTarget; + } + + /** + * Set Layout Target. + * + * @param string $value + * + * @return $this + */ + public function setLayoutTarget($value) + { + $this->layoutTarget = $value; + + return $this; + } + + /** + * Get X-Mode. + * + * @return string + */ + public function getXMode() + { + return $this->xMode; + } + + /** + * Set X-Mode. + * + * @param string $value + * + * @return $this + */ + public function setXMode($value) + { + $this->xMode = (string) $value; + + return $this; + } + + /** + * Get Y-Mode. + * + * @return string + */ + public function getYMode() + { + return $this->yMode; + } + + /** + * Set Y-Mode. + * + * @param string $value + * + * @return $this + */ + public function setYMode($value) + { + $this->yMode = (string) $value; + + return $this; + } + + /** + * Get X-Position. + * + * @return number + */ + public function getXPosition() + { + return $this->xPos; + } + + /** + * Set X-Position. + * + * @param float $value + * + * @return $this + */ + public function setXPosition($value) + { + $this->xPos = (float) $value; + + return $this; + } + + /** + * Get Y-Position. + * + * @return number + */ + public function getYPosition() + { + return $this->yPos; + } + + /** + * Set Y-Position. + * + * @param float $value + * + * @return $this + */ + public function setYPosition($value) + { + $this->yPos = (float) $value; + + return $this; + } + + /** + * Get Width. + * + * @return number + */ + public function getWidth() + { + return $this->width; + } + + /** + * Set Width. + * + * @param float $value + * + * @return $this + */ + public function setWidth($value) + { + $this->width = $value; + + return $this; + } + + /** + * Get Height. + * + * @return number + */ + public function getHeight() + { + return $this->height; + } + + /** + * Set Height. + * + * @param float $value + * + * @return $this + */ + public function setHeight($value) + { + $this->height = $value; + + return $this; + } + + /** + * Get show legend key. + * + * @return bool + */ + public function getShowLegendKey() + { + return $this->showLegendKey; + } + + /** + * Set show legend key + * Specifies that legend keys should be shown in data labels. + * + * @param bool $value Show legend key + * + * @return $this + */ + public function setShowLegendKey($value) + { + $this->showLegendKey = $value; + + return $this; + } + + /** + * Get show value. + * + * @return bool + */ + public function getShowVal() + { + return $this->showVal; + } + + /** + * Set show val + * Specifies that the value should be shown in data labels. + * + * @param bool $value Show val + * + * @return $this + */ + public function setShowVal($value) + { + $this->showVal = $value; + + return $this; + } + + /** + * Get show category name. + * + * @return bool + */ + public function getShowCatName() + { + return $this->showCatName; + } + + /** + * Set show cat name + * Specifies that the category name should be shown in data labels. + * + * @param bool $value Show cat name + * + * @return $this + */ + public function setShowCatName($value) + { + $this->showCatName = $value; + + return $this; + } + + /** + * Get show data series name. + * + * @return bool + */ + public function getShowSerName() + { + return $this->showSerName; + } + + /** + * Set show ser name + * Specifies that the series name should be shown in data labels. + * + * @param bool $value Show series name + * + * @return $this + */ + public function setShowSerName($value) + { + $this->showSerName = $value; + + return $this; + } + + /** + * Get show percentage. + * + * @return bool + */ + public function getShowPercent() + { + return $this->showPercent; + } + + /** + * Set show percentage + * Specifies that the percentage should be shown in data labels. + * + * @param bool $value Show percentage + * + * @return $this + */ + public function setShowPercent($value) + { + $this->showPercent = $value; + + return $this; + } + + /** + * Get show bubble size. + * + * @return bool + */ + public function getShowBubbleSize() + { + return $this->showBubbleSize; + } + + /** + * Set show bubble size + * Specifies that the bubble size should be shown in data labels. + * + * @param bool $value Show bubble size + * + * @return $this + */ + public function setShowBubbleSize($value) + { + $this->showBubbleSize = $value; + + return $this; + } + + /** + * Get show leader lines. + * + * @return bool + */ + public function getShowLeaderLines() + { + return $this->showLeaderLines; + } + + /** + * Set show leader lines + * Specifies that leader lines should be shown in data labels. + * + * @param bool $value Show leader lines + * + * @return $this + */ + public function setShowLeaderLines($value) + { + $this->showLeaderLines = $value; + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Legend.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Legend.php new file mode 100644 index 0000000..d077626 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Legend.php @@ -0,0 +1,158 @@ + self::POSITION_BOTTOM, + self::XL_LEGEND_POSITION_CORNER => self::POSITION_TOPRIGHT, + self::XL_LEGEND_POSITION_CUSTOM => '??', + self::XL_LEGEND_POSITION_LEFT => self::POSITION_LEFT, + self::XL_LEGEND_POSITION_RIGHT => self::POSITION_RIGHT, + self::XL_LEGEND_POSITION_TOP => self::POSITION_TOP, + ]; + + /** + * Legend position. + * + * @var string + */ + private $position = self::POSITION_RIGHT; + + /** + * Allow overlay of other elements? + * + * @var bool + */ + private $overlay = true; + + /** + * Legend Layout. + * + * @var Layout + */ + private $layout; + + /** + * Create a new Legend. + * + * @param string $position + * @param null|Layout $layout + * @param bool $overlay + */ + public function __construct($position = self::POSITION_RIGHT, Layout $layout = null, $overlay = false) + { + $this->setPosition($position); + $this->layout = $layout; + $this->setOverlay($overlay); + } + + /** + * Get legend position as an excel string value. + * + * @return string + */ + public function getPosition() + { + return $this->position; + } + + /** + * Get legend position using an excel string value. + * + * @param string $position see self::POSITION_* + * + * @return bool + */ + public function setPosition($position) + { + if (!in_array($position, self::$positionXLref)) { + return false; + } + + $this->position = $position; + + return true; + } + + /** + * Get legend position as an Excel internal numeric value. + * + * @return int + */ + public function getPositionXL() + { + return array_search($this->position, self::$positionXLref); + } + + /** + * Set legend position using an Excel internal numeric value. + * + * @param int $positionXL see self::XL_LEGEND_POSITION_* + * + * @return bool + */ + public function setPositionXL($positionXL) + { + if (!isset(self::$positionXLref[$positionXL])) { + return false; + } + + $this->position = self::$positionXLref[$positionXL]; + + return true; + } + + /** + * Get allow overlay of other elements? + * + * @return bool + */ + public function getOverlay() + { + return $this->overlay; + } + + /** + * Set allow overlay of other elements? + * + * @param bool $overlay + * + * @return bool + */ + public function setOverlay($overlay) + { + if (!is_bool($overlay)) { + return false; + } + + $this->overlay = $overlay; + + return true; + } + + /** + * Get Layout. + * + * @return Layout + */ + public function getLayout() + { + return $this->layout; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/PlotArea.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/PlotArea.php new file mode 100644 index 0000000..9da4aa3 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/PlotArea.php @@ -0,0 +1,112 @@ +layout = $layout; + $this->plotSeries = $plotSeries; + } + + /** + * Get Layout. + * + * @return Layout + */ + public function getLayout() + { + return $this->layout; + } + + /** + * Get Number of Plot Groups. + * + * @return array of DataSeries + */ + public function getPlotGroupCount() + { + return count($this->plotSeries); + } + + /** + * Get Number of Plot Series. + * + * @return int + */ + public function getPlotSeriesCount() + { + $seriesCount = 0; + foreach ($this->plotSeries as $plot) { + $seriesCount += $plot->getPlotSeriesCount(); + } + + return $seriesCount; + } + + /** + * Get Plot Series. + * + * @return array of DataSeries + */ + public function getPlotGroup() + { + return $this->plotSeries; + } + + /** + * Get Plot Series by Index. + * + * @param mixed $index + * + * @return DataSeries + */ + public function getPlotGroupByIndex($index) + { + return $this->plotSeries[$index]; + } + + /** + * Set Plot Series. + * + * @param DataSeries[] $plotSeries + * + * @return $this + */ + public function setPlotSeries(array $plotSeries) + { + $this->plotSeries = $plotSeries; + + return $this; + } + + public function refresh(Worksheet $worksheet) + { + foreach ($this->plotSeries as $plotSeries) { + $plotSeries->refresh($worksheet); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Properties.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Properties.php new file mode 100644 index 0000000..98095f0 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Properties.php @@ -0,0 +1,369 @@ + (string) $type, + 'value' => (string) $color, + 'alpha' => (string) $this->getTrueAlpha($alpha), + ]; + } + + protected function getLineStyleArrowSize($array_selector, $array_kay_selector) + { + $sizes = [ + 1 => ['w' => 'sm', 'len' => 'sm'], + 2 => ['w' => 'sm', 'len' => 'med'], + 3 => ['w' => 'sm', 'len' => 'lg'], + 4 => ['w' => 'med', 'len' => 'sm'], + 5 => ['w' => 'med', 'len' => 'med'], + 6 => ['w' => 'med', 'len' => 'lg'], + 7 => ['w' => 'lg', 'len' => 'sm'], + 8 => ['w' => 'lg', 'len' => 'med'], + 9 => ['w' => 'lg', 'len' => 'lg'], + ]; + + return $sizes[$array_selector][$array_kay_selector]; + } + + protected function getShadowPresetsMap($shadow_presets_option) + { + $presets_options = [ + //OUTER + 1 => [ + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '2700000', + 'algn' => 'tl', + 'rotWithShape' => '0', + ], + 2 => [ + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '5400000', + 'algn' => 't', + 'rotWithShape' => '0', + ], + 3 => [ + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '8100000', + 'algn' => 'tr', + 'rotWithShape' => '0', + ], + 4 => [ + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'algn' => 'l', + 'rotWithShape' => '0', + ], + 5 => [ + 'effect' => 'outerShdw', + 'size' => [ + 'sx' => '102000', + 'sy' => '102000', + ], + 'blur' => '63500', + 'distance' => '38100', + 'algn' => 'ctr', + 'rotWithShape' => '0', + ], + 6 => [ + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '10800000', + 'algn' => 'r', + 'rotWithShape' => '0', + ], + 7 => [ + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '18900000', + 'algn' => 'bl', + 'rotWithShape' => '0', + ], + 8 => [ + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '16200000', + 'rotWithShape' => '0', + ], + 9 => [ + 'effect' => 'outerShdw', + 'blur' => '50800', + 'distance' => '38100', + 'direction' => '13500000', + 'algn' => 'br', + 'rotWithShape' => '0', + ], + //INNER + 10 => [ + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '2700000', + ], + 11 => [ + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '5400000', + ], + 12 => [ + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '8100000', + ], + 13 => [ + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + ], + 14 => [ + 'effect' => 'innerShdw', + 'blur' => '114300', + ], + 15 => [ + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '10800000', + ], + 16 => [ + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '18900000', + ], + 17 => [ + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '16200000', + ], + 18 => [ + 'effect' => 'innerShdw', + 'blur' => '63500', + 'distance' => '50800', + 'direction' => '13500000', + ], + //perspective + 19 => [ + 'effect' => 'outerShdw', + 'blur' => '152400', + 'distance' => '317500', + 'size' => [ + 'sx' => '90000', + 'sy' => '-19000', + ], + 'direction' => '5400000', + 'rotWithShape' => '0', + ], + 20 => [ + 'effect' => 'outerShdw', + 'blur' => '76200', + 'direction' => '18900000', + 'size' => [ + 'sy' => '23000', + 'kx' => '-1200000', + ], + 'algn' => 'bl', + 'rotWithShape' => '0', + ], + 21 => [ + 'effect' => 'outerShdw', + 'blur' => '76200', + 'direction' => '13500000', + 'size' => [ + 'sy' => '23000', + 'kx' => '1200000', + ], + 'algn' => 'br', + 'rotWithShape' => '0', + ], + 22 => [ + 'effect' => 'outerShdw', + 'blur' => '76200', + 'distance' => '12700', + 'direction' => '2700000', + 'size' => [ + 'sy' => '-23000', + 'kx' => '-800400', + ], + 'algn' => 'bl', + 'rotWithShape' => '0', + ], + 23 => [ + 'effect' => 'outerShdw', + 'blur' => '76200', + 'distance' => '12700', + 'direction' => '8100000', + 'size' => [ + 'sy' => '-23000', + 'kx' => '800400', + ], + 'algn' => 'br', + 'rotWithShape' => '0', + ], + ]; + + return $presets_options[$shadow_presets_option]; + } + + protected function getArrayElementsValue($properties, $elements) + { + $reference = &$properties; + if (!is_array($elements)) { + return $reference[$elements]; + } + + foreach ($elements as $keys) { + $reference = &$reference[$keys]; + } + + return $reference; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php new file mode 100644 index 0000000..c6fcfbf --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/IRenderer.php @@ -0,0 +1,24 @@ +graph = null; + $this->chart = $chart; + } + + private static function init() + { + static $loaded = false; + if ($loaded) { + return; + } + + \JpGraph\JpGraph::load(); + \JpGraph\JpGraph::module('bar'); + \JpGraph\JpGraph::module('contour'); + \JpGraph\JpGraph::module('line'); + \JpGraph\JpGraph::module('pie'); + \JpGraph\JpGraph::module('pie3d'); + \JpGraph\JpGraph::module('radar'); + \JpGraph\JpGraph::module('regstat'); + \JpGraph\JpGraph::module('scatter'); + \JpGraph\JpGraph::module('stock'); + + self::$markSet = [ + 'diamond' => MARK_DIAMOND, + 'square' => MARK_SQUARE, + 'triangle' => MARK_UTRIANGLE, + 'x' => MARK_X, + 'star' => MARK_STAR, + 'dot' => MARK_FILLEDCIRCLE, + 'dash' => MARK_DTRIANGLE, + 'circle' => MARK_CIRCLE, + 'plus' => MARK_CROSS, + ]; + + $loaded = true; + } + + private function formatPointMarker($seriesPlot, $markerID) + { + $plotMarkKeys = array_keys(self::$markSet); + if ($markerID === null) { + // Use default plot marker (next marker in the series) + self::$plotMark %= count(self::$markSet); + $seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$plotMark++]]); + } elseif ($markerID !== 'none') { + // Use specified plot marker (if it exists) + if (isset(self::$markSet[$markerID])) { + $seriesPlot->mark->SetType(self::$markSet[$markerID]); + } else { + // If the specified plot marker doesn't exist, use default plot marker (next marker in the series) + self::$plotMark %= count(self::$markSet); + $seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$plotMark++]]); + } + } else { + // Hide plot marker + $seriesPlot->mark->Hide(); + } + $seriesPlot->mark->SetColor(self::$colourSet[self::$plotColour]); + $seriesPlot->mark->SetFillColor(self::$colourSet[self::$plotColour]); + $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]); + + return $seriesPlot; + } + + private function formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '') + { + $datasetLabelFormatCode = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode(); + if ($datasetLabelFormatCode !== null) { + // Retrieve any label formatting code + $datasetLabelFormatCode = stripslashes($datasetLabelFormatCode); + } + + $testCurrentIndex = 0; + foreach ($datasetLabels as $i => $datasetLabel) { + if (is_array($datasetLabel)) { + if ($rotation == 'bar') { + $datasetLabels[$i] = implode(' ', $datasetLabel); + } else { + $datasetLabel = array_reverse($datasetLabel); + $datasetLabels[$i] = implode("\n", $datasetLabel); + } + } else { + // Format labels according to any formatting code + if ($datasetLabelFormatCode !== null) { + $datasetLabels[$i] = NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode); + } + } + ++$testCurrentIndex; + } + + return $datasetLabels; + } + + private function percentageSumCalculation($groupID, $seriesCount) + { + $sumValues = []; + // Adjust our values to a percentage value across all series in the group + for ($i = 0; $i < $seriesCount; ++$i) { + if ($i == 0) { + $sumValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); + } else { + $nextValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); + foreach ($nextValues as $k => $value) { + if (isset($sumValues[$k])) { + $sumValues[$k] += $value; + } else { + $sumValues[$k] = $value; + } + } + } + } + + return $sumValues; + } + + private function percentageAdjustValues($dataValues, $sumValues) + { + foreach ($dataValues as $k => $dataValue) { + $dataValues[$k] = $dataValue / $sumValues[$k] * 100; + } + + return $dataValues; + } + + private function getCaption($captionElement) + { + // Read any caption + $caption = ($captionElement !== null) ? $captionElement->getCaption() : null; + // Test if we have a title caption to display + if ($caption !== null) { + // If we do, it could be a plain string or an array + if (is_array($caption)) { + // Implode an array to a plain string + $caption = implode('', $caption); + } + } + + return $caption; + } + + private function renderTitle() + { + $title = $this->getCaption($this->chart->getTitle()); + if ($title !== null) { + $this->graph->title->Set($title); + } + } + + private function renderLegend() + { + $legend = $this->chart->getLegend(); + if ($legend !== null) { + $legendPosition = $legend->getPosition(); + switch ($legendPosition) { + case 'r': + $this->graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right + $this->graph->legend->SetColumns(1); + + break; + case 'l': + $this->graph->legend->SetPos(0.01, 0.5, 'left', 'center'); // left + $this->graph->legend->SetColumns(1); + + break; + case 't': + $this->graph->legend->SetPos(0.5, 0.01, 'center', 'top'); // top + break; + case 'b': + $this->graph->legend->SetPos(0.5, 0.99, 'center', 'bottom'); // bottom + break; + default: + $this->graph->legend->SetPos(0.01, 0.01, 'right', 'top'); // top-right + $this->graph->legend->SetColumns(1); + + break; + } + } else { + $this->graph->legend->Hide(); + } + } + + private function renderCartesianPlotArea($type = 'textlin') + { + $this->graph = new \Graph(self::$width, self::$height); + $this->graph->SetScale($type); + + $this->renderTitle(); + + // Rotate for bar rather than column chart + $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection(); + $reverse = $rotation == 'bar'; + + $xAxisLabel = $this->chart->getXAxisLabel(); + if ($xAxisLabel !== null) { + $title = $this->getCaption($xAxisLabel); + if ($title !== null) { + $this->graph->xaxis->SetTitle($title, 'center'); + $this->graph->xaxis->title->SetMargin(35); + if ($reverse) { + $this->graph->xaxis->title->SetAngle(90); + $this->graph->xaxis->title->SetMargin(90); + } + } + } + + $yAxisLabel = $this->chart->getYAxisLabel(); + if ($yAxisLabel !== null) { + $title = $this->getCaption($yAxisLabel); + if ($title !== null) { + $this->graph->yaxis->SetTitle($title, 'center'); + if ($reverse) { + $this->graph->yaxis->title->SetAngle(0); + $this->graph->yaxis->title->SetMargin(-55); + } + } + } + } + + private function renderPiePlotArea() + { + $this->graph = new \PieGraph(self::$width, self::$height); + + $this->renderTitle(); + } + + private function renderRadarPlotArea() + { + $this->graph = new \RadarGraph(self::$width, self::$height); + $this->graph->SetScale('lin'); + + $this->renderTitle(); + } + + private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') + { + $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); + + $labelCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount(); + if ($labelCount > 0) { + $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); + $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount); + $this->graph->xaxis->SetTickLabels($datasetLabels); + } + + $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); + $seriesPlots = []; + if ($grouping == 'percentStacked') { + $sumValues = $this->percentageSumCalculation($groupID, $seriesCount); + } + + // Loop through each data series in turn + for ($i = 0; $i < $seriesCount; ++$i) { + $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); + $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); + + if ($grouping == 'percentStacked') { + $dataValues = $this->percentageAdjustValues($dataValues, $sumValues); + } + + // Fill in any missing values in the $dataValues array + $testCurrentIndex = 0; + foreach ($dataValues as $k => $dataValue) { + while ($k != $testCurrentIndex) { + $dataValues[$testCurrentIndex] = null; + ++$testCurrentIndex; + } + ++$testCurrentIndex; + } + + $seriesPlot = new \LinePlot($dataValues); + if ($combination) { + $seriesPlot->SetBarCenter(); + } + + if ($filled) { + $seriesPlot->SetFilled(true); + $seriesPlot->SetColor('black'); + $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]); + } else { + // Set the appropriate plot marker + $this->formatPointMarker($seriesPlot, $marker); + } + $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); + $seriesPlot->SetLegend($dataLabel); + + $seriesPlots[] = $seriesPlot; + } + + if ($grouping == 'standard') { + $groupPlot = $seriesPlots; + } else { + $groupPlot = new \AccLinePlot($seriesPlots); + } + $this->graph->Add($groupPlot); + } + + private function renderPlotBar($groupID, $dimensions = '2d') + { + $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection(); + // Rotate for bar rather than column chart + if (($groupID == 0) && ($rotation == 'bar')) { + $this->graph->Set90AndMargin(); + } + $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); + + $labelCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount(); + if ($labelCount > 0) { + $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); + $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation); + // Rotate for bar rather than column chart + if ($rotation == 'bar') { + $datasetLabels = array_reverse($datasetLabels); + $this->graph->yaxis->SetPos('max'); + $this->graph->yaxis->SetLabelAlign('center', 'top'); + $this->graph->yaxis->SetLabelSide(SIDE_RIGHT); + } + $this->graph->xaxis->SetTickLabels($datasetLabels); + } + + $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); + $seriesPlots = []; + if ($grouping == 'percentStacked') { + $sumValues = $this->percentageSumCalculation($groupID, $seriesCount); + } + + // Loop through each data series in turn + for ($j = 0; $j < $seriesCount; ++$j) { + $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues(); + if ($grouping == 'percentStacked') { + $dataValues = $this->percentageAdjustValues($dataValues, $sumValues); + } + + // Fill in any missing values in the $dataValues array + $testCurrentIndex = 0; + foreach ($dataValues as $k => $dataValue) { + while ($k != $testCurrentIndex) { + $dataValues[$testCurrentIndex] = null; + ++$testCurrentIndex; + } + ++$testCurrentIndex; + } + + // Reverse the $dataValues order for bar rather than column chart + if ($rotation == 'bar') { + $dataValues = array_reverse($dataValues); + } + $seriesPlot = new \BarPlot($dataValues); + $seriesPlot->SetColor('black'); + $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]); + if ($dimensions == '3d') { + $seriesPlot->SetShadow(); + } + if (!$this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) { + $dataLabel = ''; + } else { + $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue(); + } + $seriesPlot->SetLegend($dataLabel); + + $seriesPlots[] = $seriesPlot; + } + // Reverse the plot order for bar rather than column chart + if (($rotation == 'bar') && ($grouping != 'percentStacked')) { + $seriesPlots = array_reverse($seriesPlots); + } + + if ($grouping == 'clustered') { + $groupPlot = new \GroupBarPlot($seriesPlots); + } elseif ($grouping == 'standard') { + $groupPlot = new \GroupBarPlot($seriesPlots); + } else { + $groupPlot = new \AccBarPlot($seriesPlots); + if ($dimensions == '3d') { + $groupPlot->SetShadow(); + } + } + + $this->graph->Add($groupPlot); + } + + private function renderPlotScatter($groupID, $bubble) + { + $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); + $scatterStyle = $bubbleSize = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); + + $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); + $seriesPlots = []; + + // Loop through each data series in turn + for ($i = 0; $i < $seriesCount; ++$i) { + $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); + $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); + + foreach ($dataValuesY as $k => $dataValueY) { + $dataValuesY[$k] = $k; + } + + $seriesPlot = new \ScatterPlot($dataValuesX, $dataValuesY); + if ($scatterStyle == 'lineMarker') { + $seriesPlot->SetLinkPoints(); + $seriesPlot->link->SetColor(self::$colourSet[self::$plotColour]); + } elseif ($scatterStyle == 'smoothMarker') { + $spline = new \Spline($dataValuesY, $dataValuesX); + [$splineDataY, $splineDataX] = $spline->Get(count($dataValuesX) * self::$width / 20); + $lplot = new \LinePlot($splineDataX, $splineDataY); + $lplot->SetColor(self::$colourSet[self::$plotColour]); + + $this->graph->Add($lplot); + } + + if ($bubble) { + $this->formatPointMarker($seriesPlot, 'dot'); + $seriesPlot->mark->SetColor('black'); + $seriesPlot->mark->SetSize($bubbleSize); + } else { + $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); + $this->formatPointMarker($seriesPlot, $marker); + } + $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); + $seriesPlot->SetLegend($dataLabel); + + $this->graph->Add($seriesPlot); + } + } + + private function renderPlotRadar($groupID) + { + $radarStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); + + $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); + $seriesPlots = []; + + // Loop through each data series in turn + for ($i = 0; $i < $seriesCount; ++$i) { + $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); + $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); + $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker(); + + $dataValues = []; + foreach ($dataValuesY as $k => $dataValueY) { + $dataValues[$k] = implode(' ', array_reverse($dataValueY)); + } + $tmp = array_shift($dataValues); + $dataValues[] = $tmp; + $tmp = array_shift($dataValuesX); + $dataValuesX[] = $tmp; + + $this->graph->SetTitles(array_reverse($dataValues)); + + $seriesPlot = new \RadarPlot(array_reverse($dataValuesX)); + + $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue(); + $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]); + if ($radarStyle == 'filled') { + $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour]); + } + $this->formatPointMarker($seriesPlot, $marker); + $seriesPlot->SetLegend($dataLabel); + + $this->graph->Add($seriesPlot); + } + } + + private function renderPlotContour($groupID) + { + $contourStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); + + $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); + $seriesPlots = []; + + $dataValues = []; + // Loop through each data series in turn + for ($i = 0; $i < $seriesCount; ++$i) { + $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues(); + $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues(); + + $dataValues[$i] = $dataValuesX; + } + $seriesPlot = new \ContourPlot($dataValues); + + $this->graph->Add($seriesPlot); + } + + private function renderPlotStock($groupID) + { + $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); + $plotOrder = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder(); + + $dataValues = []; + // Loop through each data series in turn and build the plot arrays + foreach ($plotOrder as $i => $v) { + $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues(); + foreach ($dataValuesX as $j => $dataValueX) { + $dataValues[$plotOrder[$i]][$j] = $dataValueX; + } + } + if (empty($dataValues)) { + return; + } + + $dataValuesPlot = []; + // Flatten the plot arrays to a single dimensional array to work with jpgraph + $jMax = count($dataValues[0]); + for ($j = 0; $j < $jMax; ++$j) { + for ($i = 0; $i < $seriesCount; ++$i) { + $dataValuesPlot[] = $dataValues[$i][$j]; + } + } + + // Set the x-axis labels + $labelCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount(); + if ($labelCount > 0) { + $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); + $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount); + $this->graph->xaxis->SetTickLabels($datasetLabels); + } + + $seriesPlot = new \StockPlot($dataValuesPlot); + $seriesPlot->SetWidth(20); + + $this->graph->Add($seriesPlot); + } + + private function renderAreaChart($groupCount, $dimensions = '2d') + { + $this->renderCartesianPlotArea(); + + for ($i = 0; $i < $groupCount; ++$i) { + $this->renderPlotLine($i, true, false, $dimensions); + } + } + + private function renderLineChart($groupCount, $dimensions = '2d') + { + $this->renderCartesianPlotArea(); + + for ($i = 0; $i < $groupCount; ++$i) { + $this->renderPlotLine($i, false, false, $dimensions); + } + } + + private function renderBarChart($groupCount, $dimensions = '2d') + { + $this->renderCartesianPlotArea(); + + for ($i = 0; $i < $groupCount; ++$i) { + $this->renderPlotBar($i, $dimensions); + } + } + + private function renderScatterChart($groupCount) + { + $this->renderCartesianPlotArea('linlin'); + + for ($i = 0; $i < $groupCount; ++$i) { + $this->renderPlotScatter($i, false); + } + } + + private function renderBubbleChart($groupCount) + { + $this->renderCartesianPlotArea('linlin'); + + for ($i = 0; $i < $groupCount; ++$i) { + $this->renderPlotScatter($i, true); + } + } + + private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false) + { + $this->renderPiePlotArea(); + + $iLimit = ($multiplePlots) ? $groupCount : 1; + for ($groupID = 0; $groupID < $iLimit; ++$groupID) { + $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); + $exploded = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); + $datasetLabels = []; + if ($groupID == 0) { + $labelCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount(); + if ($labelCount > 0) { + $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); + $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount); + } + } + + $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); + $seriesPlots = []; + // For pie charts, we only display the first series: doughnut charts generally display all series + $jLimit = ($multiplePlots) ? $seriesCount : 1; + // Loop through each data series in turn + for ($j = 0; $j < $jLimit; ++$j) { + $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues(); + + // Fill in any missing values in the $dataValues array + $testCurrentIndex = 0; + foreach ($dataValues as $k => $dataValue) { + while ($k != $testCurrentIndex) { + $dataValues[$testCurrentIndex] = null; + ++$testCurrentIndex; + } + ++$testCurrentIndex; + } + + if ($dimensions == '3d') { + $seriesPlot = new \PiePlot3D($dataValues); + } else { + if ($doughnut) { + $seriesPlot = new \PiePlotC($dataValues); + } else { + $seriesPlot = new \PiePlot($dataValues); + } + } + + if ($multiplePlots) { + $seriesPlot->SetSize(($jLimit - $j) / ($jLimit * 4)); + } + + if ($doughnut) { + $seriesPlot->SetMidColor('white'); + } + + $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]); + if (count($datasetLabels) > 0) { + $seriesPlot->SetLabels(array_fill(0, count($datasetLabels), '')); + } + if ($dimensions != '3d') { + $seriesPlot->SetGuideLines(false); + } + if ($j == 0) { + if ($exploded) { + $seriesPlot->ExplodeAll(); + } + $seriesPlot->SetLegends($datasetLabels); + } + + $this->graph->Add($seriesPlot); + } + } + } + + private function renderRadarChart($groupCount) + { + $this->renderRadarPlotArea(); + + for ($groupID = 0; $groupID < $groupCount; ++$groupID) { + $this->renderPlotRadar($groupID); + } + } + + private function renderStockChart($groupCount) + { + $this->renderCartesianPlotArea('intint'); + + for ($groupID = 0; $groupID < $groupCount; ++$groupID) { + $this->renderPlotStock($groupID); + } + } + + private function renderContourChart($groupCount, $dimensions) + { + $this->renderCartesianPlotArea('intint'); + + for ($i = 0; $i < $groupCount; ++$i) { + $this->renderPlotContour($i); + } + } + + private function renderCombinationChart($groupCount, $dimensions, $outputDestination) + { + $this->renderCartesianPlotArea(); + + for ($i = 0; $i < $groupCount; ++$i) { + $dimensions = null; + $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); + switch ($chartType) { + case 'area3DChart': + $dimensions = '3d'; + // no break + case 'areaChart': + $this->renderPlotLine($i, true, true, $dimensions); + + break; + case 'bar3DChart': + $dimensions = '3d'; + // no break + case 'barChart': + $this->renderPlotBar($i, $dimensions); + + break; + case 'line3DChart': + $dimensions = '3d'; + // no break + case 'lineChart': + $this->renderPlotLine($i, false, true, $dimensions); + + break; + case 'scatterChart': + $this->renderPlotScatter($i, false); + + break; + case 'bubbleChart': + $this->renderPlotScatter($i, true); + + break; + default: + $this->graph = null; + + return false; + } + } + + $this->renderLegend(); + + $this->graph->Stroke($outputDestination); + + return true; + } + + public function render($outputDestination) + { + self::$plotColour = 0; + + $groupCount = $this->chart->getPlotArea()->getPlotGroupCount(); + + $dimensions = null; + if ($groupCount == 1) { + $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); + } else { + $chartTypes = []; + for ($i = 0; $i < $groupCount; ++$i) { + $chartTypes[] = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); + } + $chartTypes = array_unique($chartTypes); + if (count($chartTypes) == 1) { + $chartType = array_pop($chartTypes); + } elseif (count($chartTypes) == 0) { + echo 'Chart is not yet implemented
'; + + return false; + } else { + return $this->renderCombinationChart($groupCount, $dimensions, $outputDestination); + } + } + + switch ($chartType) { + case 'area3DChart': + $dimensions = '3d'; + // no break + case 'areaChart': + $this->renderAreaChart($groupCount, $dimensions); + + break; + case 'bar3DChart': + $dimensions = '3d'; + // no break + case 'barChart': + $this->renderBarChart($groupCount, $dimensions); + + break; + case 'line3DChart': + $dimensions = '3d'; + // no break + case 'lineChart': + $this->renderLineChart($groupCount, $dimensions); + + break; + case 'pie3DChart': + $dimensions = '3d'; + // no break + case 'pieChart': + $this->renderPieChart($groupCount, $dimensions, false, false); + + break; + case 'doughnut3DChart': + $dimensions = '3d'; + // no break + case 'doughnutChart': + $this->renderPieChart($groupCount, $dimensions, true, true); + + break; + case 'scatterChart': + $this->renderScatterChart($groupCount); + + break; + case 'bubbleChart': + $this->renderBubbleChart($groupCount); + + break; + case 'radarChart': + $this->renderRadarChart($groupCount); + + break; + case 'surface3DChart': + $dimensions = '3d'; + // no break + case 'surfaceChart': + $this->renderContourChart($groupCount, $dimensions); + + break; + case 'stockChart': + $this->renderStockChart($groupCount); + + break; + default: + echo $chartType . ' is not yet implemented
'; + + return false; + } + $this->renderLegend(); + + $this->graph->Stroke($outputDestination); + + return true; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/PHP Charting Libraries.txt b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/PHP Charting Libraries.txt new file mode 100644 index 0000000..4abab7a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/PHP Charting Libraries.txt @@ -0,0 +1,20 @@ +ChartDirector + https://www.advsofteng.com/cdphp.html + +GraPHPite + http://graphpite.sourceforge.net/ + +JpGraph + http://www.aditus.nu/jpgraph/ + +LibChart + https://naku.dohcrew.com/libchart/pages/introduction/ + +pChart + http://pchart.sourceforge.net/ + +TeeChart + https://www.steema.com/ + +PHPGraphLib + http://www.ebrueggeman.com/phpgraphlib \ No newline at end of file diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/Polyfill.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/Polyfill.php new file mode 100644 index 0000000..7fa3839 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/Renderer/Polyfill.php @@ -0,0 +1,9 @@ +caption = $caption; + $this->layout = $layout; + } + + /** + * Get caption. + * + * @return string + */ + public function getCaption() + { + return $this->caption; + } + + /** + * Set caption. + * + * @param string $caption + * + * @return $this + */ + public function setCaption($caption) + { + $this->caption = $caption; + + return $this; + } + + /** + * Get Layout. + * + * @return Layout + */ + public function getLayout() + { + return $this->layout; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php new file mode 100644 index 0000000..84c3d30 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/Cells.php @@ -0,0 +1,506 @@ +parent = $parent; + $this->cache = $cache; + $this->cachePrefix = $this->getUniqueID(); + } + + /** + * Return the parent worksheet for this cell collection. + * + * @return Worksheet + */ + public function getParent() + { + return $this->parent; + } + + /** + * Whether the collection holds a cell for the given coordinate. + * + * @param string $pCoord Coordinate of the cell to check + * + * @return bool + */ + public function has($pCoord) + { + if ($pCoord === $this->currentCoordinate) { + return true; + } + + // Check if the requested entry exists in the index + return isset($this->index[$pCoord]); + } + + /** + * Add or update a cell in the collection. + * + * @param Cell $cell Cell to update + * + * @throws PhpSpreadsheetException + * + * @return Cell + */ + public function update(Cell $cell) + { + return $this->add($cell->getCoordinate(), $cell); + } + + /** + * Delete a cell in cache identified by coordinate. + * + * @param string $pCoord Coordinate of the cell to delete + */ + public function delete($pCoord) + { + if ($pCoord === $this->currentCoordinate && $this->currentCell !== null) { + $this->currentCell->detach(); + $this->currentCoordinate = null; + $this->currentCell = null; + $this->currentCellIsDirty = false; + } + + unset($this->index[$pCoord]); + + // Delete the entry from cache + $this->cache->delete($this->cachePrefix . $pCoord); + } + + /** + * Get a list of all cell coordinates currently held in the collection. + * + * @return string[] + */ + public function getCoordinates() + { + return array_keys($this->index); + } + + /** + * Get a sorted list of all cell coordinates currently held in the collection by row and column. + * + * @return string[] + */ + public function getSortedCoordinates() + { + $sortKeys = []; + foreach ($this->getCoordinates() as $coord) { + $column = ''; + $row = 0; + sscanf($coord, '%[A-Z]%d', $column, $row); + $sortKeys[sprintf('%09d%3s', $row, $column)] = $coord; + } + ksort($sortKeys); + + return array_values($sortKeys); + } + + /** + * Get highest worksheet column and highest row that have cell records. + * + * @return array Highest column name and highest row number + */ + public function getHighestRowAndColumn() + { + // Lookup highest column and highest row + $col = ['A' => '1A']; + $row = [1]; + foreach ($this->getCoordinates() as $coord) { + $c = ''; + $r = 0; + sscanf($coord, '%[A-Z]%d', $c, $r); + $row[$r] = $r; + $col[$c] = strlen($c) . $c; + } + + // Determine highest column and row + $highestRow = max($row); + $highestColumn = substr(max($col), 1); + + return [ + 'row' => $highestRow, + 'column' => $highestColumn, + ]; + } + + /** + * Return the cell coordinate of the currently active cell object. + * + * @return string + */ + public function getCurrentCoordinate() + { + return $this->currentCoordinate; + } + + /** + * Return the column coordinate of the currently active cell object. + * + * @return string + */ + public function getCurrentColumn() + { + $column = ''; + $row = 0; + + sscanf($this->currentCoordinate, '%[A-Z]%d', $column, $row); + + return $column; + } + + /** + * Return the row coordinate of the currently active cell object. + * + * @return int + */ + public function getCurrentRow() + { + $column = ''; + $row = 0; + + sscanf($this->currentCoordinate, '%[A-Z]%d', $column, $row); + + return (int) $row; + } + + /** + * Get highest worksheet column. + * + * @param string $row Return the highest column for the specified row, + * or the highest column of any row if no row number is passed + * + * @return string Highest column name + */ + public function getHighestColumn($row = null) + { + if ($row === null) { + $colRow = $this->getHighestRowAndColumn(); + + return $colRow['column']; + } + + $columnList = [1]; + foreach ($this->getCoordinates() as $coord) { + $c = ''; + $r = 0; + + sscanf($coord, '%[A-Z]%d', $c, $r); + if ($r != $row) { + continue; + } + $columnList[] = Coordinate::columnIndexFromString($c); + } + + return Coordinate::stringFromColumnIndex(max($columnList)); + } + + /** + * Get highest worksheet row. + * + * @param string $column Return the highest row for the specified column, + * or the highest row of any column if no column letter is passed + * + * @return int Highest row number + */ + public function getHighestRow($column = null) + { + if ($column === null) { + $colRow = $this->getHighestRowAndColumn(); + + return $colRow['row']; + } + + $rowList = [0]; + foreach ($this->getCoordinates() as $coord) { + $c = ''; + $r = 0; + + sscanf($coord, '%[A-Z]%d', $c, $r); + if ($c != $column) { + continue; + } + $rowList[] = $r; + } + + return max($rowList); + } + + /** + * Generate a unique ID for cache referencing. + * + * @return string Unique Reference + */ + private function getUniqueID() + { + return uniqid('phpspreadsheet.', true) . '.'; + } + + /** + * Clone the cell collection. + * + * @param Worksheet $parent The new worksheet that we're copying to + * + * @return self + */ + public function cloneCellCollection(Worksheet $parent) + { + $this->storeCurrentCell(); + $newCollection = clone $this; + + $newCollection->parent = $parent; + if (($newCollection->currentCell !== null) && (is_object($newCollection->currentCell))) { + $newCollection->currentCell->attach($this); + } + + // Get old values + $oldKeys = $newCollection->getAllCacheKeys(); + $oldValues = $newCollection->cache->getMultiple($oldKeys); + $newValues = []; + $oldCachePrefix = $newCollection->cachePrefix; + + // Change prefix + $newCollection->cachePrefix = $newCollection->getUniqueID(); + foreach ($oldValues as $oldKey => $value) { + $newValues[str_replace($oldCachePrefix, $newCollection->cachePrefix, $oldKey)] = clone $value; + } + + // Store new values + $stored = $newCollection->cache->setMultiple($newValues); + if (!$stored) { + $newCollection->__destruct(); + + throw new PhpSpreadsheetException('Failed to copy cells in cache'); + } + + return $newCollection; + } + + /** + * Remove a row, deleting all cells in that row. + * + * @param string $row Row number to remove + */ + public function removeRow($row) + { + foreach ($this->getCoordinates() as $coord) { + $c = ''; + $r = 0; + + sscanf($coord, '%[A-Z]%d', $c, $r); + if ($r == $row) { + $this->delete($coord); + } + } + } + + /** + * Remove a column, deleting all cells in that column. + * + * @param string $column Column ID to remove + */ + public function removeColumn($column) + { + foreach ($this->getCoordinates() as $coord) { + $c = ''; + $r = 0; + + sscanf($coord, '%[A-Z]%d', $c, $r); + if ($c == $column) { + $this->delete($coord); + } + } + } + + /** + * Store cell data in cache for the current cell object if it's "dirty", + * and the 'nullify' the current cell object. + * + * @throws PhpSpreadsheetException + */ + private function storeCurrentCell() + { + if ($this->currentCellIsDirty && !empty($this->currentCoordinate)) { + $this->currentCell->detach(); + + $stored = $this->cache->set($this->cachePrefix . $this->currentCoordinate, $this->currentCell); + if (!$stored) { + $this->__destruct(); + + throw new PhpSpreadsheetException("Failed to store cell {$this->currentCoordinate} in cache"); + } + $this->currentCellIsDirty = false; + } + + $this->currentCoordinate = null; + $this->currentCell = null; + } + + /** + * Add or update a cell identified by its coordinate into the collection. + * + * @param string $pCoord Coordinate of the cell to update + * @param Cell $cell Cell to update + * + * @throws PhpSpreadsheetException + * + * @return \PhpOffice\PhpSpreadsheet\Cell\Cell + */ + public function add($pCoord, Cell $cell) + { + if ($pCoord !== $this->currentCoordinate) { + $this->storeCurrentCell(); + } + $this->index[$pCoord] = true; + + $this->currentCoordinate = $pCoord; + $this->currentCell = $cell; + $this->currentCellIsDirty = true; + + return $cell; + } + + /** + * Get cell at a specific coordinate. + * + * @param string $pCoord Coordinate of the cell + * + * @throws PhpSpreadsheetException + * + * @return \PhpOffice\PhpSpreadsheet\Cell\Cell Cell that was found, or null if not found + */ + public function get($pCoord) + { + if ($pCoord === $this->currentCoordinate) { + return $this->currentCell; + } + $this->storeCurrentCell(); + + // Return null if requested entry doesn't exist in collection + if (!$this->has($pCoord)) { + return null; + } + + // Check if the entry that has been requested actually exists + $cell = $this->cache->get($this->cachePrefix . $pCoord); + if ($cell === null) { + throw new PhpSpreadsheetException("Cell entry {$pCoord} no longer exists in cache. This probably means that the cache was cleared by someone else."); + } + + // Set current entry to the requested entry + $this->currentCoordinate = $pCoord; + $this->currentCell = $cell; + // Re-attach this as the cell's parent + $this->currentCell->attach($this); + + // Return requested entry + return $this->currentCell; + } + + /** + * Clear the cell collection and disconnect from our parent. + */ + public function unsetWorksheetCells() + { + if ($this->currentCell !== null) { + $this->currentCell->detach(); + $this->currentCell = null; + $this->currentCoordinate = null; + } + + // Flush the cache + $this->__destruct(); + + $this->index = []; + + // detach ourself from the worksheet, so that it can then delete this object successfully + $this->parent = null; + } + + /** + * Destroy this cell collection. + */ + public function __destruct() + { + $this->cache->deleteMultiple($this->getAllCacheKeys()); + } + + /** + * Returns all known cache keys. + * + * @return \Generator|string[] + */ + private function getAllCacheKeys() + { + foreach ($this->getCoordinates() as $coordinate) { + yield $this->cachePrefix . $coordinate; + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/CellsFactory.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/CellsFactory.php new file mode 100644 index 0000000..7f34c23 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Collection/CellsFactory.php @@ -0,0 +1,21 @@ +cache = []; + + return true; + } + + public function delete($key) + { + unset($this->cache[$key]); + + return true; + } + + public function deleteMultiple($keys) + { + foreach ($keys as $key) { + $this->delete($key); + } + + return true; + } + + public function get($key, $default = null) + { + if ($this->has($key)) { + return $this->cache[$key]; + } + + return $default; + } + + public function getMultiple($keys, $default = null) + { + $results = []; + foreach ($keys as $key) { + $results[$key] = $this->get($key, $default); + } + + return $results; + } + + public function has($key) + { + return array_key_exists($key, $this->cache); + } + + public function set($key, $value, $ttl = null) + { + $this->cache[$key] = $value; + + return true; + } + + public function setMultiple($values, $ttl = null) + { + foreach ($values as $key => $value) { + $this->set($key, $value); + } + + return true; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php new file mode 100644 index 0000000..8041dda --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Comment.php @@ -0,0 +1,331 @@ +author = 'Author'; + $this->text = new RichText(); + $this->fillColor = new Style\Color('FFFFFFE1'); + $this->alignment = Style\Alignment::HORIZONTAL_GENERAL; + } + + /** + * Get Author. + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Set Author. + * + * @param string $author + * + * @return $this + */ + public function setAuthor($author) + { + $this->author = $author; + + return $this; + } + + /** + * Get Rich text comment. + * + * @return RichText + */ + public function getText() + { + return $this->text; + } + + /** + * Set Rich text comment. + * + * @param RichText $pValue + * + * @return $this + */ + public function setText(RichText $pValue) + { + $this->text = $pValue; + + return $this; + } + + /** + * Get comment width (CSS style, i.e. XXpx or YYpt). + * + * @return string + */ + public function getWidth() + { + return $this->width; + } + + /** + * Set comment width (CSS style, i.e. XXpx or YYpt). + * + * @param string $width + * + * @return $this + */ + public function setWidth($width) + { + $this->width = $width; + + return $this; + } + + /** + * Get comment height (CSS style, i.e. XXpx or YYpt). + * + * @return string + */ + public function getHeight() + { + return $this->height; + } + + /** + * Set comment height (CSS style, i.e. XXpx or YYpt). + * + * @param string $value + * + * @return $this + */ + public function setHeight($value) + { + $this->height = $value; + + return $this; + } + + /** + * Get left margin (CSS style, i.e. XXpx or YYpt). + * + * @return string + */ + public function getMarginLeft() + { + return $this->marginLeft; + } + + /** + * Set left margin (CSS style, i.e. XXpx or YYpt). + * + * @param string $value + * + * @return $this + */ + public function setMarginLeft($value) + { + $this->marginLeft = $value; + + return $this; + } + + /** + * Get top margin (CSS style, i.e. XXpx or YYpt). + * + * @return string + */ + public function getMarginTop() + { + return $this->marginTop; + } + + /** + * Set top margin (CSS style, i.e. XXpx or YYpt). + * + * @param string $value + * + * @return $this + */ + public function setMarginTop($value) + { + $this->marginTop = $value; + + return $this; + } + + /** + * Is the comment visible by default? + * + * @return bool + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set comment default visibility. + * + * @param bool $value + * + * @return $this + */ + public function setVisible($value) + { + $this->visible = $value; + + return $this; + } + + /** + * Get fill color. + * + * @return Style\Color + */ + public function getFillColor() + { + return $this->fillColor; + } + + /** + * Set Alignment. + * + * @param string $alignment see Style\Alignment::HORIZONTAL_* + * + * @return $this + */ + public function setAlignment($alignment) + { + $this->alignment = $alignment; + + return $this; + } + + /** + * Get Alignment. + * + * @return string + */ + public function getAlignment() + { + return $this->alignment; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->author . + $this->text->getHashCode() . + $this->width . + $this->height . + $this->marginLeft . + $this->marginTop . + ($this->visible ? 1 : 0) . + $this->fillColor->getHashCode() . + $this->alignment . + __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } + + /** + * Convert to string. + * + * @return string + */ + public function __toString() + { + return $this->text->getPlainText(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php new file mode 100644 index 0000000..58fd2ef --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Properties.php @@ -0,0 +1,629 @@ +lastModifiedBy = $this->creator; + $this->created = time(); + $this->modified = time(); + } + + /** + * Get Creator. + * + * @return string + */ + public function getCreator() + { + return $this->creator; + } + + /** + * Set Creator. + * + * @param string $creator + * + * @return $this + */ + public function setCreator($creator) + { + $this->creator = $creator; + + return $this; + } + + /** + * Get Last Modified By. + * + * @return string + */ + public function getLastModifiedBy() + { + return $this->lastModifiedBy; + } + + /** + * Set Last Modified By. + * + * @param string $pValue + * + * @return $this + */ + public function setLastModifiedBy($pValue) + { + $this->lastModifiedBy = $pValue; + + return $this; + } + + /** + * Get Created. + * + * @return int + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set Created. + * + * @param int|string $time + * + * @return $this + */ + public function setCreated($time) + { + if ($time === null) { + $time = time(); + } elseif (is_string($time)) { + if (is_numeric($time)) { + $time = (int) $time; + } else { + $time = strtotime($time); + } + } + + $this->created = $time; + + return $this; + } + + /** + * Get Modified. + * + * @return int + */ + public function getModified() + { + return $this->modified; + } + + /** + * Set Modified. + * + * @param int|string $time + * + * @return $this + */ + public function setModified($time) + { + if ($time === null) { + $time = time(); + } elseif (is_string($time)) { + if (is_numeric($time)) { + $time = (int) $time; + } else { + $time = strtotime($time); + } + } + + $this->modified = $time; + + return $this; + } + + /** + * Get Title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set Title. + * + * @param string $title + * + * @return $this + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get Description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set Description. + * + * @param string $description + * + * @return $this + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get Subject. + * + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Set Subject. + * + * @param string $subject + * + * @return $this + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Get Keywords. + * + * @return string + */ + public function getKeywords() + { + return $this->keywords; + } + + /** + * Set Keywords. + * + * @param string $keywords + * + * @return $this + */ + public function setKeywords($keywords) + { + $this->keywords = $keywords; + + return $this; + } + + /** + * Get Category. + * + * @return string + */ + public function getCategory() + { + return $this->category; + } + + /** + * Set Category. + * + * @param string $category + * + * @return $this + */ + public function setCategory($category) + { + $this->category = $category; + + return $this; + } + + /** + * Get Company. + * + * @return string + */ + public function getCompany() + { + return $this->company; + } + + /** + * Set Company. + * + * @param string $company + * + * @return $this + */ + public function setCompany($company) + { + $this->company = $company; + + return $this; + } + + /** + * Get Manager. + * + * @return string + */ + public function getManager() + { + return $this->manager; + } + + /** + * Set Manager. + * + * @param string $manager + * + * @return $this + */ + public function setManager($manager) + { + $this->manager = $manager; + + return $this; + } + + /** + * Get a List of Custom Property Names. + * + * @return array of string + */ + public function getCustomProperties() + { + return array_keys($this->customProperties); + } + + /** + * Check if a Custom Property is defined. + * + * @param string $propertyName + * + * @return bool + */ + public function isCustomPropertySet($propertyName) + { + return isset($this->customProperties[$propertyName]); + } + + /** + * Get a Custom Property Value. + * + * @param string $propertyName + * + * @return mixed + */ + public function getCustomPropertyValue($propertyName) + { + if (isset($this->customProperties[$propertyName])) { + return $this->customProperties[$propertyName]['value']; + } + } + + /** + * Get a Custom Property Type. + * + * @param string $propertyName + * + * @return string + */ + public function getCustomPropertyType($propertyName) + { + if (isset($this->customProperties[$propertyName])) { + return $this->customProperties[$propertyName]['type']; + } + } + + /** + * Set a Custom Property. + * + * @param string $propertyName + * @param mixed $propertyValue + * @param string $propertyType + * 'i' : Integer + * 'f' : Floating Point + * 's' : String + * 'd' : Date/Time + * 'b' : Boolean + * + * @return $this + */ + public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null) + { + if (($propertyType === null) || (!in_array($propertyType, [self::PROPERTY_TYPE_INTEGER, + self::PROPERTY_TYPE_FLOAT, + self::PROPERTY_TYPE_STRING, + self::PROPERTY_TYPE_DATE, + self::PROPERTY_TYPE_BOOLEAN, ]))) { + if ($propertyValue === null) { + $propertyType = self::PROPERTY_TYPE_STRING; + } elseif (is_float($propertyValue)) { + $propertyType = self::PROPERTY_TYPE_FLOAT; + } elseif (is_int($propertyValue)) { + $propertyType = self::PROPERTY_TYPE_INTEGER; + } elseif (is_bool($propertyValue)) { + $propertyType = self::PROPERTY_TYPE_BOOLEAN; + } else { + $propertyType = self::PROPERTY_TYPE_STRING; + } + } + + $this->customProperties[$propertyName] = [ + 'value' => $propertyValue, + 'type' => $propertyType, + ]; + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } + + public static function convertProperty($propertyValue, $propertyType) + { + switch ($propertyType) { + case 'empty': // Empty + return ''; + + break; + case 'null': // Null + return null; + + break; + case 'i1': // 1-Byte Signed Integer + case 'i2': // 2-Byte Signed Integer + case 'i4': // 4-Byte Signed Integer + case 'i8': // 8-Byte Signed Integer + case 'int': // Integer + return (int) $propertyValue; + + break; + case 'ui1': // 1-Byte Unsigned Integer + case 'ui2': // 2-Byte Unsigned Integer + case 'ui4': // 4-Byte Unsigned Integer + case 'ui8': // 8-Byte Unsigned Integer + case 'uint': // Unsigned Integer + return abs((int) $propertyValue); + + break; + case 'r4': // 4-Byte Real Number + case 'r8': // 8-Byte Real Number + case 'decimal': // Decimal + return (float) $propertyValue; + + break; + case 'lpstr': // LPSTR + case 'lpwstr': // LPWSTR + case 'bstr': // Basic String + return $propertyValue; + + break; + case 'date': // Date and Time + case 'filetime': // File Time + return strtotime($propertyValue); + + break; + case 'bool': // Boolean + return $propertyValue == 'true'; + + break; + case 'cy': // Currency + case 'error': // Error Status Code + case 'vector': // Vector + case 'array': // Array + case 'blob': // Binary Blob + case 'oblob': // Binary Blob Object + case 'stream': // Binary Stream + case 'ostream': // Binary Stream Object + case 'storage': // Binary Storage + case 'ostorage': // Binary Storage Object + case 'vstream': // Binary Versioned Stream + case 'clsid': // Class ID + case 'cf': // Clipboard Data + return $propertyValue; + + break; + } + + return $propertyValue; + } + + public static function convertPropertyType($propertyType) + { + switch ($propertyType) { + case 'i1': // 1-Byte Signed Integer + case 'i2': // 2-Byte Signed Integer + case 'i4': // 4-Byte Signed Integer + case 'i8': // 8-Byte Signed Integer + case 'int': // Integer + case 'ui1': // 1-Byte Unsigned Integer + case 'ui2': // 2-Byte Unsigned Integer + case 'ui4': // 4-Byte Unsigned Integer + case 'ui8': // 8-Byte Unsigned Integer + case 'uint': // Unsigned Integer + return self::PROPERTY_TYPE_INTEGER; + + break; + case 'r4': // 4-Byte Real Number + case 'r8': // 8-Byte Real Number + case 'decimal': // Decimal + return self::PROPERTY_TYPE_FLOAT; + + break; + case 'empty': // Empty + case 'null': // Null + case 'lpstr': // LPSTR + case 'lpwstr': // LPWSTR + case 'bstr': // Basic String + return self::PROPERTY_TYPE_STRING; + + break; + case 'date': // Date and Time + case 'filetime': // File Time + return self::PROPERTY_TYPE_DATE; + + break; + case 'bool': // Boolean + return self::PROPERTY_TYPE_BOOLEAN; + + break; + case 'cy': // Currency + case 'error': // Error Status Code + case 'vector': // Vector + case 'array': // Array + case 'blob': // Binary Blob + case 'oblob': // Binary Blob Object + case 'stream': // Binary Stream + case 'ostream': // Binary Stream Object + case 'storage': // Binary Storage + case 'ostorage': // Binary Storage Object + case 'vstream': // Binary Versioned Stream + case 'clsid': // Class ID + case 'cf': // Clipboard Data + return self::PROPERTY_TYPE_UNKNOWN; + + break; + } + + return self::PROPERTY_TYPE_UNKNOWN; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Security.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Security.php new file mode 100644 index 0000000..cef3db8 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Security.php @@ -0,0 +1,205 @@ +lockRevision || + $this->lockStructure || + $this->lockWindows; + } + + /** + * Get LockRevision. + * + * @return bool + */ + public function getLockRevision() + { + return $this->lockRevision; + } + + /** + * Set LockRevision. + * + * @param bool $pValue + * + * @return $this + */ + public function setLockRevision($pValue) + { + $this->lockRevision = $pValue; + + return $this; + } + + /** + * Get LockStructure. + * + * @return bool + */ + public function getLockStructure() + { + return $this->lockStructure; + } + + /** + * Set LockStructure. + * + * @param bool $pValue + * + * @return $this + */ + public function setLockStructure($pValue) + { + $this->lockStructure = $pValue; + + return $this; + } + + /** + * Get LockWindows. + * + * @return bool + */ + public function getLockWindows() + { + return $this->lockWindows; + } + + /** + * Set LockWindows. + * + * @param bool $pValue + * + * @return $this + */ + public function setLockWindows($pValue) + { + $this->lockWindows = $pValue; + + return $this; + } + + /** + * Get RevisionsPassword (hashed). + * + * @return string + */ + public function getRevisionsPassword() + { + return $this->revisionsPassword; + } + + /** + * Set RevisionsPassword. + * + * @param string $pValue + * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * + * @return $this + */ + public function setRevisionsPassword($pValue, $pAlreadyHashed = false) + { + if (!$pAlreadyHashed) { + $pValue = PasswordHasher::hashPassword($pValue); + } + $this->revisionsPassword = $pValue; + + return $this; + } + + /** + * Get WorkbookPassword (hashed). + * + * @return string + */ + public function getWorkbookPassword() + { + return $this->workbookPassword; + } + + /** + * Set WorkbookPassword. + * + * @param string $pValue + * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * + * @return $this + */ + public function setWorkbookPassword($pValue, $pAlreadyHashed = false) + { + if (!$pAlreadyHashed) { + $pValue = PasswordHasher::hashPassword($pValue); + } + $this->workbookPassword = $pValue; + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Exception.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Exception.php new file mode 100644 index 0000000..9c5ab30 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Exception.php @@ -0,0 +1,7 @@ +addFromSource($pSource); + } + } + + /** + * Add HashTable items from source. + * + * @param IComparable[] $pSource Source array to create HashTable from + * + * @throws Exception + */ + public function addFromSource(array $pSource = null) + { + // Check if an array was passed + if ($pSource == null) { + return; + } + + foreach ($pSource as $item) { + $this->add($item); + } + } + + /** + * Add HashTable item. + * + * @param IComparable $pSource Item to add + */ + public function add(IComparable $pSource) + { + $hash = $pSource->getHashCode(); + if (!isset($this->items[$hash])) { + $this->items[$hash] = $pSource; + $this->keyMap[count($this->items) - 1] = $hash; + } + } + + /** + * Remove HashTable item. + * + * @param IComparable $pSource Item to remove + */ + public function remove(IComparable $pSource) + { + $hash = $pSource->getHashCode(); + if (isset($this->items[$hash])) { + unset($this->items[$hash]); + + $deleteKey = -1; + foreach ($this->keyMap as $key => $value) { + if ($deleteKey >= 0) { + $this->keyMap[$key - 1] = $value; + } + + if ($value == $hash) { + $deleteKey = $key; + } + } + unset($this->keyMap[count($this->keyMap) - 1]); + } + } + + /** + * Clear HashTable. + */ + public function clear() + { + $this->items = []; + $this->keyMap = []; + } + + /** + * Count. + * + * @return int + */ + public function count() + { + return count($this->items); + } + + /** + * Get index for hash code. + * + * @param string $pHashCode + * + * @return int Index + */ + public function getIndexForHashCode($pHashCode) + { + return array_search($pHashCode, $this->keyMap); + } + + /** + * Get by index. + * + * @param int $pIndex + * + * @return IComparable + */ + public function getByIndex($pIndex) + { + if (isset($this->keyMap[$pIndex])) { + return $this->getByHashCode($this->keyMap[$pIndex]); + } + + return null; + } + + /** + * Get by hashcode. + * + * @param string $pHashCode + * + * @return IComparable + */ + public function getByHashCode($pHashCode) + { + if (isset($this->items[$pHashCode])) { + return $this->items[$pHashCode]; + } + + return null; + } + + /** + * HashTable to array. + * + * @return IComparable[] + */ + public function toArray() + { + return $this->items; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php new file mode 100644 index 0000000..eaf7302 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Html.php @@ -0,0 +1,841 @@ + 'f0f8ff', + 'antiquewhite' => 'faebd7', + 'antiquewhite1' => 'ffefdb', + 'antiquewhite2' => 'eedfcc', + 'antiquewhite3' => 'cdc0b0', + 'antiquewhite4' => '8b8378', + 'aqua' => '00ffff', + 'aquamarine1' => '7fffd4', + 'aquamarine2' => '76eec6', + 'aquamarine4' => '458b74', + 'azure1' => 'f0ffff', + 'azure2' => 'e0eeee', + 'azure3' => 'c1cdcd', + 'azure4' => '838b8b', + 'beige' => 'f5f5dc', + 'bisque1' => 'ffe4c4', + 'bisque2' => 'eed5b7', + 'bisque3' => 'cdb79e', + 'bisque4' => '8b7d6b', + 'black' => '000000', + 'blanchedalmond' => 'ffebcd', + 'blue' => '0000ff', + 'blue1' => '0000ff', + 'blue2' => '0000ee', + 'blue4' => '00008b', + 'blueviolet' => '8a2be2', + 'brown' => 'a52a2a', + 'brown1' => 'ff4040', + 'brown2' => 'ee3b3b', + 'brown3' => 'cd3333', + 'brown4' => '8b2323', + 'burlywood' => 'deb887', + 'burlywood1' => 'ffd39b', + 'burlywood2' => 'eec591', + 'burlywood3' => 'cdaa7d', + 'burlywood4' => '8b7355', + 'cadetblue' => '5f9ea0', + 'cadetblue1' => '98f5ff', + 'cadetblue2' => '8ee5ee', + 'cadetblue3' => '7ac5cd', + 'cadetblue4' => '53868b', + 'chartreuse1' => '7fff00', + 'chartreuse2' => '76ee00', + 'chartreuse3' => '66cd00', + 'chartreuse4' => '458b00', + 'chocolate' => 'd2691e', + 'chocolate1' => 'ff7f24', + 'chocolate2' => 'ee7621', + 'chocolate3' => 'cd661d', + 'coral' => 'ff7f50', + 'coral1' => 'ff7256', + 'coral2' => 'ee6a50', + 'coral3' => 'cd5b45', + 'coral4' => '8b3e2f', + 'cornflowerblue' => '6495ed', + 'cornsilk1' => 'fff8dc', + 'cornsilk2' => 'eee8cd', + 'cornsilk3' => 'cdc8b1', + 'cornsilk4' => '8b8878', + 'cyan1' => '00ffff', + 'cyan2' => '00eeee', + 'cyan3' => '00cdcd', + 'cyan4' => '008b8b', + 'darkgoldenrod' => 'b8860b', + 'darkgoldenrod1' => 'ffb90f', + 'darkgoldenrod2' => 'eead0e', + 'darkgoldenrod3' => 'cd950c', + 'darkgoldenrod4' => '8b6508', + 'darkgreen' => '006400', + 'darkkhaki' => 'bdb76b', + 'darkolivegreen' => '556b2f', + 'darkolivegreen1' => 'caff70', + 'darkolivegreen2' => 'bcee68', + 'darkolivegreen3' => 'a2cd5a', + 'darkolivegreen4' => '6e8b3d', + 'darkorange' => 'ff8c00', + 'darkorange1' => 'ff7f00', + 'darkorange2' => 'ee7600', + 'darkorange3' => 'cd6600', + 'darkorange4' => '8b4500', + 'darkorchid' => '9932cc', + 'darkorchid1' => 'bf3eff', + 'darkorchid2' => 'b23aee', + 'darkorchid3' => '9a32cd', + 'darkorchid4' => '68228b', + 'darksalmon' => 'e9967a', + 'darkseagreen' => '8fbc8f', + 'darkseagreen1' => 'c1ffc1', + 'darkseagreen2' => 'b4eeb4', + 'darkseagreen3' => '9bcd9b', + 'darkseagreen4' => '698b69', + 'darkslateblue' => '483d8b', + 'darkslategray' => '2f4f4f', + 'darkslategray1' => '97ffff', + 'darkslategray2' => '8deeee', + 'darkslategray3' => '79cdcd', + 'darkslategray4' => '528b8b', + 'darkturquoise' => '00ced1', + 'darkviolet' => '9400d3', + 'deeppink1' => 'ff1493', + 'deeppink2' => 'ee1289', + 'deeppink3' => 'cd1076', + 'deeppink4' => '8b0a50', + 'deepskyblue1' => '00bfff', + 'deepskyblue2' => '00b2ee', + 'deepskyblue3' => '009acd', + 'deepskyblue4' => '00688b', + 'dimgray' => '696969', + 'dodgerblue1' => '1e90ff', + 'dodgerblue2' => '1c86ee', + 'dodgerblue3' => '1874cd', + 'dodgerblue4' => '104e8b', + 'firebrick' => 'b22222', + 'firebrick1' => 'ff3030', + 'firebrick2' => 'ee2c2c', + 'firebrick3' => 'cd2626', + 'firebrick4' => '8b1a1a', + 'floralwhite' => 'fffaf0', + 'forestgreen' => '228b22', + 'fuchsia' => 'ff00ff', + 'gainsboro' => 'dcdcdc', + 'ghostwhite' => 'f8f8ff', + 'gold1' => 'ffd700', + 'gold2' => 'eec900', + 'gold3' => 'cdad00', + 'gold4' => '8b7500', + 'goldenrod' => 'daa520', + 'goldenrod1' => 'ffc125', + 'goldenrod2' => 'eeb422', + 'goldenrod3' => 'cd9b1d', + 'goldenrod4' => '8b6914', + 'gray' => 'bebebe', + 'gray1' => '030303', + 'gray10' => '1a1a1a', + 'gray11' => '1c1c1c', + 'gray12' => '1f1f1f', + 'gray13' => '212121', + 'gray14' => '242424', + 'gray15' => '262626', + 'gray16' => '292929', + 'gray17' => '2b2b2b', + 'gray18' => '2e2e2e', + 'gray19' => '303030', + 'gray2' => '050505', + 'gray20' => '333333', + 'gray21' => '363636', + 'gray22' => '383838', + 'gray23' => '3b3b3b', + 'gray24' => '3d3d3d', + 'gray25' => '404040', + 'gray26' => '424242', + 'gray27' => '454545', + 'gray28' => '474747', + 'gray29' => '4a4a4a', + 'gray3' => '080808', + 'gray30' => '4d4d4d', + 'gray31' => '4f4f4f', + 'gray32' => '525252', + 'gray33' => '545454', + 'gray34' => '575757', + 'gray35' => '595959', + 'gray36' => '5c5c5c', + 'gray37' => '5e5e5e', + 'gray38' => '616161', + 'gray39' => '636363', + 'gray4' => '0a0a0a', + 'gray40' => '666666', + 'gray41' => '696969', + 'gray42' => '6b6b6b', + 'gray43' => '6e6e6e', + 'gray44' => '707070', + 'gray45' => '737373', + 'gray46' => '757575', + 'gray47' => '787878', + 'gray48' => '7a7a7a', + 'gray49' => '7d7d7d', + 'gray5' => '0d0d0d', + 'gray50' => '7f7f7f', + 'gray51' => '828282', + 'gray52' => '858585', + 'gray53' => '878787', + 'gray54' => '8a8a8a', + 'gray55' => '8c8c8c', + 'gray56' => '8f8f8f', + 'gray57' => '919191', + 'gray58' => '949494', + 'gray59' => '969696', + 'gray6' => '0f0f0f', + 'gray60' => '999999', + 'gray61' => '9c9c9c', + 'gray62' => '9e9e9e', + 'gray63' => 'a1a1a1', + 'gray64' => 'a3a3a3', + 'gray65' => 'a6a6a6', + 'gray66' => 'a8a8a8', + 'gray67' => 'ababab', + 'gray68' => 'adadad', + 'gray69' => 'b0b0b0', + 'gray7' => '121212', + 'gray70' => 'b3b3b3', + 'gray71' => 'b5b5b5', + 'gray72' => 'b8b8b8', + 'gray73' => 'bababa', + 'gray74' => 'bdbdbd', + 'gray75' => 'bfbfbf', + 'gray76' => 'c2c2c2', + 'gray77' => 'c4c4c4', + 'gray78' => 'c7c7c7', + 'gray79' => 'c9c9c9', + 'gray8' => '141414', + 'gray80' => 'cccccc', + 'gray81' => 'cfcfcf', + 'gray82' => 'd1d1d1', + 'gray83' => 'd4d4d4', + 'gray84' => 'd6d6d6', + 'gray85' => 'd9d9d9', + 'gray86' => 'dbdbdb', + 'gray87' => 'dedede', + 'gray88' => 'e0e0e0', + 'gray89' => 'e3e3e3', + 'gray9' => '171717', + 'gray90' => 'e5e5e5', + 'gray91' => 'e8e8e8', + 'gray92' => 'ebebeb', + 'gray93' => 'ededed', + 'gray94' => 'f0f0f0', + 'gray95' => 'f2f2f2', + 'gray97' => 'f7f7f7', + 'gray98' => 'fafafa', + 'gray99' => 'fcfcfc', + 'green' => '00ff00', + 'green1' => '00ff00', + 'green2' => '00ee00', + 'green3' => '00cd00', + 'green4' => '008b00', + 'greenyellow' => 'adff2f', + 'honeydew1' => 'f0fff0', + 'honeydew2' => 'e0eee0', + 'honeydew3' => 'c1cdc1', + 'honeydew4' => '838b83', + 'hotpink' => 'ff69b4', + 'hotpink1' => 'ff6eb4', + 'hotpink2' => 'ee6aa7', + 'hotpink3' => 'cd6090', + 'hotpink4' => '8b3a62', + 'indianred' => 'cd5c5c', + 'indianred1' => 'ff6a6a', + 'indianred2' => 'ee6363', + 'indianred3' => 'cd5555', + 'indianred4' => '8b3a3a', + 'ivory1' => 'fffff0', + 'ivory2' => 'eeeee0', + 'ivory3' => 'cdcdc1', + 'ivory4' => '8b8b83', + 'khaki' => 'f0e68c', + 'khaki1' => 'fff68f', + 'khaki2' => 'eee685', + 'khaki3' => 'cdc673', + 'khaki4' => '8b864e', + 'lavender' => 'e6e6fa', + 'lavenderblush1' => 'fff0f5', + 'lavenderblush2' => 'eee0e5', + 'lavenderblush3' => 'cdc1c5', + 'lavenderblush4' => '8b8386', + 'lawngreen' => '7cfc00', + 'lemonchiffon1' => 'fffacd', + 'lemonchiffon2' => 'eee9bf', + 'lemonchiffon3' => 'cdc9a5', + 'lemonchiffon4' => '8b8970', + 'light' => 'eedd82', + 'lightblue' => 'add8e6', + 'lightblue1' => 'bfefff', + 'lightblue2' => 'b2dfee', + 'lightblue3' => '9ac0cd', + 'lightblue4' => '68838b', + 'lightcoral' => 'f08080', + 'lightcyan1' => 'e0ffff', + 'lightcyan2' => 'd1eeee', + 'lightcyan3' => 'b4cdcd', + 'lightcyan4' => '7a8b8b', + 'lightgoldenrod1' => 'ffec8b', + 'lightgoldenrod2' => 'eedc82', + 'lightgoldenrod3' => 'cdbe70', + 'lightgoldenrod4' => '8b814c', + 'lightgoldenrodyellow' => 'fafad2', + 'lightgray' => 'd3d3d3', + 'lightpink' => 'ffb6c1', + 'lightpink1' => 'ffaeb9', + 'lightpink2' => 'eea2ad', + 'lightpink3' => 'cd8c95', + 'lightpink4' => '8b5f65', + 'lightsalmon1' => 'ffa07a', + 'lightsalmon2' => 'ee9572', + 'lightsalmon3' => 'cd8162', + 'lightsalmon4' => '8b5742', + 'lightseagreen' => '20b2aa', + 'lightskyblue' => '87cefa', + 'lightskyblue1' => 'b0e2ff', + 'lightskyblue2' => 'a4d3ee', + 'lightskyblue3' => '8db6cd', + 'lightskyblue4' => '607b8b', + 'lightslateblue' => '8470ff', + 'lightslategray' => '778899', + 'lightsteelblue' => 'b0c4de', + 'lightsteelblue1' => 'cae1ff', + 'lightsteelblue2' => 'bcd2ee', + 'lightsteelblue3' => 'a2b5cd', + 'lightsteelblue4' => '6e7b8b', + 'lightyellow1' => 'ffffe0', + 'lightyellow2' => 'eeeed1', + 'lightyellow3' => 'cdcdb4', + 'lightyellow4' => '8b8b7a', + 'lime' => '00ff00', + 'limegreen' => '32cd32', + 'linen' => 'faf0e6', + 'magenta' => 'ff00ff', + 'magenta2' => 'ee00ee', + 'magenta3' => 'cd00cd', + 'magenta4' => '8b008b', + 'maroon' => 'b03060', + 'maroon1' => 'ff34b3', + 'maroon2' => 'ee30a7', + 'maroon3' => 'cd2990', + 'maroon4' => '8b1c62', + 'medium' => '66cdaa', + 'mediumaquamarine' => '66cdaa', + 'mediumblue' => '0000cd', + 'mediumorchid' => 'ba55d3', + 'mediumorchid1' => 'e066ff', + 'mediumorchid2' => 'd15fee', + 'mediumorchid3' => 'b452cd', + 'mediumorchid4' => '7a378b', + 'mediumpurple' => '9370db', + 'mediumpurple1' => 'ab82ff', + 'mediumpurple2' => '9f79ee', + 'mediumpurple3' => '8968cd', + 'mediumpurple4' => '5d478b', + 'mediumseagreen' => '3cb371', + 'mediumslateblue' => '7b68ee', + 'mediumspringgreen' => '00fa9a', + 'mediumturquoise' => '48d1cc', + 'mediumvioletred' => 'c71585', + 'midnightblue' => '191970', + 'mintcream' => 'f5fffa', + 'mistyrose1' => 'ffe4e1', + 'mistyrose2' => 'eed5d2', + 'mistyrose3' => 'cdb7b5', + 'mistyrose4' => '8b7d7b', + 'moccasin' => 'ffe4b5', + 'navajowhite1' => 'ffdead', + 'navajowhite2' => 'eecfa1', + 'navajowhite3' => 'cdb38b', + 'navajowhite4' => '8b795e', + 'navy' => '000080', + 'navyblue' => '000080', + 'oldlace' => 'fdf5e6', + 'olive' => '808000', + 'olivedrab' => '6b8e23', + 'olivedrab1' => 'c0ff3e', + 'olivedrab2' => 'b3ee3a', + 'olivedrab4' => '698b22', + 'orange' => 'ffa500', + 'orange1' => 'ffa500', + 'orange2' => 'ee9a00', + 'orange3' => 'cd8500', + 'orange4' => '8b5a00', + 'orangered1' => 'ff4500', + 'orangered2' => 'ee4000', + 'orangered3' => 'cd3700', + 'orangered4' => '8b2500', + 'orchid' => 'da70d6', + 'orchid1' => 'ff83fa', + 'orchid2' => 'ee7ae9', + 'orchid3' => 'cd69c9', + 'orchid4' => '8b4789', + 'pale' => 'db7093', + 'palegoldenrod' => 'eee8aa', + 'palegreen' => '98fb98', + 'palegreen1' => '9aff9a', + 'palegreen2' => '90ee90', + 'palegreen3' => '7ccd7c', + 'palegreen4' => '548b54', + 'paleturquoise' => 'afeeee', + 'paleturquoise1' => 'bbffff', + 'paleturquoise2' => 'aeeeee', + 'paleturquoise3' => '96cdcd', + 'paleturquoise4' => '668b8b', + 'palevioletred' => 'db7093', + 'palevioletred1' => 'ff82ab', + 'palevioletred2' => 'ee799f', + 'palevioletred3' => 'cd6889', + 'palevioletred4' => '8b475d', + 'papayawhip' => 'ffefd5', + 'peachpuff1' => 'ffdab9', + 'peachpuff2' => 'eecbad', + 'peachpuff3' => 'cdaf95', + 'peachpuff4' => '8b7765', + 'pink' => 'ffc0cb', + 'pink1' => 'ffb5c5', + 'pink2' => 'eea9b8', + 'pink3' => 'cd919e', + 'pink4' => '8b636c', + 'plum' => 'dda0dd', + 'plum1' => 'ffbbff', + 'plum2' => 'eeaeee', + 'plum3' => 'cd96cd', + 'plum4' => '8b668b', + 'powderblue' => 'b0e0e6', + 'purple' => 'a020f0', + 'rebeccapurple' => '663399', + 'purple1' => '9b30ff', + 'purple2' => '912cee', + 'purple3' => '7d26cd', + 'purple4' => '551a8b', + 'red' => 'ff0000', + 'red1' => 'ff0000', + 'red2' => 'ee0000', + 'red3' => 'cd0000', + 'red4' => '8b0000', + 'rosybrown' => 'bc8f8f', + 'rosybrown1' => 'ffc1c1', + 'rosybrown2' => 'eeb4b4', + 'rosybrown3' => 'cd9b9b', + 'rosybrown4' => '8b6969', + 'royalblue' => '4169e1', + 'royalblue1' => '4876ff', + 'royalblue2' => '436eee', + 'royalblue3' => '3a5fcd', + 'royalblue4' => '27408b', + 'saddlebrown' => '8b4513', + 'salmon' => 'fa8072', + 'salmon1' => 'ff8c69', + 'salmon2' => 'ee8262', + 'salmon3' => 'cd7054', + 'salmon4' => '8b4c39', + 'sandybrown' => 'f4a460', + 'seagreen1' => '54ff9f', + 'seagreen2' => '4eee94', + 'seagreen3' => '43cd80', + 'seagreen4' => '2e8b57', + 'seashell1' => 'fff5ee', + 'seashell2' => 'eee5de', + 'seashell3' => 'cdc5bf', + 'seashell4' => '8b8682', + 'sienna' => 'a0522d', + 'sienna1' => 'ff8247', + 'sienna2' => 'ee7942', + 'sienna3' => 'cd6839', + 'sienna4' => '8b4726', + 'silver' => 'c0c0c0', + 'skyblue' => '87ceeb', + 'skyblue1' => '87ceff', + 'skyblue2' => '7ec0ee', + 'skyblue3' => '6ca6cd', + 'skyblue4' => '4a708b', + 'slateblue' => '6a5acd', + 'slateblue1' => '836fff', + 'slateblue2' => '7a67ee', + 'slateblue3' => '6959cd', + 'slateblue4' => '473c8b', + 'slategray' => '708090', + 'slategray1' => 'c6e2ff', + 'slategray2' => 'b9d3ee', + 'slategray3' => '9fb6cd', + 'slategray4' => '6c7b8b', + 'snow1' => 'fffafa', + 'snow2' => 'eee9e9', + 'snow3' => 'cdc9c9', + 'snow4' => '8b8989', + 'springgreen1' => '00ff7f', + 'springgreen2' => '00ee76', + 'springgreen3' => '00cd66', + 'springgreen4' => '008b45', + 'steelblue' => '4682b4', + 'steelblue1' => '63b8ff', + 'steelblue2' => '5cacee', + 'steelblue3' => '4f94cd', + 'steelblue4' => '36648b', + 'tan' => 'd2b48c', + 'tan1' => 'ffa54f', + 'tan2' => 'ee9a49', + 'tan3' => 'cd853f', + 'tan4' => '8b5a2b', + 'teal' => '008080', + 'thistle' => 'd8bfd8', + 'thistle1' => 'ffe1ff', + 'thistle2' => 'eed2ee', + 'thistle3' => 'cdb5cd', + 'thistle4' => '8b7b8b', + 'tomato1' => 'ff6347', + 'tomato2' => 'ee5c42', + 'tomato3' => 'cd4f39', + 'tomato4' => '8b3626', + 'turquoise' => '40e0d0', + 'turquoise1' => '00f5ff', + 'turquoise2' => '00e5ee', + 'turquoise3' => '00c5cd', + 'turquoise4' => '00868b', + 'violet' => 'ee82ee', + 'violetred' => 'd02090', + 'violetred1' => 'ff3e96', + 'violetred2' => 'ee3a8c', + 'violetred3' => 'cd3278', + 'violetred4' => '8b2252', + 'wheat' => 'f5deb3', + 'wheat1' => 'ffe7ba', + 'wheat2' => 'eed8ae', + 'wheat3' => 'cdba96', + 'wheat4' => '8b7e66', + 'white' => 'ffffff', + 'whitesmoke' => 'f5f5f5', + 'yellow' => 'ffff00', + 'yellow1' => 'ffff00', + 'yellow2' => 'eeee00', + 'yellow3' => 'cdcd00', + 'yellow4' => '8b8b00', + 'yellowgreen' => '9acd32', + ]; + + protected $face; + + protected $size; + + protected $color; + + protected $bold = false; + + protected $italic = false; + + protected $underline = false; + + protected $superscript = false; + + protected $subscript = false; + + protected $strikethrough = false; + + protected $startTagCallbacks = [ + 'font' => 'startFontTag', + 'b' => 'startBoldTag', + 'strong' => 'startBoldTag', + 'i' => 'startItalicTag', + 'em' => 'startItalicTag', + 'u' => 'startUnderlineTag', + 'ins' => 'startUnderlineTag', + 'del' => 'startStrikethruTag', + 'sup' => 'startSuperscriptTag', + 'sub' => 'startSubscriptTag', + ]; + + protected $endTagCallbacks = [ + 'font' => 'endFontTag', + 'b' => 'endBoldTag', + 'strong' => 'endBoldTag', + 'i' => 'endItalicTag', + 'em' => 'endItalicTag', + 'u' => 'endUnderlineTag', + 'ins' => 'endUnderlineTag', + 'del' => 'endStrikethruTag', + 'sup' => 'endSuperscriptTag', + 'sub' => 'endSubscriptTag', + 'br' => 'breakTag', + 'p' => 'breakTag', + 'h1' => 'breakTag', + 'h2' => 'breakTag', + 'h3' => 'breakTag', + 'h4' => 'breakTag', + 'h5' => 'breakTag', + 'h6' => 'breakTag', + ]; + + protected $stack = []; + + protected $stringData = ''; + + /** + * @var RichText + */ + protected $richTextObject; + + protected function initialise() + { + $this->face = $this->size = $this->color = null; + $this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false; + + $this->stack = []; + + $this->stringData = ''; + } + + /** + * Parse HTML formatting and return the resulting RichText. + * + * @param string $html + * + * @return RichText + */ + public function toRichTextObject($html) + { + $this->initialise(); + + // Create a new DOM object + $dom = new DOMDocument(); + // Load the HTML file into the DOM object + // Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup + $prefix = ''; + @$dom->loadHTML($prefix . $html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); + // Discard excess white space + $dom->preserveWhiteSpace = false; + + $this->richTextObject = new RichText(); + $this->parseElements($dom); + + // Clean any further spurious whitespace + $this->cleanWhitespace(); + + return $this->richTextObject; + } + + protected function cleanWhitespace() + { + foreach ($this->richTextObject->getRichTextElements() as $key => $element) { + $text = $element->getText(); + // Trim any leading spaces on the first run + if ($key == 0) { + $text = ltrim($text); + } + // Trim any spaces immediately after a line break + $text = preg_replace('/\n */mu', "\n", $text); + $element->setText($text); + } + } + + protected function buildTextRun() + { + $text = $this->stringData; + if (trim($text) === '') { + return; + } + + $richtextRun = $this->richTextObject->createTextRun($this->stringData); + if ($this->face) { + $richtextRun->getFont()->setName($this->face); + } + if ($this->size) { + $richtextRun->getFont()->setSize($this->size); + } + if ($this->color) { + $richtextRun->getFont()->setColor(new Color('ff' . $this->color)); + } + if ($this->bold) { + $richtextRun->getFont()->setBold(true); + } + if ($this->italic) { + $richtextRun->getFont()->setItalic(true); + } + if ($this->underline) { + $richtextRun->getFont()->setUnderline(Font::UNDERLINE_SINGLE); + } + if ($this->superscript) { + $richtextRun->getFont()->setSuperscript(true); + } + if ($this->subscript) { + $richtextRun->getFont()->setSubscript(true); + } + if ($this->strikethrough) { + $richtextRun->getFont()->setStrikethrough(true); + } + $this->stringData = ''; + } + + protected function rgbToColour($rgb) + { + preg_match_all('/\d+/', $rgb, $values); + foreach ($values[0] as &$value) { + $value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT); + } + + return implode($values[0]); + } + + protected function colourNameLookup($rgb) + { + return self::$colourMap[$rgb]; + } + + protected function startFontTag($tag) + { + foreach ($tag->attributes as $attribute) { + $attributeName = strtolower($attribute->name); + $attributeValue = $attribute->value; + + if ($attributeName == 'color') { + if (preg_match('/rgb\s*\(/', $attributeValue)) { + $this->$attributeName = $this->rgbToColour($attributeValue); + } elseif (strpos(trim($attributeValue), '#') === 0) { + $this->$attributeName = ltrim($attributeValue, '#'); + } else { + $this->$attributeName = $this->colourNameLookup($attributeValue); + } + } else { + $this->$attributeName = $attributeValue; + } + } + } + + protected function endFontTag() + { + $this->face = $this->size = $this->color = null; + } + + protected function startBoldTag() + { + $this->bold = true; + } + + protected function endBoldTag() + { + $this->bold = false; + } + + protected function startItalicTag() + { + $this->italic = true; + } + + protected function endItalicTag() + { + $this->italic = false; + } + + protected function startUnderlineTag() + { + $this->underline = true; + } + + protected function endUnderlineTag() + { + $this->underline = false; + } + + protected function startSubscriptTag() + { + $this->subscript = true; + } + + protected function endSubscriptTag() + { + $this->subscript = false; + } + + protected function startSuperscriptTag() + { + $this->superscript = true; + } + + protected function endSuperscriptTag() + { + $this->superscript = false; + } + + protected function startStrikethruTag() + { + $this->strikethrough = true; + } + + protected function endStrikethruTag() + { + $this->strikethrough = false; + } + + protected function breakTag() + { + $this->stringData .= "\n"; + } + + protected function parseTextNode(DOMText $textNode) + { + $domText = preg_replace( + '/\s+/u', + ' ', + str_replace(["\r", "\n"], ' ', $textNode->nodeValue) + ); + $this->stringData .= $domText; + $this->buildTextRun(); + } + + /** + * @param DOMElement $element + * @param string $callbackTag + * @param array $callbacks + */ + protected function handleCallback(DOMElement $element, $callbackTag, array $callbacks) + { + if (isset($callbacks[$callbackTag])) { + $elementHandler = $callbacks[$callbackTag]; + if (method_exists($this, $elementHandler)) { + call_user_func([$this, $elementHandler], $element); + } + } + } + + protected function parseElementNode(DOMElement $element) + { + $callbackTag = strtolower($element->nodeName); + $this->stack[] = $callbackTag; + + $this->handleCallback($element, $callbackTag, $this->startTagCallbacks); + + $this->parseElements($element); + array_pop($this->stack); + + $this->handleCallback($element, $callbackTag, $this->endTagCallbacks); + } + + protected function parseElements(DOMNode $element) + { + foreach ($element->childNodes as $child) { + if ($child instanceof DOMText) { + $this->parseTextNode($child); + } elseif ($child instanceof DOMElement) { + $this->parseElementNode($child); + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Migrator.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Migrator.php new file mode 100644 index 0000000..26d5fce --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Migrator.php @@ -0,0 +1,333 @@ +from = array_keys($this->getMapping()); + $this->to = array_values($this->getMapping()); + } + + /** + * Return the ordered mapping from old PHPExcel class names to new PhpSpreadsheet one. + * + * @return string[] + */ + public function getMapping() + { + // Order matters here, we should have the deepest namespaces first (the most "unique" strings) + $classes = [ + 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE\Blip::class, + 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer\SpContainer::class, + 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE::class, + 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer::class, + 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer::class, + 'PHPExcel_Shared_OLE_PPS_File' => \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\File::class, + 'PHPExcel_Shared_OLE_PPS_Root' => \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\Root::class, + 'PHPExcel_Worksheet_AutoFilter_Column_Rule' => \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::class, + 'PHPExcel_Writer_OpenDocument_Cell_Comment' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Cell\Comment::class, + 'PHPExcel_Calculation_Token_Stack' => \PhpOffice\PhpSpreadsheet\Calculation\Token\Stack::class, + 'PHPExcel_Chart_Renderer_jpgraph' => \PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class, + 'PHPExcel_Reader_Excel5_Escher' => \PhpOffice\PhpSpreadsheet\Reader\Xls\Escher::class, + 'PHPExcel_Reader_Excel5_MD5' => \PhpOffice\PhpSpreadsheet\Reader\Xls\MD5::class, + 'PHPExcel_Reader_Excel5_RC4' => \PhpOffice\PhpSpreadsheet\Reader\Xls\RC4::class, + 'PHPExcel_Reader_Excel2007_Chart' => \PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart::class, + 'PHPExcel_Reader_Excel2007_Theme' => \PhpOffice\PhpSpreadsheet\Reader\Xlsx\Theme::class, + 'PHPExcel_Shared_Escher_DgContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer::class, + 'PHPExcel_Shared_Escher_DggContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer::class, + 'CholeskyDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\CholeskyDecomposition::class, + 'EigenvalueDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\EigenvalueDecomposition::class, + 'PHPExcel_Shared_JAMA_LUDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\LUDecomposition::class, + 'PHPExcel_Shared_JAMA_Matrix' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\Matrix::class, + 'QRDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\QRDecomposition::class, + 'PHPExcel_Shared_JAMA_QRDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\QRDecomposition::class, + 'SingularValueDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\SingularValueDecomposition::class, + 'PHPExcel_Shared_OLE_ChainedBlockStream' => \PhpOffice\PhpSpreadsheet\Shared\OLE\ChainedBlockStream::class, + 'PHPExcel_Shared_OLE_PPS' => \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS::class, + 'PHPExcel_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\BestFit::class, + 'PHPExcel_Exponential_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\ExponentialBestFit::class, + 'PHPExcel_Linear_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\LinearBestFit::class, + 'PHPExcel_Logarithmic_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\LogarithmicBestFit::class, + 'polynomialBestFit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\PolynomialBestFit::class, + 'PHPExcel_Polynomial_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\PolynomialBestFit::class, + 'powerBestFit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\PowerBestFit::class, + 'PHPExcel_Power_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\PowerBestFit::class, + 'trendClass' => \PhpOffice\PhpSpreadsheet\Shared\Trend\Trend::class, + 'PHPExcel_Worksheet_AutoFilter_Column' => \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::class, + 'PHPExcel_Worksheet_Drawing_Shadow' => \PhpOffice\PhpSpreadsheet\Worksheet\Drawing\Shadow::class, + 'PHPExcel_Writer_OpenDocument_Content' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Content::class, + 'PHPExcel_Writer_OpenDocument_Meta' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Meta::class, + 'PHPExcel_Writer_OpenDocument_MetaInf' => \PhpOffice\PhpSpreadsheet\Writer\Ods\MetaInf::class, + 'PHPExcel_Writer_OpenDocument_Mimetype' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Mimetype::class, + 'PHPExcel_Writer_OpenDocument_Settings' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Settings::class, + 'PHPExcel_Writer_OpenDocument_Styles' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Styles::class, + 'PHPExcel_Writer_OpenDocument_Thumbnails' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Thumbnails::class, + 'PHPExcel_Writer_OpenDocument_WriterPart' => \PhpOffice\PhpSpreadsheet\Writer\Ods\WriterPart::class, + 'PHPExcel_Writer_PDF_Core' => \PhpOffice\PhpSpreadsheet\Writer\Pdf::class, + 'PHPExcel_Writer_PDF_DomPDF' => \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class, + 'PHPExcel_Writer_PDF_mPDF' => \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class, + 'PHPExcel_Writer_PDF_tcPDF' => \PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf::class, + 'PHPExcel_Writer_Excel5_BIFFwriter' => \PhpOffice\PhpSpreadsheet\Writer\Xls\BIFFwriter::class, + 'PHPExcel_Writer_Excel5_Escher' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Escher::class, + 'PHPExcel_Writer_Excel5_Font' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Font::class, + 'PHPExcel_Writer_Excel5_Parser' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Parser::class, + 'PHPExcel_Writer_Excel5_Workbook' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook::class, + 'PHPExcel_Writer_Excel5_Worksheet' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Worksheet::class, + 'PHPExcel_Writer_Excel5_Xf' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Xf::class, + 'PHPExcel_Writer_Excel2007_Chart' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart::class, + 'PHPExcel_Writer_Excel2007_Comments' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments::class, + 'PHPExcel_Writer_Excel2007_ContentTypes' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\ContentTypes::class, + 'PHPExcel_Writer_Excel2007_DocProps' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps::class, + 'PHPExcel_Writer_Excel2007_Drawing' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing::class, + 'PHPExcel_Writer_Excel2007_Rels' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels::class, + 'PHPExcel_Writer_Excel2007_RelsRibbon' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsRibbon::class, + 'PHPExcel_Writer_Excel2007_RelsVBA' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsVBA::class, + 'PHPExcel_Writer_Excel2007_StringTable' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable::class, + 'PHPExcel_Writer_Excel2007_Style' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style::class, + 'PHPExcel_Writer_Excel2007_Theme' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Theme::class, + 'PHPExcel_Writer_Excel2007_Workbook' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Workbook::class, + 'PHPExcel_Writer_Excel2007_Worksheet' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet::class, + 'PHPExcel_Writer_Excel2007_WriterPart' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart::class, + 'PHPExcel_CachedObjectStorage_CacheBase' => \PhpOffice\PhpSpreadsheet\Collection\Cells::class, + 'PHPExcel_CalcEngine_CyclicReferenceStack' => \PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack::class, + 'PHPExcel_CalcEngine_Logger' => \PhpOffice\PhpSpreadsheet\Calculation\Engine\Logger::class, + 'PHPExcel_Calculation_Functions' => \PhpOffice\PhpSpreadsheet\Calculation\Functions::class, + 'PHPExcel_Calculation_Function' => \PhpOffice\PhpSpreadsheet\Calculation\Category::class, + 'PHPExcel_Calculation_Database' => \PhpOffice\PhpSpreadsheet\Calculation\Database::class, + 'PHPExcel_Calculation_DateTime' => \PhpOffice\PhpSpreadsheet\Calculation\DateTime::class, + 'PHPExcel_Calculation_Engineering' => \PhpOffice\PhpSpreadsheet\Calculation\Engineering::class, + 'PHPExcel_Calculation_Exception' => \PhpOffice\PhpSpreadsheet\Calculation\Exception::class, + 'PHPExcel_Calculation_ExceptionHandler' => \PhpOffice\PhpSpreadsheet\Calculation\ExceptionHandler::class, + 'PHPExcel_Calculation_Financial' => \PhpOffice\PhpSpreadsheet\Calculation\Financial::class, + 'PHPExcel_Calculation_FormulaParser' => \PhpOffice\PhpSpreadsheet\Calculation\FormulaParser::class, + 'PHPExcel_Calculation_FormulaToken' => \PhpOffice\PhpSpreadsheet\Calculation\FormulaToken::class, + 'PHPExcel_Calculation_Logical' => \PhpOffice\PhpSpreadsheet\Calculation\Logical::class, + 'PHPExcel_Calculation_LookupRef' => \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::class, + 'PHPExcel_Calculation_MathTrig' => \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::class, + 'PHPExcel_Calculation_Statistical' => \PhpOffice\PhpSpreadsheet\Calculation\Statistical::class, + 'PHPExcel_Calculation_TextData' => \PhpOffice\PhpSpreadsheet\Calculation\TextData::class, + 'PHPExcel_Cell_AdvancedValueBinder' => \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class, + 'PHPExcel_Cell_DataType' => \PhpOffice\PhpSpreadsheet\Cell\DataType::class, + 'PHPExcel_Cell_DataValidation' => \PhpOffice\PhpSpreadsheet\Cell\DataValidation::class, + 'PHPExcel_Cell_DefaultValueBinder' => \PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::class, + 'PHPExcel_Cell_Hyperlink' => \PhpOffice\PhpSpreadsheet\Cell\Hyperlink::class, + 'PHPExcel_Cell_IValueBinder' => \PhpOffice\PhpSpreadsheet\Cell\IValueBinder::class, + 'PHPExcel_Chart_Axis' => \PhpOffice\PhpSpreadsheet\Chart\Axis::class, + 'PHPExcel_Chart_DataSeries' => \PhpOffice\PhpSpreadsheet\Chart\DataSeries::class, + 'PHPExcel_Chart_DataSeriesValues' => \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues::class, + 'PHPExcel_Chart_Exception' => \PhpOffice\PhpSpreadsheet\Chart\Exception::class, + 'PHPExcel_Chart_GridLines' => \PhpOffice\PhpSpreadsheet\Chart\GridLines::class, + 'PHPExcel_Chart_Layout' => \PhpOffice\PhpSpreadsheet\Chart\Layout::class, + 'PHPExcel_Chart_Legend' => \PhpOffice\PhpSpreadsheet\Chart\Legend::class, + 'PHPExcel_Chart_PlotArea' => \PhpOffice\PhpSpreadsheet\Chart\PlotArea::class, + 'PHPExcel_Properties' => \PhpOffice\PhpSpreadsheet\Chart\Properties::class, + 'PHPExcel_Chart_Title' => \PhpOffice\PhpSpreadsheet\Chart\Title::class, + 'PHPExcel_DocumentProperties' => \PhpOffice\PhpSpreadsheet\Document\Properties::class, + 'PHPExcel_DocumentSecurity' => \PhpOffice\PhpSpreadsheet\Document\Security::class, + 'PHPExcel_Helper_HTML' => \PhpOffice\PhpSpreadsheet\Helper\Html::class, + 'PHPExcel_Reader_Abstract' => \PhpOffice\PhpSpreadsheet\Reader\BaseReader::class, + 'PHPExcel_Reader_CSV' => \PhpOffice\PhpSpreadsheet\Reader\Csv::class, + 'PHPExcel_Reader_DefaultReadFilter' => \PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter::class, + 'PHPExcel_Reader_Excel2003XML' => \PhpOffice\PhpSpreadsheet\Reader\Xml::class, + 'PHPExcel_Reader_Exception' => \PhpOffice\PhpSpreadsheet\Reader\Exception::class, + 'PHPExcel_Reader_Gnumeric' => \PhpOffice\PhpSpreadsheet\Reader\Gnumeric::class, + 'PHPExcel_Reader_HTML' => \PhpOffice\PhpSpreadsheet\Reader\Html::class, + 'PHPExcel_Reader_IReadFilter' => \PhpOffice\PhpSpreadsheet\Reader\IReadFilter::class, + 'PHPExcel_Reader_IReader' => \PhpOffice\PhpSpreadsheet\Reader\IReader::class, + 'PHPExcel_Reader_OOCalc' => \PhpOffice\PhpSpreadsheet\Reader\Ods::class, + 'PHPExcel_Reader_SYLK' => \PhpOffice\PhpSpreadsheet\Reader\Slk::class, + 'PHPExcel_Reader_Excel5' => \PhpOffice\PhpSpreadsheet\Reader\Xls::class, + 'PHPExcel_Reader_Excel2007' => \PhpOffice\PhpSpreadsheet\Reader\Xlsx::class, + 'PHPExcel_RichText_ITextElement' => \PhpOffice\PhpSpreadsheet\RichText\ITextElement::class, + 'PHPExcel_RichText_Run' => \PhpOffice\PhpSpreadsheet\RichText\Run::class, + 'PHPExcel_RichText_TextElement' => \PhpOffice\PhpSpreadsheet\RichText\TextElement::class, + 'PHPExcel_Shared_CodePage' => \PhpOffice\PhpSpreadsheet\Shared\CodePage::class, + 'PHPExcel_Shared_Date' => \PhpOffice\PhpSpreadsheet\Shared\Date::class, + 'PHPExcel_Shared_Drawing' => \PhpOffice\PhpSpreadsheet\Shared\Drawing::class, + 'PHPExcel_Shared_Escher' => \PhpOffice\PhpSpreadsheet\Shared\Escher::class, + 'PHPExcel_Shared_File' => \PhpOffice\PhpSpreadsheet\Shared\File::class, + 'PHPExcel_Shared_Font' => \PhpOffice\PhpSpreadsheet\Shared\Font::class, + 'PHPExcel_Shared_OLE' => \PhpOffice\PhpSpreadsheet\Shared\OLE::class, + 'PHPExcel_Shared_OLERead' => \PhpOffice\PhpSpreadsheet\Shared\OLERead::class, + 'PHPExcel_Shared_PasswordHasher' => \PhpOffice\PhpSpreadsheet\Shared\PasswordHasher::class, + 'PHPExcel_Shared_String' => \PhpOffice\PhpSpreadsheet\Shared\StringHelper::class, + 'PHPExcel_Shared_TimeZone' => \PhpOffice\PhpSpreadsheet\Shared\TimeZone::class, + 'PHPExcel_Shared_XMLWriter' => \PhpOffice\PhpSpreadsheet\Shared\XMLWriter::class, + 'PHPExcel_Shared_Excel5' => \PhpOffice\PhpSpreadsheet\Shared\Xls::class, + 'PHPExcel_Style_Alignment' => \PhpOffice\PhpSpreadsheet\Style\Alignment::class, + 'PHPExcel_Style_Border' => \PhpOffice\PhpSpreadsheet\Style\Border::class, + 'PHPExcel_Style_Borders' => \PhpOffice\PhpSpreadsheet\Style\Borders::class, + 'PHPExcel_Style_Color' => \PhpOffice\PhpSpreadsheet\Style\Color::class, + 'PHPExcel_Style_Conditional' => \PhpOffice\PhpSpreadsheet\Style\Conditional::class, + 'PHPExcel_Style_Fill' => \PhpOffice\PhpSpreadsheet\Style\Fill::class, + 'PHPExcel_Style_Font' => \PhpOffice\PhpSpreadsheet\Style\Font::class, + 'PHPExcel_Style_NumberFormat' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::class, + 'PHPExcel_Style_Protection' => \PhpOffice\PhpSpreadsheet\Style\Protection::class, + 'PHPExcel_Style_Supervisor' => \PhpOffice\PhpSpreadsheet\Style\Supervisor::class, + 'PHPExcel_Worksheet_AutoFilter' => \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter::class, + 'PHPExcel_Worksheet_BaseDrawing' => \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing::class, + 'PHPExcel_Worksheet_CellIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\CellIterator::class, + 'PHPExcel_Worksheet_Column' => \PhpOffice\PhpSpreadsheet\Worksheet\Column::class, + 'PHPExcel_Worksheet_ColumnCellIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::class, + 'PHPExcel_Worksheet_ColumnDimension' => \PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension::class, + 'PHPExcel_Worksheet_ColumnIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\ColumnIterator::class, + 'PHPExcel_Worksheet_Drawing' => \PhpOffice\PhpSpreadsheet\Worksheet\Drawing::class, + 'PHPExcel_Worksheet_HeaderFooter' => \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter::class, + 'PHPExcel_Worksheet_HeaderFooterDrawing' => \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing::class, + 'PHPExcel_WorksheetIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\Iterator::class, + 'PHPExcel_Worksheet_MemoryDrawing' => \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::class, + 'PHPExcel_Worksheet_PageMargins' => \PhpOffice\PhpSpreadsheet\Worksheet\PageMargins::class, + 'PHPExcel_Worksheet_PageSetup' => \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::class, + 'PHPExcel_Worksheet_Protection' => \PhpOffice\PhpSpreadsheet\Worksheet\Protection::class, + 'PHPExcel_Worksheet_Row' => \PhpOffice\PhpSpreadsheet\Worksheet\Row::class, + 'PHPExcel_Worksheet_RowCellIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator::class, + 'PHPExcel_Worksheet_RowDimension' => \PhpOffice\PhpSpreadsheet\Worksheet\RowDimension::class, + 'PHPExcel_Worksheet_RowIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\RowIterator::class, + 'PHPExcel_Worksheet_SheetView' => \PhpOffice\PhpSpreadsheet\Worksheet\SheetView::class, + 'PHPExcel_Writer_Abstract' => \PhpOffice\PhpSpreadsheet\Writer\BaseWriter::class, + 'PHPExcel_Writer_CSV' => \PhpOffice\PhpSpreadsheet\Writer\Csv::class, + 'PHPExcel_Writer_Exception' => \PhpOffice\PhpSpreadsheet\Writer\Exception::class, + 'PHPExcel_Writer_HTML' => \PhpOffice\PhpSpreadsheet\Writer\Html::class, + 'PHPExcel_Writer_IWriter' => \PhpOffice\PhpSpreadsheet\Writer\IWriter::class, + 'PHPExcel_Writer_OpenDocument' => \PhpOffice\PhpSpreadsheet\Writer\Ods::class, + 'PHPExcel_Writer_PDF' => \PhpOffice\PhpSpreadsheet\Writer\Pdf::class, + 'PHPExcel_Writer_Excel5' => \PhpOffice\PhpSpreadsheet\Writer\Xls::class, + 'PHPExcel_Writer_Excel2007' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx::class, + 'PHPExcel_CachedObjectStorageFactory' => \PhpOffice\PhpSpreadsheet\Collection\CellsFactory::class, + 'PHPExcel_Calculation' => \PhpOffice\PhpSpreadsheet\Calculation\Calculation::class, + 'PHPExcel_Cell' => \PhpOffice\PhpSpreadsheet\Cell\Cell::class, + 'PHPExcel_Chart' => \PhpOffice\PhpSpreadsheet\Chart\Chart::class, + 'PHPExcel_Comment' => \PhpOffice\PhpSpreadsheet\Comment::class, + 'PHPExcel_Exception' => \PhpOffice\PhpSpreadsheet\Exception::class, + 'PHPExcel_HashTable' => \PhpOffice\PhpSpreadsheet\HashTable::class, + 'PHPExcel_IComparable' => \PhpOffice\PhpSpreadsheet\IComparable::class, + 'PHPExcel_IOFactory' => \PhpOffice\PhpSpreadsheet\IOFactory::class, + 'PHPExcel_NamedRange' => \PhpOffice\PhpSpreadsheet\NamedRange::class, + 'PHPExcel_ReferenceHelper' => \PhpOffice\PhpSpreadsheet\ReferenceHelper::class, + 'PHPExcel_RichText' => \PhpOffice\PhpSpreadsheet\RichText\RichText::class, + 'PHPExcel_Settings' => \PhpOffice\PhpSpreadsheet\Settings::class, + 'PHPExcel_Style' => \PhpOffice\PhpSpreadsheet\Style\Style::class, + 'PHPExcel_Worksheet' => \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::class, + ]; + + $methods = [ + 'MINUTEOFHOUR' => 'MINUTE', + 'SECONDOFMINUTE' => 'SECOND', + 'DAYOFWEEK' => 'WEEKDAY', + 'WEEKOFYEAR' => 'WEEKNUM', + 'ExcelToPHPObject' => 'excelToDateTimeObject', + 'ExcelToPHP' => 'excelToTimestamp', + 'FormattedPHPToExcel' => 'formattedPHPToExcel', + 'Cell::absoluteCoordinate' => 'Coordinate::absoluteCoordinate', + 'Cell::absoluteReference' => 'Coordinate::absoluteReference', + 'Cell::buildRange' => 'Coordinate::buildRange', + 'Cell::columnIndexFromString' => 'Coordinate::columnIndexFromString', + 'Cell::coordinateFromString' => 'Coordinate::coordinateFromString', + 'Cell::extractAllCellReferencesInRange' => 'Coordinate::extractAllCellReferencesInRange', + 'Cell::getRangeBoundaries' => 'Coordinate::getRangeBoundaries', + 'Cell::mergeRangesInCollection' => 'Coordinate::mergeRangesInCollection', + 'Cell::rangeBoundaries' => 'Coordinate::rangeBoundaries', + 'Cell::rangeDimension' => 'Coordinate::rangeDimension', + 'Cell::splitRange' => 'Coordinate::splitRange', + 'Cell::stringFromColumnIndex' => 'Coordinate::stringFromColumnIndex', + ]; + + // Keep '\' prefix for class names + $prefixedClasses = []; + foreach ($classes as $key => &$value) { + $value = str_replace('PhpOffice\\', '\\PhpOffice\\', $value); + $prefixedClasses['\\' . $key] = $value; + } + $mapping = $prefixedClasses + $classes + $methods; + + return $mapping; + } + + /** + * Search in all files in given directory. + * + * @param string $path + */ + private function recursiveReplace($path) + { + $patterns = [ + '/*.md', + '/*.txt', + '/*.TXT', + '/*.php', + '/*.phpt', + '/*.php3', + '/*.php4', + '/*.php5', + '/*.phtml', + ]; + + foreach ($patterns as $pattern) { + foreach (glob($path . $pattern) as $file) { + if (strpos($path, '/vendor/') !== false) { + echo $file . " skipped\n"; + + continue; + } + $original = file_get_contents($file); + $converted = $this->replace($original); + + if ($original !== $converted) { + echo $file . " converted\n"; + file_put_contents($file, $converted); + } + } + } + + // Do the recursion in subdirectory + foreach (glob($path . '/*', GLOB_ONLYDIR) as $subpath) { + if (strpos($subpath, $path . '/') === 0) { + $this->recursiveReplace($subpath); + } + } + } + + public function migrate() + { + $path = realpath(getcwd()); + echo 'This will search and replace recursively in ' . $path . PHP_EOL; + echo 'You MUST backup your files first, or you risk losing data.' . PHP_EOL; + echo 'Are you sure ? (y/n)'; + + $confirm = fread(STDIN, 1); + if ($confirm === 'y') { + $this->recursiveReplace($path); + } + } + + /** + * Migrate the given code from PHPExcel to PhpSpreadsheet. + * + * @param string $original + * + * @return string + */ + public function replace($original) + { + $converted = str_replace($this->from, $this->to, $original); + + // The string "PHPExcel" gets special treatment because of how common it might be. + // This regex requires a word boundary around the string, and it can't be + // preceded by $ or -> (goal is to filter out cases where a variable is named $PHPExcel or similar) + $converted = preg_replace('~(?)(\b|\\\\)PHPExcel\b~', '\\' . \PhpOffice\PhpSpreadsheet\Spreadsheet::class, $converted); + + return $converted; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Sample.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Sample.php new file mode 100644 index 0000000..e199c80 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/Sample.php @@ -0,0 +1,230 @@ +getScriptFilename() === 'index'; + } + + /** + * Return the page title. + * + * @return string + */ + public function getPageTitle() + { + return $this->isIndex() ? 'PHPSpreadsheet' : $this->getScriptFilename(); + } + + /** + * Return the page heading. + * + * @return string + */ + public function getPageHeading() + { + return $this->isIndex() ? '' : '

' . str_replace('_', ' ', $this->getScriptFilename()) . '

'; + } + + /** + * Returns an array of all known samples. + * + * @return string[] [$name => $path] + */ + public function getSamples() + { + // Populate samples + $baseDir = realpath(__DIR__ . '/../../../samples'); + $directory = new RecursiveDirectoryIterator($baseDir); + $iterator = new RecursiveIteratorIterator($directory); + $regex = new RegexIterator($iterator, '/^.+\.php$/', RecursiveRegexIterator::GET_MATCH); + + $files = []; + foreach ($regex as $file) { + $file = str_replace(str_replace('\\', '/', $baseDir) . '/', '', str_replace('\\', '/', $file[0])); + $info = pathinfo($file); + $category = str_replace('_', ' ', $info['dirname']); + $name = str_replace('_', ' ', preg_replace('/(|\.php)/', '', $info['filename'])); + if (!in_array($category, ['.', 'boostrap', 'templates'])) { + if (!isset($files[$category])) { + $files[$category] = []; + } + $files[$category][$name] = $file; + } + } + + // Sort everything + ksort($files); + foreach ($files as &$f) { + asort($f); + } + + return $files; + } + + /** + * Write documents. + * + * @param Spreadsheet $spreadsheet + * @param string $filename + * @param string[] $writers + */ + public function write(Spreadsheet $spreadsheet, $filename, array $writers = ['Xlsx', 'Xls']) + { + // Set active sheet index to the first sheet, so Excel opens this as the first sheet + $spreadsheet->setActiveSheetIndex(0); + + // Write documents + foreach ($writers as $writerType) { + $path = $this->getFilename($filename, mb_strtolower($writerType)); + $writer = IOFactory::createWriter($spreadsheet, $writerType); + if ($writer instanceof Pdf) { + // PDF writer needs temporary directory + $tempDir = $this->getTemporaryFolder(); + $writer->setTempDir($tempDir); + } + $callStartTime = microtime(true); + $writer->save($path); + $this->logWrite($writer, $path, $callStartTime); + } + + $this->logEndingNotes(); + } + + /** + * Returns the temporary directory and make sure it exists. + * + * @return string + */ + private function getTemporaryFolder() + { + $tempFolder = sys_get_temp_dir() . '/phpspreadsheet'; + if (!is_dir($tempFolder)) { + if (!mkdir($tempFolder) && !is_dir($tempFolder)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $tempFolder)); + } + } + + return $tempFolder; + } + + /** + * Returns the filename that should be used for sample output. + * + * @param string $filename + * @param string $extension + * + * @return string + */ + public function getFilename($filename, $extension = 'xlsx') + { + $originalExtension = pathinfo($filename, PATHINFO_EXTENSION); + + return $this->getTemporaryFolder() . '/' . str_replace('.' . $originalExtension, '.' . $extension, basename($filename)); + } + + /** + * Return a random temporary file name. + * + * @param string $extension + * + * @return string + */ + public function getTemporaryFilename($extension = 'xlsx') + { + $temporaryFilename = tempnam($this->getTemporaryFolder(), 'phpspreadsheet-'); + unlink($temporaryFilename); + + return $temporaryFilename . '.' . $extension; + } + + public function log($message) + { + $eol = $this->isCli() ? PHP_EOL : '
'; + echo date('H:i:s ') . $message . $eol; + } + + /** + * Log ending notes. + */ + public function logEndingNotes() + { + // Do not show execution time for index + $this->log('Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . 'MB'); + } + + /** + * Log a line about the write operation. + * + * @param IWriter $writer + * @param string $path + * @param float $callStartTime + */ + public function logWrite(IWriter $writer, $path, $callStartTime) + { + $callEndTime = microtime(true); + $callTime = $callEndTime - $callStartTime; + $reflection = new ReflectionClass($writer); + $format = $reflection->getShortName(); + $message = "Write {$format} format to {$path} in " . sprintf('%.4f', $callTime) . ' seconds'; + + $this->log($message); + } + + /** + * Log a line about the read operation. + * + * @param string $format + * @param string $path + * @param float $callStartTime + */ + public function logRead($format, $path, $callStartTime) + { + $callEndTime = microtime(true); + $callTime = $callEndTime - $callStartTime; + $message = "Read {$format} format from {$path} in " . sprintf('%.4f', $callTime) . ' seconds'; + + $this->log($message); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IComparable.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IComparable.php new file mode 100644 index 0000000..c215847 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IComparable.php @@ -0,0 +1,13 @@ + Reader\Xlsx::class, + 'Xls' => Reader\Xls::class, + 'Xml' => Reader\Xml::class, + 'Ods' => Reader\Ods::class, + 'Slk' => Reader\Slk::class, + 'Gnumeric' => Reader\Gnumeric::class, + 'Html' => Reader\Html::class, + 'Csv' => Reader\Csv::class, + ]; + + private static $writers = [ + 'Xls' => Writer\Xls::class, + 'Xlsx' => Writer\Xlsx::class, + 'Ods' => Writer\Ods::class, + 'Csv' => Writer\Csv::class, + 'Html' => Writer\Html::class, + 'Tcpdf' => Writer\Pdf\Tcpdf::class, + 'Dompdf' => Writer\Pdf\Dompdf::class, + 'Mpdf' => Writer\Pdf\Mpdf::class, + ]; + + /** + * Create Writer\IWriter. + * + * @param Spreadsheet $spreadsheet + * @param string $writerType Example: Xlsx + * + * @throws Writer\Exception + * + * @return Writer\IWriter + */ + public static function createWriter(Spreadsheet $spreadsheet, $writerType) + { + if (!isset(self::$writers[$writerType])) { + throw new Writer\Exception("No writer found for type $writerType"); + } + + // Instantiate writer + $className = self::$writers[$writerType]; + + return new $className($spreadsheet); + } + + /** + * Create Reader\IReader. + * + * @param string $readerType Example: Xlsx + * + * @throws Reader\Exception + * + * @return Reader\IReader + */ + public static function createReader($readerType) + { + if (!isset(self::$readers[$readerType])) { + throw new Reader\Exception("No reader found for type $readerType"); + } + + // Instantiate reader + $className = self::$readers[$readerType]; + + return new $className(); + } + + /** + * Loads Spreadsheet from file using automatic Reader\IReader resolution. + * + * @param string $pFilename The name of the spreadsheet file + * + * @throws Reader\Exception + * + * @return Spreadsheet + */ + public static function load($pFilename) + { + $reader = self::createReaderForFile($pFilename); + + return $reader->load($pFilename); + } + + /** + * Identify file type using automatic Reader\IReader resolution. + * + * @param string $pFilename The name of the spreadsheet file to identify + * + * @throws Reader\Exception + * + * @return string + */ + public static function identify($pFilename) + { + $reader = self::createReaderForFile($pFilename); + $className = get_class($reader); + $classType = explode('\\', $className); + unset($reader); + + return array_pop($classType); + } + + /** + * Create Reader\IReader for file using automatic Reader\IReader resolution. + * + * @param string $filename The name of the spreadsheet file + * + * @throws Reader\Exception + * + * @return Reader\IReader + */ + public static function createReaderForFile($filename) + { + File::assertFile($filename); + + // First, lucky guess by inspecting file extension + $guessedReader = self::getReaderTypeFromExtension($filename); + if ($guessedReader !== null) { + $reader = self::createReader($guessedReader); + + // Let's see if we are lucky + if (isset($reader) && $reader->canRead($filename)) { + return $reader; + } + } + + // If we reach here then "lucky guess" didn't give any result + // Try walking through all the options in self::$autoResolveClasses + foreach (self::$readers as $type => $class) { + // Ignore our original guess, we know that won't work + if ($type !== $guessedReader) { + $reader = self::createReader($type); + if ($reader->canRead($filename)) { + return $reader; + } + } + } + + throw new Reader\Exception('Unable to identify a reader for this file'); + } + + /** + * Guess a reader type from the file extension, if any. + * + * @param string $filename + * + * @return null|string + */ + private static function getReaderTypeFromExtension($filename) + { + $pathinfo = pathinfo($filename); + if (!isset($pathinfo['extension'])) { + return null; + } + + switch (strtolower($pathinfo['extension'])) { + case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet + case 'xlsm': // Excel (OfficeOpenXML) Macro Spreadsheet (macros will be discarded) + case 'xltx': // Excel (OfficeOpenXML) Template + case 'xltm': // Excel (OfficeOpenXML) Macro Template (macros will be discarded) + return 'Xlsx'; + case 'xls': // Excel (BIFF) Spreadsheet + case 'xlt': // Excel (BIFF) Template + return 'Xls'; + case 'ods': // Open/Libre Offic Calc + case 'ots': // Open/Libre Offic Calc Template + return 'Ods'; + case 'slk': + return 'Slk'; + case 'xml': // Excel 2003 SpreadSheetML + return 'Xml'; + case 'gnumeric': + return 'Gnumeric'; + case 'htm': + case 'html': + return 'Html'; + case 'csv': + // Do nothing + // We must not try to use CSV reader since it loads + // all files including Excel files etc. + return null; + default: + return null; + } + } + + /** + * Register a writer with its type and class name. + * + * @param string $writerType + * @param string $writerClass + */ + public static function registerWriter($writerType, $writerClass) + { + if (!is_a($writerClass, Writer\IWriter::class, true)) { + throw new Writer\Exception('Registered writers must implement ' . Writer\IWriter::class); + } + + self::$writers[$writerType] = $writerClass; + } + + /** + * Register a reader with its type and class name. + * + * @param string $readerType + * @param string $readerClass + */ + public static function registerReader($readerType, $readerClass) + { + if (!is_a($readerClass, Reader\IReader::class, true)) { + throw new Reader\Exception('Registered readers must implement ' . Reader\IReader::class); + } + + self::$readers[$readerType] = $readerClass; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/NamedRange.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/NamedRange.php new file mode 100644 index 0000000..e539b7c --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/NamedRange.php @@ -0,0 +1,240 @@ +worksheet). + * + * @var bool + */ + private $localOnly; + + /** + * Scope. + * + * @var Worksheet + */ + private $scope; + + /** + * Create a new NamedRange. + * + * @param string $pName + * @param Worksheet $pWorksheet + * @param string $pRange + * @param bool $pLocalOnly + * @param null|Worksheet $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope. + * + * @throws Exception + */ + public function __construct($pName, Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null) + { + // Validate data + if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) { + throw new Exception('Parameters can not be null.'); + } + + // Set local members + $this->name = $pName; + $this->worksheet = $pWorksheet; + $this->range = $pRange; + $this->localOnly = $pLocalOnly; + $this->scope = ($pLocalOnly == true) ? (($pScope == null) ? $pWorksheet : $pScope) : null; + } + + /** + * Get name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set name. + * + * @param string $value + * + * @return $this + */ + public function setName($value) + { + if ($value !== null) { + // Old title + $oldTitle = $this->name; + + // Re-attach + if ($this->worksheet !== null) { + $this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet); + } + $this->name = $value; + + if ($this->worksheet !== null) { + $this->worksheet->getParent()->addNamedRange($this); + } + + // New title + $newTitle = $this->name; + ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle); + } + + return $this; + } + + /** + * Get worksheet. + * + * @return Worksheet + */ + public function getWorksheet() + { + return $this->worksheet; + } + + /** + * Set worksheet. + * + * @param Worksheet $value + * + * @return $this + */ + public function setWorksheet(Worksheet $value = null) + { + if ($value !== null) { + $this->worksheet = $value; + } + + return $this; + } + + /** + * Get range. + * + * @return string + */ + public function getRange() + { + return $this->range; + } + + /** + * Set range. + * + * @param string $value + * + * @return $this + */ + public function setRange($value) + { + if ($value !== null) { + $this->range = $value; + } + + return $this; + } + + /** + * Get localOnly. + * + * @return bool + */ + public function getLocalOnly() + { + return $this->localOnly; + } + + /** + * Set localOnly. + * + * @param bool $value + * + * @return $this + */ + public function setLocalOnly($value) + { + $this->localOnly = $value; + $this->scope = $value ? $this->worksheet : null; + + return $this; + } + + /** + * Get scope. + * + * @return null|Worksheet + */ + public function getScope() + { + return $this->scope; + } + + /** + * Set scope. + * + * @param null|Worksheet $value + * + * @return $this + */ + public function setScope(Worksheet $value = null) + { + $this->scope = $value; + $this->localOnly = $value != null; + + return $this; + } + + /** + * Resolve a named range to a regular cell range. + * + * @param string $pNamedRange Named range + * @param null|Worksheet $pSheet Scope. Use null for global scope + * + * @return NamedRange + */ + public static function resolveRange($pNamedRange, Worksheet $pSheet) + { + return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php new file mode 100644 index 0000000..f7af155 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/BaseReader.php @@ -0,0 +1,160 @@ +readFilter = new DefaultReadFilter(); + } + + public function getReadDataOnly() + { + return $this->readDataOnly; + } + + public function setReadDataOnly($pValue) + { + $this->readDataOnly = (bool) $pValue; + + return $this; + } + + public function getReadEmptyCells() + { + return $this->readEmptyCells; + } + + public function setReadEmptyCells($pValue) + { + $this->readEmptyCells = (bool) $pValue; + + return $this; + } + + public function getIncludeCharts() + { + return $this->includeCharts; + } + + public function setIncludeCharts($pValue) + { + $this->includeCharts = (bool) $pValue; + + return $this; + } + + public function getLoadSheetsOnly() + { + return $this->loadSheetsOnly; + } + + public function setLoadSheetsOnly($value) + { + if ($value === null) { + return $this->setLoadAllSheets(); + } + + $this->loadSheetsOnly = is_array($value) ? $value : [$value]; + + return $this; + } + + public function setLoadAllSheets() + { + $this->loadSheetsOnly = null; + + return $this; + } + + public function getReadFilter() + { + return $this->readFilter; + } + + public function setReadFilter(IReadFilter $pValue) + { + $this->readFilter = $pValue; + + return $this; + } + + public function getSecurityScanner() + { + if (property_exists($this, 'securityScanner')) { + return $this->securityScanner; + } + + return null; + } + + /** + * Open file for reading. + * + * @param string $pFilename + * + * @throws Exception + */ + protected function openFile($pFilename) + { + File::assertFile($pFilename); + + // Open file + $this->fileHandle = fopen($pFilename, 'r'); + if ($this->fileHandle === false) { + throw new Exception('Could not open file ' . $pFilename . ' for reading.'); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php new file mode 100644 index 0000000..4713409 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php @@ -0,0 +1,563 @@ +inputEncoding = $pValue; + + return $this; + } + + /** + * Get input encoding. + * + * @return string + */ + public function getInputEncoding() + { + return $this->inputEncoding; + } + + /** + * Move filepointer past any BOM marker. + */ + protected function skipBOM() + { + rewind($this->fileHandle); + + switch ($this->inputEncoding) { + case 'UTF-8': + fgets($this->fileHandle, 4) == "\xEF\xBB\xBF" ? + fseek($this->fileHandle, 3) : fseek($this->fileHandle, 0); + + break; + case 'UTF-16LE': + fgets($this->fileHandle, 3) == "\xFF\xFE" ? + fseek($this->fileHandle, 2) : fseek($this->fileHandle, 0); + + break; + case 'UTF-16BE': + fgets($this->fileHandle, 3) == "\xFE\xFF" ? + fseek($this->fileHandle, 2) : fseek($this->fileHandle, 0); + + break; + case 'UTF-32LE': + fgets($this->fileHandle, 5) == "\xFF\xFE\x00\x00" ? + fseek($this->fileHandle, 4) : fseek($this->fileHandle, 0); + + break; + case 'UTF-32BE': + fgets($this->fileHandle, 5) == "\x00\x00\xFE\xFF" ? + fseek($this->fileHandle, 4) : fseek($this->fileHandle, 0); + + break; + default: + break; + } + } + + /** + * Identify any separator that is explicitly set in the file. + */ + protected function checkSeparator() + { + $line = fgets($this->fileHandle); + if ($line === false) { + return; + } + + if ((strlen(trim($line, "\r\n")) == 5) && (stripos($line, 'sep=') === 0)) { + $this->delimiter = substr($line, 4, 1); + + return; + } + + $this->skipBOM(); + } + + /** + * Infer the separator if it isn't explicitly set in the file or specified by the user. + */ + protected function inferSeparator() + { + if ($this->delimiter !== null) { + return; + } + + $potentialDelimiters = [',', ';', "\t", '|', ':', ' ', '~']; + $counts = []; + foreach ($potentialDelimiters as $delimiter) { + $counts[$delimiter] = []; + } + + // Count how many times each of the potential delimiters appears in each line + $numberLines = 0; + while (($line = $this->getNextLine()) !== false && (++$numberLines < 1000)) { + $countLine = []; + for ($i = strlen($line) - 1; $i >= 0; --$i) { + $char = $line[$i]; + if (isset($counts[$char])) { + if (!isset($countLine[$char])) { + $countLine[$char] = 0; + } + ++$countLine[$char]; + } + } + foreach ($potentialDelimiters as $delimiter) { + $counts[$delimiter][] = $countLine[$delimiter] + ?? 0; + } + } + + // If number of lines is 0, nothing to infer : fall back to the default + if ($numberLines === 0) { + $this->delimiter = reset($potentialDelimiters); + $this->skipBOM(); + + return; + } + + // Calculate the mean square deviations for each delimiter (ignoring delimiters that haven't been found consistently) + $meanSquareDeviations = []; + $middleIdx = floor(($numberLines - 1) / 2); + + foreach ($potentialDelimiters as $delimiter) { + $series = $counts[$delimiter]; + sort($series); + + $median = ($numberLines % 2) + ? $series[$middleIdx] + : ($series[$middleIdx] + $series[$middleIdx + 1]) / 2; + + if ($median === 0) { + continue; + } + + $meanSquareDeviations[$delimiter] = array_reduce( + $series, + function ($sum, $value) use ($median) { + return $sum + pow($value - $median, 2); + } + ) / count($series); + } + + // ... and pick the delimiter with the smallest mean square deviation (in case of ties, the order in potentialDelimiters is respected) + $min = INF; + foreach ($potentialDelimiters as $delimiter) { + if (!isset($meanSquareDeviations[$delimiter])) { + continue; + } + + if ($meanSquareDeviations[$delimiter] < $min) { + $min = $meanSquareDeviations[$delimiter]; + $this->delimiter = $delimiter; + } + } + + // If no delimiter could be detected, fall back to the default + if ($this->delimiter === null) { + $this->delimiter = reset($potentialDelimiters); + } + + $this->skipBOM(); + } + + /** + * Get the next full line from the file. + * + * @param string $line + * + * @return bool|string + */ + private function getNextLine($line = '') + { + // Get the next line in the file + $newLine = fgets($this->fileHandle); + + // Return false if there is no next line + if ($newLine === false) { + return false; + } + + // Add the new line to the line passed in + $line = $line . $newLine; + + // Drop everything that is enclosed to avoid counting false positives in enclosures + $enclosure = '(?escapeCharacter, '/') . ')' + . preg_quote($this->enclosure, '/'); + $line = preg_replace('/(' . $enclosure . '.*' . $enclosure . ')/Us', '', $line); + + // See if we have any enclosures left in the line + // if we still have an enclosure then we need to read the next line as well + if (preg_match('/(' . $enclosure . ')/', $line) > 0) { + $line = $this->getNextLine($line); + } + + return $line; + } + + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetInfo($pFilename) + { + // Open file + if (!$this->canRead($pFilename)) { + throw new Exception($pFilename . ' is an Invalid Spreadsheet file.'); + } + $this->openFile($pFilename); + $fileHandle = $this->fileHandle; + + // Skip BOM, if any + $this->skipBOM(); + $this->checkSeparator(); + $this->inferSeparator(); + + $worksheetInfo = []; + $worksheetInfo[0]['worksheetName'] = 'Worksheet'; + $worksheetInfo[0]['lastColumnLetter'] = 'A'; + $worksheetInfo[0]['lastColumnIndex'] = 0; + $worksheetInfo[0]['totalRows'] = 0; + $worksheetInfo[0]['totalColumns'] = 0; + + // Loop through each line of the file in turn + while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure, $this->escapeCharacter)) !== false) { + ++$worksheetInfo[0]['totalRows']; + $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1); + } + + $worksheetInfo[0]['lastColumnLetter'] = Coordinate::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex'] + 1); + $worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1; + + // Close file + fclose($fileHandle); + + return $worksheetInfo; + } + + /** + * Loads Spreadsheet from file. + * + * @param string $pFilename + * + * @throws Exception + * + * @return Spreadsheet + */ + public function load($pFilename) + { + // Create new Spreadsheet + $spreadsheet = new Spreadsheet(); + + // Load into this instance + return $this->loadIntoExisting($pFilename, $spreadsheet); + } + + /** + * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. + * + * @param string $pFilename + * @param Spreadsheet $spreadsheet + * + * @throws Exception + * + * @return Spreadsheet + */ + public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet) + { + $lineEnding = ini_get('auto_detect_line_endings'); + ini_set('auto_detect_line_endings', true); + + // Open file + if (!$this->canRead($pFilename)) { + throw new Exception($pFilename . ' is an Invalid Spreadsheet file.'); + } + $this->openFile($pFilename); + $fileHandle = $this->fileHandle; + + // Skip BOM, if any + $this->skipBOM(); + $this->checkSeparator(); + $this->inferSeparator(); + + // Create new PhpSpreadsheet object + while ($spreadsheet->getSheetCount() <= $this->sheetIndex) { + $spreadsheet->createSheet(); + } + $sheet = $spreadsheet->setActiveSheetIndex($this->sheetIndex); + + // Set our starting row based on whether we're in contiguous mode or not + $currentRow = 1; + if ($this->contiguous) { + $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow() : $this->contiguousRow; + } + + // Loop through each line of the file in turn + while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure, $this->escapeCharacter)) !== false) { + $columnLetter = 'A'; + foreach ($rowData as $rowDatum) { + if ($rowDatum != '' && $this->readFilter->readCell($columnLetter, $currentRow)) { + // Convert encoding if necessary + if ($this->inputEncoding !== 'UTF-8') { + $rowDatum = StringHelper::convertEncoding($rowDatum, 'UTF-8', $this->inputEncoding); + } + + // Set cell value + $sheet->getCell($columnLetter . $currentRow)->setValue($rowDatum); + } + ++$columnLetter; + } + ++$currentRow; + } + + // Close file + fclose($fileHandle); + + if ($this->contiguous) { + $this->contiguousRow = $currentRow; + } + + ini_set('auto_detect_line_endings', $lineEnding); + + // Return + return $spreadsheet; + } + + /** + * Get delimiter. + * + * @return string + */ + public function getDelimiter() + { + return $this->delimiter; + } + + /** + * Set delimiter. + * + * @param string $delimiter Delimiter, eg: ',' + * + * @return $this + */ + public function setDelimiter($delimiter) + { + $this->delimiter = $delimiter; + + return $this; + } + + /** + * Get enclosure. + * + * @return string + */ + public function getEnclosure() + { + return $this->enclosure; + } + + /** + * Set enclosure. + * + * @param string $enclosure Enclosure, defaults to " + * + * @return $this + */ + public function setEnclosure($enclosure) + { + if ($enclosure == '') { + $enclosure = '"'; + } + $this->enclosure = $enclosure; + + return $this; + } + + /** + * Get sheet index. + * + * @return int + */ + public function getSheetIndex() + { + return $this->sheetIndex; + } + + /** + * Set sheet index. + * + * @param int $pValue Sheet index + * + * @return $this + */ + public function setSheetIndex($pValue) + { + $this->sheetIndex = $pValue; + + return $this; + } + + /** + * Set Contiguous. + * + * @param bool $contiguous + * + * @return $this + */ + public function setContiguous($contiguous) + { + $this->contiguous = (bool) $contiguous; + if (!$contiguous) { + $this->contiguousRow = -1; + } + + return $this; + } + + /** + * Get Contiguous. + * + * @return bool + */ + public function getContiguous() + { + return $this->contiguous; + } + + /** + * Set escape backslashes. + * + * @param string $escapeCharacter + * + * @return $this + */ + public function setEscapeCharacter($escapeCharacter) + { + $this->escapeCharacter = $escapeCharacter; + + return $this; + } + + /** + * Get escape backslashes. + * + * @return string + */ + public function getEscapeCharacter() + { + return $this->escapeCharacter; + } + + /** + * Can the current IReader read the file? + * + * @param string $pFilename + * + * @return bool + */ + public function canRead($pFilename) + { + // Check if file exists + try { + $this->openFile($pFilename); + } catch (Exception $e) { + return false; + } + + fclose($this->fileHandle); + + // Trust file extension if any + $extension = strtolower(pathinfo($pFilename, PATHINFO_EXTENSION)); + if (in_array($extension, ['csv', 'tsv'])) { + return true; + } + + // Attempt to guess mimetype + $type = mime_content_type($pFilename); + $supportedTypes = [ + 'text/csv', + 'text/plain', + 'inode/x-empty', + ]; + + return in_array($type, $supportedTypes, true); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/DefaultReadFilter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/DefaultReadFilter.php new file mode 100644 index 0000000..e104186 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/DefaultReadFilter.php @@ -0,0 +1,20 @@ +referenceHelper = ReferenceHelper::getInstance(); + $this->securityScanner = XmlScanner::getInstance($this); + } + + /** + * Can the current IReader read the file? + * + * @param string $pFilename + * + * @throws Exception + * + * @return bool + */ + public function canRead($pFilename) + { + File::assertFile($pFilename); + + // Check if gzlib functions are available + if (!function_exists('gzread')) { + throw new Exception('gzlib library is not enabled'); + } + + // Read signature data (first 3 bytes) + $fh = fopen($pFilename, 'r'); + $data = fread($fh, 2); + fclose($fh); + + return $data == chr(0x1F) . chr(0x8B); + } + + /** + * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object. + * + * @param string $pFilename + * + * @return array + */ + public function listWorksheetNames($pFilename) + { + File::assertFile($pFilename); + + $xml = new XMLReader(); + $xml->xml($this->securityScanner->scanFile('compress.zlib://' . realpath($pFilename)), null, Settings::getLibXmlLoaderOptions()); + $xml->setParserProperty(2, true); + + $worksheetNames = []; + while ($xml->read()) { + if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) { + $xml->read(); // Move onto the value node + $worksheetNames[] = (string) $xml->value; + } elseif ($xml->name == 'gnm:Sheets') { + // break out of the loop once we've got our sheet names rather than parse the entire file + break; + } + } + + return $worksheetNames; + } + + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). + * + * @param string $pFilename + * + * @return array + */ + public function listWorksheetInfo($pFilename) + { + File::assertFile($pFilename); + + $xml = new XMLReader(); + $xml->xml($this->securityScanner->scanFile('compress.zlib://' . realpath($pFilename)), null, Settings::getLibXmlLoaderOptions()); + $xml->setParserProperty(2, true); + + $worksheetInfo = []; + while ($xml->read()) { + if ($xml->name == 'gnm:Sheet' && $xml->nodeType == XMLReader::ELEMENT) { + $tmpInfo = [ + 'worksheetName' => '', + 'lastColumnLetter' => 'A', + 'lastColumnIndex' => 0, + 'totalRows' => 0, + 'totalColumns' => 0, + ]; + + while ($xml->read()) { + if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) { + $xml->read(); // Move onto the value node + $tmpInfo['worksheetName'] = (string) $xml->value; + } elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) { + $xml->read(); // Move onto the value node + $tmpInfo['lastColumnIndex'] = (int) $xml->value; + $tmpInfo['totalColumns'] = (int) $xml->value + 1; + } elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) { + $xml->read(); // Move onto the value node + $tmpInfo['totalRows'] = (int) $xml->value + 1; + + break; + } + } + $tmpInfo['lastColumnLetter'] = Coordinate::stringFromColumnIndex($tmpInfo['lastColumnIndex'] + 1); + $worksheetInfo[] = $tmpInfo; + } + } + + return $worksheetInfo; + } + + /** + * @param string $filename + * + * @return string + */ + private function gzfileGetContents($filename) + { + $file = @gzopen($filename, 'rb'); + $data = ''; + if ($file !== false) { + while (!gzeof($file)) { + $data .= gzread($file, 1024); + } + gzclose($file); + } + + return $data; + } + + /** + * Loads Spreadsheet from file. + * + * @param string $pFilename + * + * @throws Exception + * + * @return Spreadsheet + */ + public function load($pFilename) + { + // Create new Spreadsheet + $spreadsheet = new Spreadsheet(); + + // Load into this instance + return $this->loadIntoExisting($pFilename, $spreadsheet); + } + + /** + * Loads from file into Spreadsheet instance. + * + * @param string $pFilename + * @param Spreadsheet $spreadsheet + * + * @throws Exception + * + * @return Spreadsheet + */ + public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet) + { + File::assertFile($pFilename); + + $gFileData = $this->gzfileGetContents($pFilename); + + $xml = simplexml_load_string($this->securityScanner->scan($gFileData), 'SimpleXMLElement', Settings::getLibXmlLoaderOptions()); + $namespacesMeta = $xml->getNamespaces(true); + + $gnmXML = $xml->children($namespacesMeta['gnm']); + + $docProps = $spreadsheet->getProperties(); + // Document Properties are held differently, depending on the version of Gnumeric + if (isset($namespacesMeta['office'])) { + $officeXML = $xml->children($namespacesMeta['office']); + $officeDocXML = $officeXML->{'document-meta'}; + $officeDocMetaXML = $officeDocXML->meta; + + foreach ($officeDocMetaXML as $officePropertyData) { + $officePropertyDC = []; + if (isset($namespacesMeta['dc'])) { + $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']); + } + foreach ($officePropertyDC as $propertyName => $propertyValue) { + $propertyValue = (string) $propertyValue; + switch ($propertyName) { + case 'title': + $docProps->setTitle(trim($propertyValue)); + + break; + case 'subject': + $docProps->setSubject(trim($propertyValue)); + + break; + case 'creator': + $docProps->setCreator(trim($propertyValue)); + $docProps->setLastModifiedBy(trim($propertyValue)); + + break; + case 'date': + $creationDate = strtotime(trim($propertyValue)); + $docProps->setCreated($creationDate); + $docProps->setModified($creationDate); + + break; + case 'description': + $docProps->setDescription(trim($propertyValue)); + + break; + } + } + $officePropertyMeta = []; + if (isset($namespacesMeta['meta'])) { + $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']); + } + foreach ($officePropertyMeta as $propertyName => $propertyValue) { + $attributes = $propertyValue->attributes($namespacesMeta['meta']); + $propertyValue = (string) $propertyValue; + switch ($propertyName) { + case 'keyword': + $docProps->setKeywords(trim($propertyValue)); + + break; + case 'initial-creator': + $docProps->setCreator(trim($propertyValue)); + $docProps->setLastModifiedBy(trim($propertyValue)); + + break; + case 'creation-date': + $creationDate = strtotime(trim($propertyValue)); + $docProps->setCreated($creationDate); + $docProps->setModified($creationDate); + + break; + case 'user-defined': + [, $attrName] = explode(':', $attributes['name']); + switch ($attrName) { + case 'publisher': + $docProps->setCompany(trim($propertyValue)); + + break; + case 'category': + $docProps->setCategory(trim($propertyValue)); + + break; + case 'manager': + $docProps->setManager(trim($propertyValue)); + + break; + } + + break; + } + } + } + } elseif (isset($gnmXML->Summary)) { + foreach ($gnmXML->Summary->Item as $summaryItem) { + $propertyName = $summaryItem->name; + $propertyValue = $summaryItem->{'val-string'}; + switch ($propertyName) { + case 'title': + $docProps->setTitle(trim($propertyValue)); + + break; + case 'comments': + $docProps->setDescription(trim($propertyValue)); + + break; + case 'keywords': + $docProps->setKeywords(trim($propertyValue)); + + break; + case 'category': + $docProps->setCategory(trim($propertyValue)); + + break; + case 'manager': + $docProps->setManager(trim($propertyValue)); + + break; + case 'author': + $docProps->setCreator(trim($propertyValue)); + $docProps->setLastModifiedBy(trim($propertyValue)); + + break; + case 'company': + $docProps->setCompany(trim($propertyValue)); + + break; + } + } + } + + $worksheetID = 0; + foreach ($gnmXML->Sheets->Sheet as $sheet) { + $worksheetName = (string) $sheet->Name; + if ((isset($this->loadSheetsOnly)) && (!in_array($worksheetName, $this->loadSheetsOnly))) { + continue; + } + + $maxRow = $maxCol = 0; + + // Create new Worksheet + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex($worksheetID); + // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula + // cells... during the load, all formulae should be correct, and we're simply bringing the worksheet + // name in line with the formula, not the reverse + $spreadsheet->getActiveSheet()->setTitle($worksheetName, false, false); + + if ((!$this->readDataOnly) && (isset($sheet->PrintInformation))) { + if (isset($sheet->PrintInformation->Margins)) { + foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) { + $marginAttributes = $margin->attributes(); + $marginSize = 72 / 100; // Default + switch ($marginAttributes['PrefUnit']) { + case 'mm': + $marginSize = (int) ($marginAttributes['Points']) / 100; + + break; + } + switch ($key) { + case 'top': + $spreadsheet->getActiveSheet()->getPageMargins()->setTop($marginSize); + + break; + case 'bottom': + $spreadsheet->getActiveSheet()->getPageMargins()->setBottom($marginSize); + + break; + case 'left': + $spreadsheet->getActiveSheet()->getPageMargins()->setLeft($marginSize); + + break; + case 'right': + $spreadsheet->getActiveSheet()->getPageMargins()->setRight($marginSize); + + break; + case 'header': + $spreadsheet->getActiveSheet()->getPageMargins()->setHeader($marginSize); + + break; + case 'footer': + $spreadsheet->getActiveSheet()->getPageMargins()->setFooter($marginSize); + + break; + } + } + } + } + + foreach ($sheet->Cells->Cell as $cell) { + $cellAttributes = $cell->attributes(); + $row = (int) $cellAttributes->Row + 1; + $column = (int) $cellAttributes->Col; + + if ($row > $maxRow) { + $maxRow = $row; + } + if ($column > $maxCol) { + $maxCol = $column; + } + + $column = Coordinate::stringFromColumnIndex($column + 1); + + // Read cell? + if ($this->getReadFilter() !== null) { + if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) { + continue; + } + } + + $ValueType = $cellAttributes->ValueType; + $ExprID = (string) $cellAttributes->ExprID; + $type = DataType::TYPE_FORMULA; + if ($ExprID > '') { + if (((string) $cell) > '') { + $this->expressions[$ExprID] = [ + 'column' => $cellAttributes->Col, + 'row' => $cellAttributes->Row, + 'formula' => (string) $cell, + ]; + } else { + $expression = $this->expressions[$ExprID]; + + $cell = $this->referenceHelper->updateFormulaReferences( + $expression['formula'], + 'A1', + $cellAttributes->Col - $expression['column'], + $cellAttributes->Row - $expression['row'], + $worksheetName + ); + } + $type = DataType::TYPE_FORMULA; + } else { + switch ($ValueType) { + case '10': // NULL + $type = DataType::TYPE_NULL; + + break; + case '20': // Boolean + $type = DataType::TYPE_BOOL; + $cell = $cell == 'TRUE'; + + break; + case '30': // Integer + $cell = (int) $cell; + // Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case + // no break + case '40': // Float + $type = DataType::TYPE_NUMERIC; + + break; + case '50': // Error + $type = DataType::TYPE_ERROR; + + break; + case '60': // String + $type = DataType::TYPE_STRING; + + break; + case '70': // Cell Range + case '80': // Array + } + } + $spreadsheet->getActiveSheet()->getCell($column . $row)->setValueExplicit($cell, $type); + } + + if ((!$this->readDataOnly) && (isset($sheet->Objects))) { + foreach ($sheet->Objects->children('gnm', true) as $key => $comment) { + $commentAttributes = $comment->attributes(); + // Only comment objects are handled at the moment + if ($commentAttributes->Text) { + $spreadsheet->getActiveSheet()->getComment((string) $commentAttributes->ObjectBound)->setAuthor((string) $commentAttributes->Author)->setText($this->parseRichText((string) $commentAttributes->Text)); + } + } + } + foreach ($sheet->Styles->StyleRegion as $styleRegion) { + $styleAttributes = $styleRegion->attributes(); + if (($styleAttributes['startRow'] <= $maxRow) && + ($styleAttributes['startCol'] <= $maxCol)) { + $startColumn = Coordinate::stringFromColumnIndex((int) $styleAttributes['startCol'] + 1); + $startRow = $styleAttributes['startRow'] + 1; + + $endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol']; + $endColumn = Coordinate::stringFromColumnIndex($endColumn + 1); + $endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow']; + $endRow += 1; + $cellRange = $startColumn . $startRow . ':' . $endColumn . $endRow; + + $styleAttributes = $styleRegion->Style->attributes(); + + // We still set the number format mask for date/time values, even if readDataOnly is true + if ((!$this->readDataOnly) || + (Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) { + $styleArray = []; + $styleArray['numberFormat']['formatCode'] = (string) $styleAttributes['Format']; + // If readDataOnly is false, we set all formatting information + if (!$this->readDataOnly) { + switch ($styleAttributes['HAlign']) { + case '1': + $styleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_GENERAL; + + break; + case '2': + $styleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_LEFT; + + break; + case '4': + $styleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_RIGHT; + + break; + case '8': + $styleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_CENTER; + + break; + case '16': + case '64': + $styleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_CENTER_CONTINUOUS; + + break; + case '32': + $styleArray['alignment']['horizontal'] = Alignment::HORIZONTAL_JUSTIFY; + + break; + } + + switch ($styleAttributes['VAlign']) { + case '1': + $styleArray['alignment']['vertical'] = Alignment::VERTICAL_TOP; + + break; + case '2': + $styleArray['alignment']['vertical'] = Alignment::VERTICAL_BOTTOM; + + break; + case '4': + $styleArray['alignment']['vertical'] = Alignment::VERTICAL_CENTER; + + break; + case '8': + $styleArray['alignment']['vertical'] = Alignment::VERTICAL_JUSTIFY; + + break; + } + + $styleArray['alignment']['wrapText'] = $styleAttributes['WrapText'] == '1'; + $styleArray['alignment']['shrinkToFit'] = $styleAttributes['ShrinkToFit'] == '1'; + $styleArray['alignment']['indent'] = ((int) ($styleAttributes['Indent']) > 0) ? $styleAttributes['indent'] : 0; + + $RGB = self::parseGnumericColour($styleAttributes['Fore']); + $styleArray['font']['color']['rgb'] = $RGB; + $RGB = self::parseGnumericColour($styleAttributes['Back']); + $shade = $styleAttributes['Shade']; + if (($RGB != '000000') || ($shade != '0')) { + $styleArray['fill']['color']['rgb'] = $styleArray['fill']['startColor']['rgb'] = $RGB; + $RGB2 = self::parseGnumericColour($styleAttributes['PatternColor']); + $styleArray['fill']['endColor']['rgb'] = $RGB2; + switch ($shade) { + case '1': + $styleArray['fill']['fillType'] = Fill::FILL_SOLID; + + break; + case '2': + $styleArray['fill']['fillType'] = Fill::FILL_GRADIENT_LINEAR; + + break; + case '3': + $styleArray['fill']['fillType'] = Fill::FILL_GRADIENT_PATH; + + break; + case '4': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKDOWN; + + break; + case '5': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKGRAY; + + break; + case '6': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKGRID; + + break; + case '7': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKHORIZONTAL; + + break; + case '8': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKTRELLIS; + + break; + case '9': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKUP; + + break; + case '10': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_DARKVERTICAL; + + break; + case '11': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_GRAY0625; + + break; + case '12': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_GRAY125; + + break; + case '13': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTDOWN; + + break; + case '14': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTGRAY; + + break; + case '15': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTGRID; + + break; + case '16': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTHORIZONTAL; + + break; + case '17': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTTRELLIS; + + break; + case '18': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTUP; + + break; + case '19': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_LIGHTVERTICAL; + + break; + case '20': + $styleArray['fill']['fillType'] = Fill::FILL_PATTERN_MEDIUMGRAY; + + break; + } + } + + $fontAttributes = $styleRegion->Style->Font->attributes(); + $styleArray['font']['name'] = (string) $styleRegion->Style->Font; + $styleArray['font']['size'] = (int) ($fontAttributes['Unit']); + $styleArray['font']['bold'] = $fontAttributes['Bold'] == '1'; + $styleArray['font']['italic'] = $fontAttributes['Italic'] == '1'; + $styleArray['font']['strikethrough'] = $fontAttributes['StrikeThrough'] == '1'; + switch ($fontAttributes['Underline']) { + case '1': + $styleArray['font']['underline'] = Font::UNDERLINE_SINGLE; + + break; + case '2': + $styleArray['font']['underline'] = Font::UNDERLINE_DOUBLE; + + break; + case '3': + $styleArray['font']['underline'] = Font::UNDERLINE_SINGLEACCOUNTING; + + break; + case '4': + $styleArray['font']['underline'] = Font::UNDERLINE_DOUBLEACCOUNTING; + + break; + default: + $styleArray['font']['underline'] = Font::UNDERLINE_NONE; + + break; + } + switch ($fontAttributes['Script']) { + case '1': + $styleArray['font']['superscript'] = true; + + break; + case '-1': + $styleArray['font']['subscript'] = true; + + break; + } + + if (isset($styleRegion->Style->StyleBorder)) { + if (isset($styleRegion->Style->StyleBorder->Top)) { + $styleArray['borders']['top'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Top->attributes()); + } + if (isset($styleRegion->Style->StyleBorder->Bottom)) { + $styleArray['borders']['bottom'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Bottom->attributes()); + } + if (isset($styleRegion->Style->StyleBorder->Left)) { + $styleArray['borders']['left'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Left->attributes()); + } + if (isset($styleRegion->Style->StyleBorder->Right)) { + $styleArray['borders']['right'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Right->attributes()); + } + if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) { + $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); + $styleArray['borders']['diagonalDirection'] = Borders::DIAGONAL_BOTH; + } elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) { + $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes()); + $styleArray['borders']['diagonalDirection'] = Borders::DIAGONAL_UP; + } elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) { + $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes()); + $styleArray['borders']['diagonalDirection'] = Borders::DIAGONAL_DOWN; + } + } + if (isset($styleRegion->Style->HyperLink)) { + // TO DO + $hyperlink = $styleRegion->Style->HyperLink->attributes(); + } + } + $spreadsheet->getActiveSheet()->getStyle($cellRange)->applyFromArray($styleArray); + } + } + } + + if ((!$this->readDataOnly) && (isset($sheet->Cols))) { + // Column Widths + $columnAttributes = $sheet->Cols->attributes(); + $defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4; + $c = 0; + foreach ($sheet->Cols->ColInfo as $columnOverride) { + $columnAttributes = $columnOverride->attributes(); + $column = $columnAttributes['No']; + $columnWidth = $columnAttributes['Unit'] / 5.4; + $hidden = (isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1'); + $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1; + while ($c < $column) { + $spreadsheet->getActiveSheet()->getColumnDimension(Coordinate::stringFromColumnIndex($c + 1))->setWidth($defaultWidth); + ++$c; + } + while (($c < ($column + $columnCount)) && ($c <= $maxCol)) { + $spreadsheet->getActiveSheet()->getColumnDimension(Coordinate::stringFromColumnIndex($c + 1))->setWidth($columnWidth); + if ($hidden) { + $spreadsheet->getActiveSheet()->getColumnDimension(Coordinate::stringFromColumnIndex($c + 1))->setVisible(false); + } + ++$c; + } + } + while ($c <= $maxCol) { + $spreadsheet->getActiveSheet()->getColumnDimension(Coordinate::stringFromColumnIndex($c + 1))->setWidth($defaultWidth); + ++$c; + } + } + + if ((!$this->readDataOnly) && (isset($sheet->Rows))) { + // Row Heights + $rowAttributes = $sheet->Rows->attributes(); + $defaultHeight = $rowAttributes['DefaultSizePts']; + $r = 0; + + foreach ($sheet->Rows->RowInfo as $rowOverride) { + $rowAttributes = $rowOverride->attributes(); + $row = $rowAttributes['No']; + $rowHeight = $rowAttributes['Unit']; + $hidden = (isset($rowAttributes['Hidden'])) && ($rowAttributes['Hidden'] == '1'); + $rowCount = (isset($rowAttributes['Count'])) ? $rowAttributes['Count'] : 1; + while ($r < $row) { + ++$r; + $spreadsheet->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight); + } + while (($r < ($row + $rowCount)) && ($r < $maxRow)) { + ++$r; + $spreadsheet->getActiveSheet()->getRowDimension($r)->setRowHeight($rowHeight); + if ($hidden) { + $spreadsheet->getActiveSheet()->getRowDimension($r)->setVisible(false); + } + } + } + while ($r < $maxRow) { + ++$r; + $spreadsheet->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight); + } + } + + // Handle Merged Cells in this worksheet + if (isset($sheet->MergedRegions)) { + foreach ($sheet->MergedRegions->Merge as $mergeCells) { + if (strpos($mergeCells, ':') !== false) { + $spreadsheet->getActiveSheet()->mergeCells($mergeCells); + } + } + } + + ++$worksheetID; + } + + // Loop through definedNames (global named ranges) + if (isset($gnmXML->Names)) { + foreach ($gnmXML->Names->Name as $namedRange) { + $name = (string) $namedRange->name; + $range = (string) $namedRange->value; + if (stripos($range, '#REF!') !== false) { + continue; + } + + $range = Worksheet::extractSheetTitle($range, true); + $range[0] = trim($range[0], "'"); + if ($worksheet = $spreadsheet->getSheetByName($range[0])) { + $extractedRange = str_replace('$', '', $range[1]); + $spreadsheet->addNamedRange(new NamedRange($name, $worksheet, $extractedRange)); + } + } + } + + // Return + return $spreadsheet; + } + + private static function parseBorderAttributes($borderAttributes) + { + $styleArray = []; + if (isset($borderAttributes['Color'])) { + $styleArray['color']['rgb'] = self::parseGnumericColour($borderAttributes['Color']); + } + + switch ($borderAttributes['Style']) { + case '0': + $styleArray['borderStyle'] = Border::BORDER_NONE; + + break; + case '1': + $styleArray['borderStyle'] = Border::BORDER_THIN; + + break; + case '2': + $styleArray['borderStyle'] = Border::BORDER_MEDIUM; + + break; + case '3': + $styleArray['borderStyle'] = Border::BORDER_SLANTDASHDOT; + + break; + case '4': + $styleArray['borderStyle'] = Border::BORDER_DASHED; + + break; + case '5': + $styleArray['borderStyle'] = Border::BORDER_THICK; + + break; + case '6': + $styleArray['borderStyle'] = Border::BORDER_DOUBLE; + + break; + case '7': + $styleArray['borderStyle'] = Border::BORDER_DOTTED; + + break; + case '8': + $styleArray['borderStyle'] = Border::BORDER_MEDIUMDASHED; + + break; + case '9': + $styleArray['borderStyle'] = Border::BORDER_DASHDOT; + + break; + case '10': + $styleArray['borderStyle'] = Border::BORDER_MEDIUMDASHDOT; + + break; + case '11': + $styleArray['borderStyle'] = Border::BORDER_DASHDOTDOT; + + break; + case '12': + $styleArray['borderStyle'] = Border::BORDER_MEDIUMDASHDOTDOT; + + break; + case '13': + $styleArray['borderStyle'] = Border::BORDER_MEDIUMDASHDOTDOT; + + break; + } + + return $styleArray; + } + + private function parseRichText($is) + { + $value = new RichText(); + $value->createText($is); + + return $value; + } + + private static function parseGnumericColour($gnmColour) + { + [$gnmR, $gnmG, $gnmB] = explode(':', $gnmColour); + $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2); + $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2); + $gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2); + + return $gnmR . $gnmG . $gnmB; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php new file mode 100644 index 0000000..a255cfd --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php @@ -0,0 +1,969 @@ + [ + 'font' => [ + 'bold' => true, + 'size' => 24, + ], + ], // Bold, 24pt + 'h2' => [ + 'font' => [ + 'bold' => true, + 'size' => 18, + ], + ], // Bold, 18pt + 'h3' => [ + 'font' => [ + 'bold' => true, + 'size' => 13.5, + ], + ], // Bold, 13.5pt + 'h4' => [ + 'font' => [ + 'bold' => true, + 'size' => 12, + ], + ], // Bold, 12pt + 'h5' => [ + 'font' => [ + 'bold' => true, + 'size' => 10, + ], + ], // Bold, 10pt + 'h6' => [ + 'font' => [ + 'bold' => true, + 'size' => 7.5, + ], + ], // Bold, 7.5pt + 'a' => [ + 'font' => [ + 'underline' => true, + 'color' => [ + 'argb' => Color::COLOR_BLUE, + ], + ], + ], // Blue underlined + 'hr' => [ + 'borders' => [ + 'bottom' => [ + 'borderStyle' => Border::BORDER_THIN, + 'color' => [ + Color::COLOR_BLACK, + ], + ], + ], + ], // Bottom border + 'strong' => [ + 'font' => [ + 'bold' => true, + ], + ], // Bold + 'b' => [ + 'font' => [ + 'bold' => true, + ], + ], // Bold + 'i' => [ + 'font' => [ + 'italic' => true, + ], + ], // Italic + 'em' => [ + 'font' => [ + 'italic' => true, + ], + ], // Italic + ]; + + protected $rowspan = []; + + /** + * Create a new HTML Reader instance. + */ + public function __construct() + { + parent::__construct(); + $this->securityScanner = XmlScanner::getInstance($this); + } + + /** + * Validate that the current file is an HTML file. + * + * @param string $pFilename + * + * @return bool + */ + public function canRead($pFilename) + { + // Check if file exists + try { + $this->openFile($pFilename); + } catch (Exception $e) { + return false; + } + + $beginning = $this->readBeginning(); + $startWithTag = self::startsWithTag($beginning); + $containsTags = self::containsTags($beginning); + $endsWithTag = self::endsWithTag($this->readEnding()); + + fclose($this->fileHandle); + + return $startWithTag && $containsTags && $endsWithTag; + } + + private function readBeginning() + { + fseek($this->fileHandle, 0); + + return fread($this->fileHandle, self::TEST_SAMPLE_SIZE); + } + + private function readEnding() + { + $meta = stream_get_meta_data($this->fileHandle); + $filename = $meta['uri']; + + $size = filesize($filename); + if ($size === 0) { + return ''; + } + + $blockSize = self::TEST_SAMPLE_SIZE; + if ($size < $blockSize) { + $blockSize = $size; + } + + fseek($this->fileHandle, $size - $blockSize); + + return fread($this->fileHandle, $blockSize); + } + + private static function startsWithTag($data) + { + return '<' === substr(trim($data), 0, 1); + } + + private static function endsWithTag($data) + { + return '>' === substr(trim($data), -1, 1); + } + + private static function containsTags($data) + { + return strlen($data) !== strlen(strip_tags($data)); + } + + /** + * Loads Spreadsheet from file. + * + * @param string $pFilename + * + * @throws Exception + * + * @return Spreadsheet + */ + public function load($pFilename) + { + // Create new Spreadsheet + $spreadsheet = new Spreadsheet(); + + // Load into this instance + return $this->loadIntoExisting($pFilename, $spreadsheet); + } + + /** + * Set input encoding. + * + * @param string $pValue Input encoding, eg: 'ANSI' + * + * @return $this + */ + public function setInputEncoding($pValue) + { + $this->inputEncoding = $pValue; + + return $this; + } + + /** + * Get input encoding. + * + * @return string + */ + public function getInputEncoding() + { + return $this->inputEncoding; + } + + // Data Array used for testing only, should write to Spreadsheet object on completion of tests + protected $dataArray = []; + + protected $tableLevel = 0; + + protected $nestedColumn = ['A']; + + protected function setTableStartColumn($column) + { + if ($this->tableLevel == 0) { + $column = 'A'; + } + ++$this->tableLevel; + $this->nestedColumn[$this->tableLevel] = $column; + + return $this->nestedColumn[$this->tableLevel]; + } + + protected function getTableStartColumn() + { + return $this->nestedColumn[$this->tableLevel]; + } + + protected function releaseTableStartColumn() + { + --$this->tableLevel; + + return array_pop($this->nestedColumn); + } + + protected function flushCell(Worksheet $sheet, $column, $row, &$cellContent) + { + if (is_string($cellContent)) { + // Simple String content + if (trim($cellContent) > '') { + // Only actually write it if there's content in the string + // Write to worksheet to be done here... + // ... we return the cell so we can mess about with styles more easily + $sheet->setCellValue($column . $row, $cellContent); + $this->dataArray[$row][$column] = $cellContent; + } + } else { + // We have a Rich Text run + // TODO + $this->dataArray[$row][$column] = 'RICH TEXT: ' . $cellContent; + } + $cellContent = (string) ''; + } + + /** + * @param DOMNode $element + * @param Worksheet $sheet + * @param int $row + * @param string $column + * @param string $cellContent + */ + protected function processDomElement(DOMNode $element, Worksheet $sheet, &$row, &$column, &$cellContent) + { + foreach ($element->childNodes as $child) { + if ($child instanceof DOMText) { + $domText = preg_replace('/\s+/u', ' ', trim($child->nodeValue)); + if (is_string($cellContent)) { + // simply append the text if the cell content is a plain text string + $cellContent .= $domText; + } + // but if we have a rich text run instead, we need to append it correctly + // TODO + } elseif ($child instanceof DOMElement) { + $attributeArray = []; + foreach ($child->attributes as $attribute) { + $attributeArray[$attribute->name] = $attribute->value; + } + + switch ($child->nodeName) { + case 'meta': + foreach ($attributeArray as $attributeName => $attributeValue) { + // Extract character set, so we can convert to UTF-8 if required + if ($attributeName === 'charset') { + $this->setInputEncoding($attributeValue); + } + } + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + + break; + case 'title': + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + $sheet->setTitle($cellContent, true, false); + $cellContent = ''; + + break; + case 'span': + case 'div': + case 'font': + case 'i': + case 'em': + case 'strong': + case 'b': + if (isset($attributeArray['class']) && $attributeArray['class'] === 'comment') { + $sheet->getComment($column . $row) + ->getText() + ->createTextRun($child->textContent); + + break; + } + + if ($cellContent > '') { + $cellContent .= ' '; + } + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + if ($cellContent > '') { + $cellContent .= ' '; + } + + if (isset($this->formats[$child->nodeName])) { + $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]); + } + + break; + case 'hr': + $this->flushCell($sheet, $column, $row, $cellContent); + ++$row; + if (isset($this->formats[$child->nodeName])) { + $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]); + } else { + $cellContent = '----------'; + $this->flushCell($sheet, $column, $row, $cellContent); + } + ++$row; + // Add a break after a horizontal rule, simply by allowing the code to dropthru + // no break + case 'br': + if ($this->tableLevel > 0) { + // If we're inside a table, replace with a \n and set the cell to wrap + $cellContent .= "\n"; + $sheet->getStyle($column . $row)->getAlignment()->setWrapText(true); + } else { + // Otherwise flush our existing content and move the row cursor on + $this->flushCell($sheet, $column, $row, $cellContent); + ++$row; + } + + break; + case 'a': + foreach ($attributeArray as $attributeName => $attributeValue) { + switch ($attributeName) { + case 'href': + $sheet->getCell($column . $row)->getHyperlink()->setUrl($attributeValue); + if (isset($this->formats[$child->nodeName])) { + $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]); + } + + break; + case 'class': + if ($attributeValue === 'comment-indicator') { + break; // Ignore - it's just a red square. + } + } + } + $cellContent .= ' '; + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + + break; + case 'h1': + case 'h2': + case 'h3': + case 'h4': + case 'h5': + case 'h6': + case 'ol': + case 'ul': + case 'p': + if ($this->tableLevel > 0) { + // If we're inside a table, replace with a \n + $cellContent .= "\n"; + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + } else { + if ($cellContent > '') { + $this->flushCell($sheet, $column, $row, $cellContent); + ++$row; + } + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); + + if (isset($this->formats[$child->nodeName])) { + $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]); + } + + ++$row; + $column = 'A'; + } + + break; + case 'li': + if ($this->tableLevel > 0) { + // If we're inside a table, replace with a \n + $cellContent .= "\n"; + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + } else { + if ($cellContent > '') { + $this->flushCell($sheet, $column, $row, $cellContent); + } + ++$row; + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + $this->flushCell($sheet, $column, $row, $cellContent); + $column = 'A'; + } + + break; + case 'img': + $this->insertImage($sheet, $column, $row, $attributeArray); + + break; + case 'table': + $this->flushCell($sheet, $column, $row, $cellContent); + $column = $this->setTableStartColumn($column); + if ($this->tableLevel > 1) { + --$row; + } + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + $column = $this->releaseTableStartColumn(); + if ($this->tableLevel > 1) { + ++$column; + } else { + ++$row; + } + + break; + case 'thead': + case 'tbody': + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + + break; + case 'tr': + $column = $this->getTableStartColumn(); + $cellContent = ''; + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + + if (isset($attributeArray['height'])) { + $sheet->getRowDimension($row)->setRowHeight($attributeArray['height']); + } + + ++$row; + + break; + case 'th': + case 'td': + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + + while (isset($this->rowspan[$column . $row])) { + ++$column; + } + + // apply inline style + $this->applyInlineStyle($sheet, $row, $column, $attributeArray); + + $this->flushCell($sheet, $column, $row, $cellContent); + + if (isset($attributeArray['rowspan'], $attributeArray['colspan'])) { + //create merging rowspan and colspan + $columnTo = $column; + for ($i = 0; $i < (int) $attributeArray['colspan'] - 1; ++$i) { + ++$columnTo; + } + $range = $column . $row . ':' . $columnTo . ($row + (int) $attributeArray['rowspan'] - 1); + foreach (Coordinate::extractAllCellReferencesInRange($range) as $value) { + $this->rowspan[$value] = true; + } + $sheet->mergeCells($range); + $column = $columnTo; + } elseif (isset($attributeArray['rowspan'])) { + //create merging rowspan + $range = $column . $row . ':' . $column . ($row + (int) $attributeArray['rowspan'] - 1); + foreach (Coordinate::extractAllCellReferencesInRange($range) as $value) { + $this->rowspan[$value] = true; + } + $sheet->mergeCells($range); + } elseif (isset($attributeArray['colspan'])) { + //create merging colspan + $columnTo = $column; + for ($i = 0; $i < (int) $attributeArray['colspan'] - 1; ++$i) { + ++$columnTo; + } + $sheet->mergeCells($column . $row . ':' . $columnTo . $row); + $column = $columnTo; + } elseif (isset($attributeArray['bgcolor'])) { + $sheet->getStyle($column . $row)->applyFromArray( + [ + 'fill' => [ + 'fillType' => Fill::FILL_SOLID, + 'color' => ['rgb' => $attributeArray['bgcolor']], + ], + ] + ); + } + + if (isset($attributeArray['width'])) { + $sheet->getColumnDimension($column)->setWidth($attributeArray['width']); + } + + if (isset($attributeArray['height'])) { + $sheet->getRowDimension($row)->setRowHeight($attributeArray['height']); + } + + if (isset($attributeArray['align'])) { + $sheet->getStyle($column . $row)->getAlignment()->setHorizontal($attributeArray['align']); + } + + if (isset($attributeArray['valign'])) { + $sheet->getStyle($column . $row)->getAlignment()->setVertical($attributeArray['valign']); + } + + if (isset($attributeArray['data-format'])) { + $sheet->getStyle($column . $row)->getNumberFormat()->setFormatCode($attributeArray['data-format']); + } + + ++$column; + + break; + case 'body': + $row = 1; + $column = 'A'; + $cellContent = ''; + $this->tableLevel = 0; + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + + break; + default: + $this->processDomElement($child, $sheet, $row, $column, $cellContent); + } + } + } + } + + /** + * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. + * + * @param string $pFilename + * @param Spreadsheet $spreadsheet + * + * @throws Exception + * + * @return Spreadsheet + */ + public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet) + { + // Validate + if (!$this->canRead($pFilename)) { + throw new Exception($pFilename . ' is an Invalid HTML file.'); + } + + // Create a new DOM object + $dom = new DOMDocument(); + // Reload the HTML file into the DOM object + $loaded = $dom->loadHTML(mb_convert_encoding($this->securityScanner->scanFile($pFilename), 'HTML-ENTITIES', 'UTF-8')); + if ($loaded === false) { + throw new Exception('Failed to load ' . $pFilename . ' as a DOM Document'); + } + + return $this->loadDocument($dom, $spreadsheet); + } + + /** + * Spreadsheet from content. + * + * @param string $content + * @param null|Spreadsheet $spreadsheet + * + * @return Spreadsheet + */ + public function loadFromString($content, ?Spreadsheet $spreadsheet = null): Spreadsheet + { + // Create a new DOM object + $dom = new DOMDocument(); + // Reload the HTML file into the DOM object + $loaded = $dom->loadHTML(mb_convert_encoding($this->securityScanner->scan($content), 'HTML-ENTITIES', 'UTF-8')); + if ($loaded === false) { + throw new Exception('Failed to load content as a DOM Document'); + } + + return $this->loadDocument($dom, $spreadsheet ?? new Spreadsheet()); + } + + /** + * Loads PhpSpreadsheet from DOMDocument into PhpSpreadsheet instance. + * + * @param DOMDocument $document + * @param Spreadsheet $spreadsheet + * + * @throws \PhpOffice\PhpSpreadsheet\Exception + * + * @return Spreadsheet + */ + private function loadDocument(DOMDocument $document, Spreadsheet $spreadsheet): Spreadsheet + { + while ($spreadsheet->getSheetCount() <= $this->sheetIndex) { + $spreadsheet->createSheet(); + } + $spreadsheet->setActiveSheetIndex($this->sheetIndex); + + // Discard white space + $document->preserveWhiteSpace = false; + + $row = 0; + $column = 'A'; + $content = ''; + $this->rowspan = []; + $this->processDomElement($document, $spreadsheet->getActiveSheet(), $row, $column, $content); + + // Return + return $spreadsheet; + } + + /** + * Get sheet index. + * + * @return int + */ + public function getSheetIndex() + { + return $this->sheetIndex; + } + + /** + * Set sheet index. + * + * @param int $pValue Sheet index + * + * @return $this + */ + public function setSheetIndex($pValue) + { + $this->sheetIndex = $pValue; + + return $this; + } + + /** + * Apply inline css inline style. + * + * NOTES : + * Currently only intended for td & th element, + * and only takes 'background-color' and 'color'; property with HEX color + * + * TODO : + * - Implement to other propertie, such as border + * + * @param Worksheet $sheet + * @param int $row + * @param string $column + * @param array $attributeArray + */ + private function applyInlineStyle(&$sheet, $row, $column, $attributeArray) + { + if (!isset($attributeArray['style'])) { + return; + } + + $cellStyle = $sheet->getStyle($column . $row); + + // add color styles (background & text) from dom element,currently support : td & th, using ONLY inline css style with RGB color + $styles = explode(';', $attributeArray['style']); + foreach ($styles as $st) { + $value = explode(':', $st); + $styleName = isset($value[0]) ? trim($value[0]) : null; + $styleValue = isset($value[1]) ? trim($value[1]) : null; + + if (!$styleName) { + continue; + } + + switch ($styleName) { + case 'background': + case 'background-color': + $styleColor = $this->getStyleColor($styleValue); + + if (!$styleColor) { + continue 2; + } + + $cellStyle->applyFromArray(['fill' => ['fillType' => Fill::FILL_SOLID, 'color' => ['rgb' => $styleColor]]]); + + break; + case 'color': + $styleColor = $this->getStyleColor($styleValue); + + if (!$styleColor) { + continue 2; + } + + $cellStyle->applyFromArray(['font' => ['color' => ['rgb' => $styleColor]]]); + + break; + + case 'border': + $this->setBorderStyle($cellStyle, $styleValue, 'allBorders'); + + break; + + case 'border-top': + $this->setBorderStyle($cellStyle, $styleValue, 'top'); + + break; + + case 'border-bottom': + $this->setBorderStyle($cellStyle, $styleValue, 'bottom'); + + break; + + case 'border-left': + $this->setBorderStyle($cellStyle, $styleValue, 'left'); + + break; + + case 'border-right': + $this->setBorderStyle($cellStyle, $styleValue, 'right'); + + break; + + case 'font-size': + $cellStyle->getFont()->setSize( + (float) $styleValue + ); + + break; + + case 'font-weight': + if ($styleValue === 'bold' || $styleValue >= 500) { + $cellStyle->getFont()->setBold(true); + } + + break; + + case 'font-style': + if ($styleValue === 'italic') { + $cellStyle->getFont()->setItalic(true); + } + + break; + + case 'font-family': + $cellStyle->getFont()->setName(str_replace('\'', '', $styleValue)); + + break; + + case 'text-decoration': + switch ($styleValue) { + case 'underline': + $cellStyle->getFont()->setUnderline(Font::UNDERLINE_SINGLE); + + break; + case 'line-through': + $cellStyle->getFont()->setStrikethrough(true); + + break; + } + + break; + + case 'text-align': + $cellStyle->getAlignment()->setHorizontal($styleValue); + + break; + + case 'vertical-align': + $cellStyle->getAlignment()->setVertical($styleValue); + + break; + + case 'width': + $sheet->getColumnDimension($column)->setWidth( + str_replace('px', '', $styleValue) + ); + + break; + + case 'height': + $sheet->getRowDimension($row)->setRowHeight( + str_replace('px', '', $styleValue) + ); + + break; + + case 'word-wrap': + $cellStyle->getAlignment()->setWrapText( + $styleValue === 'break-word' + ); + + break; + + case 'text-indent': + $cellStyle->getAlignment()->setIndent( + (int) str_replace(['px'], '', $styleValue) + ); + + break; + } + } + } + + /** + * Check if has #, so we can get clean hex. + * + * @param $value + * + * @return null|string + */ + public function getStyleColor($value) + { + if (strpos($value, '#') === 0) { + return substr($value, 1); + } + + return null; + } + + /** + * @param Worksheet $sheet + * @param string $column + * @param int $row + * @param array $attributes + * + * @throws \PhpOffice\PhpSpreadsheet\Exception + */ + private function insertImage(Worksheet $sheet, $column, $row, array $attributes) + { + if (!isset($attributes['src'])) { + return; + } + + $src = urldecode($attributes['src']); + $width = isset($attributes['width']) ? (float) $attributes['width'] : null; + $height = isset($attributes['height']) ? (float) $attributes['height'] : null; + $name = isset($attributes['alt']) ? (float) $attributes['alt'] : null; + + $drawing = new Drawing(); + $drawing->setPath($src); + $drawing->setWorksheet($sheet); + $drawing->setCoordinates($column . $row); + $drawing->setOffsetX(0); + $drawing->setOffsetY(10); + $drawing->setResizeProportional(true); + + if ($name) { + $drawing->setName($name); + } + + if ($width) { + $drawing->setWidth((int) $width); + } + + if ($height) { + $drawing->setHeight((int) $height); + } + + $sheet->getColumnDimension($column)->setWidth( + $drawing->getWidth() / 6 + ); + + $sheet->getRowDimension($row)->setRowHeight( + $drawing->getHeight() * 0.9 + ); + } + + /** + * Map html border style to PhpSpreadsheet border style. + * + * @param string $style + * + * @return null|string + */ + public function getBorderStyle($style) + { + switch ($style) { + case 'solid': + return Border::BORDER_THIN; + case 'dashed': + return Border::BORDER_DASHED; + case 'dotted': + return Border::BORDER_DOTTED; + case 'medium': + return Border::BORDER_MEDIUM; + case 'thick': + return Border::BORDER_THICK; + case 'none': + return Border::BORDER_NONE; + case 'dash-dot': + return Border::BORDER_DASHDOT; + case 'dash-dot-dot': + return Border::BORDER_DASHDOTDOT; + case 'double': + return Border::BORDER_DOUBLE; + case 'hair': + return Border::BORDER_HAIR; + case 'medium-dash-dot': + return Border::BORDER_MEDIUMDASHDOT; + case 'medium-dash-dot-dot': + return Border::BORDER_MEDIUMDASHDOTDOT; + case 'medium-dashed': + return Border::BORDER_MEDIUMDASHED; + case 'slant-dash-dot': + return Border::BORDER_SLANTDASHDOT; + } + + return null; + } + + /** + * @param Style $cellStyle + * @param string $styleValue + * @param string $type + */ + private function setBorderStyle(Style $cellStyle, $styleValue, $type) + { + [, $borderStyle, $color] = explode(' ', $styleValue); + + $cellStyle->applyFromArray([ + 'borders' => [ + $type => [ + 'borderStyle' => $this->getBorderStyle($borderStyle), + 'color' => ['rgb' => $this->getStyleColor($color)], + ], + ], + ]); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReadFilter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReadFilter.php new file mode 100644 index 0000000..ccfe05a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/IReadFilter.php @@ -0,0 +1,17 @@ +securityScanner = XmlScanner::getInstance($this); + } + + /** + * Can the current IReader read the file? + * + * @param string $pFilename + * + * @throws Exception + * + * @return bool + */ + public function canRead($pFilename) + { + File::assertFile($pFilename); + + $mimeType = 'UNKNOWN'; + + // Load file + + $zip = new ZipArchive(); + if ($zip->open($pFilename) === true) { + // check if it is an OOXML archive + $stat = $zip->statName('mimetype'); + if ($stat && ($stat['size'] <= 255)) { + $mimeType = $zip->getFromName($stat['name']); + } elseif ($zip->statName('META-INF/manifest.xml')) { + $xml = simplexml_load_string( + $this->securityScanner->scan($zip->getFromName('META-INF/manifest.xml')), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $namespacesContent = $xml->getNamespaces(true); + if (isset($namespacesContent['manifest'])) { + $manifest = $xml->children($namespacesContent['manifest']); + foreach ($manifest as $manifestDataSet) { + $manifestAttributes = $manifestDataSet->attributes($namespacesContent['manifest']); + if ($manifestAttributes->{'full-path'} == '/') { + $mimeType = (string) $manifestAttributes->{'media-type'}; + + break; + } + } + } + } + + $zip->close(); + + return $mimeType === 'application/vnd.oasis.opendocument.spreadsheet'; + } + + return false; + } + + /** + * Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object. + * + * @param string $pFilename + * + * @throws Exception + * + * @return string[] + */ + public function listWorksheetNames($pFilename) + { + File::assertFile($pFilename); + + $zip = new ZipArchive(); + if (!$zip->open($pFilename)) { + throw new Exception('Could not open ' . $pFilename . ' for reading! Error opening file.'); + } + + $worksheetNames = []; + + $xml = new XMLReader(); + $xml->xml( + $this->securityScanner->scanFile('zip://' . realpath($pFilename) . '#content.xml'), + null, + Settings::getLibXmlLoaderOptions() + ); + $xml->setParserProperty(2, true); + + // Step into the first level of content of the XML + $xml->read(); + while ($xml->read()) { + // Quickly jump through to the office:body node + while ($xml->name !== 'office:body') { + if ($xml->isEmptyElement) { + $xml->read(); + } else { + $xml->next(); + } + } + // Now read each node until we find our first table:table node + while ($xml->read()) { + if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { + // Loop through each table:table node reading the table:name attribute for each worksheet name + do { + $worksheetNames[] = $xml->getAttribute('table:name'); + $xml->next(); + } while ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT); + } + } + } + + return $worksheetNames; + } + + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetInfo($pFilename) + { + File::assertFile($pFilename); + + $worksheetInfo = []; + + $zip = new ZipArchive(); + if (!$zip->open($pFilename)) { + throw new Exception('Could not open ' . $pFilename . ' for reading! Error opening file.'); + } + + $xml = new XMLReader(); + $xml->xml( + $this->securityScanner->scanFile('zip://' . realpath($pFilename) . '#content.xml'), + null, + Settings::getLibXmlLoaderOptions() + ); + $xml->setParserProperty(2, true); + + // Step into the first level of content of the XML + $xml->read(); + while ($xml->read()) { + // Quickly jump through to the office:body node + while ($xml->name !== 'office:body') { + if ($xml->isEmptyElement) { + $xml->read(); + } else { + $xml->next(); + } + } + // Now read each node until we find our first table:table node + while ($xml->read()) { + if ($xml->name == 'table:table' && $xml->nodeType == XMLReader::ELEMENT) { + $worksheetNames[] = $xml->getAttribute('table:name'); + + $tmpInfo = [ + 'worksheetName' => $xml->getAttribute('table:name'), + 'lastColumnLetter' => 'A', + 'lastColumnIndex' => 0, + 'totalRows' => 0, + 'totalColumns' => 0, + ]; + + // Loop through each child node of the table:table element reading + $currCells = 0; + do { + $xml->read(); + if ($xml->name == 'table:table-row' && $xml->nodeType == XMLReader::ELEMENT) { + $rowspan = $xml->getAttribute('table:number-rows-repeated'); + $rowspan = empty($rowspan) ? 1 : $rowspan; + $tmpInfo['totalRows'] += $rowspan; + $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells); + $currCells = 0; + // Step into the row + $xml->read(); + do { + if ($xml->name == 'table:table-cell' && $xml->nodeType == XMLReader::ELEMENT) { + if (!$xml->isEmptyElement) { + ++$currCells; + $xml->next(); + } else { + $xml->read(); + } + } elseif ($xml->name == 'table:covered-table-cell' && $xml->nodeType == XMLReader::ELEMENT) { + $mergeSize = $xml->getAttribute('table:number-columns-repeated'); + $currCells += (int) $mergeSize; + $xml->read(); + } else { + $xml->read(); + } + } while ($xml->name != 'table:table-row'); + } + } while ($xml->name != 'table:table'); + + $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells); + $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1; + $tmpInfo['lastColumnLetter'] = Coordinate::stringFromColumnIndex($tmpInfo['lastColumnIndex'] + 1); + $worksheetInfo[] = $tmpInfo; + } + } + } + + return $worksheetInfo; + } + + /** + * Loads PhpSpreadsheet from file. + * + * @param string $pFilename + * + * @throws Exception + * + * @return Spreadsheet + */ + public function load($pFilename) + { + // Create new Spreadsheet + $spreadsheet = new Spreadsheet(); + + // Load into this instance + return $this->loadIntoExisting($pFilename, $spreadsheet); + } + + /** + * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. + * + * @param string $pFilename + * @param Spreadsheet $spreadsheet + * + * @throws Exception + * + * @return Spreadsheet + */ + public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet) + { + File::assertFile($pFilename); + + $timezoneObj = new DateTimeZone('Europe/London'); + $GMT = new \DateTimeZone('UTC'); + + $zip = new ZipArchive(); + if (!$zip->open($pFilename)) { + throw new Exception("Could not open {$pFilename} for reading! Error opening file."); + } + + // Meta + + $xml = simplexml_load_string( + $this->securityScanner->scan($zip->getFromName('meta.xml')), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + if ($xml === false) { + throw new Exception('Unable to read data from {$pFilename}'); + } + + $namespacesMeta = $xml->getNamespaces(true); + + (new DocumentProperties($spreadsheet))->load($xml, $namespacesMeta); + + // Content + + $dom = new \DOMDocument('1.01', 'UTF-8'); + $dom->loadXML( + $this->securityScanner->scan($zip->getFromName('content.xml')), + Settings::getLibXmlLoaderOptions() + ); + + $officeNs = $dom->lookupNamespaceUri('office'); + $tableNs = $dom->lookupNamespaceUri('table'); + $textNs = $dom->lookupNamespaceUri('text'); + $xlinkNs = $dom->lookupNamespaceUri('xlink'); + + $spreadsheets = $dom->getElementsByTagNameNS($officeNs, 'body') + ->item(0) + ->getElementsByTagNameNS($officeNs, 'spreadsheet'); + + foreach ($spreadsheets as $workbookData) { + /** @var \DOMElement $workbookData */ + $tables = $workbookData->getElementsByTagNameNS($tableNs, 'table'); + + $worksheetID = 0; + foreach ($tables as $worksheetDataSet) { + /** @var \DOMElement $worksheetDataSet */ + $worksheetName = $worksheetDataSet->getAttributeNS($tableNs, 'name'); + + // Check loadSheetsOnly + if (isset($this->loadSheetsOnly) + && $worksheetName + && !in_array($worksheetName, $this->loadSheetsOnly)) { + continue; + } + + // Create sheet + if ($worksheetID > 0) { + $spreadsheet->createSheet(); // First sheet is added by default + } + $spreadsheet->setActiveSheetIndex($worksheetID); + + if ($worksheetName) { + // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in + // formula cells... during the load, all formulae should be correct, and we're simply + // bringing the worksheet name in line with the formula, not the reverse + $spreadsheet->getActiveSheet()->setTitle($worksheetName, false, false); + } + + // Go through every child of table element + $rowID = 1; + foreach ($worksheetDataSet->childNodes as $childNode) { + /** @var \DOMElement $childNode */ + + // Filter elements which are not under the "table" ns + if ($childNode->namespaceURI != $tableNs) { + continue; + } + + $key = $childNode->nodeName; + + // Remove ns from node name + if (strpos($key, ':') !== false) { + $keyChunks = explode(':', $key); + $key = array_pop($keyChunks); + } + + switch ($key) { + case 'table-header-rows': + /// TODO :: Figure this out. This is only a partial implementation I guess. + // ($rowData it's not used at all and I'm not sure that PHPExcel + // has an API for this) + +// foreach ($rowData as $keyRowData => $cellData) { +// $rowData = $cellData; +// break; +// } + break; + case 'table-row': + if ($childNode->hasAttributeNS($tableNs, 'number-rows-repeated')) { + $rowRepeats = $childNode->getAttributeNS($tableNs, 'number-rows-repeated'); + } else { + $rowRepeats = 1; + } + + $columnID = 'A'; + foreach ($childNode->childNodes as $key => $cellData) { + // @var \DOMElement $cellData + + if ($this->getReadFilter() !== null) { + if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { + ++$columnID; + + continue; + } + } + + // Initialize variables + $formatting = $hyperlink = null; + $hasCalculatedValue = false; + $cellDataFormula = ''; + + if ($cellData->hasAttributeNS($tableNs, 'formula')) { + $cellDataFormula = $cellData->getAttributeNS($tableNs, 'formula'); + $hasCalculatedValue = true; + } + + // Annotations + $annotation = $cellData->getElementsByTagNameNS($officeNs, 'annotation'); + + if ($annotation->length > 0) { + $textNode = $annotation->item(0)->getElementsByTagNameNS($textNs, 'p'); + + if ($textNode->length > 0) { + $text = $this->scanElementForText($textNode->item(0)); + + $spreadsheet->getActiveSheet() + ->getComment($columnID . $rowID) + ->setText($this->parseRichText($text)); +// ->setAuthor( $author ) + } + } + + // Content + + /** @var \DOMElement[] $paragraphs */ + $paragraphs = []; + + foreach ($cellData->childNodes as $item) { + /** @var \DOMElement $item */ + + // Filter text:p elements + if ($item->nodeName == 'text:p') { + $paragraphs[] = $item; + } + } + + if (count($paragraphs) > 0) { + // Consolidate if there are multiple p records (maybe with spans as well) + $dataArray = []; + + // Text can have multiple text:p and within those, multiple text:span. + // text:p newlines, but text:span does not. + // Also, here we assume there is no text data is span fields are specified, since + // we have no way of knowing proper positioning anyway. + + foreach ($paragraphs as $pData) { + $dataArray[] = $this->scanElementForText($pData); + } + $allCellDataText = implode("\n", $dataArray); + + $type = $cellData->getAttributeNS($officeNs, 'value-type'); + + switch ($type) { + case 'string': + $type = DataType::TYPE_STRING; + $dataValue = $allCellDataText; + + foreach ($paragraphs as $paragraph) { + $link = $paragraph->getElementsByTagNameNS($textNs, 'a'); + if ($link->length > 0) { + $hyperlink = $link->item(0)->getAttributeNS($xlinkNs, 'href'); + } + } + + break; + case 'boolean': + $type = DataType::TYPE_BOOL; + $dataValue = ($allCellDataText == 'TRUE') ? true : false; + + break; + case 'percentage': + $type = DataType::TYPE_NUMERIC; + $dataValue = (float) $cellData->getAttributeNS($officeNs, 'value'); + + if (floor($dataValue) == $dataValue) { + $dataValue = (int) $dataValue; + } + $formatting = NumberFormat::FORMAT_PERCENTAGE_00; + + break; + case 'currency': + $type = DataType::TYPE_NUMERIC; + $dataValue = (float) $cellData->getAttributeNS($officeNs, 'value'); + + if (floor($dataValue) == $dataValue) { + $dataValue = (int) $dataValue; + } + $formatting = NumberFormat::FORMAT_CURRENCY_USD_SIMPLE; + + break; + case 'float': + $type = DataType::TYPE_NUMERIC; + $dataValue = (float) $cellData->getAttributeNS($officeNs, 'value'); + + if (floor($dataValue) == $dataValue) { + if ($dataValue == (int) $dataValue) { + $dataValue = (int) $dataValue; + } else { + $dataValue = (float) $dataValue; + } + } + + break; + case 'date': + $type = DataType::TYPE_NUMERIC; + $value = $cellData->getAttributeNS($officeNs, 'date-value'); + + $dateObj = new DateTime($value, $GMT); + $dateObj->setTimeZone($timezoneObj); + [$year, $month, $day, $hour, $minute, $second] = explode( + ' ', + $dateObj->format('Y m d H i s') + ); + + $dataValue = Date::formattedPHPToExcel( + (int) $year, + (int) $month, + (int) $day, + (int) $hour, + (int) $minute, + (int) $second + ); + + if ($dataValue != floor($dataValue)) { + $formatting = NumberFormat::FORMAT_DATE_XLSX15 + . ' ' + . NumberFormat::FORMAT_DATE_TIME4; + } else { + $formatting = NumberFormat::FORMAT_DATE_XLSX15; + } + + break; + case 'time': + $type = DataType::TYPE_NUMERIC; + + $timeValue = $cellData->getAttributeNS($officeNs, 'time-value'); + + $dataValue = Date::PHPToExcel( + strtotime( + '01-01-1970 ' . implode(':', sscanf($timeValue, 'PT%dH%dM%dS')) + ) + ); + $formatting = NumberFormat::FORMAT_DATE_TIME4; + + break; + default: + $dataValue = null; + } + } else { + $type = DataType::TYPE_NULL; + $dataValue = null; + } + + if ($hasCalculatedValue) { + $type = DataType::TYPE_FORMULA; + $cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=') + 1); + $temp = explode('"', $cellDataFormula); + $tKey = false; + foreach ($temp as &$value) { + // Only replace in alternate array entries (i.e. non-quoted blocks) + if ($tKey = !$tKey) { + // Cell range reference in another sheet + $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/U', '$1!$2:$3', $value); + + // Cell reference in another sheet + $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/U', '$1!$2', $value); + + // Cell range reference + $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/U', '$1:$2', $value); + + // Simple cell reference + $value = preg_replace('/\[\.([^\.]+)\]/U', '$1', $value); + + $value = Calculation::translateSeparator(';', ',', $value, $inBraces); + } + } + unset($value); + + // Then rebuild the formula string + $cellDataFormula = implode('"', $temp); + } + + if ($cellData->hasAttributeNS($tableNs, 'number-columns-repeated')) { + $colRepeats = (int) $cellData->getAttributeNS($tableNs, 'number-columns-repeated'); + } else { + $colRepeats = 1; + } + + if ($type !== null) { + for ($i = 0; $i < $colRepeats; ++$i) { + if ($i > 0) { + ++$columnID; + } + + if ($type !== DataType::TYPE_NULL) { + for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) { + $rID = $rowID + $rowAdjust; + + $cell = $spreadsheet->getActiveSheet() + ->getCell($columnID . $rID); + + // Set value + if ($hasCalculatedValue) { + $cell->setValueExplicit($cellDataFormula, $type); + } else { + $cell->setValueExplicit($dataValue, $type); + } + + if ($hasCalculatedValue) { + $cell->setCalculatedValue($dataValue); + } + + // Set other properties + if ($formatting !== null) { + $spreadsheet->getActiveSheet() + ->getStyle($columnID . $rID) + ->getNumberFormat() + ->setFormatCode($formatting); + } else { + $spreadsheet->getActiveSheet() + ->getStyle($columnID . $rID) + ->getNumberFormat() + ->setFormatCode(NumberFormat::FORMAT_GENERAL); + } + + if ($hyperlink !== null) { + $cell->getHyperlink() + ->setUrl($hyperlink); + } + } + } + } + } + + // Merged cells + if ($cellData->hasAttributeNS($tableNs, 'number-columns-spanned') + || $cellData->hasAttributeNS($tableNs, 'number-rows-spanned') + ) { + if (($type !== DataType::TYPE_NULL) || (!$this->readDataOnly)) { + $columnTo = $columnID; + + if ($cellData->hasAttributeNS($tableNs, 'number-columns-spanned')) { + $columnIndex = Coordinate::columnIndexFromString($columnID); + $columnIndex += (int) $cellData->getAttributeNS($tableNs, 'number-columns-spanned'); + $columnIndex -= 2; + + $columnTo = Coordinate::stringFromColumnIndex($columnIndex + 1); + } + + $rowTo = $rowID; + + if ($cellData->hasAttributeNS($tableNs, 'number-rows-spanned')) { + $rowTo = $rowTo + (int) $cellData->getAttributeNS($tableNs, 'number-rows-spanned') - 1; + } + + $cellRange = $columnID . $rowID . ':' . $columnTo . $rowTo; + $spreadsheet->getActiveSheet()->mergeCells($cellRange); + } + } + + ++$columnID; + } + $rowID += $rowRepeats; + + break; + } + } + ++$worksheetID; + } + } + + // Return + return $spreadsheet; + } + + /** + * Recursively scan element. + * + * @param \DOMNode $element + * + * @return string + */ + protected function scanElementForText(\DOMNode $element) + { + $str = ''; + foreach ($element->childNodes as $child) { + /** @var \DOMNode $child */ + if ($child->nodeType == XML_TEXT_NODE) { + $str .= $child->nodeValue; + } elseif ($child->nodeType == XML_ELEMENT_NODE && $child->nodeName == 'text:s') { + // It's a space + + // Multiple spaces? + /** @var \DOMAttr $cAttr */ + $cAttr = $child->attributes->getNamedItem('c'); + if ($cAttr) { + $multiplier = (int) $cAttr->nodeValue; + } else { + $multiplier = 1; + } + + $str .= str_repeat(' ', $multiplier); + } + + if ($child->hasChildNodes()) { + $str .= $this->scanElementForText($child); + } + } + + return $str; + } + + /** + * @param string $is + * + * @return RichText + */ + private function parseRichText($is) + { + $value = new RichText(); + $value->createText($is); + + return $value; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/Properties.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/Properties.php new file mode 100644 index 0000000..c5c7caf --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Ods/Properties.php @@ -0,0 +1,135 @@ +spreadsheet = $spreadsheet; + } + + public function load(\SimpleXMLElement $xml, $namespacesMeta) + { + $docProps = $this->spreadsheet->getProperties(); + $officeProperty = $xml->children($namespacesMeta['office']); + foreach ($officeProperty as $officePropertyData) { + // @var \SimpleXMLElement $officePropertyData + if (isset($namespacesMeta['dc'])) { + $officePropertiesDC = $officePropertyData->children($namespacesMeta['dc']); + $this->setCoreProperties($docProps, $officePropertiesDC); + } + + $officePropertyMeta = (object) []; + if (isset($namespacesMeta['dc'])) { + $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']); + } + foreach ($officePropertyMeta as $propertyName => $propertyValue) { + $this->setMetaProperties($namespacesMeta, $propertyValue, $propertyName, $docProps); + } + } + } + + private function setCoreProperties(DocumentProperties $docProps, \SimpleXMLElement $officePropertyDC) + { + foreach ($officePropertyDC as $propertyName => $propertyValue) { + $propertyValue = (string) $propertyValue; + switch ($propertyName) { + case 'title': + $docProps->setTitle($propertyValue); + + break; + case 'subject': + $docProps->setSubject($propertyValue); + + break; + case 'creator': + $docProps->setCreator($propertyValue); + $docProps->setLastModifiedBy($propertyValue); + + break; + case 'creation-date': + $creationDate = strtotime($propertyValue); + $docProps->setCreated($creationDate); + $docProps->setModified($creationDate); + + break; + case 'keyword': + $docProps->setKeywords($propertyValue); + + break; + case 'description': + $docProps->setDescription($propertyValue); + + break; + } + } + } + + private function setMetaProperties( + $namespacesMeta, + \SimpleXMLElement $propertyValue, + $propertyName, + DocumentProperties $docProps + ) { + $propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']); + $propertyValue = (string) $propertyValue; + switch ($propertyName) { + case 'initial-creator': + $docProps->setCreator($propertyValue); + + break; + case 'keyword': + $docProps->setKeywords($propertyValue); + + break; + case 'creation-date': + $creationDate = strtotime($propertyValue); + $docProps->setCreated($creationDate); + + break; + case 'user-defined': + $this->setUserDefinedProperty($propertyValueAttributes, $propertyValue, $docProps); + + break; + } + } + + private function setUserDefinedProperty($propertyValueAttributes, $propertyValue, DocumentProperties $docProps) + { + $propertyValueName = ''; + $propertyValueType = DocumentProperties::PROPERTY_TYPE_STRING; + foreach ($propertyValueAttributes as $key => $value) { + if ($key == 'name') { + $propertyValueName = (string) $value; + } elseif ($key == 'value-type') { + switch ($value) { + case 'date': + $propertyValue = DocumentProperties::convertProperty($propertyValue, 'date'); + $propertyValueType = DocumentProperties::PROPERTY_TYPE_DATE; + + break; + case 'boolean': + $propertyValue = DocumentProperties::convertProperty($propertyValue, 'bool'); + $propertyValueType = DocumentProperties::PROPERTY_TYPE_BOOLEAN; + + break; + case 'float': + $propertyValue = DocumentProperties::convertProperty($propertyValue, 'r4'); + $propertyValueType = DocumentProperties::PROPERTY_TYPE_FLOAT; + + break; + default: + $propertyValueType = DocumentProperties::PROPERTY_TYPE_STRING; + } + } + } + + $docProps->setCustomProperty($propertyValueName, $propertyValue, $propertyValueType); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Security/XmlScanner.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Security/XmlScanner.php new file mode 100644 index 0000000..732f0bf --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Security/XmlScanner.php @@ -0,0 +1,154 @@ +pattern = $pattern; + + $this->disableEntityLoaderCheck(); + + // A fatal error will bypass the destructor, so we register a shutdown here + register_shutdown_function([__CLASS__, 'shutdown']); + } + + public static function getInstance(Reader\IReader $reader) + { + switch (true) { + case $reader instanceof Reader\Html: + return new self('= 1; + case 1: + return PHP_RELEASE_VERSION >= 13; + case 0: + return PHP_RELEASE_VERSION >= 27; + } + + return true; + } + + return false; + } + + private function disableEntityLoaderCheck() + { + if (Settings::getLibXmlDisableEntityLoader()) { + $libxmlDisableEntityLoaderValue = libxml_disable_entity_loader(true); + + if (self::$libxmlDisableEntityLoaderValue === null) { + self::$libxmlDisableEntityLoaderValue = $libxmlDisableEntityLoaderValue; + } + } + } + + public static function shutdown() + { + if (self::$libxmlDisableEntityLoaderValue !== null) { + libxml_disable_entity_loader(self::$libxmlDisableEntityLoaderValue); + self::$libxmlDisableEntityLoaderValue = null; + } + } + + public function __destruct() + { + self::shutdown(); + } + + public function setAdditionalCallback(callable $callback) + { + $this->callback = $callback; + } + + private function toUtf8($xml) + { + $pattern = '/encoding="(.*?)"/'; + $result = preg_match($pattern, $xml, $matches); + $charset = strtoupper($result ? $matches[1] : 'UTF-8'); + + if ($charset !== 'UTF-8') { + $xml = mb_convert_encoding($xml, 'UTF-8', $charset); + + $result = preg_match($pattern, $xml, $matches); + $charset = strtoupper($result ? $matches[1] : 'UTF-8'); + if ($charset !== 'UTF-8') { + throw new Reader\Exception('Suspicious Double-encoded XML, spreadsheet file load() aborted to prevent XXE/XEE attacks'); + } + } + + return $xml; + } + + /** + * Scan the XML for use of disableEntityLoaderCheck(); + + $xml = $this->toUtf8($xml); + + // Don't rely purely on libxml_disable_entity_loader() + $pattern = '/\\0?' . implode('\\0?', str_split($this->pattern)) . '\\0?/'; + + if (preg_match($pattern, $xml)) { + throw new Reader\Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks'); + } + + if ($this->callback !== null && is_callable($this->callback)) { + $xml = call_user_func($this->callback, $xml); + } + + return $xml; + } + + /** + * Scan theXML for use of scan(file_get_contents($filestream)); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php new file mode 100644 index 0000000..9912e93 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Slk.php @@ -0,0 +1,496 @@ +openFile($pFilename); + } catch (Exception $e) { + return false; + } + + // Read sample data (first 2 KB will do) + $data = fread($this->fileHandle, 2048); + + // Count delimiters in file + $delimiterCount = substr_count($data, ';'); + $hasDelimiter = $delimiterCount > 0; + + // Analyze first line looking for ID; signature + $lines = explode("\n", $data); + $hasId = substr($lines[0], 0, 4) === 'ID;P'; + + fclose($this->fileHandle); + + return $hasDelimiter && $hasId; + } + + /** + * Set input encoding. + * + * @param string $pValue Input encoding, eg: 'ANSI' + * + * @return $this + */ + public function setInputEncoding($pValue) + { + $this->inputEncoding = $pValue; + + return $this; + } + + /** + * Get input encoding. + * + * @return string + */ + public function getInputEncoding() + { + return $this->inputEncoding; + } + + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetInfo($pFilename) + { + // Open file + if (!$this->canRead($pFilename)) { + throw new Exception($pFilename . ' is an Invalid Spreadsheet file.'); + } + $this->openFile($pFilename); + $fileHandle = $this->fileHandle; + rewind($fileHandle); + + $worksheetInfo = []; + $worksheetInfo[0]['worksheetName'] = 'Worksheet'; + $worksheetInfo[0]['lastColumnLetter'] = 'A'; + $worksheetInfo[0]['lastColumnIndex'] = 0; + $worksheetInfo[0]['totalRows'] = 0; + $worksheetInfo[0]['totalColumns'] = 0; + + // loop through one row (line) at a time in the file + $rowIndex = 0; + while (($rowData = fgets($fileHandle)) !== false) { + $columnIndex = 0; + + // convert SYLK encoded $rowData to UTF-8 + $rowData = StringHelper::SYLKtoUTF8($rowData); + + // explode each row at semicolons while taking into account that literal semicolon (;) + // is escaped like this (;;) + $rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData))))); + + $dataType = array_shift($rowData); + if ($dataType == 'C') { + // Read cell value data + foreach ($rowData as $rowDatum) { + switch ($rowDatum[0]) { + case 'C': + case 'X': + $columnIndex = substr($rowDatum, 1) - 1; + + break; + case 'R': + case 'Y': + $rowIndex = substr($rowDatum, 1); + + break; + } + + $worksheetInfo[0]['totalRows'] = max($worksheetInfo[0]['totalRows'], $rowIndex); + $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], $columnIndex); + } + } + } + + $worksheetInfo[0]['lastColumnLetter'] = Coordinate::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex'] + 1); + $worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1; + + // Close file + fclose($fileHandle); + + return $worksheetInfo; + } + + /** + * Loads PhpSpreadsheet from file. + * + * @param string $pFilename + * + * @throws Exception + * + * @return Spreadsheet + */ + public function load($pFilename) + { + // Create new Spreadsheet + $spreadsheet = new Spreadsheet(); + + // Load into this instance + return $this->loadIntoExisting($pFilename, $spreadsheet); + } + + /** + * Loads PhpSpreadsheet from file into PhpSpreadsheet instance. + * + * @param string $pFilename + * @param Spreadsheet $spreadsheet + * + * @throws Exception + * + * @return Spreadsheet + */ + public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet) + { + // Open file + if (!$this->canRead($pFilename)) { + throw new Exception($pFilename . ' is an Invalid Spreadsheet file.'); + } + $this->openFile($pFilename); + $fileHandle = $this->fileHandle; + rewind($fileHandle); + + // Create new Worksheets + while ($spreadsheet->getSheetCount() <= $this->sheetIndex) { + $spreadsheet->createSheet(); + } + $spreadsheet->setActiveSheetIndex($this->sheetIndex); + + $fromFormats = ['\-', '\ ']; + $toFormats = ['-', ' ']; + + // Loop through file + $column = $row = ''; + + // loop through one row (line) at a time in the file + while (($rowData = fgets($fileHandle)) !== false) { + // convert SYLK encoded $rowData to UTF-8 + $rowData = StringHelper::SYLKtoUTF8($rowData); + + // explode each row at semicolons while taking into account that literal semicolon (;) + // is escaped like this (;;) + $rowData = explode("\t", str_replace('¤', ';', str_replace(';', "\t", str_replace(';;', '¤', rtrim($rowData))))); + + $dataType = array_shift($rowData); + // Read shared styles + if ($dataType == 'P') { + $formatArray = []; + foreach ($rowData as $rowDatum) { + switch ($rowDatum[0]) { + case 'P': + $formatArray['numberFormat']['formatCode'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1)); + + break; + case 'E': + case 'F': + $formatArray['font']['name'] = substr($rowDatum, 1); + + break; + case 'L': + $formatArray['font']['size'] = substr($rowDatum, 1); + + break; + case 'S': + $styleSettings = substr($rowDatum, 1); + $iMax = strlen($styleSettings); + for ($i = 0; $i < $iMax; ++$i) { + switch ($styleSettings[$i]) { + case 'I': + $formatArray['font']['italic'] = true; + + break; + case 'D': + $formatArray['font']['bold'] = true; + + break; + case 'T': + $formatArray['borders']['top']['borderStyle'] = Border::BORDER_THIN; + + break; + case 'B': + $formatArray['borders']['bottom']['borderStyle'] = Border::BORDER_THIN; + + break; + case 'L': + $formatArray['borders']['left']['borderStyle'] = Border::BORDER_THIN; + + break; + case 'R': + $formatArray['borders']['right']['borderStyle'] = Border::BORDER_THIN; + + break; + } + } + + break; + } + } + $this->formats['P' . $this->format++] = $formatArray; + // Read cell value data + } elseif ($dataType == 'C') { + $hasCalculatedValue = false; + $cellData = $cellDataFormula = ''; + foreach ($rowData as $rowDatum) { + switch ($rowDatum[0]) { + case 'C': + case 'X': + $column = substr($rowDatum, 1); + + break; + case 'R': + case 'Y': + $row = substr($rowDatum, 1); + + break; + case 'K': + $cellData = substr($rowDatum, 1); + + break; + case 'E': + $cellDataFormula = '=' . substr($rowDatum, 1); + // Convert R1C1 style references to A1 style references (but only when not quoted) + $temp = explode('"', $cellDataFormula); + $key = false; + foreach ($temp as &$value) { + // Only count/replace in alternate array entries + if ($key = !$key) { + preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); + // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way + // through the formula from left to right. Reversing means that we work right to left.through + // the formula + $cellReferences = array_reverse($cellReferences); + // Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent, + // then modify the formula to use that new reference + foreach ($cellReferences as $cellReference) { + $rowReference = $cellReference[2][0]; + // Empty R reference is the current row + if ($rowReference == '') { + $rowReference = $row; + } + // Bracketed R references are relative to the current row + if ($rowReference[0] == '[') { + $rowReference = $row + trim($rowReference, '[]'); + } + $columnReference = $cellReference[4][0]; + // Empty C reference is the current column + if ($columnReference == '') { + $columnReference = $column; + } + // Bracketed C references are relative to the current column + if ($columnReference[0] == '[') { + $columnReference = $column + trim($columnReference, '[]'); + } + $A1CellReference = Coordinate::stringFromColumnIndex($columnReference) . $rowReference; + + $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); + } + } + } + unset($value); + // Then rebuild the formula string + $cellDataFormula = implode('"', $temp); + $hasCalculatedValue = true; + + break; + } + } + $columnLetter = Coordinate::stringFromColumnIndex($column); + $cellData = Calculation::unwrapResult($cellData); + + // Set cell value + $spreadsheet->getActiveSheet()->getCell($columnLetter . $row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData); + if ($hasCalculatedValue) { + $cellData = Calculation::unwrapResult($cellData); + $spreadsheet->getActiveSheet()->getCell($columnLetter . $row)->setCalculatedValue($cellData); + } + // Read cell formatting + } elseif ($dataType == 'F') { + $formatStyle = $columnWidth = $styleSettings = ''; + $styleData = []; + foreach ($rowData as $rowDatum) { + switch ($rowDatum[0]) { + case 'C': + case 'X': + $column = substr($rowDatum, 1); + + break; + case 'R': + case 'Y': + $row = substr($rowDatum, 1); + + break; + case 'P': + $formatStyle = $rowDatum; + + break; + case 'W': + [$startCol, $endCol, $columnWidth] = explode(' ', substr($rowDatum, 1)); + + break; + case 'S': + $styleSettings = substr($rowDatum, 1); + $iMax = strlen($styleSettings); + for ($i = 0; $i < $iMax; ++$i) { + switch ($styleSettings[$i]) { + case 'I': + $styleData['font']['italic'] = true; + + break; + case 'D': + $styleData['font']['bold'] = true; + + break; + case 'T': + $styleData['borders']['top']['borderStyle'] = Border::BORDER_THIN; + + break; + case 'B': + $styleData['borders']['bottom']['borderStyle'] = Border::BORDER_THIN; + + break; + case 'L': + $styleData['borders']['left']['borderStyle'] = Border::BORDER_THIN; + + break; + case 'R': + $styleData['borders']['right']['borderStyle'] = Border::BORDER_THIN; + + break; + } + } + + break; + } + } + if (($formatStyle > '') && ($column > '') && ($row > '')) { + $columnLetter = Coordinate::stringFromColumnIndex($column); + if (isset($this->formats[$formatStyle])) { + $spreadsheet->getActiveSheet()->getStyle($columnLetter . $row)->applyFromArray($this->formats[$formatStyle]); + } + } + if ((!empty($styleData)) && ($column > '') && ($row > '')) { + $columnLetter = Coordinate::stringFromColumnIndex($column); + $spreadsheet->getActiveSheet()->getStyle($columnLetter . $row)->applyFromArray($styleData); + } + if ($columnWidth > '') { + if ($startCol == $endCol) { + $startCol = Coordinate::stringFromColumnIndex($startCol); + $spreadsheet->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth); + } else { + $startCol = Coordinate::stringFromColumnIndex($startCol); + $endCol = Coordinate::stringFromColumnIndex($endCol); + $spreadsheet->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth); + do { + $spreadsheet->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth); + } while ($startCol != $endCol); + } + } + } else { + foreach ($rowData as $rowDatum) { + switch ($rowDatum[0]) { + case 'C': + case 'X': + $column = substr($rowDatum, 1); + + break; + case 'R': + case 'Y': + $row = substr($rowDatum, 1); + + break; + } + } + } + } + + // Close file + fclose($fileHandle); + + // Return + return $spreadsheet; + } + + /** + * Get sheet index. + * + * @return int + */ + public function getSheetIndex() + { + return $this->sheetIndex; + } + + /** + * Set sheet index. + * + * @param int $pValue Sheet index + * + * @return $this + */ + public function setSheetIndex($pValue) + { + $this->sheetIndex = $pValue; + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php new file mode 100644 index 0000000..313d721 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php @@ -0,0 +1,7947 @@ +data. + * + * @var int + */ + private $dataSize; + + /** + * Current position in stream. + * + * @var int + */ + private $pos; + + /** + * Workbook to be returned by the reader. + * + * @var Spreadsheet + */ + private $spreadsheet; + + /** + * Worksheet that is currently being built by the reader. + * + * @var Worksheet + */ + private $phpSheet; + + /** + * BIFF version. + * + * @var int + */ + private $version; + + /** + * Codepage set in the Excel file being read. Only important for BIFF5 (Excel 5.0 - Excel 95) + * For BIFF8 (Excel 97 - Excel 2003) this will always have the value 'UTF-16LE'. + * + * @var string + */ + private $codepage; + + /** + * Shared formats. + * + * @var array + */ + private $formats; + + /** + * Shared fonts. + * + * @var array + */ + private $objFonts; + + /** + * Color palette. + * + * @var array + */ + private $palette; + + /** + * Worksheets. + * + * @var array + */ + private $sheets; + + /** + * External books. + * + * @var array + */ + private $externalBooks; + + /** + * REF structures. Only applies to BIFF8. + * + * @var array + */ + private $ref; + + /** + * External names. + * + * @var array + */ + private $externalNames; + + /** + * Defined names. + * + * @var array + */ + private $definedname; + + /** + * Shared strings. Only applies to BIFF8. + * + * @var array + */ + private $sst; + + /** + * Panes are frozen? (in sheet currently being read). See WINDOW2 record. + * + * @var bool + */ + private $frozen; + + /** + * Fit printout to number of pages? (in sheet currently being read). See SHEETPR record. + * + * @var bool + */ + private $isFitToPages; + + /** + * Objects. One OBJ record contributes with one entry. + * + * @var array + */ + private $objs; + + /** + * Text Objects. One TXO record corresponds with one entry. + * + * @var array + */ + private $textObjects; + + /** + * Cell Annotations (BIFF8). + * + * @var array + */ + private $cellNotes; + + /** + * The combined MSODRAWINGGROUP data. + * + * @var string + */ + private $drawingGroupData; + + /** + * The combined MSODRAWING data (per sheet). + * + * @var string + */ + private $drawingData; + + /** + * Keep track of XF index. + * + * @var int + */ + private $xfIndex; + + /** + * Mapping of XF index (that is a cell XF) to final index in cellXf collection. + * + * @var array + */ + private $mapCellXfIndex; + + /** + * Mapping of XF index (that is a style XF) to final index in cellStyleXf collection. + * + * @var array + */ + private $mapCellStyleXfIndex; + + /** + * The shared formulas in a sheet. One SHAREDFMLA record contributes with one value. + * + * @var array + */ + private $sharedFormulas; + + /** + * The shared formula parts in a sheet. One FORMULA record contributes with one value if it + * refers to a shared formula. + * + * @var array + */ + private $sharedFormulaParts; + + /** + * The type of encryption in use. + * + * @var int + */ + private $encryption = 0; + + /** + * The position in the stream after which contents are encrypted. + * + * @var int + */ + private $encryptionStartPos = false; + + /** + * The current RC4 decryption object. + * + * @var Xls\RC4 + */ + private $rc4Key; + + /** + * The position in the stream that the RC4 decryption object was left at. + * + * @var int + */ + private $rc4Pos = 0; + + /** + * The current MD5 context state. + * + * @var string + */ + private $md5Ctxt; + + /** + * @var int + */ + private $textObjRef; + + /** + * @var string + */ + private $baseCell; + + /** + * Create a new Xls Reader instance. + */ + public function __construct() + { + parent::__construct(); + } + + /** + * Can the current IReader read the file? + * + * @param string $pFilename + * + * @return bool + */ + public function canRead($pFilename) + { + File::assertFile($pFilename); + + try { + // Use ParseXL for the hard work. + $ole = new OLERead(); + + // get excel data + $ole->read($pFilename); + + return true; + } catch (PhpSpreadsheetException $e) { + return false; + } + } + + /** + * Reads names of the worksheets from a file, without parsing the whole file to a PhpSpreadsheet object. + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetNames($pFilename) + { + File::assertFile($pFilename); + + $worksheetNames = []; + + // Read the OLE file + $this->loadOLE($pFilename); + + // total byte size of Excel data (workbook global substream + sheet substreams) + $this->dataSize = strlen($this->data); + + $this->pos = 0; + $this->sheets = []; + + // Parse Workbook Global Substream + while ($this->pos < $this->dataSize) { + $code = self::getUInt2d($this->data, $this->pos); + + switch ($code) { + case self::XLS_TYPE_BOF: + $this->readBof(); + + break; + case self::XLS_TYPE_SHEET: + $this->readSheet(); + + break; + case self::XLS_TYPE_EOF: + $this->readDefault(); + + break 2; + default: + $this->readDefault(); + + break; + } + } + + foreach ($this->sheets as $sheet) { + if ($sheet['sheetType'] != 0x00) { + // 0x00: Worksheet, 0x02: Chart, 0x06: Visual Basic module + continue; + } + + $worksheetNames[] = $sheet['name']; + } + + return $worksheetNames; + } + + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetInfo($pFilename) + { + File::assertFile($pFilename); + + $worksheetInfo = []; + + // Read the OLE file + $this->loadOLE($pFilename); + + // total byte size of Excel data (workbook global substream + sheet substreams) + $this->dataSize = strlen($this->data); + + // initialize + $this->pos = 0; + $this->sheets = []; + + // Parse Workbook Global Substream + while ($this->pos < $this->dataSize) { + $code = self::getUInt2d($this->data, $this->pos); + + switch ($code) { + case self::XLS_TYPE_BOF: + $this->readBof(); + + break; + case self::XLS_TYPE_SHEET: + $this->readSheet(); + + break; + case self::XLS_TYPE_EOF: + $this->readDefault(); + + break 2; + default: + $this->readDefault(); + + break; + } + } + + // Parse the individual sheets + foreach ($this->sheets as $sheet) { + if ($sheet['sheetType'] != 0x00) { + // 0x00: Worksheet + // 0x02: Chart + // 0x06: Visual Basic module + continue; + } + + $tmpInfo = []; + $tmpInfo['worksheetName'] = $sheet['name']; + $tmpInfo['lastColumnLetter'] = 'A'; + $tmpInfo['lastColumnIndex'] = 0; + $tmpInfo['totalRows'] = 0; + $tmpInfo['totalColumns'] = 0; + + $this->pos = $sheet['offset']; + + while ($this->pos <= $this->dataSize - 4) { + $code = self::getUInt2d($this->data, $this->pos); + + switch ($code) { + case self::XLS_TYPE_RK: + case self::XLS_TYPE_LABELSST: + case self::XLS_TYPE_NUMBER: + case self::XLS_TYPE_FORMULA: + case self::XLS_TYPE_BOOLERR: + case self::XLS_TYPE_LABEL: + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + $rowIndex = self::getUInt2d($recordData, 0) + 1; + $columnIndex = self::getUInt2d($recordData, 2); + + $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex); + $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex); + + break; + case self::XLS_TYPE_BOF: + $this->readBof(); + + break; + case self::XLS_TYPE_EOF: + $this->readDefault(); + + break 2; + default: + $this->readDefault(); + + break; + } + } + + $tmpInfo['lastColumnLetter'] = Coordinate::stringFromColumnIndex($tmpInfo['lastColumnIndex'] + 1); + $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; + + $worksheetInfo[] = $tmpInfo; + } + + return $worksheetInfo; + } + + /** + * Loads PhpSpreadsheet from file. + * + * @param string $pFilename + * + * @throws Exception + * + * @return Spreadsheet + */ + public function load($pFilename) + { + // Read the OLE file + $this->loadOLE($pFilename); + + // Initialisations + $this->spreadsheet = new Spreadsheet(); + $this->spreadsheet->removeSheetByIndex(0); // remove 1st sheet + if (!$this->readDataOnly) { + $this->spreadsheet->removeCellStyleXfByIndex(0); // remove the default style + $this->spreadsheet->removeCellXfByIndex(0); // remove the default style + } + + // Read the summary information stream (containing meta data) + $this->readSummaryInformation(); + + // Read the Additional document summary information stream (containing application-specific meta data) + $this->readDocumentSummaryInformation(); + + // total byte size of Excel data (workbook global substream + sheet substreams) + $this->dataSize = strlen($this->data); + + // initialize + $this->pos = 0; + $this->codepage = 'CP1252'; + $this->formats = []; + $this->objFonts = []; + $this->palette = []; + $this->sheets = []; + $this->externalBooks = []; + $this->ref = []; + $this->definedname = []; + $this->sst = []; + $this->drawingGroupData = ''; + $this->xfIndex = ''; + $this->mapCellXfIndex = []; + $this->mapCellStyleXfIndex = []; + + // Parse Workbook Global Substream + while ($this->pos < $this->dataSize) { + $code = self::getUInt2d($this->data, $this->pos); + + switch ($code) { + case self::XLS_TYPE_BOF: + $this->readBof(); + + break; + case self::XLS_TYPE_FILEPASS: + $this->readFilepass(); + + break; + case self::XLS_TYPE_CODEPAGE: + $this->readCodepage(); + + break; + case self::XLS_TYPE_DATEMODE: + $this->readDateMode(); + + break; + case self::XLS_TYPE_FONT: + $this->readFont(); + + break; + case self::XLS_TYPE_FORMAT: + $this->readFormat(); + + break; + case self::XLS_TYPE_XF: + $this->readXf(); + + break; + case self::XLS_TYPE_XFEXT: + $this->readXfExt(); + + break; + case self::XLS_TYPE_STYLE: + $this->readStyle(); + + break; + case self::XLS_TYPE_PALETTE: + $this->readPalette(); + + break; + case self::XLS_TYPE_SHEET: + $this->readSheet(); + + break; + case self::XLS_TYPE_EXTERNALBOOK: + $this->readExternalBook(); + + break; + case self::XLS_TYPE_EXTERNNAME: + $this->readExternName(); + + break; + case self::XLS_TYPE_EXTERNSHEET: + $this->readExternSheet(); + + break; + case self::XLS_TYPE_DEFINEDNAME: + $this->readDefinedName(); + + break; + case self::XLS_TYPE_MSODRAWINGGROUP: + $this->readMsoDrawingGroup(); + + break; + case self::XLS_TYPE_SST: + $this->readSst(); + + break; + case self::XLS_TYPE_EOF: + $this->readDefault(); + + break 2; + default: + $this->readDefault(); + + break; + } + } + + // Resolve indexed colors for font, fill, and border colors + // Cannot be resolved already in XF record, because PALETTE record comes afterwards + if (!$this->readDataOnly) { + foreach ($this->objFonts as $objFont) { + if (isset($objFont->colorIndex)) { + $color = Xls\Color::map($objFont->colorIndex, $this->palette, $this->version); + $objFont->getColor()->setRGB($color['rgb']); + } + } + + foreach ($this->spreadsheet->getCellXfCollection() as $objStyle) { + // fill start and end color + $fill = $objStyle->getFill(); + + if (isset($fill->startcolorIndex)) { + $startColor = Xls\Color::map($fill->startcolorIndex, $this->palette, $this->version); + $fill->getStartColor()->setRGB($startColor['rgb']); + } + if (isset($fill->endcolorIndex)) { + $endColor = Xls\Color::map($fill->endcolorIndex, $this->palette, $this->version); + $fill->getEndColor()->setRGB($endColor['rgb']); + } + + // border colors + $top = $objStyle->getBorders()->getTop(); + $right = $objStyle->getBorders()->getRight(); + $bottom = $objStyle->getBorders()->getBottom(); + $left = $objStyle->getBorders()->getLeft(); + $diagonal = $objStyle->getBorders()->getDiagonal(); + + if (isset($top->colorIndex)) { + $borderTopColor = Xls\Color::map($top->colorIndex, $this->palette, $this->version); + $top->getColor()->setRGB($borderTopColor['rgb']); + } + if (isset($right->colorIndex)) { + $borderRightColor = Xls\Color::map($right->colorIndex, $this->palette, $this->version); + $right->getColor()->setRGB($borderRightColor['rgb']); + } + if (isset($bottom->colorIndex)) { + $borderBottomColor = Xls\Color::map($bottom->colorIndex, $this->palette, $this->version); + $bottom->getColor()->setRGB($borderBottomColor['rgb']); + } + if (isset($left->colorIndex)) { + $borderLeftColor = Xls\Color::map($left->colorIndex, $this->palette, $this->version); + $left->getColor()->setRGB($borderLeftColor['rgb']); + } + if (isset($diagonal->colorIndex)) { + $borderDiagonalColor = Xls\Color::map($diagonal->colorIndex, $this->palette, $this->version); + $diagonal->getColor()->setRGB($borderDiagonalColor['rgb']); + } + } + } + + // treat MSODRAWINGGROUP records, workbook-level Escher + if (!$this->readDataOnly && $this->drawingGroupData) { + $escherWorkbook = new Escher(); + $reader = new Xls\Escher($escherWorkbook); + $escherWorkbook = $reader->load($this->drawingGroupData); + } + + // Parse the individual sheets + foreach ($this->sheets as $sheet) { + if ($sheet['sheetType'] != 0x00) { + // 0x00: Worksheet, 0x02: Chart, 0x06: Visual Basic module + continue; + } + + // check if sheet should be skipped + if (isset($this->loadSheetsOnly) && !in_array($sheet['name'], $this->loadSheetsOnly)) { + continue; + } + + // add sheet to PhpSpreadsheet object + $this->phpSheet = $this->spreadsheet->createSheet(); + // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula + // cells... during the load, all formulae should be correct, and we're simply bringing the worksheet + // name in line with the formula, not the reverse + $this->phpSheet->setTitle($sheet['name'], false, false); + $this->phpSheet->setSheetState($sheet['sheetState']); + + $this->pos = $sheet['offset']; + + // Initialize isFitToPages. May change after reading SHEETPR record. + $this->isFitToPages = false; + + // Initialize drawingData + $this->drawingData = ''; + + // Initialize objs + $this->objs = []; + + // Initialize shared formula parts + $this->sharedFormulaParts = []; + + // Initialize shared formulas + $this->sharedFormulas = []; + + // Initialize text objs + $this->textObjects = []; + + // Initialize cell annotations + $this->cellNotes = []; + $this->textObjRef = -1; + + while ($this->pos <= $this->dataSize - 4) { + $code = self::getUInt2d($this->data, $this->pos); + + switch ($code) { + case self::XLS_TYPE_BOF: + $this->readBof(); + + break; + case self::XLS_TYPE_PRINTGRIDLINES: + $this->readPrintGridlines(); + + break; + case self::XLS_TYPE_DEFAULTROWHEIGHT: + $this->readDefaultRowHeight(); + + break; + case self::XLS_TYPE_SHEETPR: + $this->readSheetPr(); + + break; + case self::XLS_TYPE_HORIZONTALPAGEBREAKS: + $this->readHorizontalPageBreaks(); + + break; + case self::XLS_TYPE_VERTICALPAGEBREAKS: + $this->readVerticalPageBreaks(); + + break; + case self::XLS_TYPE_HEADER: + $this->readHeader(); + + break; + case self::XLS_TYPE_FOOTER: + $this->readFooter(); + + break; + case self::XLS_TYPE_HCENTER: + $this->readHcenter(); + + break; + case self::XLS_TYPE_VCENTER: + $this->readVcenter(); + + break; + case self::XLS_TYPE_LEFTMARGIN: + $this->readLeftMargin(); + + break; + case self::XLS_TYPE_RIGHTMARGIN: + $this->readRightMargin(); + + break; + case self::XLS_TYPE_TOPMARGIN: + $this->readTopMargin(); + + break; + case self::XLS_TYPE_BOTTOMMARGIN: + $this->readBottomMargin(); + + break; + case self::XLS_TYPE_PAGESETUP: + $this->readPageSetup(); + + break; + case self::XLS_TYPE_PROTECT: + $this->readProtect(); + + break; + case self::XLS_TYPE_SCENPROTECT: + $this->readScenProtect(); + + break; + case self::XLS_TYPE_OBJECTPROTECT: + $this->readObjectProtect(); + + break; + case self::XLS_TYPE_PASSWORD: + $this->readPassword(); + + break; + case self::XLS_TYPE_DEFCOLWIDTH: + $this->readDefColWidth(); + + break; + case self::XLS_TYPE_COLINFO: + $this->readColInfo(); + + break; + case self::XLS_TYPE_DIMENSION: + $this->readDefault(); + + break; + case self::XLS_TYPE_ROW: + $this->readRow(); + + break; + case self::XLS_TYPE_DBCELL: + $this->readDefault(); + + break; + case self::XLS_TYPE_RK: + $this->readRk(); + + break; + case self::XLS_TYPE_LABELSST: + $this->readLabelSst(); + + break; + case self::XLS_TYPE_MULRK: + $this->readMulRk(); + + break; + case self::XLS_TYPE_NUMBER: + $this->readNumber(); + + break; + case self::XLS_TYPE_FORMULA: + $this->readFormula(); + + break; + case self::XLS_TYPE_SHAREDFMLA: + $this->readSharedFmla(); + + break; + case self::XLS_TYPE_BOOLERR: + $this->readBoolErr(); + + break; + case self::XLS_TYPE_MULBLANK: + $this->readMulBlank(); + + break; + case self::XLS_TYPE_LABEL: + $this->readLabel(); + + break; + case self::XLS_TYPE_BLANK: + $this->readBlank(); + + break; + case self::XLS_TYPE_MSODRAWING: + $this->readMsoDrawing(); + + break; + case self::XLS_TYPE_OBJ: + $this->readObj(); + + break; + case self::XLS_TYPE_WINDOW2: + $this->readWindow2(); + + break; + case self::XLS_TYPE_PAGELAYOUTVIEW: + $this->readPageLayoutView(); + + break; + case self::XLS_TYPE_SCL: + $this->readScl(); + + break; + case self::XLS_TYPE_PANE: + $this->readPane(); + + break; + case self::XLS_TYPE_SELECTION: + $this->readSelection(); + + break; + case self::XLS_TYPE_MERGEDCELLS: + $this->readMergedCells(); + + break; + case self::XLS_TYPE_HYPERLINK: + $this->readHyperLink(); + + break; + case self::XLS_TYPE_DATAVALIDATIONS: + $this->readDataValidations(); + + break; + case self::XLS_TYPE_DATAVALIDATION: + $this->readDataValidation(); + + break; + case self::XLS_TYPE_SHEETLAYOUT: + $this->readSheetLayout(); + + break; + case self::XLS_TYPE_SHEETPROTECTION: + $this->readSheetProtection(); + + break; + case self::XLS_TYPE_RANGEPROTECTION: + $this->readRangeProtection(); + + break; + case self::XLS_TYPE_NOTE: + $this->readNote(); + + break; + case self::XLS_TYPE_TXO: + $this->readTextObject(); + + break; + case self::XLS_TYPE_CONTINUE: + $this->readContinue(); + + break; + case self::XLS_TYPE_EOF: + $this->readDefault(); + + break 2; + default: + $this->readDefault(); + + break; + } + } + + // treat MSODRAWING records, sheet-level Escher + if (!$this->readDataOnly && $this->drawingData) { + $escherWorksheet = new Escher(); + $reader = new Xls\Escher($escherWorksheet); + $escherWorksheet = $reader->load($this->drawingData); + + // get all spContainers in one long array, so they can be mapped to OBJ records + $allSpContainers = $escherWorksheet->getDgContainer()->getSpgrContainer()->getAllSpContainers(); + } + + // treat OBJ records + foreach ($this->objs as $n => $obj) { + // the first shape container never has a corresponding OBJ record, hence $n + 1 + if (isset($allSpContainers[$n + 1]) && is_object($allSpContainers[$n + 1])) { + $spContainer = $allSpContainers[$n + 1]; + + // we skip all spContainers that are a part of a group shape since we cannot yet handle those + if ($spContainer->getNestingLevel() > 1) { + continue; + } + + // calculate the width and height of the shape + [$startColumn, $startRow] = Coordinate::coordinateFromString($spContainer->getStartCoordinates()); + [$endColumn, $endRow] = Coordinate::coordinateFromString($spContainer->getEndCoordinates()); + + $startOffsetX = $spContainer->getStartOffsetX(); + $startOffsetY = $spContainer->getStartOffsetY(); + $endOffsetX = $spContainer->getEndOffsetX(); + $endOffsetY = $spContainer->getEndOffsetY(); + + $width = \PhpOffice\PhpSpreadsheet\Shared\Xls::getDistanceX($this->phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX); + $height = \PhpOffice\PhpSpreadsheet\Shared\Xls::getDistanceY($this->phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY); + + // calculate offsetX and offsetY of the shape + $offsetX = $startOffsetX * \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeCol($this->phpSheet, $startColumn) / 1024; + $offsetY = $startOffsetY * \PhpOffice\PhpSpreadsheet\Shared\Xls::sizeRow($this->phpSheet, $startRow) / 256; + + switch ($obj['otObjType']) { + case 0x19: + // Note + if (isset($this->cellNotes[$obj['idObjID']])) { + $cellNote = $this->cellNotes[$obj['idObjID']]; + + if (isset($this->textObjects[$obj['idObjID']])) { + $textObject = $this->textObjects[$obj['idObjID']]; + $this->cellNotes[$obj['idObjID']]['objTextData'] = $textObject; + } + } + + break; + case 0x08: + // picture + // get index to BSE entry (1-based) + $BSEindex = $spContainer->getOPT(0x0104); + + // If there is no BSE Index, we will fail here and other fields are not read. + // Fix by checking here. + // TODO: Why is there no BSE Index? Is this a new Office Version? Password protected field? + // More likely : a uncompatible picture + if (!$BSEindex) { + continue 2; + } + + $BSECollection = $escherWorkbook->getDggContainer()->getBstoreContainer()->getBSECollection(); + $BSE = $BSECollection[$BSEindex - 1]; + $blipType = $BSE->getBlipType(); + + // need check because some blip types are not supported by Escher reader such as EMF + if ($blip = $BSE->getBlip()) { + $ih = imagecreatefromstring($blip->getData()); + $drawing = new MemoryDrawing(); + $drawing->setImageResource($ih); + + // width, height, offsetX, offsetY + $drawing->setResizeProportional(false); + $drawing->setWidth($width); + $drawing->setHeight($height); + $drawing->setOffsetX($offsetX); + $drawing->setOffsetY($offsetY); + + switch ($blipType) { + case BSE::BLIPTYPE_JPEG: + $drawing->setRenderingFunction(MemoryDrawing::RENDERING_JPEG); + $drawing->setMimeType(MemoryDrawing::MIMETYPE_JPEG); + + break; + case BSE::BLIPTYPE_PNG: + $drawing->setRenderingFunction(MemoryDrawing::RENDERING_PNG); + $drawing->setMimeType(MemoryDrawing::MIMETYPE_PNG); + + break; + } + + $drawing->setWorksheet($this->phpSheet); + $drawing->setCoordinates($spContainer->getStartCoordinates()); + } + + break; + default: + // other object type + break; + } + } + } + + // treat SHAREDFMLA records + if ($this->version == self::XLS_BIFF8) { + foreach ($this->sharedFormulaParts as $cell => $baseCell) { + [$column, $row] = Coordinate::coordinateFromString($cell); + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) { + $formula = $this->getFormulaFromStructure($this->sharedFormulas[$baseCell], $cell); + $this->phpSheet->getCell($cell)->setValueExplicit('=' . $formula, DataType::TYPE_FORMULA); + } + } + } + + if (!empty($this->cellNotes)) { + foreach ($this->cellNotes as $note => $noteDetails) { + if (!isset($noteDetails['objTextData'])) { + if (isset($this->textObjects[$note])) { + $textObject = $this->textObjects[$note]; + $noteDetails['objTextData'] = $textObject; + } else { + $noteDetails['objTextData']['text'] = ''; + } + } + $cellAddress = str_replace('$', '', $noteDetails['cellRef']); + $this->phpSheet->getComment($cellAddress)->setAuthor($noteDetails['author'])->setText($this->parseRichText($noteDetails['objTextData']['text'])); + } + } + } + + // add the named ranges (defined names) + foreach ($this->definedname as $definedName) { + if ($definedName['isBuiltInName']) { + switch ($definedName['name']) { + case pack('C', 0x06): + // print area + // in general, formula looks like this: Foo!$C$7:$J$66,Bar!$A$1:$IV$2 + $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? + + $extractedRanges = []; + foreach ($ranges as $range) { + // $range should look like one of these + // Foo!$C$7:$J$66 + // Bar!$A$1:$IV$2 + $explodes = Worksheet::extractSheetTitle($range, true); + $sheetName = trim($explodes[0], "'"); + if (count($explodes) == 2) { + if (strpos($explodes[1], ':') === false) { + $explodes[1] = $explodes[1] . ':' . $explodes[1]; + } + $extractedRanges[] = str_replace('$', '', $explodes[1]); // C7:J66 + } + } + if ($docSheet = $this->spreadsheet->getSheetByName($sheetName)) { + $docSheet->getPageSetup()->setPrintArea(implode(',', $extractedRanges)); // C7:J66,A1:IV2 + } + + break; + case pack('C', 0x07): + // print titles (repeating rows) + // Assuming BIFF8, there are 3 cases + // 1. repeating rows + // formula looks like this: Sheet!$A$1:$IV$2 + // rows 1-2 repeat + // 2. repeating columns + // formula looks like this: Sheet!$A$1:$B$65536 + // columns A-B repeat + // 3. both repeating rows and repeating columns + // formula looks like this: Sheet!$A$1:$B$65536,Sheet!$A$1:$IV$2 + $ranges = explode(',', $definedName['formula']); // FIXME: what if sheetname contains comma? + foreach ($ranges as $range) { + // $range should look like this one of these + // Sheet!$A$1:$B$65536 + // Sheet!$A$1:$IV$2 + if (strpos($range, '!') !== false) { + $explodes = Worksheet::extractSheetTitle($range, true); + if ($docSheet = $this->spreadsheet->getSheetByName($explodes[0])) { + $extractedRange = $explodes[1]; + $extractedRange = str_replace('$', '', $extractedRange); + + $coordinateStrings = explode(':', $extractedRange); + if (count($coordinateStrings) == 2) { + [$firstColumn, $firstRow] = Coordinate::coordinateFromString($coordinateStrings[0]); + [$lastColumn, $lastRow] = Coordinate::coordinateFromString($coordinateStrings[1]); + + if ($firstColumn == 'A' and $lastColumn == 'IV') { + // then we have repeating rows + $docSheet->getPageSetup()->setRowsToRepeatAtTop([$firstRow, $lastRow]); + } elseif ($firstRow == 1 and $lastRow == 65536) { + // then we have repeating columns + $docSheet->getPageSetup()->setColumnsToRepeatAtLeft([$firstColumn, $lastColumn]); + } + } + } + } + } + + break; + } + } else { + // Extract range + if (strpos($definedName['formula'], '!') !== false) { + $explodes = Worksheet::extractSheetTitle($definedName['formula'], true); + if (($docSheet = $this->spreadsheet->getSheetByName($explodes[0])) || + ($docSheet = $this->spreadsheet->getSheetByName(trim($explodes[0], "'")))) { + $extractedRange = $explodes[1]; + $extractedRange = str_replace('$', '', $extractedRange); + + $localOnly = ($definedName['scope'] == 0) ? false : true; + + $scope = ($definedName['scope'] == 0) ? null : $this->spreadsheet->getSheetByName($this->sheets[$definedName['scope'] - 1]['name']); + + $this->spreadsheet->addNamedRange(new NamedRange((string) $definedName['name'], $docSheet, $extractedRange, $localOnly, $scope)); + } + } + // Named Value + // TODO Provide support for named values + } + } + $this->data = null; + + return $this->spreadsheet; + } + + /** + * Read record data from stream, decrypting as required. + * + * @param string $data Data stream to read from + * @param int $pos Position to start reading from + * @param int $len Record data length + * + * @return string Record data + */ + private function readRecordData($data, $pos, $len) + { + $data = substr($data, $pos, $len); + + // File not encrypted, or record before encryption start point + if ($this->encryption == self::MS_BIFF_CRYPTO_NONE || $pos < $this->encryptionStartPos) { + return $data; + } + + $recordData = ''; + if ($this->encryption == self::MS_BIFF_CRYPTO_RC4) { + $oldBlock = floor($this->rc4Pos / self::REKEY_BLOCK); + $block = floor($pos / self::REKEY_BLOCK); + $endBlock = floor(($pos + $len) / self::REKEY_BLOCK); + + // Spin an RC4 decryptor to the right spot. If we have a decryptor sitting + // at a point earlier in the current block, re-use it as we can save some time. + if ($block != $oldBlock || $pos < $this->rc4Pos || !$this->rc4Key) { + $this->rc4Key = $this->makeKey($block, $this->md5Ctxt); + $step = $pos % self::REKEY_BLOCK; + } else { + $step = $pos - $this->rc4Pos; + } + $this->rc4Key->RC4(str_repeat("\0", $step)); + + // Decrypt record data (re-keying at the end of every block) + while ($block != $endBlock) { + $step = self::REKEY_BLOCK - ($pos % self::REKEY_BLOCK); + $recordData .= $this->rc4Key->RC4(substr($data, 0, $step)); + $data = substr($data, $step); + $pos += $step; + $len -= $step; + ++$block; + $this->rc4Key = $this->makeKey($block, $this->md5Ctxt); + } + $recordData .= $this->rc4Key->RC4(substr($data, 0, $len)); + + // Keep track of the position of this decryptor. + // We'll try and re-use it later if we can to speed things up + $this->rc4Pos = $pos + $len; + } elseif ($this->encryption == self::MS_BIFF_CRYPTO_XOR) { + throw new Exception('XOr encryption not supported'); + } + + return $recordData; + } + + /** + * Use OLE reader to extract the relevant data streams from the OLE file. + * + * @param string $pFilename + */ + private function loadOLE($pFilename) + { + // OLE reader + $ole = new OLERead(); + // get excel data, + $ole->read($pFilename); + // Get workbook data: workbook stream + sheet streams + $this->data = $ole->getStream($ole->wrkbook); + // Get summary information data + $this->summaryInformation = $ole->getStream($ole->summaryInformation); + // Get additional document summary information data + $this->documentSummaryInformation = $ole->getStream($ole->documentSummaryInformation); + } + + /** + * Read summary information. + */ + private function readSummaryInformation() + { + if (!isset($this->summaryInformation)) { + return; + } + + // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) + // offset: 2; size: 2; + // offset: 4; size: 2; OS version + // offset: 6; size: 2; OS indicator + // offset: 8; size: 16 + // offset: 24; size: 4; section count + $secCount = self::getInt4d($this->summaryInformation, 24); + + // offset: 28; size: 16; first section's class id: e0 85 9f f2 f9 4f 68 10 ab 91 08 00 2b 27 b3 d9 + // offset: 44; size: 4 + $secOffset = self::getInt4d($this->summaryInformation, 44); + + // section header + // offset: $secOffset; size: 4; section length + $secLength = self::getInt4d($this->summaryInformation, $secOffset); + + // offset: $secOffset+4; size: 4; property count + $countProperties = self::getInt4d($this->summaryInformation, $secOffset + 4); + + // initialize code page (used to resolve string values) + $codePage = 'CP1252'; + + // offset: ($secOffset+8); size: var + // loop through property decarations and properties + for ($i = 0; $i < $countProperties; ++$i) { + // offset: ($secOffset+8) + (8 * $i); size: 4; property ID + $id = self::getInt4d($this->summaryInformation, ($secOffset + 8) + (8 * $i)); + + // Use value of property id as appropriate + // offset: ($secOffset+12) + (8 * $i); size: 4; offset from beginning of section (48) + $offset = self::getInt4d($this->summaryInformation, ($secOffset + 12) + (8 * $i)); + + $type = self::getInt4d($this->summaryInformation, $secOffset + $offset); + + // initialize property value + $value = null; + + // extract property value based on property type + switch ($type) { + case 0x02: // 2 byte signed integer + $value = self::getUInt2d($this->summaryInformation, $secOffset + 4 + $offset); + + break; + case 0x03: // 4 byte signed integer + $value = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset); + + break; + case 0x13: // 4 byte unsigned integer + // not needed yet, fix later if necessary + break; + case 0x1E: // null-terminated string prepended by dword string length + $byteLength = self::getInt4d($this->summaryInformation, $secOffset + 4 + $offset); + $value = substr($this->summaryInformation, $secOffset + 8 + $offset, $byteLength); + $value = StringHelper::convertEncoding($value, 'UTF-8', $codePage); + $value = rtrim($value); + + break; + case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) + // PHP-time + $value = OLE::OLE2LocalDate(substr($this->summaryInformation, $secOffset + 4 + $offset, 8)); + + break; + case 0x47: // Clipboard format + // not needed yet, fix later if necessary + break; + } + + switch ($id) { + case 0x01: // Code Page + $codePage = CodePage::numberToName($value); + + break; + case 0x02: // Title + $this->spreadsheet->getProperties()->setTitle($value); + + break; + case 0x03: // Subject + $this->spreadsheet->getProperties()->setSubject($value); + + break; + case 0x04: // Author (Creator) + $this->spreadsheet->getProperties()->setCreator($value); + + break; + case 0x05: // Keywords + $this->spreadsheet->getProperties()->setKeywords($value); + + break; + case 0x06: // Comments (Description) + $this->spreadsheet->getProperties()->setDescription($value); + + break; + case 0x07: // Template + // Not supported by PhpSpreadsheet + break; + case 0x08: // Last Saved By (LastModifiedBy) + $this->spreadsheet->getProperties()->setLastModifiedBy($value); + + break; + case 0x09: // Revision + // Not supported by PhpSpreadsheet + break; + case 0x0A: // Total Editing Time + // Not supported by PhpSpreadsheet + break; + case 0x0B: // Last Printed + // Not supported by PhpSpreadsheet + break; + case 0x0C: // Created Date/Time + $this->spreadsheet->getProperties()->setCreated($value); + + break; + case 0x0D: // Modified Date/Time + $this->spreadsheet->getProperties()->setModified($value); + + break; + case 0x0E: // Number of Pages + // Not supported by PhpSpreadsheet + break; + case 0x0F: // Number of Words + // Not supported by PhpSpreadsheet + break; + case 0x10: // Number of Characters + // Not supported by PhpSpreadsheet + break; + case 0x11: // Thumbnail + // Not supported by PhpSpreadsheet + break; + case 0x12: // Name of creating application + // Not supported by PhpSpreadsheet + break; + case 0x13: // Security + // Not supported by PhpSpreadsheet + break; + } + } + } + + /** + * Read additional document summary information. + */ + private function readDocumentSummaryInformation() + { + if (!isset($this->documentSummaryInformation)) { + return; + } + + // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) + // offset: 2; size: 2; + // offset: 4; size: 2; OS version + // offset: 6; size: 2; OS indicator + // offset: 8; size: 16 + // offset: 24; size: 4; section count + $secCount = self::getInt4d($this->documentSummaryInformation, 24); + + // offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae + // offset: 44; size: 4; first section offset + $secOffset = self::getInt4d($this->documentSummaryInformation, 44); + + // section header + // offset: $secOffset; size: 4; section length + $secLength = self::getInt4d($this->documentSummaryInformation, $secOffset); + + // offset: $secOffset+4; size: 4; property count + $countProperties = self::getInt4d($this->documentSummaryInformation, $secOffset + 4); + + // initialize code page (used to resolve string values) + $codePage = 'CP1252'; + + // offset: ($secOffset+8); size: var + // loop through property decarations and properties + for ($i = 0; $i < $countProperties; ++$i) { + // offset: ($secOffset+8) + (8 * $i); size: 4; property ID + $id = self::getInt4d($this->documentSummaryInformation, ($secOffset + 8) + (8 * $i)); + + // Use value of property id as appropriate + // offset: 60 + 8 * $i; size: 4; offset from beginning of section (48) + $offset = self::getInt4d($this->documentSummaryInformation, ($secOffset + 12) + (8 * $i)); + + $type = self::getInt4d($this->documentSummaryInformation, $secOffset + $offset); + + // initialize property value + $value = null; + + // extract property value based on property type + switch ($type) { + case 0x02: // 2 byte signed integer + $value = self::getUInt2d($this->documentSummaryInformation, $secOffset + 4 + $offset); + + break; + case 0x03: // 4 byte signed integer + $value = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset); + + break; + case 0x0B: // Boolean + $value = self::getUInt2d($this->documentSummaryInformation, $secOffset + 4 + $offset); + $value = ($value == 0 ? false : true); + + break; + case 0x13: // 4 byte unsigned integer + // not needed yet, fix later if necessary + break; + case 0x1E: // null-terminated string prepended by dword string length + $byteLength = self::getInt4d($this->documentSummaryInformation, $secOffset + 4 + $offset); + $value = substr($this->documentSummaryInformation, $secOffset + 8 + $offset, $byteLength); + $value = StringHelper::convertEncoding($value, 'UTF-8', $codePage); + $value = rtrim($value); + + break; + case 0x40: // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) + // PHP-Time + $value = OLE::OLE2LocalDate(substr($this->documentSummaryInformation, $secOffset + 4 + $offset, 8)); + + break; + case 0x47: // Clipboard format + // not needed yet, fix later if necessary + break; + } + + switch ($id) { + case 0x01: // Code Page + $codePage = CodePage::numberToName($value); + + break; + case 0x02: // Category + $this->spreadsheet->getProperties()->setCategory($value); + + break; + case 0x03: // Presentation Target + // Not supported by PhpSpreadsheet + break; + case 0x04: // Bytes + // Not supported by PhpSpreadsheet + break; + case 0x05: // Lines + // Not supported by PhpSpreadsheet + break; + case 0x06: // Paragraphs + // Not supported by PhpSpreadsheet + break; + case 0x07: // Slides + // Not supported by PhpSpreadsheet + break; + case 0x08: // Notes + // Not supported by PhpSpreadsheet + break; + case 0x09: // Hidden Slides + // Not supported by PhpSpreadsheet + break; + case 0x0A: // MM Clips + // Not supported by PhpSpreadsheet + break; + case 0x0B: // Scale Crop + // Not supported by PhpSpreadsheet + break; + case 0x0C: // Heading Pairs + // Not supported by PhpSpreadsheet + break; + case 0x0D: // Titles of Parts + // Not supported by PhpSpreadsheet + break; + case 0x0E: // Manager + $this->spreadsheet->getProperties()->setManager($value); + + break; + case 0x0F: // Company + $this->spreadsheet->getProperties()->setCompany($value); + + break; + case 0x10: // Links up-to-date + // Not supported by PhpSpreadsheet + break; + } + } + } + + /** + * Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record. + */ + private function readDefault() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + + // move stream pointer to next record + $this->pos += 4 + $length; + } + + /** + * The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions, + * this record stores a note (cell note). This feature was significantly enhanced in Excel 97. + */ + private function readNote() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return; + } + + $cellAddress = $this->readBIFF8CellAddress(substr($recordData, 0, 4)); + if ($this->version == self::XLS_BIFF8) { + $noteObjID = self::getUInt2d($recordData, 6); + $noteAuthor = self::readUnicodeStringLong(substr($recordData, 8)); + $noteAuthor = $noteAuthor['value']; + $this->cellNotes[$noteObjID] = [ + 'cellRef' => $cellAddress, + 'objectID' => $noteObjID, + 'author' => $noteAuthor, + ]; + } else { + $extension = false; + if ($cellAddress == '$B$65536') { + // If the address row is -1 and the column is 0, (which translates as $B$65536) then this is a continuation + // note from the previous cell annotation. We're not yet handling this, so annotations longer than the + // max 2048 bytes will probably throw a wobbly. + $row = self::getUInt2d($recordData, 0); + $extension = true; + $cellAddress = array_pop(array_keys($this->phpSheet->getComments())); + } + + $cellAddress = str_replace('$', '', $cellAddress); + $noteLength = self::getUInt2d($recordData, 4); + $noteText = trim(substr($recordData, 6)); + + if ($extension) { + // Concatenate this extension with the currently set comment for the cell + $comment = $this->phpSheet->getComment($cellAddress); + $commentText = $comment->getText()->getPlainText(); + $comment->setText($this->parseRichText($commentText . $noteText)); + } else { + // Set comment for the cell + $this->phpSheet->getComment($cellAddress)->setText($this->parseRichText($noteText)); +// ->setAuthor($author) + } + } + } + + /** + * The TEXT Object record contains the text associated with a cell annotation. + */ + private function readTextObject() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return; + } + + // recordData consists of an array of subrecords looking like this: + // grbit: 2 bytes; Option Flags + // rot: 2 bytes; rotation + // cchText: 2 bytes; length of the text (in the first continue record) + // cbRuns: 2 bytes; length of the formatting (in the second continue record) + // followed by the continuation records containing the actual text and formatting + $grbitOpts = self::getUInt2d($recordData, 0); + $rot = self::getUInt2d($recordData, 2); + $cchText = self::getUInt2d($recordData, 10); + $cbRuns = self::getUInt2d($recordData, 12); + $text = $this->getSplicedRecordData(); + + $textByte = $text['spliceOffsets'][1] - $text['spliceOffsets'][0] - 1; + $textStr = substr($text['recordData'], $text['spliceOffsets'][0] + 1, $textByte); + // get 1 byte + $is16Bit = ord($text['recordData'][0]); + // it is possible to use a compressed format, + // which omits the high bytes of all characters, if they are all zero + if (($is16Bit & 0x01) === 0) { + $textStr = StringHelper::ConvertEncoding($textStr, 'UTF-8', 'ISO-8859-1'); + } else { + $textStr = $this->decodeCodepage($textStr); + } + + $this->textObjects[$this->textObjRef] = [ + 'text' => $textStr, + 'format' => substr($text['recordData'], $text['spliceOffsets'][1], $cbRuns), + 'alignment' => $grbitOpts, + 'rotation' => $rot, + ]; + } + + /** + * Read BOF. + */ + private function readBof() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = substr($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 2; size: 2; type of the following data + $substreamType = self::getUInt2d($recordData, 2); + + switch ($substreamType) { + case self::XLS_WORKBOOKGLOBALS: + $version = self::getUInt2d($recordData, 0); + if (($version != self::XLS_BIFF8) && ($version != self::XLS_BIFF7)) { + throw new Exception('Cannot read this Excel file. Version is too old.'); + } + $this->version = $version; + + break; + case self::XLS_WORKSHEET: + // do not use this version information for anything + // it is unreliable (OpenOffice doc, 5.8), use only version information from the global stream + break; + default: + // substream, e.g. chart + // just skip the entire substream + do { + $code = self::getUInt2d($this->data, $this->pos); + $this->readDefault(); + } while ($code != self::XLS_TYPE_EOF && $this->pos < $this->dataSize); + + break; + } + } + + /** + * FILEPASS. + * + * This record is part of the File Protection Block. It + * contains information about the read/write password of the + * file. All record contents following this record will be + * encrypted. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + * + * The decryption functions and objects used from here on in + * are based on the source of Spreadsheet-ParseExcel: + * https://metacpan.org/release/Spreadsheet-ParseExcel + */ + private function readFilepass() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + + if ($length != 54) { + throw new Exception('Unexpected file pass record length'); + } + + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->verifyPassword('VelvetSweatshop', substr($recordData, 6, 16), substr($recordData, 22, 16), substr($recordData, 38, 16), $this->md5Ctxt)) { + throw new Exception('Decryption password incorrect'); + } + + $this->encryption = self::MS_BIFF_CRYPTO_RC4; + + // Decryption required from the record after next onwards + $this->encryptionStartPos = $this->pos + self::getUInt2d($this->data, $this->pos + 2); + } + + /** + * Make an RC4 decryptor for the given block. + * + * @param int $block Block for which to create decrypto + * @param string $valContext MD5 context state + * + * @return Xls\RC4 + */ + private function makeKey($block, $valContext) + { + $pwarray = str_repeat("\0", 64); + + for ($i = 0; $i < 5; ++$i) { + $pwarray[$i] = $valContext[$i]; + } + + $pwarray[5] = chr($block & 0xff); + $pwarray[6] = chr(($block >> 8) & 0xff); + $pwarray[7] = chr(($block >> 16) & 0xff); + $pwarray[8] = chr(($block >> 24) & 0xff); + + $pwarray[9] = "\x80"; + $pwarray[56] = "\x48"; + + $md5 = new Xls\MD5(); + $md5->add($pwarray); + + $s = $md5->getContext(); + + return new Xls\RC4($s); + } + + /** + * Verify RC4 file password. + * + * @param string $password Password to check + * @param string $docid Document id + * @param string $salt_data Salt data + * @param string $hashedsalt_data Hashed salt data + * @param string $valContext Set to the MD5 context of the value + * + * @return bool Success + */ + private function verifyPassword($password, $docid, $salt_data, $hashedsalt_data, &$valContext) + { + $pwarray = str_repeat("\0", 64); + + $iMax = strlen($password); + for ($i = 0; $i < $iMax; ++$i) { + $o = ord(substr($password, $i, 1)); + $pwarray[2 * $i] = chr($o & 0xff); + $pwarray[2 * $i + 1] = chr(($o >> 8) & 0xff); + } + $pwarray[2 * $i] = chr(0x80); + $pwarray[56] = chr(($i << 4) & 0xff); + + $md5 = new Xls\MD5(); + $md5->add($pwarray); + + $mdContext1 = $md5->getContext(); + + $offset = 0; + $keyoffset = 0; + $tocopy = 5; + + $md5->reset(); + + while ($offset != 16) { + if ((64 - $offset) < 5) { + $tocopy = 64 - $offset; + } + for ($i = 0; $i <= $tocopy; ++$i) { + $pwarray[$offset + $i] = $mdContext1[$keyoffset + $i]; + } + $offset += $tocopy; + + if ($offset == 64) { + $md5->add($pwarray); + $keyoffset = $tocopy; + $tocopy = 5 - $tocopy; + $offset = 0; + + continue; + } + + $keyoffset = 0; + $tocopy = 5; + for ($i = 0; $i < 16; ++$i) { + $pwarray[$offset + $i] = $docid[$i]; + } + $offset += 16; + } + + $pwarray[16] = "\x80"; + for ($i = 0; $i < 47; ++$i) { + $pwarray[17 + $i] = "\0"; + } + $pwarray[56] = "\x80"; + $pwarray[57] = "\x0a"; + + $md5->add($pwarray); + $valContext = $md5->getContext(); + + $key = $this->makeKey(0, $valContext); + + $salt = $key->RC4($salt_data); + $hashedsalt = $key->RC4($hashedsalt_data); + + $salt .= "\x80" . str_repeat("\0", 47); + $salt[56] = "\x80"; + + $md5->reset(); + $md5->add($salt); + $mdContext2 = $md5->getContext(); + + return $mdContext2 == $hashedsalt; + } + + /** + * CODEPAGE. + * + * This record stores the text encoding used to write byte + * strings, stored as MS Windows code page identifier. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readCodepage() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; code page identifier + $codepage = self::getUInt2d($recordData, 0); + + $this->codepage = CodePage::numberToName($codepage); + } + + /** + * DATEMODE. + * + * This record specifies the base date for displaying date + * values. All dates are stored as count of days past this + * base date. In BIFF2-BIFF4 this record is part of the + * Calculation Settings Block. In BIFF5-BIFF8 it is + * stored in the Workbook Globals Substream. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readDateMode() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; 0 = base 1900, 1 = base 1904 + Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); + if (ord($recordData[0]) == 1) { + Date::setExcelCalendar(Date::CALENDAR_MAC_1904); + } + } + + /** + * Read a FONT record. + */ + private function readFont() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + $objFont = new Font(); + + // offset: 0; size: 2; height of the font (in twips = 1/20 of a point) + $size = self::getUInt2d($recordData, 0); + $objFont->setSize($size / 20); + + // offset: 2; size: 2; option flags + // bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8) + // bit: 1; mask 0x0002; italic + $isItalic = (0x0002 & self::getUInt2d($recordData, 2)) >> 1; + if ($isItalic) { + $objFont->setItalic(true); + } + + // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8) + // bit: 3; mask 0x0008; strikethrough + $isStrike = (0x0008 & self::getUInt2d($recordData, 2)) >> 3; + if ($isStrike) { + $objFont->setStrikethrough(true); + } + + // offset: 4; size: 2; colour index + $colorIndex = self::getUInt2d($recordData, 4); + $objFont->colorIndex = $colorIndex; + + // offset: 6; size: 2; font weight + $weight = self::getUInt2d($recordData, 6); + switch ($weight) { + case 0x02BC: + $objFont->setBold(true); + + break; + } + + // offset: 8; size: 2; escapement type + $escapement = self::getUInt2d($recordData, 8); + switch ($escapement) { + case 0x0001: + $objFont->setSuperscript(true); + + break; + case 0x0002: + $objFont->setSubscript(true); + + break; + } + + // offset: 10; size: 1; underline type + $underlineType = ord($recordData[10]); + switch ($underlineType) { + case 0x00: + break; // no underline + case 0x01: + $objFont->setUnderline(Font::UNDERLINE_SINGLE); + + break; + case 0x02: + $objFont->setUnderline(Font::UNDERLINE_DOUBLE); + + break; + case 0x21: + $objFont->setUnderline(Font::UNDERLINE_SINGLEACCOUNTING); + + break; + case 0x22: + $objFont->setUnderline(Font::UNDERLINE_DOUBLEACCOUNTING); + + break; + } + + // offset: 11; size: 1; font family + // offset: 12; size: 1; character set + // offset: 13; size: 1; not used + // offset: 14; size: var; font name + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringShort(substr($recordData, 14)); + } else { + $string = $this->readByteStringShort(substr($recordData, 14)); + } + $objFont->setName($string['value']); + + $this->objFonts[] = $objFont; + } + } + + /** + * FORMAT. + * + * This record contains information about a number format. + * All FORMAT records occur together in a sequential list. + * + * In BIFF2-BIFF4 other records referencing a FORMAT record + * contain a zero-based index into this list. From BIFF5 on + * the FORMAT record contains the index itself that will be + * used by other records. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readFormat() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + $indexCode = self::getUInt2d($recordData, 0); + + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong(substr($recordData, 2)); + } else { + // BIFF7 + $string = $this->readByteStringShort(substr($recordData, 2)); + } + + $formatString = $string['value']; + $this->formats[$indexCode] = $formatString; + } + } + + /** + * XF - Extended Format. + * + * This record contains formatting information for cells, rows, columns or styles. + * According to https://support.microsoft.com/en-us/help/147732 there are always at least 15 cell style XF + * and 1 cell XF. + * Inspection of Excel files generated by MS Office Excel shows that XF records 0-14 are cell style XF + * and XF record 15 is a cell XF + * We only read the first cell style XF and skip the remaining cell style XF records + * We read all cell XF records. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readXf() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + $objStyle = new Style(); + + if (!$this->readDataOnly) { + // offset: 0; size: 2; Index to FONT record + if (self::getUInt2d($recordData, 0) < 4) { + $fontIndex = self::getUInt2d($recordData, 0); + } else { + // this has to do with that index 4 is omitted in all BIFF versions for some strange reason + // check the OpenOffice documentation of the FONT record + $fontIndex = self::getUInt2d($recordData, 0) - 1; + } + $objStyle->setFont($this->objFonts[$fontIndex]); + + // offset: 2; size: 2; Index to FORMAT record + $numberFormatIndex = self::getUInt2d($recordData, 2); + if (isset($this->formats[$numberFormatIndex])) { + // then we have user-defined format code + $numberFormat = ['formatCode' => $this->formats[$numberFormatIndex]]; + } elseif (($code = NumberFormat::builtInFormatCode($numberFormatIndex)) !== '') { + // then we have built-in format code + $numberFormat = ['formatCode' => $code]; + } else { + // we set the general format code + $numberFormat = ['formatCode' => 'General']; + } + $objStyle->getNumberFormat()->setFormatCode($numberFormat['formatCode']); + + // offset: 4; size: 2; XF type, cell protection, and parent style XF + // bit 2-0; mask 0x0007; XF_TYPE_PROT + $xfTypeProt = self::getUInt2d($recordData, 4); + // bit 0; mask 0x01; 1 = cell is locked + $isLocked = (0x01 & $xfTypeProt) >> 0; + $objStyle->getProtection()->setLocked($isLocked ? Protection::PROTECTION_INHERIT : Protection::PROTECTION_UNPROTECTED); + + // bit 1; mask 0x02; 1 = Formula is hidden + $isHidden = (0x02 & $xfTypeProt) >> 1; + $objStyle->getProtection()->setHidden($isHidden ? Protection::PROTECTION_PROTECTED : Protection::PROTECTION_UNPROTECTED); + + // bit 2; mask 0x04; 0 = Cell XF, 1 = Cell Style XF + $isCellStyleXf = (0x04 & $xfTypeProt) >> 2; + + // offset: 6; size: 1; Alignment and text break + // bit 2-0, mask 0x07; horizontal alignment + $horAlign = (0x07 & ord($recordData[6])) >> 0; + switch ($horAlign) { + case 0: + $objStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_GENERAL); + + break; + case 1: + $objStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT); + + break; + case 2: + $objStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); + + break; + case 3: + $objStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT); + + break; + case 4: + $objStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_FILL); + + break; + case 5: + $objStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_JUSTIFY); + + break; + case 6: + $objStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER_CONTINUOUS); + + break; + } + // bit 3, mask 0x08; wrap text + $wrapText = (0x08 & ord($recordData[6])) >> 3; + switch ($wrapText) { + case 0: + $objStyle->getAlignment()->setWrapText(false); + + break; + case 1: + $objStyle->getAlignment()->setWrapText(true); + + break; + } + // bit 6-4, mask 0x70; vertical alignment + $vertAlign = (0x70 & ord($recordData[6])) >> 4; + switch ($vertAlign) { + case 0: + $objStyle->getAlignment()->setVertical(Alignment::VERTICAL_TOP); + + break; + case 1: + $objStyle->getAlignment()->setVertical(Alignment::VERTICAL_CENTER); + + break; + case 2: + $objStyle->getAlignment()->setVertical(Alignment::VERTICAL_BOTTOM); + + break; + case 3: + $objStyle->getAlignment()->setVertical(Alignment::VERTICAL_JUSTIFY); + + break; + } + + if ($this->version == self::XLS_BIFF8) { + // offset: 7; size: 1; XF_ROTATION: Text rotation angle + $angle = ord($recordData[7]); + $rotation = 0; + if ($angle <= 90) { + $rotation = $angle; + } elseif ($angle <= 180) { + $rotation = 90 - $angle; + } elseif ($angle == 255) { + $rotation = -165; + } + $objStyle->getAlignment()->setTextRotation($rotation); + + // offset: 8; size: 1; Indentation, shrink to cell size, and text direction + // bit: 3-0; mask: 0x0F; indent level + $indent = (0x0F & ord($recordData[8])) >> 0; + $objStyle->getAlignment()->setIndent($indent); + + // bit: 4; mask: 0x10; 1 = shrink content to fit into cell + $shrinkToFit = (0x10 & ord($recordData[8])) >> 4; + switch ($shrinkToFit) { + case 0: + $objStyle->getAlignment()->setShrinkToFit(false); + + break; + case 1: + $objStyle->getAlignment()->setShrinkToFit(true); + + break; + } + + // offset: 9; size: 1; Flags used for attribute groups + + // offset: 10; size: 4; Cell border lines and background area + // bit: 3-0; mask: 0x0000000F; left style + if ($bordersLeftStyle = Xls\Style\Border::lookup((0x0000000F & self::getInt4d($recordData, 10)) >> 0)) { + $objStyle->getBorders()->getLeft()->setBorderStyle($bordersLeftStyle); + } + // bit: 7-4; mask: 0x000000F0; right style + if ($bordersRightStyle = Xls\Style\Border::lookup((0x000000F0 & self::getInt4d($recordData, 10)) >> 4)) { + $objStyle->getBorders()->getRight()->setBorderStyle($bordersRightStyle); + } + // bit: 11-8; mask: 0x00000F00; top style + if ($bordersTopStyle = Xls\Style\Border::lookup((0x00000F00 & self::getInt4d($recordData, 10)) >> 8)) { + $objStyle->getBorders()->getTop()->setBorderStyle($bordersTopStyle); + } + // bit: 15-12; mask: 0x0000F000; bottom style + if ($bordersBottomStyle = Xls\Style\Border::lookup((0x0000F000 & self::getInt4d($recordData, 10)) >> 12)) { + $objStyle->getBorders()->getBottom()->setBorderStyle($bordersBottomStyle); + } + // bit: 22-16; mask: 0x007F0000; left color + $objStyle->getBorders()->getLeft()->colorIndex = (0x007F0000 & self::getInt4d($recordData, 10)) >> 16; + + // bit: 29-23; mask: 0x3F800000; right color + $objStyle->getBorders()->getRight()->colorIndex = (0x3F800000 & self::getInt4d($recordData, 10)) >> 23; + + // bit: 30; mask: 0x40000000; 1 = diagonal line from top left to right bottom + $diagonalDown = (0x40000000 & self::getInt4d($recordData, 10)) >> 30 ? true : false; + + // bit: 31; mask: 0x80000000; 1 = diagonal line from bottom left to top right + $diagonalUp = (0x80000000 & self::getInt4d($recordData, 10)) >> 31 ? true : false; + + if ($diagonalUp == false && $diagonalDown == false) { + $objStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_NONE); + } elseif ($diagonalUp == true && $diagonalDown == false) { + $objStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_UP); + } elseif ($diagonalUp == false && $diagonalDown == true) { + $objStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_DOWN); + } elseif ($diagonalUp == true && $diagonalDown == true) { + $objStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_BOTH); + } + + // offset: 14; size: 4; + // bit: 6-0; mask: 0x0000007F; top color + $objStyle->getBorders()->getTop()->colorIndex = (0x0000007F & self::getInt4d($recordData, 14)) >> 0; + + // bit: 13-7; mask: 0x00003F80; bottom color + $objStyle->getBorders()->getBottom()->colorIndex = (0x00003F80 & self::getInt4d($recordData, 14)) >> 7; + + // bit: 20-14; mask: 0x001FC000; diagonal color + $objStyle->getBorders()->getDiagonal()->colorIndex = (0x001FC000 & self::getInt4d($recordData, 14)) >> 14; + + // bit: 24-21; mask: 0x01E00000; diagonal style + if ($bordersDiagonalStyle = Xls\Style\Border::lookup((0x01E00000 & self::getInt4d($recordData, 14)) >> 21)) { + $objStyle->getBorders()->getDiagonal()->setBorderStyle($bordersDiagonalStyle); + } + + // bit: 31-26; mask: 0xFC000000 fill pattern + if ($fillType = Xls\Style\FillPattern::lookup((0xFC000000 & self::getInt4d($recordData, 14)) >> 26)) { + $objStyle->getFill()->setFillType($fillType); + } + // offset: 18; size: 2; pattern and background colour + // bit: 6-0; mask: 0x007F; color index for pattern color + $objStyle->getFill()->startcolorIndex = (0x007F & self::getUInt2d($recordData, 18)) >> 0; + + // bit: 13-7; mask: 0x3F80; color index for pattern background + $objStyle->getFill()->endcolorIndex = (0x3F80 & self::getUInt2d($recordData, 18)) >> 7; + } else { + // BIFF5 + + // offset: 7; size: 1; Text orientation and flags + $orientationAndFlags = ord($recordData[7]); + + // bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation + $xfOrientation = (0x03 & $orientationAndFlags) >> 0; + switch ($xfOrientation) { + case 0: + $objStyle->getAlignment()->setTextRotation(0); + + break; + case 1: + $objStyle->getAlignment()->setTextRotation(-165); + + break; + case 2: + $objStyle->getAlignment()->setTextRotation(90); + + break; + case 3: + $objStyle->getAlignment()->setTextRotation(-90); + + break; + } + + // offset: 8; size: 4; cell border lines and background area + $borderAndBackground = self::getInt4d($recordData, 8); + + // bit: 6-0; mask: 0x0000007F; color index for pattern color + $objStyle->getFill()->startcolorIndex = (0x0000007F & $borderAndBackground) >> 0; + + // bit: 13-7; mask: 0x00003F80; color index for pattern background + $objStyle->getFill()->endcolorIndex = (0x00003F80 & $borderAndBackground) >> 7; + + // bit: 21-16; mask: 0x003F0000; fill pattern + $objStyle->getFill()->setFillType(Xls\Style\FillPattern::lookup((0x003F0000 & $borderAndBackground) >> 16)); + + // bit: 24-22; mask: 0x01C00000; bottom line style + $objStyle->getBorders()->getBottom()->setBorderStyle(Xls\Style\Border::lookup((0x01C00000 & $borderAndBackground) >> 22)); + + // bit: 31-25; mask: 0xFE000000; bottom line color + $objStyle->getBorders()->getBottom()->colorIndex = (0xFE000000 & $borderAndBackground) >> 25; + + // offset: 12; size: 4; cell border lines + $borderLines = self::getInt4d($recordData, 12); + + // bit: 2-0; mask: 0x00000007; top line style + $objStyle->getBorders()->getTop()->setBorderStyle(Xls\Style\Border::lookup((0x00000007 & $borderLines) >> 0)); + + // bit: 5-3; mask: 0x00000038; left line style + $objStyle->getBorders()->getLeft()->setBorderStyle(Xls\Style\Border::lookup((0x00000038 & $borderLines) >> 3)); + + // bit: 8-6; mask: 0x000001C0; right line style + $objStyle->getBorders()->getRight()->setBorderStyle(Xls\Style\Border::lookup((0x000001C0 & $borderLines) >> 6)); + + // bit: 15-9; mask: 0x0000FE00; top line color index + $objStyle->getBorders()->getTop()->colorIndex = (0x0000FE00 & $borderLines) >> 9; + + // bit: 22-16; mask: 0x007F0000; left line color index + $objStyle->getBorders()->getLeft()->colorIndex = (0x007F0000 & $borderLines) >> 16; + + // bit: 29-23; mask: 0x3F800000; right line color index + $objStyle->getBorders()->getRight()->colorIndex = (0x3F800000 & $borderLines) >> 23; + } + + // add cellStyleXf or cellXf and update mapping + if ($isCellStyleXf) { + // we only read one style XF record which is always the first + if ($this->xfIndex == 0) { + $this->spreadsheet->addCellStyleXf($objStyle); + $this->mapCellStyleXfIndex[$this->xfIndex] = 0; + } + } else { + // we read all cell XF records + $this->spreadsheet->addCellXf($objStyle); + $this->mapCellXfIndex[$this->xfIndex] = count($this->spreadsheet->getCellXfCollection()) - 1; + } + + // update XF index for when we read next record + ++$this->xfIndex; + } + } + + private function readXfExt() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; 0x087D = repeated header + + // offset: 2; size: 2 + + // offset: 4; size: 8; not used + + // offset: 12; size: 2; record version + + // offset: 14; size: 2; index to XF record which this record modifies + $ixfe = self::getUInt2d($recordData, 14); + + // offset: 16; size: 2; not used + + // offset: 18; size: 2; number of extension properties that follow + $cexts = self::getUInt2d($recordData, 18); + + // start reading the actual extension data + $offset = 20; + while ($offset < $length) { + // extension type + $extType = self::getUInt2d($recordData, $offset); + + // extension length + $cb = self::getUInt2d($recordData, $offset + 2); + + // extension data + $extData = substr($recordData, $offset + 4, $cb); + + switch ($extType) { + case 4: // fill start color + $xclfType = self::getUInt2d($extData, 0); // color type + $xclrValue = substr($extData, 4, 4); // color value (value based on color type) + + if ($xclfType == 2) { + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); + + // modify the relevant style property + if (isset($this->mapCellXfIndex[$ixfe])) { + $fill = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill(); + $fill->getStartColor()->setRGB($rgb); + unset($fill->startcolorIndex); // normal color index does not apply, discard + } + } + + break; + case 5: // fill end color + $xclfType = self::getUInt2d($extData, 0); // color type + $xclrValue = substr($extData, 4, 4); // color value (value based on color type) + + if ($xclfType == 2) { + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); + + // modify the relevant style property + if (isset($this->mapCellXfIndex[$ixfe])) { + $fill = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFill(); + $fill->getEndColor()->setRGB($rgb); + unset($fill->endcolorIndex); // normal color index does not apply, discard + } + } + + break; + case 7: // border color top + $xclfType = self::getUInt2d($extData, 0); // color type + $xclrValue = substr($extData, 4, 4); // color value (value based on color type) + + if ($xclfType == 2) { + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); + + // modify the relevant style property + if (isset($this->mapCellXfIndex[$ixfe])) { + $top = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getTop(); + $top->getColor()->setRGB($rgb); + unset($top->colorIndex); // normal color index does not apply, discard + } + } + + break; + case 8: // border color bottom + $xclfType = self::getUInt2d($extData, 0); // color type + $xclrValue = substr($extData, 4, 4); // color value (value based on color type) + + if ($xclfType == 2) { + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); + + // modify the relevant style property + if (isset($this->mapCellXfIndex[$ixfe])) { + $bottom = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getBottom(); + $bottom->getColor()->setRGB($rgb); + unset($bottom->colorIndex); // normal color index does not apply, discard + } + } + + break; + case 9: // border color left + $xclfType = self::getUInt2d($extData, 0); // color type + $xclrValue = substr($extData, 4, 4); // color value (value based on color type) + + if ($xclfType == 2) { + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); + + // modify the relevant style property + if (isset($this->mapCellXfIndex[$ixfe])) { + $left = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getLeft(); + $left->getColor()->setRGB($rgb); + unset($left->colorIndex); // normal color index does not apply, discard + } + } + + break; + case 10: // border color right + $xclfType = self::getUInt2d($extData, 0); // color type + $xclrValue = substr($extData, 4, 4); // color value (value based on color type) + + if ($xclfType == 2) { + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); + + // modify the relevant style property + if (isset($this->mapCellXfIndex[$ixfe])) { + $right = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getRight(); + $right->getColor()->setRGB($rgb); + unset($right->colorIndex); // normal color index does not apply, discard + } + } + + break; + case 11: // border color diagonal + $xclfType = self::getUInt2d($extData, 0); // color type + $xclrValue = substr($extData, 4, 4); // color value (value based on color type) + + if ($xclfType == 2) { + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); + + // modify the relevant style property + if (isset($this->mapCellXfIndex[$ixfe])) { + $diagonal = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getBorders()->getDiagonal(); + $diagonal->getColor()->setRGB($rgb); + unset($diagonal->colorIndex); // normal color index does not apply, discard + } + } + + break; + case 13: // font color + $xclfType = self::getUInt2d($extData, 0); // color type + $xclrValue = substr($extData, 4, 4); // color value (value based on color type) + + if ($xclfType == 2) { + $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); + + // modify the relevant style property + if (isset($this->mapCellXfIndex[$ixfe])) { + $font = $this->spreadsheet->getCellXfByIndex($this->mapCellXfIndex[$ixfe])->getFont(); + $font->getColor()->setRGB($rgb); + unset($font->colorIndex); // normal color index does not apply, discard + } + } + + break; + } + + $offset += $cb; + } + } + } + + /** + * Read STYLE record. + */ + private function readStyle() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; index to XF record and flag for built-in style + $ixfe = self::getUInt2d($recordData, 0); + + // bit: 11-0; mask 0x0FFF; index to XF record + $xfIndex = (0x0FFF & $ixfe) >> 0; + + // bit: 15; mask 0x8000; 0 = user-defined style, 1 = built-in style + $isBuiltIn = (bool) ((0x8000 & $ixfe) >> 15); + + if ($isBuiltIn) { + // offset: 2; size: 1; identifier for built-in style + $builtInId = ord($recordData[2]); + + switch ($builtInId) { + case 0x00: + // currently, we are not using this for anything + break; + default: + break; + } + } + // user-defined; not supported by PhpSpreadsheet + } + } + + /** + * Read PALETTE record. + */ + private function readPalette() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; number of following colors + $nm = self::getUInt2d($recordData, 0); + + // list of RGB colors + for ($i = 0; $i < $nm; ++$i) { + $rgb = substr($recordData, 2 + 4 * $i, 4); + $this->palette[] = self::readRGB($rgb); + } + } + } + + /** + * SHEET. + * + * This record is located in the Workbook Globals + * Substream and represents a sheet inside the workbook. + * One SHEET record is written for each sheet. It stores the + * sheet name and a stream offset to the BOF record of the + * respective Sheet Substream within the Workbook Stream. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readSheet() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // offset: 0; size: 4; absolute stream position of the BOF record of the sheet + // NOTE: not encrypted + $rec_offset = self::getInt4d($this->data, $this->pos + 4); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 4; size: 1; sheet state + switch (ord($recordData[4])) { + case 0x00: + $sheetState = Worksheet::SHEETSTATE_VISIBLE; + + break; + case 0x01: + $sheetState = Worksheet::SHEETSTATE_HIDDEN; + + break; + case 0x02: + $sheetState = Worksheet::SHEETSTATE_VERYHIDDEN; + + break; + default: + $sheetState = Worksheet::SHEETSTATE_VISIBLE; + + break; + } + + // offset: 5; size: 1; sheet type + $sheetType = ord($recordData[5]); + + // offset: 6; size: var; sheet name + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringShort(substr($recordData, 6)); + $rec_name = $string['value']; + } elseif ($this->version == self::XLS_BIFF7) { + $string = $this->readByteStringShort(substr($recordData, 6)); + $rec_name = $string['value']; + } + + $this->sheets[] = [ + 'name' => $rec_name, + 'offset' => $rec_offset, + 'sheetState' => $sheetState, + 'sheetType' => $sheetType, + ]; + } + + /** + * Read EXTERNALBOOK record. + */ + private function readExternalBook() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset within record data + $offset = 0; + + // there are 4 types of records + if (strlen($recordData) > 4) { + // external reference + // offset: 0; size: 2; number of sheet names ($nm) + $nm = self::getUInt2d($recordData, 0); + $offset += 2; + + // offset: 2; size: var; encoded URL without sheet name (Unicode string, 16-bit length) + $encodedUrlString = self::readUnicodeStringLong(substr($recordData, 2)); + $offset += $encodedUrlString['size']; + + // offset: var; size: var; list of $nm sheet names (Unicode strings, 16-bit length) + $externalSheetNames = []; + for ($i = 0; $i < $nm; ++$i) { + $externalSheetNameString = self::readUnicodeStringLong(substr($recordData, $offset)); + $externalSheetNames[] = $externalSheetNameString['value']; + $offset += $externalSheetNameString['size']; + } + + // store the record data + $this->externalBooks[] = [ + 'type' => 'external', + 'encodedUrl' => $encodedUrlString['value'], + 'externalSheetNames' => $externalSheetNames, + ]; + } elseif (substr($recordData, 2, 2) == pack('CC', 0x01, 0x04)) { + // internal reference + // offset: 0; size: 2; number of sheet in this document + // offset: 2; size: 2; 0x01 0x04 + $this->externalBooks[] = [ + 'type' => 'internal', + ]; + } elseif (substr($recordData, 0, 4) == pack('vCC', 0x0001, 0x01, 0x3A)) { + // add-in function + // offset: 0; size: 2; 0x0001 + $this->externalBooks[] = [ + 'type' => 'addInFunction', + ]; + } elseif (substr($recordData, 0, 2) == pack('v', 0x0000)) { + // DDE links, OLE links + // offset: 0; size: 2; 0x0000 + // offset: 2; size: var; encoded source document name + $this->externalBooks[] = [ + 'type' => 'DDEorOLE', + ]; + } + } + + /** + * Read EXTERNNAME record. + */ + private function readExternName() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // external sheet references provided for named cells + if ($this->version == self::XLS_BIFF8) { + // offset: 0; size: 2; options + $options = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; + + // offset: 4; size: 2; not used + + // offset: 6; size: var + $nameString = self::readUnicodeStringShort(substr($recordData, 6)); + + // offset: var; size: var; formula data + $offset = 6 + $nameString['size']; + $formula = $this->getFormulaFromStructure(substr($recordData, $offset)); + + $this->externalNames[] = [ + 'name' => $nameString['value'], + 'formula' => $formula, + ]; + } + } + + /** + * Read EXTERNSHEET record. + */ + private function readExternSheet() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // external sheet references provided for named cells + if ($this->version == self::XLS_BIFF8) { + // offset: 0; size: 2; number of following ref structures + $nm = self::getUInt2d($recordData, 0); + for ($i = 0; $i < $nm; ++$i) { + $this->ref[] = [ + // offset: 2 + 6 * $i; index to EXTERNALBOOK record + 'externalBookIndex' => self::getUInt2d($recordData, 2 + 6 * $i), + // offset: 4 + 6 * $i; index to first sheet in EXTERNALBOOK record + 'firstSheetIndex' => self::getUInt2d($recordData, 4 + 6 * $i), + // offset: 6 + 6 * $i; index to last sheet in EXTERNALBOOK record + 'lastSheetIndex' => self::getUInt2d($recordData, 6 + 6 * $i), + ]; + } + } + } + + /** + * DEFINEDNAME. + * + * This record is part of a Link Table. It contains the name + * and the token array of an internal defined name. Token + * arrays of defined names contain tokens with aberrant + * token classes. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readDefinedName() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->version == self::XLS_BIFF8) { + // retrieves named cells + + // offset: 0; size: 2; option flags + $opts = self::getUInt2d($recordData, 0); + + // bit: 5; mask: 0x0020; 0 = user-defined name, 1 = built-in-name + $isBuiltInName = (0x0020 & $opts) >> 5; + + // offset: 2; size: 1; keyboard shortcut + + // offset: 3; size: 1; length of the name (character count) + $nlen = ord($recordData[3]); + + // offset: 4; size: 2; size of the formula data (it can happen that this is zero) + // note: there can also be additional data, this is not included in $flen + $flen = self::getUInt2d($recordData, 4); + + // offset: 8; size: 2; 0=Global name, otherwise index to sheet (1-based) + $scope = self::getUInt2d($recordData, 8); + + // offset: 14; size: var; Name (Unicode string without length field) + $string = self::readUnicodeString(substr($recordData, 14), $nlen); + + // offset: var; size: $flen; formula data + $offset = 14 + $string['size']; + $formulaStructure = pack('v', $flen) . substr($recordData, $offset); + + try { + $formula = $this->getFormulaFromStructure($formulaStructure); + } catch (PhpSpreadsheetException $e) { + $formula = ''; + } + + $this->definedname[] = [ + 'isBuiltInName' => $isBuiltInName, + 'name' => $string['value'], + 'formula' => $formula, + 'scope' => $scope, + ]; + } + } + + /** + * Read MSODRAWINGGROUP record. + */ + private function readMsoDrawingGroup() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + + // get spliced record data + $splicedRecordData = $this->getSplicedRecordData(); + $recordData = $splicedRecordData['recordData']; + + $this->drawingGroupData .= $recordData; + } + + /** + * SST - Shared String Table. + * + * This record contains a list of all strings used anywhere + * in the workbook. Each string occurs only once. The + * workbook uses indexes into the list to reference the + * strings. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readSst() + { + // offset within (spliced) record data + $pos = 0; + + // get spliced record data + $splicedRecordData = $this->getSplicedRecordData(); + + $recordData = $splicedRecordData['recordData']; + $spliceOffsets = $splicedRecordData['spliceOffsets']; + + // offset: 0; size: 4; total number of strings in the workbook + $pos += 4; + + // offset: 4; size: 4; number of following strings ($nm) + $nm = self::getInt4d($recordData, 4); + $pos += 4; + + // loop through the Unicode strings (16-bit length) + for ($i = 0; $i < $nm; ++$i) { + // number of characters in the Unicode string + $numChars = self::getUInt2d($recordData, $pos); + $pos += 2; + + // option flags + $optionFlags = ord($recordData[$pos]); + ++$pos; + + // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed + $isCompressed = (($optionFlags & 0x01) == 0); + + // bit: 2; mask: 0x02; 0 = ordinary; 1 = Asian phonetic + $hasAsian = (($optionFlags & 0x04) != 0); + + // bit: 3; mask: 0x03; 0 = ordinary; 1 = Rich-Text + $hasRichText = (($optionFlags & 0x08) != 0); + + if ($hasRichText) { + // number of Rich-Text formatting runs + $formattingRuns = self::getUInt2d($recordData, $pos); + $pos += 2; + } + + if ($hasAsian) { + // size of Asian phonetic setting + $extendedRunLength = self::getInt4d($recordData, $pos); + $pos += 4; + } + + // expected byte length of character array if not split + $len = ($isCompressed) ? $numChars : $numChars * 2; + + // look up limit position + foreach ($spliceOffsets as $spliceOffset) { + // it can happen that the string is empty, therefore we need + // <= and not just < + if ($pos <= $spliceOffset) { + $limitpos = $spliceOffset; + + break; + } + } + + if ($pos + $len <= $limitpos) { + // character array is not split between records + + $retstr = substr($recordData, $pos, $len); + $pos += $len; + } else { + // character array is split between records + + // first part of character array + $retstr = substr($recordData, $pos, $limitpos - $pos); + + $bytesRead = $limitpos - $pos; + + // remaining characters in Unicode string + $charsLeft = $numChars - (($isCompressed) ? $bytesRead : ($bytesRead / 2)); + + $pos = $limitpos; + + // keep reading the characters + while ($charsLeft > 0) { + // look up next limit position, in case the string span more than one continue record + foreach ($spliceOffsets as $spliceOffset) { + if ($pos < $spliceOffset) { + $limitpos = $spliceOffset; + + break; + } + } + + // repeated option flags + // OpenOffice.org documentation 5.21 + $option = ord($recordData[$pos]); + ++$pos; + + if ($isCompressed && ($option == 0)) { + // 1st fragment compressed + // this fragment compressed + $len = min($charsLeft, $limitpos - $pos); + $retstr .= substr($recordData, $pos, $len); + $charsLeft -= $len; + $isCompressed = true; + } elseif (!$isCompressed && ($option != 0)) { + // 1st fragment uncompressed + // this fragment uncompressed + $len = min($charsLeft * 2, $limitpos - $pos); + $retstr .= substr($recordData, $pos, $len); + $charsLeft -= $len / 2; + $isCompressed = false; + } elseif (!$isCompressed && ($option == 0)) { + // 1st fragment uncompressed + // this fragment compressed + $len = min($charsLeft, $limitpos - $pos); + for ($j = 0; $j < $len; ++$j) { + $retstr .= $recordData[$pos + $j] + . chr(0); + } + $charsLeft -= $len; + $isCompressed = false; + } else { + // 1st fragment compressed + // this fragment uncompressed + $newstr = ''; + $jMax = strlen($retstr); + for ($j = 0; $j < $jMax; ++$j) { + $newstr .= $retstr[$j] . chr(0); + } + $retstr = $newstr; + $len = min($charsLeft * 2, $limitpos - $pos); + $retstr .= substr($recordData, $pos, $len); + $charsLeft -= $len / 2; + $isCompressed = false; + } + + $pos += $len; + } + } + + // convert to UTF-8 + $retstr = self::encodeUTF16($retstr, $isCompressed); + + // read additional Rich-Text information, if any + $fmtRuns = []; + if ($hasRichText) { + // list of formatting runs + for ($j = 0; $j < $formattingRuns; ++$j) { + // first formatted character; zero-based + $charPos = self::getUInt2d($recordData, $pos + $j * 4); + + // index to font record + $fontIndex = self::getUInt2d($recordData, $pos + 2 + $j * 4); + + $fmtRuns[] = [ + 'charPos' => $charPos, + 'fontIndex' => $fontIndex, + ]; + } + $pos += 4 * $formattingRuns; + } + + // read additional Asian phonetics information, if any + if ($hasAsian) { + // For Asian phonetic settings, we skip the extended string data + $pos += $extendedRunLength; + } + + // store the shared sting + $this->sst[] = [ + 'value' => $retstr, + 'fmtRuns' => $fmtRuns, + ]; + } + + // getSplicedRecordData() takes care of moving current position in data stream + } + + /** + * Read PRINTGRIDLINES record. + */ + private function readPrintGridlines() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) { + // offset: 0; size: 2; 0 = do not print sheet grid lines; 1 = print sheet gridlines + $printGridlines = (bool) self::getUInt2d($recordData, 0); + $this->phpSheet->setPrintGridlines($printGridlines); + } + } + + /** + * Read DEFAULTROWHEIGHT record. + */ + private function readDefaultRowHeight() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; option flags + // offset: 2; size: 2; default height for unused rows, (twips 1/20 point) + $height = self::getUInt2d($recordData, 2); + $this->phpSheet->getDefaultRowDimension()->setRowHeight($height / 20); + } + + /** + * Read SHEETPR record. + */ + private function readSheetPr() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2 + + // bit: 6; mask: 0x0040; 0 = outline buttons above outline group + $isSummaryBelow = (0x0040 & self::getUInt2d($recordData, 0)) >> 6; + $this->phpSheet->setShowSummaryBelow($isSummaryBelow); + + // bit: 7; mask: 0x0080; 0 = outline buttons left of outline group + $isSummaryRight = (0x0080 & self::getUInt2d($recordData, 0)) >> 7; + $this->phpSheet->setShowSummaryRight($isSummaryRight); + + // bit: 8; mask: 0x100; 0 = scale printout in percent, 1 = fit printout to number of pages + // this corresponds to radio button setting in page setup dialog in Excel + $this->isFitToPages = (bool) ((0x0100 & self::getUInt2d($recordData, 0)) >> 8); + } + + /** + * Read HORIZONTALPAGEBREAKS record. + */ + private function readHorizontalPageBreaks() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) { + // offset: 0; size: 2; number of the following row index structures + $nm = self::getUInt2d($recordData, 0); + + // offset: 2; size: 6 * $nm; list of $nm row index structures + for ($i = 0; $i < $nm; ++$i) { + $r = self::getUInt2d($recordData, 2 + 6 * $i); + $cf = self::getUInt2d($recordData, 2 + 6 * $i + 2); + $cl = self::getUInt2d($recordData, 2 + 6 * $i + 4); + + // not sure why two column indexes are necessary? + $this->phpSheet->setBreakByColumnAndRow($cf + 1, $r, Worksheet::BREAK_ROW); + } + } + } + + /** + * Read VERTICALPAGEBREAKS record. + */ + private function readVerticalPageBreaks() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) { + // offset: 0; size: 2; number of the following column index structures + $nm = self::getUInt2d($recordData, 0); + + // offset: 2; size: 6 * $nm; list of $nm row index structures + for ($i = 0; $i < $nm; ++$i) { + $c = self::getUInt2d($recordData, 2 + 6 * $i); + $rf = self::getUInt2d($recordData, 2 + 6 * $i + 2); + $rl = self::getUInt2d($recordData, 2 + 6 * $i + 4); + + // not sure why two row indexes are necessary? + $this->phpSheet->setBreakByColumnAndRow($c + 1, $rf, Worksheet::BREAK_COLUMN); + } + } + } + + /** + * Read HEADER record. + */ + private function readHeader() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: var + // realized that $recordData can be empty even when record exists + if ($recordData) { + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong($recordData); + } else { + $string = $this->readByteStringShort($recordData); + } + + $this->phpSheet->getHeaderFooter()->setOddHeader($string['value']); + $this->phpSheet->getHeaderFooter()->setEvenHeader($string['value']); + } + } + } + + /** + * Read FOOTER record. + */ + private function readFooter() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: var + // realized that $recordData can be empty even when record exists + if ($recordData) { + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong($recordData); + } else { + $string = $this->readByteStringShort($recordData); + } + $this->phpSheet->getHeaderFooter()->setOddFooter($string['value']); + $this->phpSheet->getHeaderFooter()->setEvenFooter($string['value']); + } + } + } + + /** + * Read HCENTER record. + */ + private function readHcenter() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally + $isHorizontalCentered = (bool) self::getUInt2d($recordData, 0); + + $this->phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered); + } + } + + /** + * Read VCENTER record. + */ + private function readVcenter() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; 0 = print sheet aligned at top page border, 1 = print sheet vertically centered + $isVerticalCentered = (bool) self::getUInt2d($recordData, 0); + + $this->phpSheet->getPageSetup()->setVerticalCentered($isVerticalCentered); + } + } + + /** + * Read LEFTMARGIN record. + */ + private function readLeftMargin() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 8 + $this->phpSheet->getPageMargins()->setLeft(self::extractNumber($recordData)); + } + } + + /** + * Read RIGHTMARGIN record. + */ + private function readRightMargin() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 8 + $this->phpSheet->getPageMargins()->setRight(self::extractNumber($recordData)); + } + } + + /** + * Read TOPMARGIN record. + */ + private function readTopMargin() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 8 + $this->phpSheet->getPageMargins()->setTop(self::extractNumber($recordData)); + } + } + + /** + * Read BOTTOMMARGIN record. + */ + private function readBottomMargin() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 8 + $this->phpSheet->getPageMargins()->setBottom(self::extractNumber($recordData)); + } + } + + /** + * Read PAGESETUP record. + */ + private function readPageSetup() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; paper size + $paperSize = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; scaling factor + $scale = self::getUInt2d($recordData, 2); + + // offset: 6; size: 2; fit worksheet width to this number of pages, 0 = use as many as needed + $fitToWidth = self::getUInt2d($recordData, 6); + + // offset: 8; size: 2; fit worksheet height to this number of pages, 0 = use as many as needed + $fitToHeight = self::getUInt2d($recordData, 8); + + // offset: 10; size: 2; option flags + + // bit: 1; mask: 0x0002; 0=landscape, 1=portrait + $isPortrait = (0x0002 & self::getUInt2d($recordData, 10)) >> 1; + + // bit: 2; mask: 0x0004; 1= paper size, scaling factor, paper orient. not init + // when this bit is set, do not use flags for those properties + $isNotInit = (0x0004 & self::getUInt2d($recordData, 10)) >> 2; + + if (!$isNotInit) { + $this->phpSheet->getPageSetup()->setPaperSize($paperSize); + switch ($isPortrait) { + case 0: + $this->phpSheet->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); + + break; + case 1: + $this->phpSheet->getPageSetup()->setOrientation(PageSetup::ORIENTATION_PORTRAIT); + + break; + } + + $this->phpSheet->getPageSetup()->setScale($scale, false); + $this->phpSheet->getPageSetup()->setFitToPage((bool) $this->isFitToPages); + $this->phpSheet->getPageSetup()->setFitToWidth($fitToWidth, false); + $this->phpSheet->getPageSetup()->setFitToHeight($fitToHeight, false); + } + + // offset: 16; size: 8; header margin (IEEE 754 floating-point value) + $marginHeader = self::extractNumber(substr($recordData, 16, 8)); + $this->phpSheet->getPageMargins()->setHeader($marginHeader); + + // offset: 24; size: 8; footer margin (IEEE 754 floating-point value) + $marginFooter = self::extractNumber(substr($recordData, 24, 8)); + $this->phpSheet->getPageMargins()->setFooter($marginFooter); + } + } + + /** + * PROTECT - Sheet protection (BIFF2 through BIFF8) + * if this record is omitted, then it also means no sheet protection. + */ + private function readProtect() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return; + } + + // offset: 0; size: 2; + + // bit 0, mask 0x01; 1 = sheet is protected + $bool = (0x01 & self::getUInt2d($recordData, 0)) >> 0; + $this->phpSheet->getProtection()->setSheet((bool) $bool); + } + + /** + * SCENPROTECT. + */ + private function readScenProtect() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return; + } + + // offset: 0; size: 2; + + // bit: 0, mask 0x01; 1 = scenarios are protected + $bool = (0x01 & self::getUInt2d($recordData, 0)) >> 0; + + $this->phpSheet->getProtection()->setScenarios((bool) $bool); + } + + /** + * OBJECTPROTECT. + */ + private function readObjectProtect() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return; + } + + // offset: 0; size: 2; + + // bit: 0, mask 0x01; 1 = objects are protected + $bool = (0x01 & self::getUInt2d($recordData, 0)) >> 0; + + $this->phpSheet->getProtection()->setObjects((bool) $bool); + } + + /** + * PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8). + */ + private function readPassword() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; 16-bit hash value of password + $password = strtoupper(dechex(self::getUInt2d($recordData, 0))); // the hashed password + $this->phpSheet->getProtection()->setPassword($password, true); + } + } + + /** + * Read DEFCOLWIDTH record. + */ + private function readDefColWidth() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; default column width + $width = self::getUInt2d($recordData, 0); + if ($width != 8) { + $this->phpSheet->getDefaultColumnDimension()->setWidth($width); + } + } + + /** + * Read COLINFO record. + */ + private function readColInfo() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; index to first column in range + $firstColumnIndex = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; index to last column in range + $lastColumnIndex = self::getUInt2d($recordData, 2); + + // offset: 4; size: 2; width of the column in 1/256 of the width of the zero character + $width = self::getUInt2d($recordData, 4); + + // offset: 6; size: 2; index to XF record for default column formatting + $xfIndex = self::getUInt2d($recordData, 6); + + // offset: 8; size: 2; option flags + // bit: 0; mask: 0x0001; 1= columns are hidden + $isHidden = (0x0001 & self::getUInt2d($recordData, 8)) >> 0; + + // bit: 10-8; mask: 0x0700; outline level of the columns (0 = no outline) + $level = (0x0700 & self::getUInt2d($recordData, 8)) >> 8; + + // bit: 12; mask: 0x1000; 1 = collapsed + $isCollapsed = (0x1000 & self::getUInt2d($recordData, 8)) >> 12; + + // offset: 10; size: 2; not used + + for ($i = $firstColumnIndex + 1; $i <= $lastColumnIndex + 1; ++$i) { + if ($lastColumnIndex == 255 || $lastColumnIndex == 256) { + $this->phpSheet->getDefaultColumnDimension()->setWidth($width / 256); + + break; + } + $this->phpSheet->getColumnDimensionByColumn($i)->setWidth($width / 256); + $this->phpSheet->getColumnDimensionByColumn($i)->setVisible(!$isHidden); + $this->phpSheet->getColumnDimensionByColumn($i)->setOutlineLevel($level); + $this->phpSheet->getColumnDimensionByColumn($i)->setCollapsed($isCollapsed); + $this->phpSheet->getColumnDimensionByColumn($i)->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + } + } + + /** + * ROW. + * + * This record contains the properties of a single row in a + * sheet. Rows and cells in a sheet are divided into blocks + * of 32 rows. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readRow() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; index of this row + $r = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; index to column of the first cell which is described by a cell record + + // offset: 4; size: 2; index to column of the last cell which is described by a cell record, increased by 1 + + // offset: 6; size: 2; + + // bit: 14-0; mask: 0x7FFF; height of the row, in twips = 1/20 of a point + $height = (0x7FFF & self::getUInt2d($recordData, 6)) >> 0; + + // bit: 15: mask: 0x8000; 0 = row has custom height; 1= row has default height + $useDefaultHeight = (0x8000 & self::getUInt2d($recordData, 6)) >> 15; + + if (!$useDefaultHeight) { + $this->phpSheet->getRowDimension($r + 1)->setRowHeight($height / 20); + } + + // offset: 8; size: 2; not used + + // offset: 10; size: 2; not used in BIFF5-BIFF8 + + // offset: 12; size: 4; option flags and default row formatting + + // bit: 2-0: mask: 0x00000007; outline level of the row + $level = (0x00000007 & self::getInt4d($recordData, 12)) >> 0; + $this->phpSheet->getRowDimension($r + 1)->setOutlineLevel($level); + + // bit: 4; mask: 0x00000010; 1 = outline group start or ends here... and is collapsed + $isCollapsed = (0x00000010 & self::getInt4d($recordData, 12)) >> 4; + $this->phpSheet->getRowDimension($r + 1)->setCollapsed($isCollapsed); + + // bit: 5; mask: 0x00000020; 1 = row is hidden + $isHidden = (0x00000020 & self::getInt4d($recordData, 12)) >> 5; + $this->phpSheet->getRowDimension($r + 1)->setVisible(!$isHidden); + + // bit: 7; mask: 0x00000080; 1 = row has explicit format + $hasExplicitFormat = (0x00000080 & self::getInt4d($recordData, 12)) >> 7; + + // bit: 27-16; mask: 0x0FFF0000; only applies when hasExplicitFormat = 1; index to XF record + $xfIndex = (0x0FFF0000 & self::getInt4d($recordData, 12)) >> 16; + + if ($hasExplicitFormat && isset($this->mapCellXfIndex[$xfIndex])) { + $this->phpSheet->getRowDimension($r + 1)->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + } + } + + /** + * Read RK record + * This record represents a cell that contains an RK value + * (encoded integer or floating-point value). If a + * floating-point value cannot be encoded to an RK value, + * a NUMBER record will be written. This record replaces the + * record INTEGER written in BIFF2. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readRk() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; index to column + $column = self::getUInt2d($recordData, 2); + $columnString = Coordinate::stringFromColumnIndex($column + 1); + + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + // offset: 4; size: 2; index to XF record + $xfIndex = self::getUInt2d($recordData, 4); + + // offset: 6; size: 4; RK value + $rknum = self::getInt4d($recordData, 6); + $numValue = self::getIEEE754($rknum); + + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + if (!$this->readDataOnly) { + // add style information + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + + // add cell + $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC); + } + } + + /** + * Read LABELSST record + * This record represents a cell that contains a string. It + * replaces the LABEL record and RSTRING record used in + * BIFF2-BIFF5. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readLabelSst() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; index to column + $column = self::getUInt2d($recordData, 2); + $columnString = Coordinate::stringFromColumnIndex($column + 1); + + $emptyCell = true; + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + // offset: 4; size: 2; index to XF record + $xfIndex = self::getUInt2d($recordData, 4); + + // offset: 6; size: 4; index to SST record + $index = self::getInt4d($recordData, 6); + + // add cell + if (($fmtRuns = $this->sst[$index]['fmtRuns']) && !$this->readDataOnly) { + // then we should treat as rich text + $richText = new RichText(); + $charPos = 0; + $sstCount = count($this->sst[$index]['fmtRuns']); + for ($i = 0; $i <= $sstCount; ++$i) { + if (isset($fmtRuns[$i])) { + $text = StringHelper::substring($this->sst[$index]['value'], $charPos, $fmtRuns[$i]['charPos'] - $charPos); + $charPos = $fmtRuns[$i]['charPos']; + } else { + $text = StringHelper::substring($this->sst[$index]['value'], $charPos, StringHelper::countCharacters($this->sst[$index]['value'])); + } + + if (StringHelper::countCharacters($text) > 0) { + if ($i == 0) { // first text run, no style + $richText->createText($text); + } else { + $textRun = $richText->createTextRun($text); + if (isset($fmtRuns[$i - 1])) { + if ($fmtRuns[$i - 1]['fontIndex'] < 4) { + $fontIndex = $fmtRuns[$i - 1]['fontIndex']; + } else { + // this has to do with that index 4 is omitted in all BIFF versions for some strange reason + // check the OpenOffice documentation of the FONT record + $fontIndex = $fmtRuns[$i - 1]['fontIndex'] - 1; + } + $textRun->setFont(clone $this->objFonts[$fontIndex]); + } + } + } + } + if ($this->readEmptyCells || trim($richText->getPlainText()) !== '') { + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + $cell->setValueExplicit($richText, DataType::TYPE_STRING); + $emptyCell = false; + } + } else { + if ($this->readEmptyCells || trim($this->sst[$index]['value']) !== '') { + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + $cell->setValueExplicit($this->sst[$index]['value'], DataType::TYPE_STRING); + $emptyCell = false; + } + } + + if (!$this->readDataOnly && !$emptyCell && isset($this->mapCellXfIndex[$xfIndex])) { + // add style information + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + } + } + + /** + * Read MULRK record + * This record represents a cell range containing RK value + * cells. All cells are located in the same row. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readMulRk() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; index to first column + $colFirst = self::getUInt2d($recordData, 2); + + // offset: var; size: 2; index to last column + $colLast = self::getUInt2d($recordData, $length - 2); + $columns = $colLast - $colFirst + 1; + + // offset within record data + $offset = 4; + + for ($i = 1; $i <= $columns; ++$i) { + $columnString = Coordinate::stringFromColumnIndex($colFirst + $i); + + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + // offset: var; size: 2; index to XF record + $xfIndex = self::getUInt2d($recordData, $offset); + + // offset: var; size: 4; RK value + $numValue = self::getIEEE754(self::getInt4d($recordData, $offset + 2)); + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + if (!$this->readDataOnly) { + // add style + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + + // add cell value + $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC); + } + + $offset += 6; + } + } + + /** + * Read NUMBER record + * This record represents a cell that contains a + * floating-point value. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readNumber() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size 2; index to column + $column = self::getUInt2d($recordData, 2); + $columnString = Coordinate::stringFromColumnIndex($column + 1); + + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + // offset 4; size: 2; index to XF record + $xfIndex = self::getUInt2d($recordData, 4); + + $numValue = self::extractNumber(substr($recordData, 6, 8)); + + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + if (!$this->readDataOnly) { + // add cell style + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + + // add cell value + $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC); + } + } + + /** + * Read FORMULA record + perhaps a following STRING record if formula result is a string + * This record contains the token array and the result of a + * formula cell. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readFormula() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; row index + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; col index + $column = self::getUInt2d($recordData, 2); + $columnString = Coordinate::stringFromColumnIndex($column + 1); + + // offset: 20: size: variable; formula structure + $formulaStructure = substr($recordData, 20); + + // offset: 14: size: 2; option flags, recalculate always, recalculate on open etc. + $options = self::getUInt2d($recordData, 14); + + // bit: 0; mask: 0x0001; 1 = recalculate always + // bit: 1; mask: 0x0002; 1 = calculate on open + // bit: 2; mask: 0x0008; 1 = part of a shared formula + $isPartOfSharedFormula = (bool) (0x0008 & $options); + + // WARNING: + // We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true + // the formula data may be ordinary formula data, therefore we need to check + // explicitly for the tExp token (0x01) + $isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure[2]) == 0x01; + + if ($isPartOfSharedFormula) { + // part of shared formula which means there will be a formula with a tExp token and nothing else + // get the base cell, grab tExp token + $baseRow = self::getUInt2d($formulaStructure, 3); + $baseCol = self::getUInt2d($formulaStructure, 5); + $this->baseCell = Coordinate::stringFromColumnIndex($baseCol + 1) . ($baseRow + 1); + } + + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + if ($isPartOfSharedFormula) { + // formula is added to this cell after the sheet has been read + $this->sharedFormulaParts[$columnString . ($row + 1)] = $this->baseCell; + } + + // offset: 16: size: 4; not used + + // offset: 4; size: 2; XF index + $xfIndex = self::getUInt2d($recordData, 4); + + // offset: 6; size: 8; result of the formula + if ((ord($recordData[6]) == 0) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) { + // String formula. Result follows in appended STRING record + $dataType = DataType::TYPE_STRING; + + // read possible SHAREDFMLA record + $code = self::getUInt2d($this->data, $this->pos); + if ($code == self::XLS_TYPE_SHAREDFMLA) { + $this->readSharedFmla(); + } + + // read STRING record + $value = $this->readString(); + } elseif ((ord($recordData[6]) == 1) + && (ord($recordData[12]) == 255) + && (ord($recordData[13]) == 255)) { + // Boolean formula. Result is in +2; 0=false, 1=true + $dataType = DataType::TYPE_BOOL; + $value = (bool) ord($recordData[8]); + } elseif ((ord($recordData[6]) == 2) + && (ord($recordData[12]) == 255) + && (ord($recordData[13]) == 255)) { + // Error formula. Error code is in +2 + $dataType = DataType::TYPE_ERROR; + $value = Xls\ErrorCode::lookup(ord($recordData[8])); + } elseif ((ord($recordData[6]) == 3) + && (ord($recordData[12]) == 255) + && (ord($recordData[13]) == 255)) { + // Formula result is a null string + $dataType = DataType::TYPE_NULL; + $value = ''; + } else { + // forumla result is a number, first 14 bytes like _NUMBER record + $dataType = DataType::TYPE_NUMERIC; + $value = self::extractNumber(substr($recordData, 6, 8)); + } + + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + if (!$this->readDataOnly) { + // add cell style + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + + // store the formula + if (!$isPartOfSharedFormula) { + // not part of shared formula + // add cell value. If we can read formula, populate with formula, otherwise just used cached value + try { + if ($this->version != self::XLS_BIFF8) { + throw new Exception('Not BIFF8. Can only read BIFF8 formulas'); + } + $formula = $this->getFormulaFromStructure($formulaStructure); // get formula in human language + $cell->setValueExplicit('=' . $formula, DataType::TYPE_FORMULA); + } catch (PhpSpreadsheetException $e) { + $cell->setValueExplicit($value, $dataType); + } + } else { + if ($this->version == self::XLS_BIFF8) { + // do nothing at this point, formula id added later in the code + } else { + $cell->setValueExplicit($value, $dataType); + } + } + + // store the cached calculated value + $cell->setCalculatedValue($value); + } + } + + /** + * Read a SHAREDFMLA record. This function just stores the binary shared formula in the reader, + * which usually contains relative references. + * These will be used to construct the formula in each shared formula part after the sheet is read. + */ + private function readSharedFmla() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0, size: 6; cell range address of the area used by the shared formula, not used for anything + $cellRange = substr($recordData, 0, 6); + $cellRange = $this->readBIFF5CellRangeAddressFixed($cellRange); // note: even BIFF8 uses BIFF5 syntax + + // offset: 6, size: 1; not used + + // offset: 7, size: 1; number of existing FORMULA records for this shared formula + $no = ord($recordData[7]); + + // offset: 8, size: var; Binary token array of the shared formula + $formula = substr($recordData, 8); + + // at this point we only store the shared formula for later use + $this->sharedFormulas[$this->baseCell] = $formula; + } + + /** + * Read a STRING record from current stream position and advance the stream pointer to next record + * This record is used for storing result from FORMULA record when it is a string, and + * it occurs directly after the FORMULA record. + * + * @return string The string contents as UTF-8 + */ + private function readString() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong($recordData); + $value = $string['value']; + } else { + $string = $this->readByteStringLong($recordData); + $value = $string['value']; + } + + return $value; + } + + /** + * Read BOOLERR record + * This record represents a Boolean value or error value + * cell. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readBoolErr() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; row index + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; column index + $column = self::getUInt2d($recordData, 2); + $columnString = Coordinate::stringFromColumnIndex($column + 1); + + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + // offset: 4; size: 2; index to XF record + $xfIndex = self::getUInt2d($recordData, 4); + + // offset: 6; size: 1; the boolean value or error value + $boolErr = ord($recordData[6]); + + // offset: 7; size: 1; 0=boolean; 1=error + $isError = ord($recordData[7]); + + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + switch ($isError) { + case 0: // boolean + $value = (bool) $boolErr; + + // add cell value + $cell->setValueExplicit($value, DataType::TYPE_BOOL); + + break; + case 1: // error type + $value = Xls\ErrorCode::lookup($boolErr); + + // add cell value + $cell->setValueExplicit($value, DataType::TYPE_ERROR); + + break; + } + + if (!$this->readDataOnly) { + // add cell style + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + } + } + + /** + * Read MULBLANK record + * This record represents a cell range of empty cells. All + * cells are located in the same row. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readMulBlank() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; index to first column + $fc = self::getUInt2d($recordData, 2); + + // offset: 4; size: 2 x nc; list of indexes to XF records + // add style information + if (!$this->readDataOnly && $this->readEmptyCells) { + for ($i = 0; $i < $length / 2 - 3; ++$i) { + $columnString = Coordinate::stringFromColumnIndex($fc + $i + 1); + + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + $xfIndex = self::getUInt2d($recordData, 4 + 2 * $i); + $this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + } + } + + // offset: 6; size 2; index to last column (not needed) + } + + /** + * Read LABEL record + * This record represents a cell that contains a string. In + * BIFF8 it is usually replaced by the LABELSST record. + * Excel still uses this record, if it copies unformatted + * text cells to the clipboard. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readLabel() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; index to row + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; index to column + $column = self::getUInt2d($recordData, 2); + $columnString = Coordinate::stringFromColumnIndex($column + 1); + + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + // offset: 4; size: 2; XF index + $xfIndex = self::getUInt2d($recordData, 4); + + // add cell value + // todo: what if string is very long? continue record + if ($this->version == self::XLS_BIFF8) { + $string = self::readUnicodeStringLong(substr($recordData, 6)); + $value = $string['value']; + } else { + $string = $this->readByteStringLong(substr($recordData, 6)); + $value = $string['value']; + } + if ($this->readEmptyCells || trim($value) !== '') { + $cell = $this->phpSheet->getCell($columnString . ($row + 1)); + $cell->setValueExplicit($value, DataType::TYPE_STRING); + + if (!$this->readDataOnly) { + // add cell style + $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + } + } + } + + /** + * Read BLANK record. + */ + private function readBlank() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; row index + $row = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; col index + $col = self::getUInt2d($recordData, 2); + $columnString = Coordinate::stringFromColumnIndex($col + 1); + + // Read cell? + if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) { + // offset: 4; size: 2; XF index + $xfIndex = self::getUInt2d($recordData, 4); + + // add style information + if (!$this->readDataOnly && $this->readEmptyCells) { + $this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } + } + } + + /** + * Read MSODRAWING record. + */ + private function readMsoDrawing() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + + // get spliced record data + $splicedRecordData = $this->getSplicedRecordData(); + $recordData = $splicedRecordData['recordData']; + + $this->drawingData .= $recordData; + } + + /** + * Read OBJ record. + */ + private function readObj() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly || $this->version != self::XLS_BIFF8) { + return; + } + + // recordData consists of an array of subrecords looking like this: + // ft: 2 bytes; ftCmo type (0x15) + // cb: 2 bytes; size in bytes of ftCmo data + // ot: 2 bytes; Object Type + // id: 2 bytes; Object id number + // grbit: 2 bytes; Option Flags + // data: var; subrecord data + + // for now, we are just interested in the second subrecord containing the object type + $ftCmoType = self::getUInt2d($recordData, 0); + $cbCmoSize = self::getUInt2d($recordData, 2); + $otObjType = self::getUInt2d($recordData, 4); + $idObjID = self::getUInt2d($recordData, 6); + $grbitOpts = self::getUInt2d($recordData, 6); + + $this->objs[] = [ + 'ftCmoType' => $ftCmoType, + 'cbCmoSize' => $cbCmoSize, + 'otObjType' => $otObjType, + 'idObjID' => $idObjID, + 'grbitOpts' => $grbitOpts, + ]; + $this->textObjRef = $idObjID; + } + + /** + * Read WINDOW2 record. + */ + private function readWindow2() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; option flags + $options = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; index to first visible row + $firstVisibleRow = self::getUInt2d($recordData, 2); + + // offset: 4; size: 2; index to first visible colum + $firstVisibleColumn = self::getUInt2d($recordData, 4); + if ($this->version === self::XLS_BIFF8) { + // offset: 8; size: 2; not used + // offset: 10; size: 2; cached magnification factor in page break preview (in percent); 0 = Default (60%) + // offset: 12; size: 2; cached magnification factor in normal view (in percent); 0 = Default (100%) + // offset: 14; size: 4; not used + $zoomscaleInPageBreakPreview = self::getUInt2d($recordData, 10); + if ($zoomscaleInPageBreakPreview === 0) { + $zoomscaleInPageBreakPreview = 60; + } + $zoomscaleInNormalView = self::getUInt2d($recordData, 12); + if ($zoomscaleInNormalView === 0) { + $zoomscaleInNormalView = 100; + } + } + + // bit: 1; mask: 0x0002; 0 = do not show gridlines, 1 = show gridlines + $showGridlines = (bool) ((0x0002 & $options) >> 1); + $this->phpSheet->setShowGridlines($showGridlines); + + // bit: 2; mask: 0x0004; 0 = do not show headers, 1 = show headers + $showRowColHeaders = (bool) ((0x0004 & $options) >> 2); + $this->phpSheet->setShowRowColHeaders($showRowColHeaders); + + // bit: 3; mask: 0x0008; 0 = panes are not frozen, 1 = panes are frozen + $this->frozen = (bool) ((0x0008 & $options) >> 3); + + // bit: 6; mask: 0x0040; 0 = columns from left to right, 1 = columns from right to left + $this->phpSheet->setRightToLeft((bool) ((0x0040 & $options) >> 6)); + + // bit: 10; mask: 0x0400; 0 = sheet not active, 1 = sheet active + $isActive = (bool) ((0x0400 & $options) >> 10); + if ($isActive) { + $this->spreadsheet->setActiveSheetIndex($this->spreadsheet->getIndex($this->phpSheet)); + } + + // bit: 11; mask: 0x0800; 0 = normal view, 1 = page break view + $isPageBreakPreview = (bool) ((0x0800 & $options) >> 11); + + //FIXME: set $firstVisibleRow and $firstVisibleColumn + + if ($this->phpSheet->getSheetView()->getView() !== SheetView::SHEETVIEW_PAGE_LAYOUT) { + //NOTE: this setting is inferior to page layout view(Excel2007-) + $view = $isPageBreakPreview ? SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW : SheetView::SHEETVIEW_NORMAL; + $this->phpSheet->getSheetView()->setView($view); + if ($this->version === self::XLS_BIFF8) { + $zoomScale = $isPageBreakPreview ? $zoomscaleInPageBreakPreview : $zoomscaleInNormalView; + $this->phpSheet->getSheetView()->setZoomScale($zoomScale); + $this->phpSheet->getSheetView()->setZoomScaleNormal($zoomscaleInNormalView); + } + } + } + + /** + * Read PLV Record(Created by Excel2007 or upper). + */ + private function readPageLayoutView() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; rt + //->ignore + $rt = self::getUInt2d($recordData, 0); + // offset: 2; size: 2; grbitfr + //->ignore + $grbitFrt = self::getUInt2d($recordData, 2); + // offset: 4; size: 8; reserved + //->ignore + + // offset: 12; size 2; zoom scale + $wScalePLV = self::getUInt2d($recordData, 12); + // offset: 14; size 2; grbit + $grbit = self::getUInt2d($recordData, 14); + + // decomprise grbit + $fPageLayoutView = $grbit & 0x01; + $fRulerVisible = ($grbit >> 1) & 0x01; //no support + $fWhitespaceHidden = ($grbit >> 3) & 0x01; //no support + + if ($fPageLayoutView === 1) { + $this->phpSheet->getSheetView()->setView(SheetView::SHEETVIEW_PAGE_LAYOUT); + $this->phpSheet->getSheetView()->setZoomScale($wScalePLV); //set by Excel2007 only if SHEETVIEW_PAGE_LAYOUT + } + //otherwise, we cannot know whether SHEETVIEW_PAGE_LAYOUT or SHEETVIEW_PAGE_BREAK_PREVIEW. + } + + /** + * Read SCL record. + */ + private function readScl() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // offset: 0; size: 2; numerator of the view magnification + $numerator = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; numerator of the view magnification + $denumerator = self::getUInt2d($recordData, 2); + + // set the zoom scale (in percent) + $this->phpSheet->getSheetView()->setZoomScale($numerator * 100 / $denumerator); + } + + /** + * Read PANE record. + */ + private function readPane() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; position of vertical split + $px = self::getUInt2d($recordData, 0); + + // offset: 2; size: 2; position of horizontal split + $py = self::getUInt2d($recordData, 2); + + // offset: 4; size: 2; top most visible row in the bottom pane + $rwTop = self::getUInt2d($recordData, 4); + + // offset: 6; size: 2; first visible left column in the right pane + $colLeft = self::getUInt2d($recordData, 6); + + if ($this->frozen) { + // frozen panes + $cell = Coordinate::stringFromColumnIndex($px + 1) . ($py + 1); + $topLeftCell = Coordinate::stringFromColumnIndex($colLeft + 1) . ($rwTop + 1); + $this->phpSheet->freezePane($cell, $topLeftCell); + } + // unfrozen panes; split windows; not supported by PhpSpreadsheet core + } + } + + /** + * Read SELECTION record. There is one such record for each pane in the sheet. + */ + private function readSelection() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 1; pane identifier + $paneId = ord($recordData[0]); + + // offset: 1; size: 2; index to row of the active cell + $r = self::getUInt2d($recordData, 1); + + // offset: 3; size: 2; index to column of the active cell + $c = self::getUInt2d($recordData, 3); + + // offset: 5; size: 2; index into the following cell range list to the + // entry that contains the active cell + $index = self::getUInt2d($recordData, 5); + + // offset: 7; size: var; cell range address list containing all selected cell ranges + $data = substr($recordData, 7); + $cellRangeAddressList = $this->readBIFF5CellRangeAddressList($data); // note: also BIFF8 uses BIFF5 syntax + + $selectedCells = $cellRangeAddressList['cellRangeAddresses'][0]; + + // first row '1' + last row '16384' indicates that full column is selected (apparently also in BIFF8!) + if (preg_match('/^([A-Z]+1\:[A-Z]+)16384$/', $selectedCells)) { + $selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)16384$/', '${1}1048576', $selectedCells); + } + + // first row '1' + last row '65536' indicates that full column is selected + if (preg_match('/^([A-Z]+1\:[A-Z]+)65536$/', $selectedCells)) { + $selectedCells = preg_replace('/^([A-Z]+1\:[A-Z]+)65536$/', '${1}1048576', $selectedCells); + } + + // first column 'A' + last column 'IV' indicates that full row is selected + if (preg_match('/^(A\d+\:)IV(\d+)$/', $selectedCells)) { + $selectedCells = preg_replace('/^(A\d+\:)IV(\d+)$/', '${1}XFD${2}', $selectedCells); + } + + $this->phpSheet->setSelectedCells($selectedCells); + } + } + + private function includeCellRangeFiltered($cellRangeAddress) + { + $includeCellRange = true; + if ($this->getReadFilter() !== null) { + $includeCellRange = false; + $rangeBoundaries = Coordinate::getRangeBoundaries($cellRangeAddress); + ++$rangeBoundaries[1][0]; + for ($row = $rangeBoundaries[0][1]; $row <= $rangeBoundaries[1][1]; ++$row) { + for ($column = $rangeBoundaries[0][0]; $column != $rangeBoundaries[1][0]; ++$column) { + if ($this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) { + $includeCellRange = true; + + break 2; + } + } + } + } + + return $includeCellRange; + } + + /** + * MERGEDCELLS. + * + * This record contains the addresses of merged cell ranges + * in the current sheet. + * + * -- "OpenOffice.org's Documentation of the Microsoft + * Excel File Format" + */ + private function readMergedCells() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->version == self::XLS_BIFF8 && !$this->readDataOnly) { + $cellRangeAddressList = $this->readBIFF8CellRangeAddressList($recordData); + foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) { + if ((strpos($cellRangeAddress, ':') !== false) && + ($this->includeCellRangeFiltered($cellRangeAddress))) { + $this->phpSheet->mergeCells($cellRangeAddress); + } + } + } + } + + /** + * Read HYPERLINK record. + */ + private function readHyperLink() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer forward to next record + $this->pos += 4 + $length; + + if (!$this->readDataOnly) { + // offset: 0; size: 8; cell range address of all cells containing this hyperlink + try { + $cellRange = $this->readBIFF8CellRangeAddressFixed($recordData); + } catch (PhpSpreadsheetException $e) { + return; + } + + // offset: 8, size: 16; GUID of StdLink + + // offset: 24, size: 4; unknown value + + // offset: 28, size: 4; option flags + // bit: 0; mask: 0x00000001; 0 = no link or extant, 1 = file link or URL + $isFileLinkOrUrl = (0x00000001 & self::getUInt2d($recordData, 28)) >> 0; + + // bit: 1; mask: 0x00000002; 0 = relative path, 1 = absolute path or URL + $isAbsPathOrUrl = (0x00000001 & self::getUInt2d($recordData, 28)) >> 1; + + // bit: 2 (and 4); mask: 0x00000014; 0 = no description + $hasDesc = (0x00000014 & self::getUInt2d($recordData, 28)) >> 2; + + // bit: 3; mask: 0x00000008; 0 = no text, 1 = has text + $hasText = (0x00000008 & self::getUInt2d($recordData, 28)) >> 3; + + // bit: 7; mask: 0x00000080; 0 = no target frame, 1 = has target frame + $hasFrame = (0x00000080 & self::getUInt2d($recordData, 28)) >> 7; + + // bit: 8; mask: 0x00000100; 0 = file link or URL, 1 = UNC path (inc. server name) + $isUNC = (0x00000100 & self::getUInt2d($recordData, 28)) >> 8; + + // offset within record data + $offset = 32; + + if ($hasDesc) { + // offset: 32; size: var; character count of description text + $dl = self::getInt4d($recordData, 32); + // offset: 36; size: var; character array of description text, no Unicode string header, always 16-bit characters, zero terminated + $desc = self::encodeUTF16(substr($recordData, 36, 2 * ($dl - 1)), false); + $offset += 4 + 2 * $dl; + } + if ($hasFrame) { + $fl = self::getInt4d($recordData, $offset); + $offset += 4 + 2 * $fl; + } + + // detect type of hyperlink (there are 4 types) + $hyperlinkType = null; + + if ($isUNC) { + $hyperlinkType = 'UNC'; + } elseif (!$isFileLinkOrUrl) { + $hyperlinkType = 'workbook'; + } elseif (ord($recordData[$offset]) == 0x03) { + $hyperlinkType = 'local'; + } elseif (ord($recordData[$offset]) == 0xE0) { + $hyperlinkType = 'URL'; + } + + switch ($hyperlinkType) { + case 'URL': + // section 5.58.2: Hyperlink containing a URL + // e.g. http://example.org/index.php + + // offset: var; size: 16; GUID of URL Moniker + $offset += 16; + // offset: var; size: 4; size (in bytes) of character array of the URL including trailing zero word + $us = self::getInt4d($recordData, $offset); + $offset += 4; + // offset: var; size: $us; character array of the URL, no Unicode string header, always 16-bit characters, zero-terminated + $url = self::encodeUTF16(substr($recordData, $offset, $us - 2), false); + $nullOffset = strpos($url, chr(0x00)); + if ($nullOffset) { + $url = substr($url, 0, $nullOffset); + } + $url .= $hasText ? '#' : ''; + $offset += $us; + + break; + case 'local': + // section 5.58.3: Hyperlink to local file + // examples: + // mydoc.txt + // ../../somedoc.xls#Sheet!A1 + + // offset: var; size: 16; GUI of File Moniker + $offset += 16; + + // offset: var; size: 2; directory up-level count. + $upLevelCount = self::getUInt2d($recordData, $offset); + $offset += 2; + + // offset: var; size: 4; character count of the shortened file path and name, including trailing zero word + $sl = self::getInt4d($recordData, $offset); + $offset += 4; + + // offset: var; size: sl; character array of the shortened file path and name in 8.3-DOS-format (compressed Unicode string) + $shortenedFilePath = substr($recordData, $offset, $sl); + $shortenedFilePath = self::encodeUTF16($shortenedFilePath, true); + $shortenedFilePath = substr($shortenedFilePath, 0, -1); // remove trailing zero + + $offset += $sl; + + // offset: var; size: 24; unknown sequence + $offset += 24; + + // extended file path + // offset: var; size: 4; size of the following file link field including string lenth mark + $sz = self::getInt4d($recordData, $offset); + $offset += 4; + + // only present if $sz > 0 + if ($sz > 0) { + // offset: var; size: 4; size of the character array of the extended file path and name + $xl = self::getInt4d($recordData, $offset); + $offset += 4; + + // offset: var; size 2; unknown + $offset += 2; + + // offset: var; size $xl; character array of the extended file path and name. + $extendedFilePath = substr($recordData, $offset, $xl); + $extendedFilePath = self::encodeUTF16($extendedFilePath, false); + $offset += $xl; + } + + // construct the path + $url = str_repeat('..\\', $upLevelCount); + $url .= ($sz > 0) ? $extendedFilePath : $shortenedFilePath; // use extended path if available + $url .= $hasText ? '#' : ''; + + break; + case 'UNC': + // section 5.58.4: Hyperlink to a File with UNC (Universal Naming Convention) Path + // todo: implement + return; + case 'workbook': + // section 5.58.5: Hyperlink to the Current Workbook + // e.g. Sheet2!B1:C2, stored in text mark field + $url = 'sheet://'; + + break; + default: + return; + } + + if ($hasText) { + // offset: var; size: 4; character count of text mark including trailing zero word + $tl = self::getInt4d($recordData, $offset); + $offset += 4; + // offset: var; size: var; character array of the text mark without the # sign, no Unicode header, always 16-bit characters, zero-terminated + $text = self::encodeUTF16(substr($recordData, $offset, 2 * ($tl - 1)), false); + $url .= $text; + } + + // apply the hyperlink to all the relevant cells + foreach (Coordinate::extractAllCellReferencesInRange($cellRange) as $coordinate) { + $this->phpSheet->getCell($coordinate)->getHyperLink()->setUrl($url); + } + } + } + + /** + * Read DATAVALIDATIONS record. + */ + private function readDataValidations() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer forward to next record + $this->pos += 4 + $length; + } + + /** + * Read DATAVALIDATION record. + */ + private function readDataValidation() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer forward to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return; + } + + // offset: 0; size: 4; Options + $options = self::getInt4d($recordData, 0); + + // bit: 0-3; mask: 0x0000000F; type + $type = (0x0000000F & $options) >> 0; + switch ($type) { + case 0x00: + $type = DataValidation::TYPE_NONE; + + break; + case 0x01: + $type = DataValidation::TYPE_WHOLE; + + break; + case 0x02: + $type = DataValidation::TYPE_DECIMAL; + + break; + case 0x03: + $type = DataValidation::TYPE_LIST; + + break; + case 0x04: + $type = DataValidation::TYPE_DATE; + + break; + case 0x05: + $type = DataValidation::TYPE_TIME; + + break; + case 0x06: + $type = DataValidation::TYPE_TEXTLENGTH; + + break; + case 0x07: + $type = DataValidation::TYPE_CUSTOM; + + break; + } + + // bit: 4-6; mask: 0x00000070; error type + $errorStyle = (0x00000070 & $options) >> 4; + switch ($errorStyle) { + case 0x00: + $errorStyle = DataValidation::STYLE_STOP; + + break; + case 0x01: + $errorStyle = DataValidation::STYLE_WARNING; + + break; + case 0x02: + $errorStyle = DataValidation::STYLE_INFORMATION; + + break; + } + + // bit: 7; mask: 0x00000080; 1= formula is explicit (only applies to list) + // I have only seen cases where this is 1 + $explicitFormula = (0x00000080 & $options) >> 7; + + // bit: 8; mask: 0x00000100; 1= empty cells allowed + $allowBlank = (0x00000100 & $options) >> 8; + + // bit: 9; mask: 0x00000200; 1= suppress drop down arrow in list type validity + $suppressDropDown = (0x00000200 & $options) >> 9; + + // bit: 18; mask: 0x00040000; 1= show prompt box if cell selected + $showInputMessage = (0x00040000 & $options) >> 18; + + // bit: 19; mask: 0x00080000; 1= show error box if invalid values entered + $showErrorMessage = (0x00080000 & $options) >> 19; + + // bit: 20-23; mask: 0x00F00000; condition operator + $operator = (0x00F00000 & $options) >> 20; + switch ($operator) { + case 0x00: + $operator = DataValidation::OPERATOR_BETWEEN; + + break; + case 0x01: + $operator = DataValidation::OPERATOR_NOTBETWEEN; + + break; + case 0x02: + $operator = DataValidation::OPERATOR_EQUAL; + + break; + case 0x03: + $operator = DataValidation::OPERATOR_NOTEQUAL; + + break; + case 0x04: + $operator = DataValidation::OPERATOR_GREATERTHAN; + + break; + case 0x05: + $operator = DataValidation::OPERATOR_LESSTHAN; + + break; + case 0x06: + $operator = DataValidation::OPERATOR_GREATERTHANOREQUAL; + + break; + case 0x07: + $operator = DataValidation::OPERATOR_LESSTHANOREQUAL; + + break; + } + + // offset: 4; size: var; title of the prompt box + $offset = 4; + $string = self::readUnicodeStringLong(substr($recordData, $offset)); + $promptTitle = $string['value'] !== chr(0) ? $string['value'] : ''; + $offset += $string['size']; + + // offset: var; size: var; title of the error box + $string = self::readUnicodeStringLong(substr($recordData, $offset)); + $errorTitle = $string['value'] !== chr(0) ? $string['value'] : ''; + $offset += $string['size']; + + // offset: var; size: var; text of the prompt box + $string = self::readUnicodeStringLong(substr($recordData, $offset)); + $prompt = $string['value'] !== chr(0) ? $string['value'] : ''; + $offset += $string['size']; + + // offset: var; size: var; text of the error box + $string = self::readUnicodeStringLong(substr($recordData, $offset)); + $error = $string['value'] !== chr(0) ? $string['value'] : ''; + $offset += $string['size']; + + // offset: var; size: 2; size of the formula data for the first condition + $sz1 = self::getUInt2d($recordData, $offset); + $offset += 2; + + // offset: var; size: 2; not used + $offset += 2; + + // offset: var; size: $sz1; formula data for first condition (without size field) + $formula1 = substr($recordData, $offset, $sz1); + $formula1 = pack('v', $sz1) . $formula1; // prepend the length + try { + $formula1 = $this->getFormulaFromStructure($formula1); + + // in list type validity, null characters are used as item separators + if ($type == DataValidation::TYPE_LIST) { + $formula1 = str_replace(chr(0), ',', $formula1); + } + } catch (PhpSpreadsheetException $e) { + return; + } + $offset += $sz1; + + // offset: var; size: 2; size of the formula data for the first condition + $sz2 = self::getUInt2d($recordData, $offset); + $offset += 2; + + // offset: var; size: 2; not used + $offset += 2; + + // offset: var; size: $sz2; formula data for second condition (without size field) + $formula2 = substr($recordData, $offset, $sz2); + $formula2 = pack('v', $sz2) . $formula2; // prepend the length + try { + $formula2 = $this->getFormulaFromStructure($formula2); + } catch (PhpSpreadsheetException $e) { + return; + } + $offset += $sz2; + + // offset: var; size: var; cell range address list with + $cellRangeAddressList = $this->readBIFF8CellRangeAddressList(substr($recordData, $offset)); + $cellRangeAddresses = $cellRangeAddressList['cellRangeAddresses']; + + foreach ($cellRangeAddresses as $cellRange) { + $stRange = $this->phpSheet->shrinkRangeToFit($cellRange); + foreach (Coordinate::extractAllCellReferencesInRange($stRange) as $coordinate) { + $objValidation = $this->phpSheet->getCell($coordinate)->getDataValidation(); + $objValidation->setType($type); + $objValidation->setErrorStyle($errorStyle); + $objValidation->setAllowBlank((bool) $allowBlank); + $objValidation->setShowInputMessage((bool) $showInputMessage); + $objValidation->setShowErrorMessage((bool) $showErrorMessage); + $objValidation->setShowDropDown(!$suppressDropDown); + $objValidation->setOperator($operator); + $objValidation->setErrorTitle($errorTitle); + $objValidation->setError($error); + $objValidation->setPromptTitle($promptTitle); + $objValidation->setPrompt($prompt); + $objValidation->setFormula1($formula1); + $objValidation->setFormula2($formula2); + } + } + } + + /** + * Read SHEETLAYOUT record. Stores sheet tab color information. + */ + private function readSheetLayout() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // local pointer in record data + $offset = 0; + + if (!$this->readDataOnly) { + // offset: 0; size: 2; repeated record identifier 0x0862 + + // offset: 2; size: 10; not used + + // offset: 12; size: 4; size of record data + // Excel 2003 uses size of 0x14 (documented), Excel 2007 uses size of 0x28 (not documented?) + $sz = self::getInt4d($recordData, 12); + + switch ($sz) { + case 0x14: + // offset: 16; size: 2; color index for sheet tab + $colorIndex = self::getUInt2d($recordData, 16); + $color = Xls\Color::map($colorIndex, $this->palette, $this->version); + $this->phpSheet->getTabColor()->setRGB($color['rgb']); + + break; + case 0x28: + // TODO: Investigate structure for .xls SHEETLAYOUT record as saved by MS Office Excel 2007 + return; + + break; + } + } + } + + /** + * Read SHEETPROTECTION record (FEATHEADR). + */ + private function readSheetProtection() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + if ($this->readDataOnly) { + return; + } + + // offset: 0; size: 2; repeated record header + + // offset: 2; size: 2; FRT cell reference flag (=0 currently) + + // offset: 4; size: 8; Currently not used and set to 0 + + // offset: 12; size: 2; Shared feature type index (2=Enhanced Protetion, 4=SmartTag) + $isf = self::getUInt2d($recordData, 12); + if ($isf != 2) { + return; + } + + // offset: 14; size: 1; =1 since this is a feat header + + // offset: 15; size: 4; size of rgbHdrSData + + // rgbHdrSData, assume "Enhanced Protection" + // offset: 19; size: 2; option flags + $options = self::getUInt2d($recordData, 19); + + // bit: 0; mask 0x0001; 1 = user may edit objects, 0 = users must not edit objects + $bool = (0x0001 & $options) >> 0; + $this->phpSheet->getProtection()->setObjects(!$bool); + + // bit: 1; mask 0x0002; edit scenarios + $bool = (0x0002 & $options) >> 1; + $this->phpSheet->getProtection()->setScenarios(!$bool); + + // bit: 2; mask 0x0004; format cells + $bool = (0x0004 & $options) >> 2; + $this->phpSheet->getProtection()->setFormatCells(!$bool); + + // bit: 3; mask 0x0008; format columns + $bool = (0x0008 & $options) >> 3; + $this->phpSheet->getProtection()->setFormatColumns(!$bool); + + // bit: 4; mask 0x0010; format rows + $bool = (0x0010 & $options) >> 4; + $this->phpSheet->getProtection()->setFormatRows(!$bool); + + // bit: 5; mask 0x0020; insert columns + $bool = (0x0020 & $options) >> 5; + $this->phpSheet->getProtection()->setInsertColumns(!$bool); + + // bit: 6; mask 0x0040; insert rows + $bool = (0x0040 & $options) >> 6; + $this->phpSheet->getProtection()->setInsertRows(!$bool); + + // bit: 7; mask 0x0080; insert hyperlinks + $bool = (0x0080 & $options) >> 7; + $this->phpSheet->getProtection()->setInsertHyperlinks(!$bool); + + // bit: 8; mask 0x0100; delete columns + $bool = (0x0100 & $options) >> 8; + $this->phpSheet->getProtection()->setDeleteColumns(!$bool); + + // bit: 9; mask 0x0200; delete rows + $bool = (0x0200 & $options) >> 9; + $this->phpSheet->getProtection()->setDeleteRows(!$bool); + + // bit: 10; mask 0x0400; select locked cells + $bool = (0x0400 & $options) >> 10; + $this->phpSheet->getProtection()->setSelectLockedCells(!$bool); + + // bit: 11; mask 0x0800; sort cell range + $bool = (0x0800 & $options) >> 11; + $this->phpSheet->getProtection()->setSort(!$bool); + + // bit: 12; mask 0x1000; auto filter + $bool = (0x1000 & $options) >> 12; + $this->phpSheet->getProtection()->setAutoFilter(!$bool); + + // bit: 13; mask 0x2000; pivot tables + $bool = (0x2000 & $options) >> 13; + $this->phpSheet->getProtection()->setPivotTables(!$bool); + + // bit: 14; mask 0x4000; select unlocked cells + $bool = (0x4000 & $options) >> 14; + $this->phpSheet->getProtection()->setSelectUnlockedCells(!$bool); + + // offset: 21; size: 2; not used + } + + /** + * Read RANGEPROTECTION record + * Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification, + * where it is referred to as FEAT record. + */ + private function readRangeProtection() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // move stream pointer to next record + $this->pos += 4 + $length; + + // local pointer in record data + $offset = 0; + + if (!$this->readDataOnly) { + $offset += 12; + + // offset: 12; size: 2; shared feature type, 2 = enhanced protection, 4 = smart tag + $isf = self::getUInt2d($recordData, 12); + if ($isf != 2) { + // we only read FEAT records of type 2 + return; + } + $offset += 2; + + $offset += 5; + + // offset: 19; size: 2; count of ref ranges this feature is on + $cref = self::getUInt2d($recordData, 19); + $offset += 2; + + $offset += 6; + + // offset: 27; size: 8 * $cref; list of cell ranges (like in hyperlink record) + $cellRanges = []; + for ($i = 0; $i < $cref; ++$i) { + try { + $cellRange = $this->readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8)); + } catch (PhpSpreadsheetException $e) { + return; + } + $cellRanges[] = $cellRange; + $offset += 8; + } + + // offset: var; size: var; variable length of feature specific data + $rgbFeat = substr($recordData, $offset); + $offset += 4; + + // offset: var; size: 4; the encrypted password (only 16-bit although field is 32-bit) + $wPassword = self::getInt4d($recordData, $offset); + $offset += 4; + + // Apply range protection to sheet + if ($cellRanges) { + $this->phpSheet->protectCells(implode(' ', $cellRanges), strtoupper(dechex($wPassword)), true); + } + } + } + + /** + * Read a free CONTINUE record. Free CONTINUE record may be a camouflaged MSODRAWING record + * When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented. + * In this case, we must treat the CONTINUE record as a MSODRAWING record. + */ + private function readContinue() + { + $length = self::getUInt2d($this->data, $this->pos + 2); + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); + + // check if we are reading drawing data + // this is in case a free CONTINUE record occurs in other circumstances we are unaware of + if ($this->drawingData == '') { + // move stream pointer to next record + $this->pos += 4 + $length; + + return; + } + + // check if record data is at least 4 bytes long, otherwise there is no chance this is MSODRAWING data + if ($length < 4) { + // move stream pointer to next record + $this->pos += 4 + $length; + + return; + } + + // dirty check to see if CONTINUE record could be a camouflaged MSODRAWING record + // look inside CONTINUE record to see if it looks like a part of an Escher stream + // we know that Escher stream may be split at least at + // 0xF003 MsofbtSpgrContainer + // 0xF004 MsofbtSpContainer + // 0xF00D MsofbtClientTextbox + $validSplitPoints = [0xF003, 0xF004, 0xF00D]; // add identifiers if we find more + + $splitPoint = self::getUInt2d($recordData, 2); + if (in_array($splitPoint, $validSplitPoints)) { + // get spliced record data (and move pointer to next record) + $splicedRecordData = $this->getSplicedRecordData(); + $this->drawingData .= $splicedRecordData['recordData']; + + return; + } + + // move stream pointer to next record + $this->pos += 4 + $length; + } + + /** + * Reads a record from current position in data stream and continues reading data as long as CONTINUE + * records are found. Splices the record data pieces and returns the combined string as if record data + * is in one piece. + * Moves to next current position in data stream to start of next record different from a CONtINUE record. + * + * @return array + */ + private function getSplicedRecordData() + { + $data = ''; + $spliceOffsets = []; + + $i = 0; + $spliceOffsets[0] = 0; + + do { + ++$i; + + // offset: 0; size: 2; identifier + $identifier = self::getUInt2d($this->data, $this->pos); + // offset: 2; size: 2; length + $length = self::getUInt2d($this->data, $this->pos + 2); + $data .= $this->readRecordData($this->data, $this->pos + 4, $length); + + $spliceOffsets[$i] = $spliceOffsets[$i - 1] + $length; + + $this->pos += 4 + $length; + $nextIdentifier = self::getUInt2d($this->data, $this->pos); + } while ($nextIdentifier == self::XLS_TYPE_CONTINUE); + + return [ + 'recordData' => $data, + 'spliceOffsets' => $spliceOffsets, + ]; + } + + /** + * Convert formula structure into human readable Excel formula like 'A3+A5*5'. + * + * @param string $formulaStructure The complete binary data for the formula + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * + * @return string Human readable formula + */ + private function getFormulaFromStructure($formulaStructure, $baseCell = 'A1') + { + // offset: 0; size: 2; size of the following formula data + $sz = self::getUInt2d($formulaStructure, 0); + + // offset: 2; size: sz + $formulaData = substr($formulaStructure, 2, $sz); + + // offset: 2 + sz; size: variable (optional) + if (strlen($formulaStructure) > 2 + $sz) { + $additionalData = substr($formulaStructure, 2 + $sz); + } else { + $additionalData = ''; + } + + return $this->getFormulaFromData($formulaData, $additionalData, $baseCell); + } + + /** + * Take formula data and additional data for formula and return human readable formula. + * + * @param string $formulaData The binary data for the formula itself + * @param string $additionalData Additional binary data going with the formula + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * + * @return string Human readable formula + */ + private function getFormulaFromData($formulaData, $additionalData = '', $baseCell = 'A1') + { + // start parsing the formula data + $tokens = []; + + while (strlen($formulaData) > 0 and $token = $this->getNextToken($formulaData, $baseCell)) { + $tokens[] = $token; + $formulaData = substr($formulaData, $token['size']); + } + + $formulaString = $this->createFormulaFromTokens($tokens, $additionalData); + + return $formulaString; + } + + /** + * Take array of tokens together with additional data for formula and return human readable formula. + * + * @param array $tokens + * @param string $additionalData Additional binary data going with the formula + * + * @return string Human readable formula + */ + private function createFormulaFromTokens($tokens, $additionalData) + { + // empty formula? + if (empty($tokens)) { + return ''; + } + + $formulaStrings = []; + foreach ($tokens as $token) { + // initialize spaces + $space0 = $space0 ?? ''; // spaces before next token, not tParen + $space1 = $space1 ?? ''; // carriage returns before next token, not tParen + $space2 = $space2 ?? ''; // spaces before opening parenthesis + $space3 = $space3 ?? ''; // carriage returns before opening parenthesis + $space4 = $space4 ?? ''; // spaces before closing parenthesis + $space5 = $space5 ?? ''; // carriage returns before closing parenthesis + + switch ($token['name']) { + case 'tAdd': // addition + case 'tConcat': // addition + case 'tDiv': // division + case 'tEQ': // equality + case 'tGE': // greater than or equal + case 'tGT': // greater than + case 'tIsect': // intersection + case 'tLE': // less than or equal + case 'tList': // less than or equal + case 'tLT': // less than + case 'tMul': // multiplication + case 'tNE': // multiplication + case 'tPower': // power + case 'tRange': // range + case 'tSub': // subtraction + $op2 = array_pop($formulaStrings); + $op1 = array_pop($formulaStrings); + $formulaStrings[] = "$op1$space1$space0{$token['data']}$op2"; + unset($space0, $space1); + + break; + case 'tUplus': // unary plus + case 'tUminus': // unary minus + $op = array_pop($formulaStrings); + $formulaStrings[] = "$space1$space0{$token['data']}$op"; + unset($space0, $space1); + + break; + case 'tPercent': // percent sign + $op = array_pop($formulaStrings); + $formulaStrings[] = "$op$space1$space0{$token['data']}"; + unset($space0, $space1); + + break; + case 'tAttrVolatile': // indicates volatile function + case 'tAttrIf': + case 'tAttrSkip': + case 'tAttrChoose': + // token is only important for Excel formula evaluator + // do nothing + break; + case 'tAttrSpace': // space / carriage return + // space will be used when next token arrives, do not alter formulaString stack + switch ($token['data']['spacetype']) { + case 'type0': + $space0 = str_repeat(' ', $token['data']['spacecount']); + + break; + case 'type1': + $space1 = str_repeat("\n", $token['data']['spacecount']); + + break; + case 'type2': + $space2 = str_repeat(' ', $token['data']['spacecount']); + + break; + case 'type3': + $space3 = str_repeat("\n", $token['data']['spacecount']); + + break; + case 'type4': + $space4 = str_repeat(' ', $token['data']['spacecount']); + + break; + case 'type5': + $space5 = str_repeat("\n", $token['data']['spacecount']); + + break; + } + + break; + case 'tAttrSum': // SUM function with one parameter + $op = array_pop($formulaStrings); + $formulaStrings[] = "{$space1}{$space0}SUM($op)"; + unset($space0, $space1); + + break; + case 'tFunc': // function with fixed number of arguments + case 'tFuncV': // function with variable number of arguments + if ($token['data']['function'] != '') { + // normal function + $ops = []; // array of operators + for ($i = 0; $i < $token['data']['args']; ++$i) { + $ops[] = array_pop($formulaStrings); + } + $ops = array_reverse($ops); + $formulaStrings[] = "$space1$space0{$token['data']['function']}(" . implode(',', $ops) . ')'; + unset($space0, $space1); + } else { + // add-in function + $ops = []; // array of operators + for ($i = 0; $i < $token['data']['args'] - 1; ++$i) { + $ops[] = array_pop($formulaStrings); + } + $ops = array_reverse($ops); + $function = array_pop($formulaStrings); + $formulaStrings[] = "$space1$space0$function(" . implode(',', $ops) . ')'; + unset($space0, $space1); + } + + break; + case 'tParen': // parenthesis + $expression = array_pop($formulaStrings); + $formulaStrings[] = "$space3$space2($expression$space5$space4)"; + unset($space2, $space3, $space4, $space5); + + break; + case 'tArray': // array constant + $constantArray = self::readBIFF8ConstantArray($additionalData); + $formulaStrings[] = $space1 . $space0 . $constantArray['value']; + $additionalData = substr($additionalData, $constantArray['size']); // bite of chunk of additional data + unset($space0, $space1); + + break; + case 'tMemArea': + // bite off chunk of additional data + $cellRangeAddressList = $this->readBIFF8CellRangeAddressList($additionalData); + $additionalData = substr($additionalData, $cellRangeAddressList['size']); + $formulaStrings[] = "$space1$space0{$token['data']}"; + unset($space0, $space1); + + break; + case 'tArea': // cell range address + case 'tBool': // boolean + case 'tErr': // error code + case 'tInt': // integer + case 'tMemErr': + case 'tMemFunc': + case 'tMissArg': + case 'tName': + case 'tNameX': + case 'tNum': // number + case 'tRef': // single cell reference + case 'tRef3d': // 3d cell reference + case 'tArea3d': // 3d cell range reference + case 'tRefN': + case 'tAreaN': + case 'tStr': // string + $formulaStrings[] = "$space1$space0{$token['data']}"; + unset($space0, $space1); + + break; + } + } + $formulaString = $formulaStrings[0]; + + return $formulaString; + } + + /** + * Fetch next token from binary formula data. + * + * @param string $formulaData Formula data + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * + * @throws Exception + * + * @return array + */ + private function getNextToken($formulaData, $baseCell = 'A1') + { + // offset: 0; size: 1; token id + $id = ord($formulaData[0]); // token id + $name = false; // initialize token name + + switch ($id) { + case 0x03: + $name = 'tAdd'; + $size = 1; + $data = '+'; + + break; + case 0x04: + $name = 'tSub'; + $size = 1; + $data = '-'; + + break; + case 0x05: + $name = 'tMul'; + $size = 1; + $data = '*'; + + break; + case 0x06: + $name = 'tDiv'; + $size = 1; + $data = '/'; + + break; + case 0x07: + $name = 'tPower'; + $size = 1; + $data = '^'; + + break; + case 0x08: + $name = 'tConcat'; + $size = 1; + $data = '&'; + + break; + case 0x09: + $name = 'tLT'; + $size = 1; + $data = '<'; + + break; + case 0x0A: + $name = 'tLE'; + $size = 1; + $data = '<='; + + break; + case 0x0B: + $name = 'tEQ'; + $size = 1; + $data = '='; + + break; + case 0x0C: + $name = 'tGE'; + $size = 1; + $data = '>='; + + break; + case 0x0D: + $name = 'tGT'; + $size = 1; + $data = '>'; + + break; + case 0x0E: + $name = 'tNE'; + $size = 1; + $data = '<>'; + + break; + case 0x0F: + $name = 'tIsect'; + $size = 1; + $data = ' '; + + break; + case 0x10: + $name = 'tList'; + $size = 1; + $data = ','; + + break; + case 0x11: + $name = 'tRange'; + $size = 1; + $data = ':'; + + break; + case 0x12: + $name = 'tUplus'; + $size = 1; + $data = '+'; + + break; + case 0x13: + $name = 'tUminus'; + $size = 1; + $data = '-'; + + break; + case 0x14: + $name = 'tPercent'; + $size = 1; + $data = '%'; + + break; + case 0x15: // parenthesis + $name = 'tParen'; + $size = 1; + $data = null; + + break; + case 0x16: // missing argument + $name = 'tMissArg'; + $size = 1; + $data = ''; + + break; + case 0x17: // string + $name = 'tStr'; + // offset: 1; size: var; Unicode string, 8-bit string length + $string = self::readUnicodeStringShort(substr($formulaData, 1)); + $size = 1 + $string['size']; + $data = self::UTF8toExcelDoubleQuoted($string['value']); + + break; + case 0x19: // Special attribute + // offset: 1; size: 1; attribute type flags: + switch (ord($formulaData[1])) { + case 0x01: + $name = 'tAttrVolatile'; + $size = 4; + $data = null; + + break; + case 0x02: + $name = 'tAttrIf'; + $size = 4; + $data = null; + + break; + case 0x04: + $name = 'tAttrChoose'; + // offset: 2; size: 2; number of choices in the CHOOSE function ($nc, number of parameters decreased by 1) + $nc = self::getUInt2d($formulaData, 2); + // offset: 4; size: 2 * $nc + // offset: 4 + 2 * $nc; size: 2 + $size = 2 * $nc + 6; + $data = null; + + break; + case 0x08: + $name = 'tAttrSkip'; + $size = 4; + $data = null; + + break; + case 0x10: + $name = 'tAttrSum'; + $size = 4; + $data = null; + + break; + case 0x40: + case 0x41: + $name = 'tAttrSpace'; + $size = 4; + // offset: 2; size: 2; space type and position + switch (ord($formulaData[2])) { + case 0x00: + $spacetype = 'type0'; + + break; + case 0x01: + $spacetype = 'type1'; + + break; + case 0x02: + $spacetype = 'type2'; + + break; + case 0x03: + $spacetype = 'type3'; + + break; + case 0x04: + $spacetype = 'type4'; + + break; + case 0x05: + $spacetype = 'type5'; + + break; + default: + throw new Exception('Unrecognized space type in tAttrSpace token'); + + break; + } + // offset: 3; size: 1; number of inserted spaces/carriage returns + $spacecount = ord($formulaData[3]); + + $data = ['spacetype' => $spacetype, 'spacecount' => $spacecount]; + + break; + default: + throw new Exception('Unrecognized attribute flag in tAttr token'); + + break; + } + + break; + case 0x1C: // error code + // offset: 1; size: 1; error code + $name = 'tErr'; + $size = 2; + $data = Xls\ErrorCode::lookup(ord($formulaData[1])); + + break; + case 0x1D: // boolean + // offset: 1; size: 1; 0 = false, 1 = true; + $name = 'tBool'; + $size = 2; + $data = ord($formulaData[1]) ? 'TRUE' : 'FALSE'; + + break; + case 0x1E: // integer + // offset: 1; size: 2; unsigned 16-bit integer + $name = 'tInt'; + $size = 3; + $data = self::getUInt2d($formulaData, 1); + + break; + case 0x1F: // number + // offset: 1; size: 8; + $name = 'tNum'; + $size = 9; + $data = self::extractNumber(substr($formulaData, 1)); + $data = str_replace(',', '.', (string) $data); // in case non-English locale + break; + case 0x20: // array constant + case 0x40: + case 0x60: + // offset: 1; size: 7; not used + $name = 'tArray'; + $size = 8; + $data = null; + + break; + case 0x21: // function with fixed number of arguments + case 0x41: + case 0x61: + $name = 'tFunc'; + $size = 3; + // offset: 1; size: 2; index to built-in sheet function + switch (self::getUInt2d($formulaData, 1)) { + case 2: + $function = 'ISNA'; + $args = 1; + + break; + case 3: + $function = 'ISERROR'; + $args = 1; + + break; + case 10: + $function = 'NA'; + $args = 0; + + break; + case 15: + $function = 'SIN'; + $args = 1; + + break; + case 16: + $function = 'COS'; + $args = 1; + + break; + case 17: + $function = 'TAN'; + $args = 1; + + break; + case 18: + $function = 'ATAN'; + $args = 1; + + break; + case 19: + $function = 'PI'; + $args = 0; + + break; + case 20: + $function = 'SQRT'; + $args = 1; + + break; + case 21: + $function = 'EXP'; + $args = 1; + + break; + case 22: + $function = 'LN'; + $args = 1; + + break; + case 23: + $function = 'LOG10'; + $args = 1; + + break; + case 24: + $function = 'ABS'; + $args = 1; + + break; + case 25: + $function = 'INT'; + $args = 1; + + break; + case 26: + $function = 'SIGN'; + $args = 1; + + break; + case 27: + $function = 'ROUND'; + $args = 2; + + break; + case 30: + $function = 'REPT'; + $args = 2; + + break; + case 31: + $function = 'MID'; + $args = 3; + + break; + case 32: + $function = 'LEN'; + $args = 1; + + break; + case 33: + $function = 'VALUE'; + $args = 1; + + break; + case 34: + $function = 'TRUE'; + $args = 0; + + break; + case 35: + $function = 'FALSE'; + $args = 0; + + break; + case 38: + $function = 'NOT'; + $args = 1; + + break; + case 39: + $function = 'MOD'; + $args = 2; + + break; + case 40: + $function = 'DCOUNT'; + $args = 3; + + break; + case 41: + $function = 'DSUM'; + $args = 3; + + break; + case 42: + $function = 'DAVERAGE'; + $args = 3; + + break; + case 43: + $function = 'DMIN'; + $args = 3; + + break; + case 44: + $function = 'DMAX'; + $args = 3; + + break; + case 45: + $function = 'DSTDEV'; + $args = 3; + + break; + case 48: + $function = 'TEXT'; + $args = 2; + + break; + case 61: + $function = 'MIRR'; + $args = 3; + + break; + case 63: + $function = 'RAND'; + $args = 0; + + break; + case 65: + $function = 'DATE'; + $args = 3; + + break; + case 66: + $function = 'TIME'; + $args = 3; + + break; + case 67: + $function = 'DAY'; + $args = 1; + + break; + case 68: + $function = 'MONTH'; + $args = 1; + + break; + case 69: + $function = 'YEAR'; + $args = 1; + + break; + case 71: + $function = 'HOUR'; + $args = 1; + + break; + case 72: + $function = 'MINUTE'; + $args = 1; + + break; + case 73: + $function = 'SECOND'; + $args = 1; + + break; + case 74: + $function = 'NOW'; + $args = 0; + + break; + case 75: + $function = 'AREAS'; + $args = 1; + + break; + case 76: + $function = 'ROWS'; + $args = 1; + + break; + case 77: + $function = 'COLUMNS'; + $args = 1; + + break; + case 83: + $function = 'TRANSPOSE'; + $args = 1; + + break; + case 86: + $function = 'TYPE'; + $args = 1; + + break; + case 97: + $function = 'ATAN2'; + $args = 2; + + break; + case 98: + $function = 'ASIN'; + $args = 1; + + break; + case 99: + $function = 'ACOS'; + $args = 1; + + break; + case 105: + $function = 'ISREF'; + $args = 1; + + break; + case 111: + $function = 'CHAR'; + $args = 1; + + break; + case 112: + $function = 'LOWER'; + $args = 1; + + break; + case 113: + $function = 'UPPER'; + $args = 1; + + break; + case 114: + $function = 'PROPER'; + $args = 1; + + break; + case 117: + $function = 'EXACT'; + $args = 2; + + break; + case 118: + $function = 'TRIM'; + $args = 1; + + break; + case 119: + $function = 'REPLACE'; + $args = 4; + + break; + case 121: + $function = 'CODE'; + $args = 1; + + break; + case 126: + $function = 'ISERR'; + $args = 1; + + break; + case 127: + $function = 'ISTEXT'; + $args = 1; + + break; + case 128: + $function = 'ISNUMBER'; + $args = 1; + + break; + case 129: + $function = 'ISBLANK'; + $args = 1; + + break; + case 130: + $function = 'T'; + $args = 1; + + break; + case 131: + $function = 'N'; + $args = 1; + + break; + case 140: + $function = 'DATEVALUE'; + $args = 1; + + break; + case 141: + $function = 'TIMEVALUE'; + $args = 1; + + break; + case 142: + $function = 'SLN'; + $args = 3; + + break; + case 143: + $function = 'SYD'; + $args = 4; + + break; + case 162: + $function = 'CLEAN'; + $args = 1; + + break; + case 163: + $function = 'MDETERM'; + $args = 1; + + break; + case 164: + $function = 'MINVERSE'; + $args = 1; + + break; + case 165: + $function = 'MMULT'; + $args = 2; + + break; + case 184: + $function = 'FACT'; + $args = 1; + + break; + case 189: + $function = 'DPRODUCT'; + $args = 3; + + break; + case 190: + $function = 'ISNONTEXT'; + $args = 1; + + break; + case 195: + $function = 'DSTDEVP'; + $args = 3; + + break; + case 196: + $function = 'DVARP'; + $args = 3; + + break; + case 198: + $function = 'ISLOGICAL'; + $args = 1; + + break; + case 199: + $function = 'DCOUNTA'; + $args = 3; + + break; + case 207: + $function = 'REPLACEB'; + $args = 4; + + break; + case 210: + $function = 'MIDB'; + $args = 3; + + break; + case 211: + $function = 'LENB'; + $args = 1; + + break; + case 212: + $function = 'ROUNDUP'; + $args = 2; + + break; + case 213: + $function = 'ROUNDDOWN'; + $args = 2; + + break; + case 214: + $function = 'ASC'; + $args = 1; + + break; + case 215: + $function = 'DBCS'; + $args = 1; + + break; + case 221: + $function = 'TODAY'; + $args = 0; + + break; + case 229: + $function = 'SINH'; + $args = 1; + + break; + case 230: + $function = 'COSH'; + $args = 1; + + break; + case 231: + $function = 'TANH'; + $args = 1; + + break; + case 232: + $function = 'ASINH'; + $args = 1; + + break; + case 233: + $function = 'ACOSH'; + $args = 1; + + break; + case 234: + $function = 'ATANH'; + $args = 1; + + break; + case 235: + $function = 'DGET'; + $args = 3; + + break; + case 244: + $function = 'INFO'; + $args = 1; + + break; + case 252: + $function = 'FREQUENCY'; + $args = 2; + + break; + case 261: + $function = 'ERROR.TYPE'; + $args = 1; + + break; + case 271: + $function = 'GAMMALN'; + $args = 1; + + break; + case 273: + $function = 'BINOMDIST'; + $args = 4; + + break; + case 274: + $function = 'CHIDIST'; + $args = 2; + + break; + case 275: + $function = 'CHIINV'; + $args = 2; + + break; + case 276: + $function = 'COMBIN'; + $args = 2; + + break; + case 277: + $function = 'CONFIDENCE'; + $args = 3; + + break; + case 278: + $function = 'CRITBINOM'; + $args = 3; + + break; + case 279: + $function = 'EVEN'; + $args = 1; + + break; + case 280: + $function = 'EXPONDIST'; + $args = 3; + + break; + case 281: + $function = 'FDIST'; + $args = 3; + + break; + case 282: + $function = 'FINV'; + $args = 3; + + break; + case 283: + $function = 'FISHER'; + $args = 1; + + break; + case 284: + $function = 'FISHERINV'; + $args = 1; + + break; + case 285: + $function = 'FLOOR'; + $args = 2; + + break; + case 286: + $function = 'GAMMADIST'; + $args = 4; + + break; + case 287: + $function = 'GAMMAINV'; + $args = 3; + + break; + case 288: + $function = 'CEILING'; + $args = 2; + + break; + case 289: + $function = 'HYPGEOMDIST'; + $args = 4; + + break; + case 290: + $function = 'LOGNORMDIST'; + $args = 3; + + break; + case 291: + $function = 'LOGINV'; + $args = 3; + + break; + case 292: + $function = 'NEGBINOMDIST'; + $args = 3; + + break; + case 293: + $function = 'NORMDIST'; + $args = 4; + + break; + case 294: + $function = 'NORMSDIST'; + $args = 1; + + break; + case 295: + $function = 'NORMINV'; + $args = 3; + + break; + case 296: + $function = 'NORMSINV'; + $args = 1; + + break; + case 297: + $function = 'STANDARDIZE'; + $args = 3; + + break; + case 298: + $function = 'ODD'; + $args = 1; + + break; + case 299: + $function = 'PERMUT'; + $args = 2; + + break; + case 300: + $function = 'POISSON'; + $args = 3; + + break; + case 301: + $function = 'TDIST'; + $args = 3; + + break; + case 302: + $function = 'WEIBULL'; + $args = 4; + + break; + case 303: + $function = 'SUMXMY2'; + $args = 2; + + break; + case 304: + $function = 'SUMX2MY2'; + $args = 2; + + break; + case 305: + $function = 'SUMX2PY2'; + $args = 2; + + break; + case 306: + $function = 'CHITEST'; + $args = 2; + + break; + case 307: + $function = 'CORREL'; + $args = 2; + + break; + case 308: + $function = 'COVAR'; + $args = 2; + + break; + case 309: + $function = 'FORECAST'; + $args = 3; + + break; + case 310: + $function = 'FTEST'; + $args = 2; + + break; + case 311: + $function = 'INTERCEPT'; + $args = 2; + + break; + case 312: + $function = 'PEARSON'; + $args = 2; + + break; + case 313: + $function = 'RSQ'; + $args = 2; + + break; + case 314: + $function = 'STEYX'; + $args = 2; + + break; + case 315: + $function = 'SLOPE'; + $args = 2; + + break; + case 316: + $function = 'TTEST'; + $args = 4; + + break; + case 325: + $function = 'LARGE'; + $args = 2; + + break; + case 326: + $function = 'SMALL'; + $args = 2; + + break; + case 327: + $function = 'QUARTILE'; + $args = 2; + + break; + case 328: + $function = 'PERCENTILE'; + $args = 2; + + break; + case 331: + $function = 'TRIMMEAN'; + $args = 2; + + break; + case 332: + $function = 'TINV'; + $args = 2; + + break; + case 337: + $function = 'POWER'; + $args = 2; + + break; + case 342: + $function = 'RADIANS'; + $args = 1; + + break; + case 343: + $function = 'DEGREES'; + $args = 1; + + break; + case 346: + $function = 'COUNTIF'; + $args = 2; + + break; + case 347: + $function = 'COUNTBLANK'; + $args = 1; + + break; + case 350: + $function = 'ISPMT'; + $args = 4; + + break; + case 351: + $function = 'DATEDIF'; + $args = 3; + + break; + case 352: + $function = 'DATESTRING'; + $args = 1; + + break; + case 353: + $function = 'NUMBERSTRING'; + $args = 2; + + break; + case 360: + $function = 'PHONETIC'; + $args = 1; + + break; + case 368: + $function = 'BAHTTEXT'; + $args = 1; + + break; + default: + throw new Exception('Unrecognized function in formula'); + + break; + } + $data = ['function' => $function, 'args' => $args]; + + break; + case 0x22: // function with variable number of arguments + case 0x42: + case 0x62: + $name = 'tFuncV'; + $size = 4; + // offset: 1; size: 1; number of arguments + $args = ord($formulaData[1]); + // offset: 2: size: 2; index to built-in sheet function + $index = self::getUInt2d($formulaData, 2); + switch ($index) { + case 0: + $function = 'COUNT'; + + break; + case 1: + $function = 'IF'; + + break; + case 4: + $function = 'SUM'; + + break; + case 5: + $function = 'AVERAGE'; + + break; + case 6: + $function = 'MIN'; + + break; + case 7: + $function = 'MAX'; + + break; + case 8: + $function = 'ROW'; + + break; + case 9: + $function = 'COLUMN'; + + break; + case 11: + $function = 'NPV'; + + break; + case 12: + $function = 'STDEV'; + + break; + case 13: + $function = 'DOLLAR'; + + break; + case 14: + $function = 'FIXED'; + + break; + case 28: + $function = 'LOOKUP'; + + break; + case 29: + $function = 'INDEX'; + + break; + case 36: + $function = 'AND'; + + break; + case 37: + $function = 'OR'; + + break; + case 46: + $function = 'VAR'; + + break; + case 49: + $function = 'LINEST'; + + break; + case 50: + $function = 'TREND'; + + break; + case 51: + $function = 'LOGEST'; + + break; + case 52: + $function = 'GROWTH'; + + break; + case 56: + $function = 'PV'; + + break; + case 57: + $function = 'FV'; + + break; + case 58: + $function = 'NPER'; + + break; + case 59: + $function = 'PMT'; + + break; + case 60: + $function = 'RATE'; + + break; + case 62: + $function = 'IRR'; + + break; + case 64: + $function = 'MATCH'; + + break; + case 70: + $function = 'WEEKDAY'; + + break; + case 78: + $function = 'OFFSET'; + + break; + case 82: + $function = 'SEARCH'; + + break; + case 100: + $function = 'CHOOSE'; + + break; + case 101: + $function = 'HLOOKUP'; + + break; + case 102: + $function = 'VLOOKUP'; + + break; + case 109: + $function = 'LOG'; + + break; + case 115: + $function = 'LEFT'; + + break; + case 116: + $function = 'RIGHT'; + + break; + case 120: + $function = 'SUBSTITUTE'; + + break; + case 124: + $function = 'FIND'; + + break; + case 125: + $function = 'CELL'; + + break; + case 144: + $function = 'DDB'; + + break; + case 148: + $function = 'INDIRECT'; + + break; + case 167: + $function = 'IPMT'; + + break; + case 168: + $function = 'PPMT'; + + break; + case 169: + $function = 'COUNTA'; + + break; + case 183: + $function = 'PRODUCT'; + + break; + case 193: + $function = 'STDEVP'; + + break; + case 194: + $function = 'VARP'; + + break; + case 197: + $function = 'TRUNC'; + + break; + case 204: + $function = 'USDOLLAR'; + + break; + case 205: + $function = 'FINDB'; + + break; + case 206: + $function = 'SEARCHB'; + + break; + case 208: + $function = 'LEFTB'; + + break; + case 209: + $function = 'RIGHTB'; + + break; + case 216: + $function = 'RANK'; + + break; + case 219: + $function = 'ADDRESS'; + + break; + case 220: + $function = 'DAYS360'; + + break; + case 222: + $function = 'VDB'; + + break; + case 227: + $function = 'MEDIAN'; + + break; + case 228: + $function = 'SUMPRODUCT'; + + break; + case 247: + $function = 'DB'; + + break; + case 255: + $function = ''; + + break; + case 269: + $function = 'AVEDEV'; + + break; + case 270: + $function = 'BETADIST'; + + break; + case 272: + $function = 'BETAINV'; + + break; + case 317: + $function = 'PROB'; + + break; + case 318: + $function = 'DEVSQ'; + + break; + case 319: + $function = 'GEOMEAN'; + + break; + case 320: + $function = 'HARMEAN'; + + break; + case 321: + $function = 'SUMSQ'; + + break; + case 322: + $function = 'KURT'; + + break; + case 323: + $function = 'SKEW'; + + break; + case 324: + $function = 'ZTEST'; + + break; + case 329: + $function = 'PERCENTRANK'; + + break; + case 330: + $function = 'MODE'; + + break; + case 336: + $function = 'CONCATENATE'; + + break; + case 344: + $function = 'SUBTOTAL'; + + break; + case 345: + $function = 'SUMIF'; + + break; + case 354: + $function = 'ROMAN'; + + break; + case 358: + $function = 'GETPIVOTDATA'; + + break; + case 359: + $function = 'HYPERLINK'; + + break; + case 361: + $function = 'AVERAGEA'; + + break; + case 362: + $function = 'MAXA'; + + break; + case 363: + $function = 'MINA'; + + break; + case 364: + $function = 'STDEVPA'; + + break; + case 365: + $function = 'VARPA'; + + break; + case 366: + $function = 'STDEVA'; + + break; + case 367: + $function = 'VARA'; + + break; + default: + throw new Exception('Unrecognized function in formula'); + + break; + } + $data = ['function' => $function, 'args' => $args]; + + break; + case 0x23: // index to defined name + case 0x43: + case 0x63: + $name = 'tName'; + $size = 5; + // offset: 1; size: 2; one-based index to definedname record + $definedNameIndex = self::getUInt2d($formulaData, 1) - 1; + // offset: 2; size: 2; not used + $data = $this->definedname[$definedNameIndex]['name']; + + break; + case 0x24: // single cell reference e.g. A5 + case 0x44: + case 0x64: + $name = 'tRef'; + $size = 5; + $data = $this->readBIFF8CellAddress(substr($formulaData, 1, 4)); + + break; + case 0x25: // cell range reference to cells in the same sheet (2d) + case 0x45: + case 0x65: + $name = 'tArea'; + $size = 9; + $data = $this->readBIFF8CellRangeAddress(substr($formulaData, 1, 8)); + + break; + case 0x26: // Constant reference sub-expression + case 0x46: + case 0x66: + $name = 'tMemArea'; + // offset: 1; size: 4; not used + // offset: 5; size: 2; size of the following subexpression + $subSize = self::getUInt2d($formulaData, 5); + $size = 7 + $subSize; + $data = $this->getFormulaFromData(substr($formulaData, 7, $subSize)); + + break; + case 0x27: // Deleted constant reference sub-expression + case 0x47: + case 0x67: + $name = 'tMemErr'; + // offset: 1; size: 4; not used + // offset: 5; size: 2; size of the following subexpression + $subSize = self::getUInt2d($formulaData, 5); + $size = 7 + $subSize; + $data = $this->getFormulaFromData(substr($formulaData, 7, $subSize)); + + break; + case 0x29: // Variable reference sub-expression + case 0x49: + case 0x69: + $name = 'tMemFunc'; + // offset: 1; size: 2; size of the following sub-expression + $subSize = self::getUInt2d($formulaData, 1); + $size = 3 + $subSize; + $data = $this->getFormulaFromData(substr($formulaData, 3, $subSize)); + + break; + case 0x2C: // Relative 2d cell reference reference, used in shared formulas and some other places + case 0x4C: + case 0x6C: + $name = 'tRefN'; + $size = 5; + $data = $this->readBIFF8CellAddressB(substr($formulaData, 1, 4), $baseCell); + + break; + case 0x2D: // Relative 2d range reference + case 0x4D: + case 0x6D: + $name = 'tAreaN'; + $size = 9; + $data = $this->readBIFF8CellRangeAddressB(substr($formulaData, 1, 8), $baseCell); + + break; + case 0x39: // External name + case 0x59: + case 0x79: + $name = 'tNameX'; + $size = 7; + // offset: 1; size: 2; index to REF entry in EXTERNSHEET record + // offset: 3; size: 2; one-based index to DEFINEDNAME or EXTERNNAME record + $index = self::getUInt2d($formulaData, 3); + // assume index is to EXTERNNAME record + $data = $this->externalNames[$index - 1]['name']; + // offset: 5; size: 2; not used + break; + case 0x3A: // 3d reference to cell + case 0x5A: + case 0x7A: + $name = 'tRef3d'; + $size = 7; + + try { + // offset: 1; size: 2; index to REF entry + $sheetRange = $this->readSheetRangeByRefIndex(self::getUInt2d($formulaData, 1)); + // offset: 3; size: 4; cell address + $cellAddress = $this->readBIFF8CellAddress(substr($formulaData, 3, 4)); + + $data = "$sheetRange!$cellAddress"; + } catch (PhpSpreadsheetException $e) { + // deleted sheet reference + $data = '#REF!'; + } + + break; + case 0x3B: // 3d reference to cell range + case 0x5B: + case 0x7B: + $name = 'tArea3d'; + $size = 11; + + try { + // offset: 1; size: 2; index to REF entry + $sheetRange = $this->readSheetRangeByRefIndex(self::getUInt2d($formulaData, 1)); + // offset: 3; size: 8; cell address + $cellRangeAddress = $this->readBIFF8CellRangeAddress(substr($formulaData, 3, 8)); + + $data = "$sheetRange!$cellRangeAddress"; + } catch (PhpSpreadsheetException $e) { + // deleted sheet reference + $data = '#REF!'; + } + + break; + // Unknown cases // don't know how to deal with + default: + throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula'); + + break; + } + + return [ + 'id' => $id, + 'name' => $name, + 'size' => $size, + 'data' => $data, + ]; + } + + /** + * Reads a cell address in BIFF8 e.g. 'A2' or '$A$2' + * section 3.3.4. + * + * @param string $cellAddressStructure + * + * @return string + */ + private function readBIFF8CellAddress($cellAddressStructure) + { + // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767)) + $row = self::getUInt2d($cellAddressStructure, 0) + 1; + + // offset: 2; size: 2; index to column or column offset + relative flags + // bit: 7-0; mask 0x00FF; column index + $column = Coordinate::stringFromColumnIndex((0x00FF & self::getUInt2d($cellAddressStructure, 2)) + 1); + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & self::getUInt2d($cellAddressStructure, 2))) { + $column = '$' . $column; + } + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & self::getUInt2d($cellAddressStructure, 2))) { + $row = '$' . $row; + } + + return $column . $row; + } + + /** + * Reads a cell address in BIFF8 for shared formulas. Uses positive and negative values for row and column + * to indicate offsets from a base cell + * section 3.3.4. + * + * @param string $cellAddressStructure + * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas + * + * @return string + */ + private function readBIFF8CellAddressB($cellAddressStructure, $baseCell = 'A1') + { + [$baseCol, $baseRow] = Coordinate::coordinateFromString($baseCell); + $baseCol = Coordinate::columnIndexFromString($baseCol) - 1; + + // offset: 0; size: 2; index to row (0... 65535) (or offset (-32768... 32767)) + $rowIndex = self::getUInt2d($cellAddressStructure, 0); + $row = self::getUInt2d($cellAddressStructure, 0) + 1; + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & self::getUInt2d($cellAddressStructure, 2))) { + // offset: 2; size: 2; index to column or column offset + relative flags + // bit: 7-0; mask 0x00FF; column index + $colIndex = 0x00FF & self::getUInt2d($cellAddressStructure, 2); + + $column = Coordinate::stringFromColumnIndex($colIndex + 1); + $column = '$' . $column; + } else { + // offset: 2; size: 2; index to column or column offset + relative flags + // bit: 7-0; mask 0x00FF; column index + $relativeColIndex = 0x00FF & self::getInt2d($cellAddressStructure, 2); + $colIndex = $baseCol + $relativeColIndex; + $colIndex = ($colIndex < 256) ? $colIndex : $colIndex - 256; + $colIndex = ($colIndex >= 0) ? $colIndex : $colIndex + 256; + $column = Coordinate::stringFromColumnIndex($colIndex + 1); + } + + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & self::getUInt2d($cellAddressStructure, 2))) { + $row = '$' . $row; + } else { + $rowIndex = ($rowIndex <= 32767) ? $rowIndex : $rowIndex - 65536; + $row = $baseRow + $rowIndex; + } + + return $column . $row; + } + + /** + * Reads a cell range address in BIFF5 e.g. 'A2:B6' or 'A1' + * always fixed range + * section 2.5.14. + * + * @param string $subData + * + * @throws Exception + * + * @return string + */ + private function readBIFF5CellRangeAddressFixed($subData) + { + // offset: 0; size: 2; index to first row + $fr = self::getUInt2d($subData, 0) + 1; + + // offset: 2; size: 2; index to last row + $lr = self::getUInt2d($subData, 2) + 1; + + // offset: 4; size: 1; index to first column + $fc = ord($subData[4]); + + // offset: 5; size: 1; index to last column + $lc = ord($subData[5]); + + // check values + if ($fr > $lr || $fc > $lc) { + throw new Exception('Not a cell range address'); + } + + // column index to letter + $fc = Coordinate::stringFromColumnIndex($fc + 1); + $lc = Coordinate::stringFromColumnIndex($lc + 1); + + if ($fr == $lr and $fc == $lc) { + return "$fc$fr"; + } + + return "$fc$fr:$lc$lr"; + } + + /** + * Reads a cell range address in BIFF8 e.g. 'A2:B6' or 'A1' + * always fixed range + * section 2.5.14. + * + * @param string $subData + * + * @throws Exception + * + * @return string + */ + private function readBIFF8CellRangeAddressFixed($subData) + { + // offset: 0; size: 2; index to first row + $fr = self::getUInt2d($subData, 0) + 1; + + // offset: 2; size: 2; index to last row + $lr = self::getUInt2d($subData, 2) + 1; + + // offset: 4; size: 2; index to first column + $fc = self::getUInt2d($subData, 4); + + // offset: 6; size: 2; index to last column + $lc = self::getUInt2d($subData, 6); + + // check values + if ($fr > $lr || $fc > $lc) { + throw new Exception('Not a cell range address'); + } + + // column index to letter + $fc = Coordinate::stringFromColumnIndex($fc + 1); + $lc = Coordinate::stringFromColumnIndex($lc + 1); + + if ($fr == $lr and $fc == $lc) { + return "$fc$fr"; + } + + return "$fc$fr:$lc$lr"; + } + + /** + * Reads a cell range address in BIFF8 e.g. 'A2:B6' or '$A$2:$B$6' + * there are flags indicating whether column/row index is relative + * section 3.3.4. + * + * @param string $subData + * + * @return string + */ + private function readBIFF8CellRangeAddress($subData) + { + // todo: if cell range is just a single cell, should this funciton + // not just return e.g. 'A1' and not 'A1:A1' ? + + // offset: 0; size: 2; index to first row (0... 65535) (or offset (-32768... 32767)) + $fr = self::getUInt2d($subData, 0) + 1; + + // offset: 2; size: 2; index to last row (0... 65535) (or offset (-32768... 32767)) + $lr = self::getUInt2d($subData, 2) + 1; + + // offset: 4; size: 2; index to first column or column offset + relative flags + + // bit: 7-0; mask 0x00FF; column index + $fc = Coordinate::stringFromColumnIndex((0x00FF & self::getUInt2d($subData, 4)) + 1); + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & self::getUInt2d($subData, 4))) { + $fc = '$' . $fc; + } + + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & self::getUInt2d($subData, 4))) { + $fr = '$' . $fr; + } + + // offset: 6; size: 2; index to last column or column offset + relative flags + + // bit: 7-0; mask 0x00FF; column index + $lc = Coordinate::stringFromColumnIndex((0x00FF & self::getUInt2d($subData, 6)) + 1); + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & self::getUInt2d($subData, 6))) { + $lc = '$' . $lc; + } + + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & self::getUInt2d($subData, 6))) { + $lr = '$' . $lr; + } + + return "$fc$fr:$lc$lr"; + } + + /** + * Reads a cell range address in BIFF8 for shared formulas. Uses positive and negative values for row and column + * to indicate offsets from a base cell + * section 3.3.4. + * + * @param string $subData + * @param string $baseCell Base cell + * + * @return string Cell range address + */ + private function readBIFF8CellRangeAddressB($subData, $baseCell = 'A1') + { + [$baseCol, $baseRow] = Coordinate::coordinateFromString($baseCell); + $baseCol = Coordinate::columnIndexFromString($baseCol) - 1; + + // TODO: if cell range is just a single cell, should this funciton + // not just return e.g. 'A1' and not 'A1:A1' ? + + // offset: 0; size: 2; first row + $frIndex = self::getUInt2d($subData, 0); // adjust below + + // offset: 2; size: 2; relative index to first row (0... 65535) should be treated as offset (-32768... 32767) + $lrIndex = self::getUInt2d($subData, 2); // adjust below + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & self::getUInt2d($subData, 4))) { + // absolute column index + // offset: 4; size: 2; first column with relative/absolute flags + // bit: 7-0; mask 0x00FF; column index + $fcIndex = 0x00FF & self::getUInt2d($subData, 4); + $fc = Coordinate::stringFromColumnIndex($fcIndex + 1); + $fc = '$' . $fc; + } else { + // column offset + // offset: 4; size: 2; first column with relative/absolute flags + // bit: 7-0; mask 0x00FF; column index + $relativeFcIndex = 0x00FF & self::getInt2d($subData, 4); + $fcIndex = $baseCol + $relativeFcIndex; + $fcIndex = ($fcIndex < 256) ? $fcIndex : $fcIndex - 256; + $fcIndex = ($fcIndex >= 0) ? $fcIndex : $fcIndex + 256; + $fc = Coordinate::stringFromColumnIndex($fcIndex + 1); + } + + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & self::getUInt2d($subData, 4))) { + // absolute row index + $fr = $frIndex + 1; + $fr = '$' . $fr; + } else { + // row offset + $frIndex = ($frIndex <= 32767) ? $frIndex : $frIndex - 65536; + $fr = $baseRow + $frIndex; + } + + // bit: 14; mask 0x4000; (1 = relative column index, 0 = absolute column index) + if (!(0x4000 & self::getUInt2d($subData, 6))) { + // absolute column index + // offset: 6; size: 2; last column with relative/absolute flags + // bit: 7-0; mask 0x00FF; column index + $lcIndex = 0x00FF & self::getUInt2d($subData, 6); + $lc = Coordinate::stringFromColumnIndex($lcIndex + 1); + $lc = '$' . $lc; + } else { + // column offset + // offset: 4; size: 2; first column with relative/absolute flags + // bit: 7-0; mask 0x00FF; column index + $relativeLcIndex = 0x00FF & self::getInt2d($subData, 4); + $lcIndex = $baseCol + $relativeLcIndex; + $lcIndex = ($lcIndex < 256) ? $lcIndex : $lcIndex - 256; + $lcIndex = ($lcIndex >= 0) ? $lcIndex : $lcIndex + 256; + $lc = Coordinate::stringFromColumnIndex($lcIndex + 1); + } + + // bit: 15; mask 0x8000; (1 = relative row index, 0 = absolute row index) + if (!(0x8000 & self::getUInt2d($subData, 6))) { + // absolute row index + $lr = $lrIndex + 1; + $lr = '$' . $lr; + } else { + // row offset + $lrIndex = ($lrIndex <= 32767) ? $lrIndex : $lrIndex - 65536; + $lr = $baseRow + $lrIndex; + } + + return "$fc$fr:$lc$lr"; + } + + /** + * Read BIFF8 cell range address list + * section 2.5.15. + * + * @param string $subData + * + * @return array + */ + private function readBIFF8CellRangeAddressList($subData) + { + $cellRangeAddresses = []; + + // offset: 0; size: 2; number of the following cell range addresses + $nm = self::getUInt2d($subData, 0); + + $offset = 2; + // offset: 2; size: 8 * $nm; list of $nm (fixed) cell range addresses + for ($i = 0; $i < $nm; ++$i) { + $cellRangeAddresses[] = $this->readBIFF8CellRangeAddressFixed(substr($subData, $offset, 8)); + $offset += 8; + } + + return [ + 'size' => 2 + 8 * $nm, + 'cellRangeAddresses' => $cellRangeAddresses, + ]; + } + + /** + * Read BIFF5 cell range address list + * section 2.5.15. + * + * @param string $subData + * + * @return array + */ + private function readBIFF5CellRangeAddressList($subData) + { + $cellRangeAddresses = []; + + // offset: 0; size: 2; number of the following cell range addresses + $nm = self::getUInt2d($subData, 0); + + $offset = 2; + // offset: 2; size: 6 * $nm; list of $nm (fixed) cell range addresses + for ($i = 0; $i < $nm; ++$i) { + $cellRangeAddresses[] = $this->readBIFF5CellRangeAddressFixed(substr($subData, $offset, 6)); + $offset += 6; + } + + return [ + 'size' => 2 + 6 * $nm, + 'cellRangeAddresses' => $cellRangeAddresses, + ]; + } + + /** + * Get a sheet range like Sheet1:Sheet3 from REF index + * Note: If there is only one sheet in the range, one gets e.g Sheet1 + * It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets, + * in which case an Exception is thrown. + * + * @param int $index + * + * @throws Exception + * + * @return false|string + */ + private function readSheetRangeByRefIndex($index) + { + if (isset($this->ref[$index])) { + $type = $this->externalBooks[$this->ref[$index]['externalBookIndex']]['type']; + + switch ($type) { + case 'internal': + // check if we have a deleted 3d reference + if ($this->ref[$index]['firstSheetIndex'] == 0xFFFF or $this->ref[$index]['lastSheetIndex'] == 0xFFFF) { + throw new Exception('Deleted sheet reference'); + } + + // we have normal sheet range (collapsed or uncollapsed) + $firstSheetName = $this->sheets[$this->ref[$index]['firstSheetIndex']]['name']; + $lastSheetName = $this->sheets[$this->ref[$index]['lastSheetIndex']]['name']; + + if ($firstSheetName == $lastSheetName) { + // collapsed sheet range + $sheetRange = $firstSheetName; + } else { + $sheetRange = "$firstSheetName:$lastSheetName"; + } + + // escape the single-quotes + $sheetRange = str_replace("'", "''", $sheetRange); + + // if there are special characters, we need to enclose the range in single-quotes + // todo: check if we have identified the whole set of special characters + // it seems that the following characters are not accepted for sheet names + // and we may assume that they are not present: []*/:\? + if (preg_match("/[ !\"@#£$%&{()}<>=+'|^,;-]/u", $sheetRange)) { + $sheetRange = "'$sheetRange'"; + } + + return $sheetRange; + + break; + default: + // TODO: external sheet support + throw new Exception('Xls reader only supports internal sheets in formulas'); + + break; + } + } + + return false; + } + + /** + * read BIFF8 constant value array from array data + * returns e.g. ['value' => '{1,2;3,4}', 'size' => 40] + * section 2.5.8. + * + * @param string $arrayData + * + * @return array + */ + private static function readBIFF8ConstantArray($arrayData) + { + // offset: 0; size: 1; number of columns decreased by 1 + $nc = ord($arrayData[0]); + + // offset: 1; size: 2; number of rows decreased by 1 + $nr = self::getUInt2d($arrayData, 1); + $size = 3; // initialize + $arrayData = substr($arrayData, 3); + + // offset: 3; size: var; list of ($nc + 1) * ($nr + 1) constant values + $matrixChunks = []; + for ($r = 1; $r <= $nr + 1; ++$r) { + $items = []; + for ($c = 1; $c <= $nc + 1; ++$c) { + $constant = self::readBIFF8Constant($arrayData); + $items[] = $constant['value']; + $arrayData = substr($arrayData, $constant['size']); + $size += $constant['size']; + } + $matrixChunks[] = implode(',', $items); // looks like e.g. '1,"hello"' + } + $matrix = '{' . implode(';', $matrixChunks) . '}'; + + return [ + 'value' => $matrix, + 'size' => $size, + ]; + } + + /** + * read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value' + * section 2.5.7 + * returns e.g. ['value' => '5', 'size' => 9]. + * + * @param string $valueData + * + * @return array + */ + private static function readBIFF8Constant($valueData) + { + // offset: 0; size: 1; identifier for type of constant + $identifier = ord($valueData[0]); + + switch ($identifier) { + case 0x00: // empty constant (what is this?) + $value = ''; + $size = 9; + + break; + case 0x01: // number + // offset: 1; size: 8; IEEE 754 floating-point value + $value = self::extractNumber(substr($valueData, 1, 8)); + $size = 9; + + break; + case 0x02: // string value + // offset: 1; size: var; Unicode string, 16-bit string length + $string = self::readUnicodeStringLong(substr($valueData, 1)); + $value = '"' . $string['value'] . '"'; + $size = 1 + $string['size']; + + break; + case 0x04: // boolean + // offset: 1; size: 1; 0 = FALSE, 1 = TRUE + if (ord($valueData[1])) { + $value = 'TRUE'; + } else { + $value = 'FALSE'; + } + $size = 9; + + break; + case 0x10: // error code + // offset: 1; size: 1; error code + $value = Xls\ErrorCode::lookup(ord($valueData[1])); + $size = 9; + + break; + } + + return [ + 'value' => $value, + 'size' => $size, + ]; + } + + /** + * Extract RGB color + * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4. + * + * @param string $rgb Encoded RGB value (4 bytes) + * + * @return array + */ + private static function readRGB($rgb) + { + // offset: 0; size 1; Red component + $r = ord($rgb[0]); + + // offset: 1; size: 1; Green component + $g = ord($rgb[1]); + + // offset: 2; size: 1; Blue component + $b = ord($rgb[2]); + + // HEX notation, e.g. 'FF00FC' + $rgb = sprintf('%02X%02X%02X', $r, $g, $b); + + return ['rgb' => $rgb]; + } + + /** + * Read byte string (8-bit string length) + * OpenOffice documentation: 2.5.2. + * + * @param string $subData + * + * @return array + */ + private function readByteStringShort($subData) + { + // offset: 0; size: 1; length of the string (character count) + $ln = ord($subData[0]); + + // offset: 1: size: var; character array (8-bit characters) + $value = $this->decodeCodepage(substr($subData, 1, $ln)); + + return [ + 'value' => $value, + 'size' => 1 + $ln, // size in bytes of data structure + ]; + } + + /** + * Read byte string (16-bit string length) + * OpenOffice documentation: 2.5.2. + * + * @param string $subData + * + * @return array + */ + private function readByteStringLong($subData) + { + // offset: 0; size: 2; length of the string (character count) + $ln = self::getUInt2d($subData, 0); + + // offset: 2: size: var; character array (8-bit characters) + $value = $this->decodeCodepage(substr($subData, 2)); + + //return $string; + return [ + 'value' => $value, + 'size' => 2 + $ln, // size in bytes of data structure + ]; + } + + /** + * Extracts an Excel Unicode short string (8-bit string length) + * OpenOffice documentation: 2.5.3 + * function will automatically find out where the Unicode string ends. + * + * @param string $subData + * + * @return array + */ + private static function readUnicodeStringShort($subData) + { + $value = ''; + + // offset: 0: size: 1; length of the string (character count) + $characterCount = ord($subData[0]); + + $string = self::readUnicodeString(substr($subData, 1), $characterCount); + + // add 1 for the string length + $string['size'] += 1; + + return $string; + } + + /** + * Extracts an Excel Unicode long string (16-bit string length) + * OpenOffice documentation: 2.5.3 + * this function is under construction, needs to support rich text, and Asian phonetic settings. + * + * @param string $subData + * + * @return array + */ + private static function readUnicodeStringLong($subData) + { + $value = ''; + + // offset: 0: size: 2; length of the string (character count) + $characterCount = self::getUInt2d($subData, 0); + + $string = self::readUnicodeString(substr($subData, 2), $characterCount); + + // add 2 for the string length + $string['size'] += 2; + + return $string; + } + + /** + * Read Unicode string with no string length field, but with known character count + * this function is under construction, needs to support rich text, and Asian phonetic settings + * OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.3. + * + * @param string $subData + * @param int $characterCount + * + * @return array + */ + private static function readUnicodeString($subData, $characterCount) + { + $value = ''; + + // offset: 0: size: 1; option flags + // bit: 0; mask: 0x01; character compression (0 = compressed 8-bit, 1 = uncompressed 16-bit) + $isCompressed = !((0x01 & ord($subData[0])) >> 0); + + // bit: 2; mask: 0x04; Asian phonetic settings + $hasAsian = (0x04) & ord($subData[0]) >> 2; + + // bit: 3; mask: 0x08; Rich-Text settings + $hasRichText = (0x08) & ord($subData[0]) >> 3; + + // offset: 1: size: var; character array + // this offset assumes richtext and Asian phonetic settings are off which is generally wrong + // needs to be fixed + $value = self::encodeUTF16(substr($subData, 1, $isCompressed ? $characterCount : 2 * $characterCount), $isCompressed); + + return [ + 'value' => $value, + 'size' => $isCompressed ? 1 + $characterCount : 1 + 2 * $characterCount, // the size in bytes including the option flags + ]; + } + + /** + * Convert UTF-8 string to string surounded by double quotes. Used for explicit string tokens in formulas. + * Example: hello"world --> "hello""world". + * + * @param string $value UTF-8 encoded string + * + * @return string + */ + private static function UTF8toExcelDoubleQuoted($value) + { + return '"' . str_replace('"', '""', $value) . '"'; + } + + /** + * Reads first 8 bytes of a string and return IEEE 754 float. + * + * @param string $data Binary string that is at least 8 bytes long + * + * @return float + */ + private static function extractNumber($data) + { + $rknumhigh = self::getInt4d($data, 4); + $rknumlow = self::getInt4d($data, 0); + $sign = ($rknumhigh & 0x80000000) >> 31; + $exp = (($rknumhigh & 0x7ff00000) >> 20) - 1023; + $mantissa = (0x100000 | ($rknumhigh & 0x000fffff)); + $mantissalow1 = ($rknumlow & 0x80000000) >> 31; + $mantissalow2 = ($rknumlow & 0x7fffffff); + $value = $mantissa / pow(2, (20 - $exp)); + + if ($mantissalow1 != 0) { + $value += 1 / pow(2, (21 - $exp)); + } + + $value += $mantissalow2 / pow(2, (52 - $exp)); + if ($sign) { + $value *= -1; + } + + return $value; + } + + /** + * @param int $rknum + * + * @return float + */ + private static function getIEEE754($rknum) + { + if (($rknum & 0x02) != 0) { + $value = $rknum >> 2; + } else { + // changes by mmp, info on IEEE754 encoding from + // research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html + // The RK format calls for using only the most significant 30 bits + // of the 64 bit floating point value. The other 34 bits are assumed + // to be 0 so we use the upper 30 bits of $rknum as follows... + $sign = ($rknum & 0x80000000) >> 31; + $exp = ($rknum & 0x7ff00000) >> 20; + $mantissa = (0x100000 | ($rknum & 0x000ffffc)); + $value = $mantissa / pow(2, (20 - ($exp - 1023))); + if ($sign) { + $value = -1 * $value; + } + //end of changes by mmp + } + if (($rknum & 0x01) != 0) { + $value /= 100; + } + + return $value; + } + + /** + * Get UTF-8 string from (compressed or uncompressed) UTF-16 string. + * + * @param string $string + * @param bool $compressed + * + * @return string + */ + private static function encodeUTF16($string, $compressed = false) + { + if ($compressed) { + $string = self::uncompressByteString($string); + } + + return StringHelper::convertEncoding($string, 'UTF-8', 'UTF-16LE'); + } + + /** + * Convert UTF-16 string in compressed notation to uncompressed form. Only used for BIFF8. + * + * @param string $string + * + * @return string + */ + private static function uncompressByteString($string) + { + $uncompressedString = ''; + $strLen = strlen($string); + for ($i = 0; $i < $strLen; ++$i) { + $uncompressedString .= $string[$i] . "\0"; + } + + return $uncompressedString; + } + + /** + * Convert string to UTF-8. Only used for BIFF5. + * + * @param string $string + * + * @return string + */ + private function decodeCodepage($string) + { + return StringHelper::convertEncoding($string, 'UTF-8', $this->codepage); + } + + /** + * Read 16-bit unsigned integer. + * + * @param string $data + * @param int $pos + * + * @return int + */ + public static function getUInt2d($data, $pos) + { + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); + } + + /** + * Read 16-bit signed integer. + * + * @param string $data + * @param int $pos + * + * @return int + */ + public static function getInt2d($data, $pos) + { + return unpack('s', $data[$pos] . $data[$pos + 1])[1]; + } + + /** + * Read 32-bit signed integer. + * + * @param string $data + * @param int $pos + * + * @return int + */ + public static function getInt4d($data, $pos) + { + // FIX: represent numbers correctly on 64-bit system + // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 + // Changed by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems + $_or_24 = ord($data[$pos + 3]); + if ($_or_24 >= 128) { + // negative number + $_ord_24 = -abs((256 - $_or_24) << 24); + } else { + $_ord_24 = ($_or_24 & 127) << 24; + } + + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24; + } + + private function parseRichText($is) + { + $value = new RichText(); + $value->createText($is); + + return $value; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color.php new file mode 100644 index 0000000..c45f88c --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color.php @@ -0,0 +1,36 @@ + 'FF0000'] + */ + public static function map($color, $palette, $version) + { + if ($color <= 0x07 || $color >= 0x40) { + // special built-in color + return Color\BuiltIn::lookup($color); + } elseif (isset($palette, $palette[$color - 8])) { + // palette color, color index 0x08 maps to pallete index 0 + return $palette[$color - 8]; + } + + // default color table + if ($version == Xls::XLS_BIFF8) { + return Color\BIFF8::lookup($color); + } + + // BIFF5 + return Color\BIFF5::lookup($color); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php new file mode 100644 index 0000000..743d938 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF5.php @@ -0,0 +1,81 @@ + '000000', + 0x09 => 'FFFFFF', + 0x0A => 'FF0000', + 0x0B => '00FF00', + 0x0C => '0000FF', + 0x0D => 'FFFF00', + 0x0E => 'FF00FF', + 0x0F => '00FFFF', + 0x10 => '800000', + 0x11 => '008000', + 0x12 => '000080', + 0x13 => '808000', + 0x14 => '800080', + 0x15 => '008080', + 0x16 => 'C0C0C0', + 0x17 => '808080', + 0x18 => '8080FF', + 0x19 => '802060', + 0x1A => 'FFFFC0', + 0x1B => 'A0E0F0', + 0x1C => '600080', + 0x1D => 'FF8080', + 0x1E => '0080C0', + 0x1F => 'C0C0FF', + 0x20 => '000080', + 0x21 => 'FF00FF', + 0x22 => 'FFFF00', + 0x23 => '00FFFF', + 0x24 => '800080', + 0x25 => '800000', + 0x26 => '008080', + 0x27 => '0000FF', + 0x28 => '00CFFF', + 0x29 => '69FFFF', + 0x2A => 'E0FFE0', + 0x2B => 'FFFF80', + 0x2C => 'A6CAF0', + 0x2D => 'DD9CB3', + 0x2E => 'B38FEE', + 0x2F => 'E3E3E3', + 0x30 => '2A6FF9', + 0x31 => '3FB8CD', + 0x32 => '488436', + 0x33 => '958C41', + 0x34 => '8E5E42', + 0x35 => 'A0627A', + 0x36 => '624FAC', + 0x37 => '969696', + 0x38 => '1D2FBE', + 0x39 => '286676', + 0x3A => '004500', + 0x3B => '453E01', + 0x3C => '6A2813', + 0x3D => '85396A', + 0x3E => '4A3285', + 0x3F => '424242', + ]; + + /** + * Map color array from BIFF5 built-in color index. + * + * @param int $color + * + * @return array + */ + public static function lookup($color) + { + if (isset(self::$map[$color])) { + return ['rgb' => self::$map[$color]]; + } + + return ['rgb' => '000000']; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php new file mode 100644 index 0000000..5c109fb --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BIFF8.php @@ -0,0 +1,81 @@ + '000000', + 0x09 => 'FFFFFF', + 0x0A => 'FF0000', + 0x0B => '00FF00', + 0x0C => '0000FF', + 0x0D => 'FFFF00', + 0x0E => 'FF00FF', + 0x0F => '00FFFF', + 0x10 => '800000', + 0x11 => '008000', + 0x12 => '000080', + 0x13 => '808000', + 0x14 => '800080', + 0x15 => '008080', + 0x16 => 'C0C0C0', + 0x17 => '808080', + 0x18 => '9999FF', + 0x19 => '993366', + 0x1A => 'FFFFCC', + 0x1B => 'CCFFFF', + 0x1C => '660066', + 0x1D => 'FF8080', + 0x1E => '0066CC', + 0x1F => 'CCCCFF', + 0x20 => '000080', + 0x21 => 'FF00FF', + 0x22 => 'FFFF00', + 0x23 => '00FFFF', + 0x24 => '800080', + 0x25 => '800000', + 0x26 => '008080', + 0x27 => '0000FF', + 0x28 => '00CCFF', + 0x29 => 'CCFFFF', + 0x2A => 'CCFFCC', + 0x2B => 'FFFF99', + 0x2C => '99CCFF', + 0x2D => 'FF99CC', + 0x2E => 'CC99FF', + 0x2F => 'FFCC99', + 0x30 => '3366FF', + 0x31 => '33CCCC', + 0x32 => '99CC00', + 0x33 => 'FFCC00', + 0x34 => 'FF9900', + 0x35 => 'FF6600', + 0x36 => '666699', + 0x37 => '969696', + 0x38 => '003366', + 0x39 => '339966', + 0x3A => '003300', + 0x3B => '333300', + 0x3C => '993300', + 0x3D => '993366', + 0x3E => '333399', + 0x3F => '333333', + ]; + + /** + * Map color array from BIFF8 built-in color index. + * + * @param int $color + * + * @return array + */ + public static function lookup($color) + { + if (isset(self::$map[$color])) { + return ['rgb' => self::$map[$color]]; + } + + return ['rgb' => '000000']; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php new file mode 100644 index 0000000..90d50e3 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Color/BuiltIn.php @@ -0,0 +1,35 @@ + '000000', + 0x01 => 'FFFFFF', + 0x02 => 'FF0000', + 0x03 => '00FF00', + 0x04 => '0000FF', + 0x05 => 'FFFF00', + 0x06 => 'FF00FF', + 0x07 => '00FFFF', + 0x40 => '000000', // system window text color + 0x41 => 'FFFFFF', // system window background color + ]; + + /** + * Map built-in color to RGB value. + * + * @param int $color Indexed color + * + * @return array + */ + public static function lookup($color) + { + if (isset(self::$map[$color])) { + return ['rgb' => self::$map[$color]]; + } + + return ['rgb' => '000000']; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php new file mode 100644 index 0000000..7daf723 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/ErrorCode.php @@ -0,0 +1,32 @@ + '#NULL!', + 0x07 => '#DIV/0!', + 0x0F => '#VALUE!', + 0x17 => '#REF!', + 0x1D => '#NAME?', + 0x24 => '#NUM!', + 0x2A => '#N/A', + ]; + + /** + * Map error code, e.g. '#N/A'. + * + * @param int $code + * + * @return bool|string + */ + public static function lookup($code) + { + if (isset(self::$map[$code])) { + return self::$map[$code]; + } + + return false; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Escher.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Escher.php new file mode 100644 index 0000000..858d6bb --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Escher.php @@ -0,0 +1,677 @@ +object = $object; + } + + /** + * Load Escher stream data. May be a partial Escher stream. + * + * @param string $data + * + * @return BSE|BstoreContainer|DgContainer|DggContainer|\PhpOffice\PhpSpreadsheet\Shared\Escher|SpContainer|SpgrContainer + */ + public function load($data) + { + $this->data = $data; + + // total byte size of Excel data (workbook global substream + sheet substreams) + $this->dataSize = strlen($this->data); + + $this->pos = 0; + + // Parse Escher stream + while ($this->pos < $this->dataSize) { + // offset: 2; size: 2: Record Type + $fbt = Xls::getUInt2d($this->data, $this->pos + 2); + + switch ($fbt) { + case self::DGGCONTAINER: + $this->readDggContainer(); + + break; + case self::DGG: + $this->readDgg(); + + break; + case self::BSTORECONTAINER: + $this->readBstoreContainer(); + + break; + case self::BSE: + $this->readBSE(); + + break; + case self::BLIPJPEG: + $this->readBlipJPEG(); + + break; + case self::BLIPPNG: + $this->readBlipPNG(); + + break; + case self::OPT: + $this->readOPT(); + + break; + case self::TERTIARYOPT: + $this->readTertiaryOPT(); + + break; + case self::SPLITMENUCOLORS: + $this->readSplitMenuColors(); + + break; + case self::DGCONTAINER: + $this->readDgContainer(); + + break; + case self::DG: + $this->readDg(); + + break; + case self::SPGRCONTAINER: + $this->readSpgrContainer(); + + break; + case self::SPCONTAINER: + $this->readSpContainer(); + + break; + case self::SPGR: + $this->readSpgr(); + + break; + case self::SP: + $this->readSp(); + + break; + case self::CLIENTTEXTBOX: + $this->readClientTextbox(); + + break; + case self::CLIENTANCHOR: + $this->readClientAnchor(); + + break; + case self::CLIENTDATA: + $this->readClientData(); + + break; + default: + $this->readDefault(); + + break; + } + } + + return $this->object; + } + + /** + * Read a generic record. + */ + private function readDefault() + { + // offset 0; size: 2; recVer and recInstance + $verInstance = Xls::getUInt2d($this->data, $this->pos); + + // offset: 2; size: 2: Record Type + $fbt = Xls::getUInt2d($this->data, $this->pos + 2); + + // bit: 0-3; mask: 0x000F; recVer + $recVer = (0x000F & $verInstance) >> 0; + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read DggContainer record (Drawing Group Container). + */ + private function readDggContainer() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + // record is a container, read contents + $dggContainer = new DggContainer(); + $this->object->setDggContainer($dggContainer); + $reader = new self($dggContainer); + $reader->load($recordData); + } + + /** + * Read Dgg record (Drawing Group). + */ + private function readDgg() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read BstoreContainer record (Blip Store Container). + */ + private function readBstoreContainer() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + // record is a container, read contents + $bstoreContainer = new BstoreContainer(); + $this->object->setBstoreContainer($bstoreContainer); + $reader = new self($bstoreContainer); + $reader->load($recordData); + } + + /** + * Read BSE record. + */ + private function readBSE() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4; + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + // add BSE to BstoreContainer + $BSE = new BSE(); + $this->object->addBSE($BSE); + + $BSE->setBLIPType($recInstance); + + // offset: 0; size: 1; btWin32 (MSOBLIPTYPE) + $btWin32 = ord($recordData[0]); + + // offset: 1; size: 1; btWin32 (MSOBLIPTYPE) + $btMacOS = ord($recordData[1]); + + // offset: 2; size: 16; MD4 digest + $rgbUid = substr($recordData, 2, 16); + + // offset: 18; size: 2; tag + $tag = Xls::getUInt2d($recordData, 18); + + // offset: 20; size: 4; size of BLIP in bytes + $size = Xls::getInt4d($recordData, 20); + + // offset: 24; size: 4; number of references to this BLIP + $cRef = Xls::getInt4d($recordData, 24); + + // offset: 28; size: 4; MSOFO file offset + $foDelay = Xls::getInt4d($recordData, 28); + + // offset: 32; size: 1; unused1 + $unused1 = ord($recordData[32]); + + // offset: 33; size: 1; size of nameData in bytes (including null terminator) + $cbName = ord($recordData[33]); + + // offset: 34; size: 1; unused2 + $unused2 = ord($recordData[34]); + + // offset: 35; size: 1; unused3 + $unused3 = ord($recordData[35]); + + // offset: 36; size: $cbName; nameData + $nameData = substr($recordData, 36, $cbName); + + // offset: 36 + $cbName, size: var; the BLIP data + $blipData = substr($recordData, 36 + $cbName); + + // record is a container, read contents + $reader = new self($BSE); + $reader->load($blipData); + } + + /** + * Read BlipJPEG record. Holds raw JPEG image data. + */ + private function readBlipJPEG() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4; + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + $pos = 0; + + // offset: 0; size: 16; rgbUid1 (MD4 digest of) + $rgbUid1 = substr($recordData, 0, 16); + $pos += 16; + + // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3 + if (in_array($recInstance, [0x046B, 0x06E3])) { + $rgbUid2 = substr($recordData, 16, 16); + $pos += 16; + } + + // offset: var; size: 1; tag + $tag = ord($recordData[$pos]); + $pos += 1; + + // offset: var; size: var; the raw image data + $data = substr($recordData, $pos); + + $blip = new Blip(); + $blip->setData($data); + + $this->object->setBlip($blip); + } + + /** + * Read BlipPNG record. Holds raw PNG image data. + */ + private function readBlipPNG() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4; + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + $pos = 0; + + // offset: 0; size: 16; rgbUid1 (MD4 digest of) + $rgbUid1 = substr($recordData, 0, 16); + $pos += 16; + + // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3 + if ($recInstance == 0x06E1) { + $rgbUid2 = substr($recordData, 16, 16); + $pos += 16; + } + + // offset: var; size: 1; tag + $tag = ord($recordData[$pos]); + $pos += 1; + + // offset: var; size: var; the raw image data + $data = substr($recordData, $pos); + + $blip = new Blip(); + $blip->setData($data); + + $this->object->setBlip($blip); + } + + /** + * Read OPT record. This record may occur within DggContainer record or SpContainer. + */ + private function readOPT() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4; + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + $this->readOfficeArtRGFOPTE($recordData, $recInstance); + } + + /** + * Read TertiaryOPT record. + */ + private function readTertiaryOPT() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4; + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read SplitMenuColors record. + */ + private function readSplitMenuColors() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read DgContainer record (Drawing Container). + */ + private function readDgContainer() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + // record is a container, read contents + $dgContainer = new DgContainer(); + $this->object->setDgContainer($dgContainer); + $reader = new self($dgContainer); + $escher = $reader->load($recordData); + } + + /** + * Read Dg record (Drawing). + */ + private function readDg() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read SpgrContainer record (Shape Group Container). + */ + private function readSpgrContainer() + { + // context is either context DgContainer or SpgrContainer + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + // record is a container, read contents + $spgrContainer = new SpgrContainer(); + + if ($this->object instanceof DgContainer) { + // DgContainer + $this->object->setSpgrContainer($spgrContainer); + } else { + // SpgrContainer + $this->object->addChild($spgrContainer); + } + + $reader = new self($spgrContainer); + $escher = $reader->load($recordData); + } + + /** + * Read SpContainer record (Shape Container). + */ + private function readSpContainer() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // add spContainer to spgrContainer + $spContainer = new SpContainer(); + $this->object->addChild($spContainer); + + // move stream pointer to next record + $this->pos += 8 + $length; + + // record is a container, read contents + $reader = new self($spContainer); + $escher = $reader->load($recordData); + } + + /** + * Read Spgr record (Shape Group). + */ + private function readSpgr() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read Sp record (Shape). + */ + private function readSp() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4; + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read ClientTextbox record. + */ + private function readClientTextbox() + { + // offset: 0; size: 2; recVer and recInstance + + // bit: 4-15; mask: 0xFFF0; recInstance + $recInstance = (0xFFF0 & Xls::getUInt2d($this->data, $this->pos)) >> 4; + + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet. + */ + private function readClientAnchor() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + + // offset: 2; size: 2; upper-left corner column index (0-based) + $c1 = Xls::getUInt2d($recordData, 2); + + // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width + $startOffsetX = Xls::getUInt2d($recordData, 4); + + // offset: 6; size: 2; upper-left corner row index (0-based) + $r1 = Xls::getUInt2d($recordData, 6); + + // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height + $startOffsetY = Xls::getUInt2d($recordData, 8); + + // offset: 10; size: 2; bottom-right corner column index (0-based) + $c2 = Xls::getUInt2d($recordData, 10); + + // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width + $endOffsetX = Xls::getUInt2d($recordData, 12); + + // offset: 14; size: 2; bottom-right corner row index (0-based) + $r2 = Xls::getUInt2d($recordData, 14); + + // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height + $endOffsetY = Xls::getUInt2d($recordData, 16); + + // set the start coordinates + $this->object->setStartCoordinates(Coordinate::stringFromColumnIndex($c1 + 1) . ($r1 + 1)); + + // set the start offsetX + $this->object->setStartOffsetX($startOffsetX); + + // set the start offsetY + $this->object->setStartOffsetY($startOffsetY); + + // set the end coordinates + $this->object->setEndCoordinates(Coordinate::stringFromColumnIndex($c2 + 1) . ($r2 + 1)); + + // set the end offsetX + $this->object->setEndOffsetX($endOffsetX); + + // set the end offsetY + $this->object->setEndOffsetY($endOffsetY); + } + + /** + * Read ClientData record. + */ + private function readClientData() + { + $length = Xls::getInt4d($this->data, $this->pos + 4); + $recordData = substr($this->data, $this->pos + 8, $length); + + // move stream pointer to next record + $this->pos += 8 + $length; + } + + /** + * Read OfficeArtRGFOPTE table of property-value pairs. + * + * @param string $data Binary data + * @param int $n Number of properties + */ + private function readOfficeArtRGFOPTE($data, $n) + { + $splicedComplexData = substr($data, 6 * $n); + + // loop through property-value pairs + for ($i = 0; $i < $n; ++$i) { + // read 6 bytes at a time + $fopte = substr($data, 6 * $i, 6); + + // offset: 0; size: 2; opid + $opid = Xls::getUInt2d($fopte, 0); + + // bit: 0-13; mask: 0x3FFF; opid.opid + $opidOpid = (0x3FFF & $opid) >> 0; + + // bit: 14; mask 0x4000; 1 = value in op field is BLIP identifier + $opidFBid = (0x4000 & $opid) >> 14; + + // bit: 15; mask 0x8000; 1 = this is a complex property, op field specifies size of complex data + $opidFComplex = (0x8000 & $opid) >> 15; + + // offset: 2; size: 4; the value for this property + $op = Xls::getInt4d($fopte, 2); + + if ($opidFComplex) { + $complexData = substr($splicedComplexData, 0, $op); + $splicedComplexData = substr($splicedComplexData, $op); + + // we store string value with complex data + $value = $complexData; + } else { + // we store integer value + $value = $op; + } + + $this->object->setOPT($opidOpid, $value); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php new file mode 100644 index 0000000..6a10e59 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/MD5.php @@ -0,0 +1,184 @@ +reset(); + } + + /** + * Reset the MD5 stream context. + */ + public function reset() + { + $this->a = 0x67452301; + $this->b = 0xEFCDAB89; + $this->c = 0x98BADCFE; + $this->d = 0x10325476; + } + + /** + * Get MD5 stream context. + * + * @return string + */ + public function getContext() + { + $s = ''; + foreach (['a', 'b', 'c', 'd'] as $i) { + $v = $this->{$i}; + $s .= chr($v & 0xff); + $s .= chr(($v >> 8) & 0xff); + $s .= chr(($v >> 16) & 0xff); + $s .= chr(($v >> 24) & 0xff); + } + + return $s; + } + + /** + * Add data to context. + * + * @param string $data Data to add + */ + public function add($data) + { + $words = array_values(unpack('V16', $data)); + + $A = $this->a; + $B = $this->b; + $C = $this->c; + $D = $this->d; + + $F = ['self', 'f']; + $G = ['self', 'g']; + $H = ['self', 'h']; + $I = ['self', 'i']; + + // ROUND 1 + self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478); + self::step($F, $D, $A, $B, $C, $words[1], 12, 0xe8c7b756); + self::step($F, $C, $D, $A, $B, $words[2], 17, 0x242070db); + self::step($F, $B, $C, $D, $A, $words[3], 22, 0xc1bdceee); + self::step($F, $A, $B, $C, $D, $words[4], 7, 0xf57c0faf); + self::step($F, $D, $A, $B, $C, $words[5], 12, 0x4787c62a); + self::step($F, $C, $D, $A, $B, $words[6], 17, 0xa8304613); + self::step($F, $B, $C, $D, $A, $words[7], 22, 0xfd469501); + self::step($F, $A, $B, $C, $D, $words[8], 7, 0x698098d8); + self::step($F, $D, $A, $B, $C, $words[9], 12, 0x8b44f7af); + self::step($F, $C, $D, $A, $B, $words[10], 17, 0xffff5bb1); + self::step($F, $B, $C, $D, $A, $words[11], 22, 0x895cd7be); + self::step($F, $A, $B, $C, $D, $words[12], 7, 0x6b901122); + self::step($F, $D, $A, $B, $C, $words[13], 12, 0xfd987193); + self::step($F, $C, $D, $A, $B, $words[14], 17, 0xa679438e); + self::step($F, $B, $C, $D, $A, $words[15], 22, 0x49b40821); + + // ROUND 2 + self::step($G, $A, $B, $C, $D, $words[1], 5, 0xf61e2562); + self::step($G, $D, $A, $B, $C, $words[6], 9, 0xc040b340); + self::step($G, $C, $D, $A, $B, $words[11], 14, 0x265e5a51); + self::step($G, $B, $C, $D, $A, $words[0], 20, 0xe9b6c7aa); + self::step($G, $A, $B, $C, $D, $words[5], 5, 0xd62f105d); + self::step($G, $D, $A, $B, $C, $words[10], 9, 0x02441453); + self::step($G, $C, $D, $A, $B, $words[15], 14, 0xd8a1e681); + self::step($G, $B, $C, $D, $A, $words[4], 20, 0xe7d3fbc8); + self::step($G, $A, $B, $C, $D, $words[9], 5, 0x21e1cde6); + self::step($G, $D, $A, $B, $C, $words[14], 9, 0xc33707d6); + self::step($G, $C, $D, $A, $B, $words[3], 14, 0xf4d50d87); + self::step($G, $B, $C, $D, $A, $words[8], 20, 0x455a14ed); + self::step($G, $A, $B, $C, $D, $words[13], 5, 0xa9e3e905); + self::step($G, $D, $A, $B, $C, $words[2], 9, 0xfcefa3f8); + self::step($G, $C, $D, $A, $B, $words[7], 14, 0x676f02d9); + self::step($G, $B, $C, $D, $A, $words[12], 20, 0x8d2a4c8a); + + // ROUND 3 + self::step($H, $A, $B, $C, $D, $words[5], 4, 0xfffa3942); + self::step($H, $D, $A, $B, $C, $words[8], 11, 0x8771f681); + self::step($H, $C, $D, $A, $B, $words[11], 16, 0x6d9d6122); + self::step($H, $B, $C, $D, $A, $words[14], 23, 0xfde5380c); + self::step($H, $A, $B, $C, $D, $words[1], 4, 0xa4beea44); + self::step($H, $D, $A, $B, $C, $words[4], 11, 0x4bdecfa9); + self::step($H, $C, $D, $A, $B, $words[7], 16, 0xf6bb4b60); + self::step($H, $B, $C, $D, $A, $words[10], 23, 0xbebfbc70); + self::step($H, $A, $B, $C, $D, $words[13], 4, 0x289b7ec6); + self::step($H, $D, $A, $B, $C, $words[0], 11, 0xeaa127fa); + self::step($H, $C, $D, $A, $B, $words[3], 16, 0xd4ef3085); + self::step($H, $B, $C, $D, $A, $words[6], 23, 0x04881d05); + self::step($H, $A, $B, $C, $D, $words[9], 4, 0xd9d4d039); + self::step($H, $D, $A, $B, $C, $words[12], 11, 0xe6db99e5); + self::step($H, $C, $D, $A, $B, $words[15], 16, 0x1fa27cf8); + self::step($H, $B, $C, $D, $A, $words[2], 23, 0xc4ac5665); + + // ROUND 4 + self::step($I, $A, $B, $C, $D, $words[0], 6, 0xf4292244); + self::step($I, $D, $A, $B, $C, $words[7], 10, 0x432aff97); + self::step($I, $C, $D, $A, $B, $words[14], 15, 0xab9423a7); + self::step($I, $B, $C, $D, $A, $words[5], 21, 0xfc93a039); + self::step($I, $A, $B, $C, $D, $words[12], 6, 0x655b59c3); + self::step($I, $D, $A, $B, $C, $words[3], 10, 0x8f0ccc92); + self::step($I, $C, $D, $A, $B, $words[10], 15, 0xffeff47d); + self::step($I, $B, $C, $D, $A, $words[1], 21, 0x85845dd1); + self::step($I, $A, $B, $C, $D, $words[8], 6, 0x6fa87e4f); + self::step($I, $D, $A, $B, $C, $words[15], 10, 0xfe2ce6e0); + self::step($I, $C, $D, $A, $B, $words[6], 15, 0xa3014314); + self::step($I, $B, $C, $D, $A, $words[13], 21, 0x4e0811a1); + self::step($I, $A, $B, $C, $D, $words[4], 6, 0xf7537e82); + self::step($I, $D, $A, $B, $C, $words[11], 10, 0xbd3af235); + self::step($I, $C, $D, $A, $B, $words[2], 15, 0x2ad7d2bb); + self::step($I, $B, $C, $D, $A, $words[9], 21, 0xeb86d391); + + $this->a = ($this->a + $A) & 0xffffffff; + $this->b = ($this->b + $B) & 0xffffffff; + $this->c = ($this->c + $C) & 0xffffffff; + $this->d = ($this->d + $D) & 0xffffffff; + } + + private static function f($X, $Y, $Z) + { + return ($X & $Y) | ((~$X) & $Z); // X AND Y OR NOT X AND Z + } + + private static function g($X, $Y, $Z) + { + return ($X & $Z) | ($Y & (~$Z)); // X AND Z OR Y AND NOT Z + } + + private static function h($X, $Y, $Z) + { + return $X ^ $Y ^ $Z; // X XOR Y XOR Z + } + + private static function i($X, $Y, $Z) + { + return $Y ^ ($X | (~$Z)); // Y XOR (X OR NOT Z) + } + + private static function step($func, &$A, $B, $C, $D, $M, $s, $t) + { + $A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff; + $A = self::rotate($A, $s); + $A = ($B + $A) & 0xffffffff; + } + + private static function rotate($decimal, $bits) + { + $binary = str_pad(decbin($decimal), 32, '0', STR_PAD_LEFT); + + return bindec(substr($binary, $bits) . substr($binary, 0, $bits)); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/RC4.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/RC4.php new file mode 100644 index 0000000..691aca7 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/RC4.php @@ -0,0 +1,61 @@ +i = 0; $this->i < 256; ++$this->i) { + $this->s[$this->i] = $this->i; + } + + $this->j = 0; + for ($this->i = 0; $this->i < 256; ++$this->i) { + $this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256; + $t = $this->s[$this->i]; + $this->s[$this->i] = $this->s[$this->j]; + $this->s[$this->j] = $t; + } + $this->i = $this->j = 0; + } + + /** + * Symmetric decryption/encryption function. + * + * @param string $data Data to encrypt/decrypt + * + * @return string + */ + public function RC4($data) + { + $len = strlen($data); + for ($c = 0; $c < $len; ++$c) { + $this->i = ($this->i + 1) % 256; + $this->j = ($this->j + $this->s[$this->i]) % 256; + $t = $this->s[$this->i]; + $this->s[$this->i] = $this->s[$this->j]; + $this->s[$this->j] = $t; + + $t = ($this->s[$this->i] + $this->s[$this->j]) % 256; + + $data[$c] = chr(ord($data[$c]) ^ $this->s[$t]); + } + + return $data; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/Border.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/Border.php new file mode 100644 index 0000000..91cbe36 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/Border.php @@ -0,0 +1,42 @@ + StyleBorder::BORDER_NONE, + 0x01 => StyleBorder::BORDER_THIN, + 0x02 => StyleBorder::BORDER_MEDIUM, + 0x03 => StyleBorder::BORDER_DASHED, + 0x04 => StyleBorder::BORDER_DOTTED, + 0x05 => StyleBorder::BORDER_THICK, + 0x06 => StyleBorder::BORDER_DOUBLE, + 0x07 => StyleBorder::BORDER_HAIR, + 0x08 => StyleBorder::BORDER_MEDIUMDASHED, + 0x09 => StyleBorder::BORDER_DASHDOT, + 0x0A => StyleBorder::BORDER_MEDIUMDASHDOT, + 0x0B => StyleBorder::BORDER_DASHDOTDOT, + 0x0C => StyleBorder::BORDER_MEDIUMDASHDOTDOT, + 0x0D => StyleBorder::BORDER_SLANTDASHDOT, + ]; + + /** + * Map border style + * OpenOffice documentation: 2.5.11. + * + * @param int $index + * + * @return string + */ + public static function lookup($index) + { + if (isset(self::$map[$index])) { + return self::$map[$index]; + } + + return StyleBorder::BORDER_NONE; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php new file mode 100644 index 0000000..7b85c08 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls/Style/FillPattern.php @@ -0,0 +1,47 @@ + Fill::FILL_NONE, + 0x01 => Fill::FILL_SOLID, + 0x02 => Fill::FILL_PATTERN_MEDIUMGRAY, + 0x03 => Fill::FILL_PATTERN_DARKGRAY, + 0x04 => Fill::FILL_PATTERN_LIGHTGRAY, + 0x05 => Fill::FILL_PATTERN_DARKHORIZONTAL, + 0x06 => Fill::FILL_PATTERN_DARKVERTICAL, + 0x07 => Fill::FILL_PATTERN_DARKDOWN, + 0x08 => Fill::FILL_PATTERN_DARKUP, + 0x09 => Fill::FILL_PATTERN_DARKGRID, + 0x0A => Fill::FILL_PATTERN_DARKTRELLIS, + 0x0B => Fill::FILL_PATTERN_LIGHTHORIZONTAL, + 0x0C => Fill::FILL_PATTERN_LIGHTVERTICAL, + 0x0D => Fill::FILL_PATTERN_LIGHTDOWN, + 0x0E => Fill::FILL_PATTERN_LIGHTUP, + 0x0F => Fill::FILL_PATTERN_LIGHTGRID, + 0x10 => Fill::FILL_PATTERN_LIGHTTRELLIS, + 0x11 => Fill::FILL_PATTERN_GRAY125, + 0x12 => Fill::FILL_PATTERN_GRAY0625, + ]; + + /** + * Get fill pattern from index + * OpenOffice documentation: 2.5.12. + * + * @param int $index + * + * @return string + */ + public static function lookup($index) + { + if (isset(self::$map[$index])) { + return self::$map[$index]; + } + + return Fill::FILL_NONE; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php new file mode 100644 index 0000000..9b5b7db --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php @@ -0,0 +1,2040 @@ +referenceHelper = ReferenceHelper::getInstance(); + $this->securityScanner = XmlScanner::getInstance($this); + } + + /** + * Can the current IReader read the file? + * + * @param string $pFilename + * + * @throws Exception + * + * @return bool + */ + public function canRead($pFilename) + { + File::assertFile($pFilename); + + $result = false; + $zip = new ZipArchive(); + + if ($zip->open($pFilename) === true) { + $workbookBasename = $this->getWorkbookBaseName($zip); + $result = !empty($workbookBasename); + + $zip->close(); + } + + return $result; + } + + /** + * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object. + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetNames($pFilename) + { + File::assertFile($pFilename); + + $worksheetNames = []; + + $zip = new ZipArchive(); + $zip->open($pFilename); + + // The files we're looking at here are small enough that simpleXML is more efficient than XMLReader + //~ http://schemas.openxmlformats.org/package/2006/relationships"); + $rels = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, '_rels/.rels')) + ); + foreach ($rels->Relationship as $rel) { + switch ($rel['Type']) { + case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument': + //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" + $xmlWorkbook = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "{$rel['Target']}")) + ); + + if ($xmlWorkbook->sheets) { + foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { + // Check if sheet should be skipped + $worksheetNames[] = (string) $eleSheet['name']; + } + } + } + } + + $zip->close(); + + return $worksheetNames; + } + + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetInfo($pFilename) + { + File::assertFile($pFilename); + + $worksheetInfo = []; + + $zip = new ZipArchive(); + $zip->open($pFilename); + + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $rels = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, '_rels/.rels')), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + foreach ($rels->Relationship as $rel) { + if ($rel['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument') { + $dir = dirname($rel['Target']); + + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsWorkbook = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, "$dir/_rels/" . basename($rel['Target']) . '.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $relsWorkbook->registerXPathNamespace('rel', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + $worksheets = []; + foreach ($relsWorkbook->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet') { + $worksheets[(string) $ele['Id']] = $ele['Target']; + } + } + + //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" + $xmlWorkbook = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, "{$rel['Target']}") + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + if ($xmlWorkbook->sheets) { + $dir = dirname($rel['Target']); + /** @var SimpleXMLElement $eleSheet */ + foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { + $tmpInfo = [ + 'worksheetName' => (string) $eleSheet['name'], + 'lastColumnLetter' => 'A', + 'lastColumnIndex' => 0, + 'totalRows' => 0, + 'totalColumns' => 0, + ]; + + $fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), 'id')]; + + $xml = new XMLReader(); + $xml->xml( + $this->securityScanner->scanFile( + 'zip://' . File::realpath($pFilename) . '#' . "$dir/$fileWorksheet" + ), + null, + Settings::getLibXmlLoaderOptions() + ); + $xml->setParserProperty(2, true); + + $currCells = 0; + while ($xml->read()) { + if ($xml->name == 'row' && $xml->nodeType == XMLReader::ELEMENT) { + $row = $xml->getAttribute('r'); + $tmpInfo['totalRows'] = $row; + $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells); + $currCells = 0; + } elseif ($xml->name == 'c' && $xml->nodeType == XMLReader::ELEMENT) { + ++$currCells; + } + } + $tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells); + $xml->close(); + + $tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1; + $tmpInfo['lastColumnLetter'] = Coordinate::stringFromColumnIndex($tmpInfo['lastColumnIndex'] + 1); + + $worksheetInfo[] = $tmpInfo; + } + } + } + } + + $zip->close(); + + return $worksheetInfo; + } + + private static function castToBoolean($c) + { + $value = isset($c->v) ? (string) $c->v : null; + if ($value == '0') { + return false; + } elseif ($value == '1') { + return true; + } + + return (bool) $c->v; + } + + private static function castToError($c) + { + return isset($c->v) ? (string) $c->v : null; + } + + private static function castToString($c) + { + return isset($c->v) ? (string) $c->v : null; + } + + private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType) + { + $cellDataType = 'f'; + $value = "={$c->f}"; + $calculatedValue = self::$castBaseType($c); + + // Shared formula? + if (isset($c->f['t']) && strtolower((string) $c->f['t']) == 'shared') { + $instance = (string) $c->f['si']; + + if (!isset($sharedFormulas[(string) $c->f['si']])) { + $sharedFormulas[$instance] = ['master' => $r, 'formula' => $value]; + } else { + $master = Coordinate::coordinateFromString($sharedFormulas[$instance]['master']); + $current = Coordinate::coordinateFromString($r); + + $difference = [0, 0]; + $difference[0] = Coordinate::columnIndexFromString($current[0]) - Coordinate::columnIndexFromString($master[0]); + $difference[1] = $current[1] - $master[1]; + + $value = $this->referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]); + } + } + } + + /** + * @param ZipArchive $archive + * @param string $fileName + * + * @return string + */ + private function getFromZipArchive(ZipArchive $archive, $fileName = '') + { + // Root-relative paths + if (strpos($fileName, '//') !== false) { + $fileName = substr($fileName, strpos($fileName, '//') + 1); + } + $fileName = File::realpath($fileName); + + // Sadly, some 3rd party xlsx generators don't use consistent case for filenaming + // so we need to load case-insensitively from the zip file + + // Apache POI fixes + $contents = $archive->getFromName($fileName, 0, ZipArchive::FL_NOCASE); + if ($contents === false) { + $contents = $archive->getFromName(substr($fileName, 1), 0, ZipArchive::FL_NOCASE); + } + + return $contents; + } + + /** + * Loads Spreadsheet from file. + * + * @param string $pFilename + * + * @throws Exception + * + * @return Spreadsheet + */ + public function load($pFilename) + { + File::assertFile($pFilename); + + // Initialisations + $excel = new Spreadsheet(); + $excel->removeSheetByIndex(0); + if (!$this->readDataOnly) { + $excel->removeCellStyleXfByIndex(0); // remove the default style + $excel->removeCellXfByIndex(0); // remove the default style + } + $unparsedLoadedData = []; + + $zip = new ZipArchive(); + $zip->open($pFilename); + + // Read the theme first, because we need the colour scheme when reading the styles + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $workbookBasename = $this->getWorkbookBaseName($zip); + $wbRels = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "xl/_rels/${workbookBasename}.rels")), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + foreach ($wbRels->Relationship as $rel) { + switch ($rel['Type']) { + case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme': + $themeOrderArray = ['lt1', 'dk1', 'lt2', 'dk2']; + $themeOrderAdditional = count($themeOrderArray); + + $xmlTheme = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "xl/{$rel['Target']}")), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + if (is_object($xmlTheme)) { + $xmlThemeName = $xmlTheme->attributes(); + $xmlTheme = $xmlTheme->children('http://schemas.openxmlformats.org/drawingml/2006/main'); + $themeName = (string) $xmlThemeName['name']; + + $colourScheme = $xmlTheme->themeElements->clrScheme->attributes(); + $colourSchemeName = (string) $colourScheme['name']; + $colourScheme = $xmlTheme->themeElements->clrScheme->children('http://schemas.openxmlformats.org/drawingml/2006/main'); + + $themeColours = []; + foreach ($colourScheme as $k => $xmlColour) { + $themePos = array_search($k, $themeOrderArray); + if ($themePos === false) { + $themePos = $themeOrderAdditional++; + } + if (isset($xmlColour->sysClr)) { + $xmlColourData = $xmlColour->sysClr->attributes(); + $themeColours[$themePos] = $xmlColourData['lastClr']; + } elseif (isset($xmlColour->srgbClr)) { + $xmlColourData = $xmlColour->srgbClr->attributes(); + $themeColours[$themePos] = $xmlColourData['val']; + } + } + self::$theme = new Xlsx\Theme($themeName, $colourSchemeName, $themeColours); + } + + break; + } + } + + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $rels = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, '_rels/.rels')), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + + $propertyReader = new PropertyReader($this->securityScanner, $excel->getProperties()); + foreach ($rels->Relationship as $rel) { + switch ($rel['Type']) { + case 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties': + $propertyReader->readCoreProperties($this->getFromZipArchive($zip, "{$rel['Target']}")); + + break; + case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties': + $propertyReader->readExtendedProperties($this->getFromZipArchive($zip, "{$rel['Target']}")); + + break; + case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties': + $propertyReader->readCustomProperties($this->getFromZipArchive($zip, "{$rel['Target']}")); + + break; + //Ribbon + case 'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility': + $customUI = $rel['Target']; + if ($customUI !== null) { + $this->readRibbon($excel, $customUI, $zip); + } + + break; + case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument': + $dir = dirname($rel['Target']); + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsWorkbook = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "$dir/_rels/" . basename($rel['Target']) . '.rels')), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $relsWorkbook->registerXPathNamespace('rel', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + $sharedStrings = []; + $xpath = self::getArrayItem($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']")); + if ($xpath) { + //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" + $xmlStrings = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + if (isset($xmlStrings, $xmlStrings->si)) { + foreach ($xmlStrings->si as $val) { + if (isset($val->t)) { + $sharedStrings[] = StringHelper::controlCharacterOOXML2PHP((string) $val->t); + } elseif (isset($val->r)) { + $sharedStrings[] = $this->parseRichText($val); + } + } + } + } + + $worksheets = []; + $macros = $customUI = null; + foreach ($relsWorkbook->Relationship as $ele) { + switch ($ele['Type']) { + case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet': + $worksheets[(string) $ele['Id']] = $ele['Target']; + + break; + // a vbaProject ? (: some macros) + case 'http://schemas.microsoft.com/office/2006/relationships/vbaProject': + $macros = $ele['Target']; + + break; + } + } + + if ($macros !== null) { + $macrosCode = $this->getFromZipArchive($zip, 'xl/vbaProject.bin'); //vbaProject.bin always in 'xl' dir and always named vbaProject.bin + if ($macrosCode !== false) { + $excel->setMacrosCode($macrosCode); + $excel->setHasMacros(true); + //short-circuit : not reading vbaProject.bin.rel to get Signature =>allways vbaProjectSignature.bin in 'xl' dir + $Certificate = $this->getFromZipArchive($zip, 'xl/vbaProjectSignature.bin'); + if ($Certificate !== false) { + $excel->setMacrosCertificate($Certificate); + } + } + } + + $xpath = self::getArrayItem($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']")); + //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" + $xmlStyles = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "$dir/$xpath[Target]")), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + + $styles = []; + $cellStyles = []; + $numFmts = null; + if ($xmlStyles && $xmlStyles->numFmts[0]) { + $numFmts = $xmlStyles->numFmts[0]; + } + if (isset($numFmts) && ($numFmts !== null)) { + $numFmts->registerXPathNamespace('sml', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + } + if (!$this->readDataOnly && $xmlStyles) { + foreach ($xmlStyles->cellXfs->xf as $xf) { + $numFmt = NumberFormat::FORMAT_GENERAL; + + if ($xf['numFmtId']) { + if (isset($numFmts)) { + $tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); + + if (isset($tmpNumFmt['formatCode'])) { + $numFmt = (string) $tmpNumFmt['formatCode']; + } + } + + // We shouldn't override any of the built-in MS Excel values (values below id 164) + // But there's a lot of naughty homebrew xlsx writers that do use "reserved" id values that aren't actually used + // So we make allowance for them rather than lose formatting masks + if ((int) $xf['numFmtId'] < 164 && + NumberFormat::builtInFormatCode((int) $xf['numFmtId']) !== '') { + $numFmt = NumberFormat::builtInFormatCode((int) $xf['numFmtId']); + } + } + $quotePrefix = false; + if (isset($xf['quotePrefix'])) { + $quotePrefix = (bool) $xf['quotePrefix']; + } + + $style = (object) [ + 'numFmt' => $numFmt, + 'font' => $xmlStyles->fonts->font[(int) ($xf['fontId'])], + 'fill' => $xmlStyles->fills->fill[(int) ($xf['fillId'])], + 'border' => $xmlStyles->borders->border[(int) ($xf['borderId'])], + 'alignment' => $xf->alignment, + 'protection' => $xf->protection, + 'quotePrefix' => $quotePrefix, + ]; + $styles[] = $style; + + // add style to cellXf collection + $objStyle = new Style(); + self::readStyle($objStyle, $style); + $excel->addCellXf($objStyle); + } + + foreach (isset($xmlStyles->cellStyleXfs->xf) ? $xmlStyles->cellStyleXfs->xf : [] as $xf) { + $numFmt = NumberFormat::FORMAT_GENERAL; + if ($numFmts && $xf['numFmtId']) { + $tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); + if (isset($tmpNumFmt['formatCode'])) { + $numFmt = (string) $tmpNumFmt['formatCode']; + } elseif ((int) $xf['numFmtId'] < 165) { + $numFmt = NumberFormat::builtInFormatCode((int) $xf['numFmtId']); + } + } + + $cellStyle = (object) [ + 'numFmt' => $numFmt, + 'font' => $xmlStyles->fonts->font[(int) ($xf['fontId'])], + 'fill' => $xmlStyles->fills->fill[(int) ($xf['fillId'])], + 'border' => $xmlStyles->borders->border[(int) ($xf['borderId'])], + 'alignment' => $xf->alignment, + 'protection' => $xf->protection, + 'quotePrefix' => $quotePrefix, + ]; + $cellStyles[] = $cellStyle; + + // add style to cellStyleXf collection + $objStyle = new Style(); + self::readStyle($objStyle, $cellStyle); + $excel->addCellStyleXf($objStyle); + } + } + + $styleReader = new Styles($xmlStyles); + $styleReader->setStyleBaseData(self::$theme, $styles, $cellStyles); + $dxfs = $styleReader->dxfs($this->readDataOnly); + $styles = $styleReader->styles(); + + //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" + $xmlWorkbook = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "{$rel['Target']}")), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + + // Set base date + if ($xmlWorkbook->workbookPr) { + Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); + if (isset($xmlWorkbook->workbookPr['date1904'])) { + if (self::boolean((string) $xmlWorkbook->workbookPr['date1904'])) { + Date::setExcelCalendar(Date::CALENDAR_MAC_1904); + } + } + } + + // Set protection + $this->readProtection($excel, $xmlWorkbook); + + $sheetId = 0; // keep track of new sheet id in final workbook + $oldSheetId = -1; // keep track of old sheet id in final workbook + $countSkippedSheets = 0; // keep track of number of skipped sheets + $mapSheetId = []; // mapping of sheet ids from old to new + + $charts = $chartDetails = []; + + if ($xmlWorkbook->sheets) { + /** @var SimpleXMLElement $eleSheet */ + foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { + ++$oldSheetId; + + // Check if sheet should be skipped + if (isset($this->loadSheetsOnly) && !in_array((string) $eleSheet['name'], $this->loadSheetsOnly)) { + ++$countSkippedSheets; + $mapSheetId[$oldSheetId] = null; + + continue; + } + + // Map old sheet id in original workbook to new sheet id. + // They will differ if loadSheetsOnly() is being used + $mapSheetId[$oldSheetId] = $oldSheetId - $countSkippedSheets; + + // Load sheet + $docSheet = $excel->createSheet(); + // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet + // references in formula cells... during the load, all formulae should be correct, + // and we're simply bringing the worksheet name in line with the formula, not the + // reverse + $docSheet->setTitle((string) $eleSheet['name'], false, false); + $fileWorksheet = $worksheets[(string) self::getArrayItem($eleSheet->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), 'id')]; + //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" + $xmlSheet = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, "$dir/$fileWorksheet")), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + + $sharedFormulas = []; + + if (isset($eleSheet['state']) && (string) $eleSheet['state'] != '') { + $docSheet->setSheetState((string) $eleSheet['state']); + } + + if ($xmlSheet) { + if (isset($xmlSheet->sheetViews, $xmlSheet->sheetViews->sheetView)) { + $sheetViews = new SheetViews($xmlSheet->sheetViews->sheetView, $docSheet); + $sheetViews->load(); + } + + $sheetViewOptions = new SheetViewOptions($docSheet, $xmlSheet); + $sheetViewOptions->load($this->getReadDataOnly()); + + (new ColumnAndRowAttributes($docSheet, $xmlSheet)) + ->load($this->getReadFilter(), $this->getReadDataOnly()); + } + + if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) { + $cIndex = 1; // Cell Start from 1 + foreach ($xmlSheet->sheetData->row as $row) { + $rowIndex = 1; + foreach ($row->c as $c) { + $r = (string) $c['r']; + if ($r == '') { + $r = Coordinate::stringFromColumnIndex($rowIndex) . $cIndex; + } + $cellDataType = (string) $c['t']; + $value = null; + $calculatedValue = null; + + // Read cell? + if ($this->getReadFilter() !== null) { + $coordinates = Coordinate::coordinateFromString($r); + + if (!$this->getReadFilter()->readCell($coordinates[0], (int) $coordinates[1], $docSheet->getTitle())) { + $rowIndex += 1; + + continue; + } + } + + // Read cell! + switch ($cellDataType) { + case 's': + if ((string) $c->v != '') { + $value = $sharedStrings[(int) ($c->v)]; + + if ($value instanceof RichText) { + $value = clone $value; + } + } else { + $value = ''; + } + + break; + case 'b': + if (!isset($c->f)) { + $value = self::castToBoolean($c); + } else { + // Formula + $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToBoolean'); + if (isset($c->f['t'])) { + $att = $c->f; + $docSheet->getCell($r)->setFormulaAttributes($att); + } + } + + break; + case 'inlineStr': + if (isset($c->f)) { + $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToError'); + } else { + $value = $this->parseRichText($c->is); + } + + break; + case 'e': + if (!isset($c->f)) { + $value = self::castToError($c); + } else { + // Formula + $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToError'); + } + + break; + default: + if (!isset($c->f)) { + $value = self::castToString($c); + } else { + // Formula + $this->castToFormula($c, $r, $cellDataType, $value, $calculatedValue, $sharedFormulas, 'castToString'); + } + + break; + } + + // read empty cells or the cells are not empty + if ($this->readEmptyCells || ($value !== null && $value !== '')) { + // Rich text? + if ($value instanceof RichText && $this->readDataOnly) { + $value = $value->getPlainText(); + } + + $cell = $docSheet->getCell($r); + // Assign value + if ($cellDataType != '') { + $cell->setValueExplicit($value, $cellDataType); + } else { + $cell->setValue($value); + } + if ($calculatedValue !== null) { + $cell->setCalculatedValue($calculatedValue); + } + + // Style information? + if ($c['s'] && !$this->readDataOnly) { + // no style index means 0, it seems + $cell->setXfIndex(isset($styles[(int) ($c['s'])]) ? + (int) ($c['s']) : 0); + } + } + $rowIndex += 1; + } + $cIndex += 1; + } + } + + if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { + (new ConditionalStyles($docSheet, $xmlSheet, $dxfs))->load(); + } + + $aKeys = ['sheet', 'objects', 'scenarios', 'formatCells', 'formatColumns', 'formatRows', 'insertColumns', 'insertRows', 'insertHyperlinks', 'deleteColumns', 'deleteRows', 'selectLockedCells', 'sort', 'autoFilter', 'pivotTables', 'selectUnlockedCells']; + if (!$this->readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { + foreach ($aKeys as $key) { + $method = 'set' . ucfirst($key); + $docSheet->getProtection()->$method(self::boolean((string) $xmlSheet->sheetProtection[$key])); + } + } + + if (!$this->readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) { + $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection['password'], true); + if ($xmlSheet->protectedRanges->protectedRange) { + foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) { + $docSheet->protectCells((string) $protectedRange['sqref'], (string) $protectedRange['password'], true); + } + } + } + + if ($xmlSheet && $xmlSheet->autoFilter && !$this->readDataOnly) { + (new AutoFilter($docSheet, $xmlSheet))->load(); + } + + if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->readDataOnly) { + foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) { + $mergeRef = (string) $mergeCell['ref']; + if (strpos($mergeRef, ':') !== false) { + $docSheet->mergeCells((string) $mergeCell['ref']); + } + } + } + + if ($xmlSheet && !$this->readDataOnly) { + $unparsedLoadedData = (new PageSetup($docSheet, $xmlSheet))->load($unparsedLoadedData); + } + + if ($xmlSheet && $xmlSheet->dataValidations && !$this->readDataOnly) { + (new DataValidations($docSheet, $xmlSheet))->load(); + } + + // unparsed sheet AlternateContent + if ($xmlSheet && !$this->readDataOnly) { + $mc = $xmlSheet->children('http://schemas.openxmlformats.org/markup-compatibility/2006'); + if ($mc->AlternateContent) { + foreach ($mc->AlternateContent as $alternateContent) { + $unparsedLoadedData['sheets'][$docSheet->getCodeName()]['AlternateContents'][] = $alternateContent->asXML(); + } + } + } + + // Add hyperlinks + if (!$this->readDataOnly) { + $hyperlinkReader = new Hyperlinks($docSheet); + // Locate hyperlink relations + $relationsFileName = dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels'; + if ($zip->locateName($relationsFileName)) { + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsWorksheet = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, $relationsFileName) + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $hyperlinkReader->readHyperlinks($relsWorksheet); + } + + // Loop through hyperlinks + if ($xmlSheet && $xmlSheet->hyperlinks) { + $hyperlinkReader->setHyperlinks($xmlSheet->hyperlinks); + } + } + + // Add comments + $comments = []; + $vmlComments = []; + if (!$this->readDataOnly) { + // Locate comment relations + if ($zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) { + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsWorksheet = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments') { + $comments[(string) $ele['Id']] = (string) $ele['Target']; + } + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing') { + $vmlComments[(string) $ele['Id']] = (string) $ele['Target']; + } + } + } + + // Loop through comments + foreach ($comments as $relName => $relPath) { + // Load comments file + $relPath = File::realpath(dirname("$dir/$fileWorksheet") . '/' . $relPath); + $commentsFile = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, $relPath)), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + + // Utility variables + $authors = []; + + // Loop through authors + foreach ($commentsFile->authors->author as $author) { + $authors[] = (string) $author; + } + + // Loop through contents + foreach ($commentsFile->commentList->comment as $comment) { + if (!empty($comment['authorId'])) { + $docSheet->getComment((string) $comment['ref'])->setAuthor($authors[(string) $comment['authorId']]); + } + $docSheet->getComment((string) $comment['ref'])->setText($this->parseRichText($comment->text)); + } + } + + // later we will remove from it real vmlComments + $unparsedVmlDrawings = $vmlComments; + + // Loop through VML comments + foreach ($vmlComments as $relName => $relPath) { + // Load VML comments file + $relPath = File::realpath(dirname("$dir/$fileWorksheet") . '/' . $relPath); + + try { + $vmlCommentsFile = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, $relPath)), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); + } catch (\Throwable $ex) { + //Ignore unparsable vmlDrawings. Later they will be moved from $unparsedVmlDrawings to $unparsedLoadedData + continue; + } + + $shapes = $vmlCommentsFile->xpath('//v:shape'); + foreach ($shapes as $shape) { + $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); + + if (isset($shape['style'])) { + $style = (string) $shape['style']; + $fillColor = strtoupper(substr((string) $shape['fillcolor'], 1)); + $column = null; + $row = null; + + $clientData = $shape->xpath('.//x:ClientData'); + if (is_array($clientData) && !empty($clientData)) { + $clientData = $clientData[0]; + + if (isset($clientData['ObjectType']) && (string) $clientData['ObjectType'] == 'Note') { + $temp = $clientData->xpath('.//x:Row'); + if (is_array($temp)) { + $row = $temp[0]; + } + + $temp = $clientData->xpath('.//x:Column'); + if (is_array($temp)) { + $column = $temp[0]; + } + } + } + + if (($column !== null) && ($row !== null)) { + // Set comment properties + $comment = $docSheet->getCommentByColumnAndRow($column + 1, $row + 1); + $comment->getFillColor()->setRGB($fillColor); + + // Parse style + $styleArray = explode(';', str_replace(' ', '', $style)); + foreach ($styleArray as $stylePair) { + $stylePair = explode(':', $stylePair); + + if ($stylePair[0] == 'margin-left') { + $comment->setMarginLeft($stylePair[1]); + } + if ($stylePair[0] == 'margin-top') { + $comment->setMarginTop($stylePair[1]); + } + if ($stylePair[0] == 'width') { + $comment->setWidth($stylePair[1]); + } + if ($stylePair[0] == 'height') { + $comment->setHeight($stylePair[1]); + } + if ($stylePair[0] == 'visibility') { + $comment->setVisible($stylePair[1] == 'visible'); + } + } + + unset($unparsedVmlDrawings[$relName]); + } + } + } + } + + // unparsed vmlDrawing + if ($unparsedVmlDrawings) { + foreach ($unparsedVmlDrawings as $rId => $relPath) { + $rId = substr($rId, 3); // rIdXXX + $unparsedVmlDrawing = &$unparsedLoadedData['sheets'][$docSheet->getCodeName()]['vmlDrawings']; + $unparsedVmlDrawing[$rId] = []; + $unparsedVmlDrawing[$rId]['filePath'] = self::dirAdd("$dir/$fileWorksheet", $relPath); + $unparsedVmlDrawing[$rId]['relFilePath'] = $relPath; + $unparsedVmlDrawing[$rId]['content'] = $this->securityScanner->scan($this->getFromZipArchive($zip, $unparsedVmlDrawing[$rId]['filePath'])); + unset($unparsedVmlDrawing); + } + } + + // Header/footer images + if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->readDataOnly) { + if ($zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) { + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsWorksheet = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $vmlRelationship = ''; + + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing') { + $vmlRelationship = self::dirAdd("$dir/$fileWorksheet", $ele['Target']); + } + } + + if ($vmlRelationship != '') { + // Fetch linked images + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsVML = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $drawings = []; + foreach ($relsVML->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') { + $drawings[(string) $ele['Id']] = self::dirAdd($vmlRelationship, $ele['Target']); + } + } + + // Fetch VML document + $vmlDrawing = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, $vmlRelationship)), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); + + $hfImages = []; + + $shapes = $vmlDrawing->xpath('//v:shape'); + foreach ($shapes as $idx => $shape) { + $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); + $imageData = $shape->xpath('//v:imagedata'); + + if (!$imageData) { + continue; + } + + $imageData = $imageData[$idx]; + + $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); + $style = self::toCSSArray((string) $shape['style']); + + $hfImages[(string) $shape['id']] = new HeaderFooterDrawing(); + if (isset($imageData['title'])) { + $hfImages[(string) $shape['id']]->setName((string) $imageData['title']); + } + + $hfImages[(string) $shape['id']]->setPath('zip://' . File::realpath($pFilename) . '#' . $drawings[(string) $imageData['relid']], false); + $hfImages[(string) $shape['id']]->setResizeProportional(false); + $hfImages[(string) $shape['id']]->setWidth($style['width']); + $hfImages[(string) $shape['id']]->setHeight($style['height']); + if (isset($style['margin-left'])) { + $hfImages[(string) $shape['id']]->setOffsetX($style['margin-left']); + } + $hfImages[(string) $shape['id']]->setOffsetY($style['margin-top']); + $hfImages[(string) $shape['id']]->setResizeProportional(true); + } + + $docSheet->getHeaderFooter()->setImages($hfImages); + } + } + } + } + + // TODO: Autoshapes from twoCellAnchors! + if ($zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) { + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsWorksheet = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $drawings = []; + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing') { + $drawings[(string) $ele['Id']] = self::dirAdd("$dir/$fileWorksheet", $ele['Target']); + } + } + if ($xmlSheet->drawing && !$this->readDataOnly) { + $unparsedDrawings = []; + foreach ($xmlSheet->drawing as $drawing) { + $drawingRelId = (string) self::getArrayItem($drawing->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), 'id'); + $fileDrawing = $drawings[$drawingRelId]; + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsDrawing = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, dirname($fileDrawing) . '/_rels/' . basename($fileDrawing) . '.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $images = []; + $hyperlinks = []; + if ($relsDrawing && $relsDrawing->Relationship) { + foreach ($relsDrawing->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink') { + $hyperlinks[(string) $ele['Id']] = (string) $ele['Target']; + } + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') { + $images[(string) $ele['Id']] = self::dirAdd($fileDrawing, $ele['Target']); + } elseif ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart') { + if ($this->includeCharts) { + $charts[self::dirAdd($fileDrawing, $ele['Target'])] = [ + 'id' => (string) $ele['Id'], + 'sheet' => $docSheet->getTitle(), + ]; + } + } + } + } + $xmlDrawing = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, $fileDrawing)), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $xmlDrawingChildren = $xmlDrawing->children('http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing'); + + if ($xmlDrawingChildren->oneCellAnchor) { + foreach ($xmlDrawingChildren->oneCellAnchor as $oneCellAnchor) { + if ($oneCellAnchor->pic->blipFill) { + /** @var SimpleXMLElement $blip */ + $blip = $oneCellAnchor->pic->blipFill->children('http://schemas.openxmlformats.org/drawingml/2006/main')->blip; + /** @var SimpleXMLElement $xfrm */ + $xfrm = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm; + /** @var SimpleXMLElement $outerShdw */ + $outerShdw = $oneCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw; + /** @var \SimpleXMLElement $hlinkClick */ + $hlinkClick = $oneCellAnchor->pic->nvPicPr->cNvPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->hlinkClick; + + $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); + $objDrawing->setName((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name')); + $objDrawing->setDescription((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'descr')); + $objDrawing->setPath( + 'zip://' . File::realpath($pFilename) . '#' . + $images[(string) self::getArrayItem( + $blip->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), + 'embed' + )], + false + ); + $objDrawing->setCoordinates(Coordinate::stringFromColumnIndex(((string) $oneCellAnchor->from->col) + 1) . ($oneCellAnchor->from->row + 1)); + $objDrawing->setOffsetX(Drawing::EMUToPixels($oneCellAnchor->from->colOff)); + $objDrawing->setOffsetY(Drawing::EMUToPixels($oneCellAnchor->from->rowOff)); + $objDrawing->setResizeProportional(false); + $objDrawing->setWidth(Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), 'cx'))); + $objDrawing->setHeight(Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), 'cy'))); + if ($xfrm) { + $objDrawing->setRotation(Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), 'rot'))); + } + if ($outerShdw) { + $shadow = $objDrawing->getShadow(); + $shadow->setVisible(true); + $shadow->setBlurRadius(Drawing::EMUToPixels(self::getArrayItem($outerShdw->attributes(), 'blurRad'))); + $shadow->setDistance(Drawing::EMUToPixels(self::getArrayItem($outerShdw->attributes(), 'dist'))); + $shadow->setDirection(Drawing::angleToDegrees(self::getArrayItem($outerShdw->attributes(), 'dir'))); + $shadow->setAlignment((string) self::getArrayItem($outerShdw->attributes(), 'algn')); + $clr = isset($outerShdw->srgbClr) ? $outerShdw->srgbClr : $outerShdw->prstClr; + $shadow->getColor()->setRGB(self::getArrayItem($clr->attributes(), 'val')); + $shadow->setAlpha(self::getArrayItem($clr->alpha->attributes(), 'val') / 1000); + } + + $this->readHyperLinkDrawing($objDrawing, $oneCellAnchor, $hyperlinks); + + $objDrawing->setWorksheet($docSheet); + } else { + // ? Can charts be positioned with a oneCellAnchor ? + $coordinates = Coordinate::stringFromColumnIndex(((string) $oneCellAnchor->from->col) + 1) . ($oneCellAnchor->from->row + 1); + $offsetX = Drawing::EMUToPixels($oneCellAnchor->from->colOff); + $offsetY = Drawing::EMUToPixels($oneCellAnchor->from->rowOff); + $width = Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), 'cx')); + $height = Drawing::EMUToPixels(self::getArrayItem($oneCellAnchor->ext->attributes(), 'cy')); + } + } + } + if ($xmlDrawingChildren->twoCellAnchor) { + foreach ($xmlDrawingChildren->twoCellAnchor as $twoCellAnchor) { + if ($twoCellAnchor->pic->blipFill) { + $blip = $twoCellAnchor->pic->blipFill->children('http://schemas.openxmlformats.org/drawingml/2006/main')->blip; + $xfrm = $twoCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->xfrm; + $outerShdw = $twoCellAnchor->pic->spPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->effectLst->outerShdw; + $hlinkClick = $twoCellAnchor->pic->nvPicPr->cNvPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->hlinkClick; + $objDrawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); + $objDrawing->setName((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name')); + $objDrawing->setDescription((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 'descr')); + $objDrawing->setPath( + 'zip://' . File::realpath($pFilename) . '#' . + $images[(string) self::getArrayItem( + $blip->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'), + 'embed' + )], + false + ); + $objDrawing->setCoordinates(Coordinate::stringFromColumnIndex(((string) $twoCellAnchor->from->col) + 1) . ($twoCellAnchor->from->row + 1)); + $objDrawing->setOffsetX(Drawing::EMUToPixels($twoCellAnchor->from->colOff)); + $objDrawing->setOffsetY(Drawing::EMUToPixels($twoCellAnchor->from->rowOff)); + $objDrawing->setResizeProportional(false); + + if ($xfrm) { + $objDrawing->setWidth(Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), 'cx'))); + $objDrawing->setHeight(Drawing::EMUToPixels(self::getArrayItem($xfrm->ext->attributes(), 'cy'))); + $objDrawing->setRotation(Drawing::angleToDegrees(self::getArrayItem($xfrm->attributes(), 'rot'))); + } + if ($outerShdw) { + $shadow = $objDrawing->getShadow(); + $shadow->setVisible(true); + $shadow->setBlurRadius(Drawing::EMUToPixels(self::getArrayItem($outerShdw->attributes(), 'blurRad'))); + $shadow->setDistance(Drawing::EMUToPixels(self::getArrayItem($outerShdw->attributes(), 'dist'))); + $shadow->setDirection(Drawing::angleToDegrees(self::getArrayItem($outerShdw->attributes(), 'dir'))); + $shadow->setAlignment((string) self::getArrayItem($outerShdw->attributes(), 'algn')); + $clr = isset($outerShdw->srgbClr) ? $outerShdw->srgbClr : $outerShdw->prstClr; + $shadow->getColor()->setRGB(self::getArrayItem($clr->attributes(), 'val')); + $shadow->setAlpha(self::getArrayItem($clr->alpha->attributes(), 'val') / 1000); + } + + $this->readHyperLinkDrawing($objDrawing, $twoCellAnchor, $hyperlinks); + + $objDrawing->setWorksheet($docSheet); + } elseif (($this->includeCharts) && ($twoCellAnchor->graphicFrame)) { + $fromCoordinate = Coordinate::stringFromColumnIndex(((string) $twoCellAnchor->from->col) + 1) . ($twoCellAnchor->from->row + 1); + $fromOffsetX = Drawing::EMUToPixels($twoCellAnchor->from->colOff); + $fromOffsetY = Drawing::EMUToPixels($twoCellAnchor->from->rowOff); + $toCoordinate = Coordinate::stringFromColumnIndex(((string) $twoCellAnchor->to->col) + 1) . ($twoCellAnchor->to->row + 1); + $toOffsetX = Drawing::EMUToPixels($twoCellAnchor->to->colOff); + $toOffsetY = Drawing::EMUToPixels($twoCellAnchor->to->rowOff); + $graphic = $twoCellAnchor->graphicFrame->children('http://schemas.openxmlformats.org/drawingml/2006/main')->graphic; + /** @var SimpleXMLElement $chartRef */ + $chartRef = $graphic->graphicData->children('http://schemas.openxmlformats.org/drawingml/2006/chart')->chart; + $thisChart = (string) $chartRef->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + $chartDetails[$docSheet->getTitle() . '!' . $thisChart] = [ + 'fromCoordinate' => $fromCoordinate, + 'fromOffsetX' => $fromOffsetX, + 'fromOffsetY' => $fromOffsetY, + 'toCoordinate' => $toCoordinate, + 'toOffsetX' => $toOffsetX, + 'toOffsetY' => $toOffsetY, + 'worksheetTitle' => $docSheet->getTitle(), + ]; + } + } + } + if ($relsDrawing === false && $xmlDrawing->count() == 0) { + // Save Drawing without rels and children as unparsed + $unparsedDrawings[$drawingRelId] = $xmlDrawing->asXML(); + } + } + + // store original rId of drawing files + $unparsedLoadedData['sheets'][$docSheet->getCodeName()]['drawingOriginalIds'] = []; + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing') { + $drawingRelId = (string) $ele['Id']; + $unparsedLoadedData['sheets'][$docSheet->getCodeName()]['drawingOriginalIds'][(string) $ele['Target']] = $drawingRelId; + if (isset($unparsedDrawings[$drawingRelId])) { + $unparsedLoadedData['sheets'][$docSheet->getCodeName()]['Drawings'][$drawingRelId] = $unparsedDrawings[$drawingRelId]; + } + } + } + + // unparsed drawing AlternateContent + $xmlAltDrawing = simplexml_load_string( + $this->securityScanner->scan($this->getFromZipArchive($zip, $fileDrawing)), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + )->children('http://schemas.openxmlformats.org/markup-compatibility/2006'); + + if ($xmlAltDrawing->AlternateContent) { + foreach ($xmlAltDrawing->AlternateContent as $alternateContent) { + $unparsedLoadedData['sheets'][$docSheet->getCodeName()]['drawingAlternateContents'][] = $alternateContent->asXML(); + } + } + } + } + + $this->readFormControlProperties($excel, $zip, $dir, $fileWorksheet, $docSheet, $unparsedLoadedData); + $this->readPrinterSettings($excel, $zip, $dir, $fileWorksheet, $docSheet, $unparsedLoadedData); + + // Loop through definedNames + if ($xmlWorkbook->definedNames) { + foreach ($xmlWorkbook->definedNames->definedName as $definedName) { + // Extract range + $extractedRange = (string) $definedName; + if (($spos = strpos($extractedRange, '!')) !== false) { + $extractedRange = substr($extractedRange, 0, $spos) . str_replace('$', '', substr($extractedRange, $spos)); + } else { + $extractedRange = str_replace('$', '', $extractedRange); + } + + // Valid range? + if (stripos((string) $definedName, '#REF!') !== false || $extractedRange == '') { + continue; + } + + // Some definedNames are only applicable if we are on the same sheet... + if ((string) $definedName['localSheetId'] != '' && (string) $definedName['localSheetId'] == $oldSheetId) { + // Switch on type + switch ((string) $definedName['name']) { + case '_xlnm._FilterDatabase': + if ((string) $definedName['hidden'] !== '1') { + $extractedRange = explode(',', $extractedRange); + foreach ($extractedRange as $range) { + $autoFilterRange = $range; + if (strpos($autoFilterRange, ':') !== false) { + $docSheet->getAutoFilter()->setRange($autoFilterRange); + } + } + } + + break; + case '_xlnm.Print_Titles': + // Split $extractedRange + $extractedRange = explode(',', $extractedRange); + + // Set print titles + foreach ($extractedRange as $range) { + $matches = []; + $range = str_replace('$', '', $range); + + // check for repeating columns, e g. 'A:A' or 'A:D' + if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) { + $docSheet->getPageSetup()->setColumnsToRepeatAtLeft([$matches[1], $matches[2]]); + } elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) { + // check for repeating rows, e.g. '1:1' or '1:5' + $docSheet->getPageSetup()->setRowsToRepeatAtTop([$matches[1], $matches[2]]); + } + } + + break; + case '_xlnm.Print_Area': + $rangeSets = preg_split("/('?(?:.*?)'?(?:![A-Z0-9]+:[A-Z0-9]+)),?/", $extractedRange, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + $newRangeSets = []; + foreach ($rangeSets as $rangeSet) { + [$sheetName, $rangeSet] = Worksheet::extractSheetTitle($rangeSet, true); + if (strpos($rangeSet, ':') === false) { + $rangeSet = $rangeSet . ':' . $rangeSet; + } + $newRangeSets[] = str_replace('$', '', $rangeSet); + } + $docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets)); + + break; + default: + break; + } + } + } + } + + // Next sheet id + ++$sheetId; + } + + // Loop through definedNames + if ($xmlWorkbook->definedNames) { + foreach ($xmlWorkbook->definedNames->definedName as $definedName) { + // Extract range + $extractedRange = (string) $definedName; + if (($spos = strpos($extractedRange, '!')) !== false) { + $extractedRange = substr($extractedRange, 0, $spos) . str_replace('$', '', substr($extractedRange, $spos)); + } else { + $extractedRange = str_replace('$', '', $extractedRange); + } + + // Valid range? + if (stripos((string) $definedName, '#REF!') !== false || $extractedRange == '') { + continue; + } + + // Some definedNames are only applicable if we are on the same sheet... + if ((string) $definedName['localSheetId'] != '') { + // Local defined name + // Switch on type + switch ((string) $definedName['name']) { + case '_xlnm._FilterDatabase': + case '_xlnm.Print_Titles': + case '_xlnm.Print_Area': + break; + default: + if ($mapSheetId[(int) $definedName['localSheetId']] !== null) { + if (strpos((string) $definedName, '!') !== false) { + $range = Worksheet::extractSheetTitle((string) $definedName, true); + $range[0] = str_replace("''", "'", $range[0]); + $range[0] = str_replace("'", '', $range[0]); + if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) { + $extractedRange = str_replace('$', '', $range[1]); + $scope = $docSheet->getParent()->getSheet($mapSheetId[(int) $definedName['localSheetId']]); + $excel->addNamedRange(new NamedRange((string) $definedName['name'], $worksheet, $extractedRange, true, $scope)); + } + } + } + + break; + } + } elseif (!isset($definedName['localSheetId'])) { + // "Global" definedNames + $locatedSheet = null; + $extractedSheetName = ''; + if (strpos((string) $definedName, '!') !== false) { + // Extract sheet name + $extractedSheetName = Worksheet::extractSheetTitle((string) $definedName, true); + $extractedSheetName = trim($extractedSheetName[0], "'"); + + // Locate sheet + $locatedSheet = $excel->getSheetByName($extractedSheetName); + + // Modify range + [$worksheetName, $extractedRange] = Worksheet::extractSheetTitle($extractedRange, true); + } + + if ($locatedSheet !== null) { + $excel->addNamedRange(new NamedRange((string) $definedName['name'], $locatedSheet, $extractedRange, false)); + } + } + } + } + } + + if ((!$this->readDataOnly || !empty($this->loadSheetsOnly)) && isset($xmlWorkbook->bookViews->workbookView)) { + $workbookView = $xmlWorkbook->bookViews->workbookView; + + // active sheet index + $activeTab = (int) ($workbookView['activeTab']); // refers to old sheet index + + // keep active sheet index if sheet is still loaded, else first sheet is set as the active + if (isset($mapSheetId[$activeTab]) && $mapSheetId[$activeTab] !== null) { + $excel->setActiveSheetIndex($mapSheetId[$activeTab]); + } else { + if ($excel->getSheetCount() == 0) { + $excel->createSheet(); + } + $excel->setActiveSheetIndex(0); + } + + if (isset($workbookView['showHorizontalScroll'])) { + $showHorizontalScroll = (string) $workbookView['showHorizontalScroll']; + $excel->setShowHorizontalScroll($this->castXsdBooleanToBool($showHorizontalScroll)); + } + + if (isset($workbookView['showVerticalScroll'])) { + $showVerticalScroll = (string) $workbookView['showVerticalScroll']; + $excel->setShowVerticalScroll($this->castXsdBooleanToBool($showVerticalScroll)); + } + + if (isset($workbookView['showSheetTabs'])) { + $showSheetTabs = (string) $workbookView['showSheetTabs']; + $excel->setShowSheetTabs($this->castXsdBooleanToBool($showSheetTabs)); + } + + if (isset($workbookView['minimized'])) { + $minimized = (string) $workbookView['minimized']; + $excel->setMinimized($this->castXsdBooleanToBool($minimized)); + } + + if (isset($workbookView['autoFilterDateGrouping'])) { + $autoFilterDateGrouping = (string) $workbookView['autoFilterDateGrouping']; + $excel->setAutoFilterDateGrouping($this->castXsdBooleanToBool($autoFilterDateGrouping)); + } + + if (isset($workbookView['firstSheet'])) { + $firstSheet = (string) $workbookView['firstSheet']; + $excel->setFirstSheetIndex((int) $firstSheet); + } + + if (isset($workbookView['visibility'])) { + $visibility = (string) $workbookView['visibility']; + $excel->setVisibility($visibility); + } + + if (isset($workbookView['tabRatio'])) { + $tabRatio = (string) $workbookView['tabRatio']; + $excel->setTabRatio((int) $tabRatio); + } + } + + break; + } + } + + if (!$this->readDataOnly) { + $contentTypes = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, '[Content_Types].xml') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + + // Default content types + foreach ($contentTypes->Default as $contentType) { + switch ($contentType['ContentType']) { + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings': + $unparsedLoadedData['default_content_types'][(string) $contentType['Extension']] = (string) $contentType['ContentType']; + + break; + } + } + + // Override content types + foreach ($contentTypes->Override as $contentType) { + switch ($contentType['ContentType']) { + case 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml': + if ($this->includeCharts) { + $chartEntryRef = ltrim($contentType['PartName'], '/'); + $chartElements = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, $chartEntryRef) + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $objChart = Chart::readChart($chartElements, basename($chartEntryRef, '.xml')); + + if (isset($charts[$chartEntryRef])) { + $chartPositionRef = $charts[$chartEntryRef]['sheet'] . '!' . $charts[$chartEntryRef]['id']; + if (isset($chartDetails[$chartPositionRef])) { + $excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart); + $objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet'])); + $objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], $chartDetails[$chartPositionRef]['fromOffsetX'], $chartDetails[$chartPositionRef]['fromOffsetY']); + $objChart->setBottomRightPosition($chartDetails[$chartPositionRef]['toCoordinate'], $chartDetails[$chartPositionRef]['toOffsetX'], $chartDetails[$chartPositionRef]['toOffsetY']); + } + } + } + + break; + + // unparsed + case 'application/vnd.ms-excel.controlproperties+xml': + $unparsedLoadedData['override_content_types'][(string) $contentType['PartName']] = (string) $contentType['ContentType']; + + break; + } + } + } + + $excel->setUnparsedLoadedData($unparsedLoadedData); + + $zip->close(); + + return $excel; + } + + private static function readColor($color, $background = false) + { + if (isset($color['rgb'])) { + return (string) $color['rgb']; + } elseif (isset($color['indexed'])) { + return Color::indexedColor($color['indexed'] - 7, $background)->getARGB(); + } elseif (isset($color['theme'])) { + if (self::$theme !== null) { + $returnColour = self::$theme->getColourByIndex((int) $color['theme']); + if (isset($color['tint'])) { + $tintAdjust = (float) $color['tint']; + $returnColour = Color::changeBrightness($returnColour, $tintAdjust); + } + + return 'FF' . $returnColour; + } + } + + if ($background) { + return 'FFFFFFFF'; + } + + return 'FF000000'; + } + + /** + * @param Style $docStyle + * @param SimpleXMLElement|\stdClass $style + */ + private static function readStyle(Style $docStyle, $style) + { + $docStyle->getNumberFormat()->setFormatCode($style->numFmt); + + // font + if (isset($style->font)) { + $docStyle->getFont()->setName((string) $style->font->name['val']); + $docStyle->getFont()->setSize((string) $style->font->sz['val']); + if (isset($style->font->b)) { + $docStyle->getFont()->setBold(!isset($style->font->b['val']) || self::boolean((string) $style->font->b['val'])); + } + if (isset($style->font->i)) { + $docStyle->getFont()->setItalic(!isset($style->font->i['val']) || self::boolean((string) $style->font->i['val'])); + } + if (isset($style->font->strike)) { + $docStyle->getFont()->setStrikethrough(!isset($style->font->strike['val']) || self::boolean((string) $style->font->strike['val'])); + } + $docStyle->getFont()->getColor()->setARGB(self::readColor($style->font->color)); + + if (isset($style->font->u) && !isset($style->font->u['val'])) { + $docStyle->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE); + } elseif (isset($style->font->u, $style->font->u['val'])) { + $docStyle->getFont()->setUnderline((string) $style->font->u['val']); + } + + if (isset($style->font->vertAlign, $style->font->vertAlign['val'])) { + $vertAlign = strtolower((string) $style->font->vertAlign['val']); + if ($vertAlign == 'superscript') { + $docStyle->getFont()->setSuperscript(true); + } + if ($vertAlign == 'subscript') { + $docStyle->getFont()->setSubscript(true); + } + } + } + + // fill + if (isset($style->fill)) { + if ($style->fill->gradientFill) { + /** @var SimpleXMLElement $gradientFill */ + $gradientFill = $style->fill->gradientFill[0]; + if (!empty($gradientFill['type'])) { + $docStyle->getFill()->setFillType((string) $gradientFill['type']); + } + $docStyle->getFill()->setRotation((float) ($gradientFill['degree'])); + $gradientFill->registerXPathNamespace('sml', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $docStyle->getFill()->getStartColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=0]'))->color)); + $docStyle->getFill()->getEndColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=1]'))->color)); + } elseif ($style->fill->patternFill) { + $patternType = (string) $style->fill->patternFill['patternType'] != '' ? (string) $style->fill->patternFill['patternType'] : 'solid'; + $docStyle->getFill()->setFillType($patternType); + if ($style->fill->patternFill->fgColor) { + $docStyle->getFill()->getStartColor()->setARGB(self::readColor($style->fill->patternFill->fgColor, true)); + } else { + $docStyle->getFill()->getStartColor()->setARGB('FF000000'); + } + if ($style->fill->patternFill->bgColor) { + $docStyle->getFill()->getEndColor()->setARGB(self::readColor($style->fill->patternFill->bgColor, true)); + } + } + } + + // border + if (isset($style->border)) { + $diagonalUp = self::boolean((string) $style->border['diagonalUp']); + $diagonalDown = self::boolean((string) $style->border['diagonalDown']); + if (!$diagonalUp && !$diagonalDown) { + $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_NONE); + } elseif ($diagonalUp && !$diagonalDown) { + $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_UP); + } elseif (!$diagonalUp && $diagonalDown) { + $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_DOWN); + } else { + $docStyle->getBorders()->setDiagonalDirection(Borders::DIAGONAL_BOTH); + } + self::readBorder($docStyle->getBorders()->getLeft(), $style->border->left); + self::readBorder($docStyle->getBorders()->getRight(), $style->border->right); + self::readBorder($docStyle->getBorders()->getTop(), $style->border->top); + self::readBorder($docStyle->getBorders()->getBottom(), $style->border->bottom); + self::readBorder($docStyle->getBorders()->getDiagonal(), $style->border->diagonal); + } + + // alignment + if (isset($style->alignment)) { + $docStyle->getAlignment()->setHorizontal((string) $style->alignment['horizontal']); + $docStyle->getAlignment()->setVertical((string) $style->alignment['vertical']); + + $textRotation = 0; + if ((int) $style->alignment['textRotation'] <= 90) { + $textRotation = (int) $style->alignment['textRotation']; + } elseif ((int) $style->alignment['textRotation'] > 90) { + $textRotation = 90 - (int) $style->alignment['textRotation']; + } + + $docStyle->getAlignment()->setTextRotation((int) $textRotation); + $docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment['wrapText'])); + $docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment['shrinkToFit'])); + $docStyle->getAlignment()->setIndent((int) ((string) $style->alignment['indent']) > 0 ? (int) ((string) $style->alignment['indent']) : 0); + $docStyle->getAlignment()->setReadOrder((int) ((string) $style->alignment['readingOrder']) > 0 ? (int) ((string) $style->alignment['readingOrder']) : 0); + } + + // protection + if (isset($style->protection)) { + if (isset($style->protection['locked'])) { + if (self::boolean((string) $style->protection['locked'])) { + $docStyle->getProtection()->setLocked(Protection::PROTECTION_PROTECTED); + } else { + $docStyle->getProtection()->setLocked(Protection::PROTECTION_UNPROTECTED); + } + } + + if (isset($style->protection['hidden'])) { + if (self::boolean((string) $style->protection['hidden'])) { + $docStyle->getProtection()->setHidden(Protection::PROTECTION_PROTECTED); + } else { + $docStyle->getProtection()->setHidden(Protection::PROTECTION_UNPROTECTED); + } + } + } + + // top-level style settings + if (isset($style->quotePrefix)) { + $docStyle->setQuotePrefix($style->quotePrefix); + } + } + + /** + * @param Border $docBorder + * @param SimpleXMLElement $eleBorder + */ + private static function readBorder(Border $docBorder, $eleBorder) + { + if (isset($eleBorder['style'])) { + $docBorder->setBorderStyle((string) $eleBorder['style']); + } + if (isset($eleBorder->color)) { + $docBorder->getColor()->setARGB(self::readColor($eleBorder->color)); + } + } + + /** + * @param SimpleXMLElement | null $is + * + * @return RichText + */ + private function parseRichText($is) + { + $value = new RichText(); + + if (isset($is->t)) { + $value->createText(StringHelper::controlCharacterOOXML2PHP((string) $is->t)); + } else { + if (is_object($is->r)) { + foreach ($is->r as $run) { + if (!isset($run->rPr)) { + $value->createText(StringHelper::controlCharacterOOXML2PHP((string) $run->t)); + } else { + $objText = $value->createTextRun(StringHelper::controlCharacterOOXML2PHP((string) $run->t)); + + if (isset($run->rPr->rFont['val'])) { + $objText->getFont()->setName((string) $run->rPr->rFont['val']); + } + if (isset($run->rPr->sz['val'])) { + $objText->getFont()->setSize((float) $run->rPr->sz['val']); + } + if (isset($run->rPr->color)) { + $objText->getFont()->setColor(new Color(self::readColor($run->rPr->color))); + } + if ((isset($run->rPr->b['val']) && self::boolean((string) $run->rPr->b['val'])) || + (isset($run->rPr->b) && !isset($run->rPr->b['val']))) { + $objText->getFont()->setBold(true); + } + if ((isset($run->rPr->i['val']) && self::boolean((string) $run->rPr->i['val'])) || + (isset($run->rPr->i) && !isset($run->rPr->i['val']))) { + $objText->getFont()->setItalic(true); + } + if (isset($run->rPr->vertAlign, $run->rPr->vertAlign['val'])) { + $vertAlign = strtolower((string) $run->rPr->vertAlign['val']); + if ($vertAlign == 'superscript') { + $objText->getFont()->setSuperscript(true); + } + if ($vertAlign == 'subscript') { + $objText->getFont()->setSubscript(true); + } + } + if (isset($run->rPr->u) && !isset($run->rPr->u['val'])) { + $objText->getFont()->setUnderline(\PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE); + } elseif (isset($run->rPr->u, $run->rPr->u['val'])) { + $objText->getFont()->setUnderline((string) $run->rPr->u['val']); + } + if ((isset($run->rPr->strike['val']) && self::boolean((string) $run->rPr->strike['val'])) || + (isset($run->rPr->strike) && !isset($run->rPr->strike['val']))) { + $objText->getFont()->setStrikethrough(true); + } + } + } + } + } + + return $value; + } + + /** + * @param Spreadsheet $excel + * @param mixed $customUITarget + * @param mixed $zip + */ + private function readRibbon(Spreadsheet $excel, $customUITarget, $zip) + { + $baseDir = dirname($customUITarget); + $nameCustomUI = basename($customUITarget); + // get the xml file (ribbon) + $localRibbon = $this->getFromZipArchive($zip, $customUITarget); + $customUIImagesNames = []; + $customUIImagesBinaries = []; + // something like customUI/_rels/customUI.xml.rels + $pathRels = $baseDir . '/_rels/' . $nameCustomUI . '.rels'; + $dataRels = $this->getFromZipArchive($zip, $pathRels); + if ($dataRels) { + // exists and not empty if the ribbon have some pictures (other than internal MSO) + $UIRels = simplexml_load_string( + $this->securityScanner->scan($dataRels), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + if (false !== $UIRels) { + // we need to save id and target to avoid parsing customUI.xml and "guess" if it's a pseudo callback who load the image + foreach ($UIRels->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') { + // an image ? + $customUIImagesNames[(string) $ele['Id']] = (string) $ele['Target']; + $customUIImagesBinaries[(string) $ele['Target']] = $this->getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']); + } + } + } + } + if ($localRibbon) { + $excel->setRibbonXMLData($customUITarget, $localRibbon); + if (count($customUIImagesNames) > 0 && count($customUIImagesBinaries) > 0) { + $excel->setRibbonBinObjects($customUIImagesNames, $customUIImagesBinaries); + } else { + $excel->setRibbonBinObjects(null, null); + } + } else { + $excel->setRibbonXMLData(null, null); + $excel->setRibbonBinObjects(null, null); + } + } + + private static function getArrayItem($array, $key = 0) + { + return $array[$key] ?? null; + } + + private static function dirAdd($base, $add) + { + return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add"); + } + + private static function toCSSArray($style) + { + $style = trim(str_replace(["\r", "\n"], '', $style), ';'); + + $temp = explode(';', $style); + $style = []; + foreach ($temp as $item) { + $item = explode(':', $item); + + if (strpos($item[1], 'px') !== false) { + $item[1] = str_replace('px', '', $item[1]); + } + if (strpos($item[1], 'pt') !== false) { + $item[1] = str_replace('pt', '', $item[1]); + $item[1] = Font::fontSizeToPixels($item[1]); + } + if (strpos($item[1], 'in') !== false) { + $item[1] = str_replace('in', '', $item[1]); + $item[1] = Font::inchSizeToPixels($item[1]); + } + if (strpos($item[1], 'cm') !== false) { + $item[1] = str_replace('cm', '', $item[1]); + $item[1] = Font::centimeterSizeToPixels($item[1]); + } + + $style[$item[0]] = $item[1]; + } + + return $style; + } + + private static function boolean($value) + { + if (is_object($value)) { + $value = (string) $value; + } + if (is_numeric($value)) { + return (bool) $value; + } + + return $value === 'true' || $value === 'TRUE'; + } + + /** + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Drawing $objDrawing + * @param \SimpleXMLElement $cellAnchor + * @param array $hyperlinks + */ + private function readHyperLinkDrawing($objDrawing, $cellAnchor, $hyperlinks) + { + $hlinkClick = $cellAnchor->pic->nvPicPr->cNvPr->children('http://schemas.openxmlformats.org/drawingml/2006/main')->hlinkClick; + + if ($hlinkClick->count() === 0) { + return; + } + + $hlinkId = (string) $hlinkClick->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships')['id']; + $hyperlink = new Hyperlink( + $hyperlinks[$hlinkId], + (string) self::getArrayItem($cellAnchor->pic->nvPicPr->cNvPr->attributes(), 'name') + ); + $objDrawing->setHyperlink($hyperlink); + } + + private function readProtection(Spreadsheet $excel, SimpleXMLElement $xmlWorkbook) + { + if (!$xmlWorkbook->workbookProtection) { + return; + } + + if ($xmlWorkbook->workbookProtection['lockRevision']) { + $excel->getSecurity()->setLockRevision((bool) $xmlWorkbook->workbookProtection['lockRevision']); + } + + if ($xmlWorkbook->workbookProtection['lockStructure']) { + $excel->getSecurity()->setLockStructure((bool) $xmlWorkbook->workbookProtection['lockStructure']); + } + + if ($xmlWorkbook->workbookProtection['lockWindows']) { + $excel->getSecurity()->setLockWindows((bool) $xmlWorkbook->workbookProtection['lockWindows']); + } + + if ($xmlWorkbook->workbookProtection['revisionsPassword']) { + $excel->getSecurity()->setRevisionsPassword((string) $xmlWorkbook->workbookProtection['revisionsPassword'], true); + } + + if ($xmlWorkbook->workbookProtection['workbookPassword']) { + $excel->getSecurity()->setWorkbookPassword((string) $xmlWorkbook->workbookProtection['workbookPassword'], true); + } + } + + private function readFormControlProperties(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData) + { + if (!$zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) { + return; + } + + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsWorksheet = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $ctrlProps = []; + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp') { + $ctrlProps[(string) $ele['Id']] = $ele; + } + } + + $unparsedCtrlProps = &$unparsedLoadedData['sheets'][$docSheet->getCodeName()]['ctrlProps']; + foreach ($ctrlProps as $rId => $ctrlProp) { + $rId = substr($rId, 3); // rIdXXX + $unparsedCtrlProps[$rId] = []; + $unparsedCtrlProps[$rId]['filePath'] = self::dirAdd("$dir/$fileWorksheet", $ctrlProp['Target']); + $unparsedCtrlProps[$rId]['relFilePath'] = (string) $ctrlProp['Target']; + $unparsedCtrlProps[$rId]['content'] = $this->securityScanner->scan($this->getFromZipArchive($zip, $unparsedCtrlProps[$rId]['filePath'])); + } + unset($unparsedCtrlProps); + } + + private function readPrinterSettings(Spreadsheet $excel, ZipArchive $zip, $dir, $fileWorksheet, $docSheet, array &$unparsedLoadedData) + { + if (!$zip->locateName(dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels')) { + return; + } + + //~ http://schemas.openxmlformats.org/package/2006/relationships" + $relsWorksheet = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . '/_rels/' . basename($fileWorksheet) . '.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + $sheetPrinterSettings = []; + foreach ($relsWorksheet->Relationship as $ele) { + if ($ele['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings') { + $sheetPrinterSettings[(string) $ele['Id']] = $ele; + } + } + + $unparsedPrinterSettings = &$unparsedLoadedData['sheets'][$docSheet->getCodeName()]['printerSettings']; + foreach ($sheetPrinterSettings as $rId => $printerSettings) { + $rId = substr($rId, 3); // rIdXXX + $unparsedPrinterSettings[$rId] = []; + $unparsedPrinterSettings[$rId]['filePath'] = self::dirAdd("$dir/$fileWorksheet", $printerSettings['Target']); + $unparsedPrinterSettings[$rId]['relFilePath'] = (string) $printerSettings['Target']; + $unparsedPrinterSettings[$rId]['content'] = $this->securityScanner->scan($this->getFromZipArchive($zip, $unparsedPrinterSettings[$rId]['filePath'])); + } + unset($unparsedPrinterSettings); + } + + /** + * Convert an 'xsd:boolean' XML value to a PHP boolean value. + * A valid 'xsd:boolean' XML value can be one of the following + * four values: 'true', 'false', '1', '0'. It is case sensitive. + * + * Note that just doing '(bool) $xsdBoolean' is not safe, + * since '(bool) "false"' returns true. + * + * @see https://www.w3.org/TR/xmlschema11-2/#boolean + * + * @param string $xsdBoolean An XML string value of type 'xsd:boolean' + * + * @return bool Boolean value + */ + private function castXsdBooleanToBool($xsdBoolean) + { + if ($xsdBoolean === 'false') { + return false; + } + + return (bool) $xsdBoolean; + } + + /** + * @param ZipArchive $zip Opened zip archive + * + * @return string basename of the used excel workbook + */ + private function getWorkbookBaseName(ZipArchive $zip) + { + $workbookBasename = ''; + + // check if it is an OOXML archive + $rels = simplexml_load_string( + $this->securityScanner->scan( + $this->getFromZipArchive($zip, '_rels/.rels') + ), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + if ($rels !== false) { + foreach ($rels->Relationship as $rel) { + switch ($rel['Type']) { + case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument': + $basename = basename($rel['Target']); + if (preg_match('/workbook.*\.xml/', $basename)) { + $workbookBasename = $basename; + } + + break; + } + } + } + + return $workbookBasename; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php new file mode 100644 index 0000000..69d5f69 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/AutoFilter.php @@ -0,0 +1,145 @@ +worksheet = $workSheet; + $this->worksheetXml = $worksheetXml; + } + + public function load() + { + // Remove all "$" in the auto filter range + $autoFilterRange = preg_replace('/\$/', '', $this->worksheetXml->autoFilter['ref']); + if (strpos($autoFilterRange, ':') !== false) { + $this->readAutoFilter($autoFilterRange, $this->worksheetXml); + } + } + + private function readAutoFilter($autoFilterRange, $xmlSheet) + { + $autoFilter = $this->worksheet->getAutoFilter(); + $autoFilter->setRange($autoFilterRange); + + foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) { + $column = $autoFilter->getColumnByOffset((int) $filterColumn['colId']); + // Check for standard filters + if ($filterColumn->filters) { + $column->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER); + $filters = $filterColumn->filters; + if ((isset($filters['blank'])) && ($filters['blank'] == 1)) { + // Operator is undefined, but always treated as EQUAL + $column->createRule()->setRule(null, '')->setRuleType(Rule::AUTOFILTER_RULETYPE_FILTER); + } + // Standard filters are always an OR join, so no join rule needs to be set + // Entries can be either filter elements + foreach ($filters->filter as $filterRule) { + // Operator is undefined, but always treated as EQUAL + $column->createRule()->setRule(null, (string) $filterRule['val'])->setRuleType(Rule::AUTOFILTER_RULETYPE_FILTER); + } + + // Or Date Group elements + $this->readDateRangeAutoFilter($filters, $column); + } + + // Check for custom filters + $this->readCustomAutoFilter($filterColumn, $column); + // Check for dynamic filters + $this->readDynamicAutoFilter($filterColumn, $column); + // Check for dynamic filters + $this->readTopTenAutoFilter($filterColumn, $column); + } + } + + private function readDateRangeAutoFilter(\SimpleXMLElement $filters, Column $column) + { + foreach ($filters->dateGroupItem as $dateGroupItem) { + // Operator is undefined, but always treated as EQUAL + $column->createRule()->setRule( + null, + [ + 'year' => (string) $dateGroupItem['year'], + 'month' => (string) $dateGroupItem['month'], + 'day' => (string) $dateGroupItem['day'], + 'hour' => (string) $dateGroupItem['hour'], + 'minute' => (string) $dateGroupItem['minute'], + 'second' => (string) $dateGroupItem['second'], + ], + (string) $dateGroupItem['dateTimeGrouping'] + )->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); + } + } + + private function readCustomAutoFilter(\SimpleXMLElement $filterColumn, Column $column) + { + if ($filterColumn->customFilters) { + $column->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER); + $customFilters = $filterColumn->customFilters; + // Custom filters can an AND or an OR join; + // and there should only ever be one or two entries + if ((isset($customFilters['and'])) && ($customFilters['and'] == 1)) { + $column->setJoin(Column::AUTOFILTER_COLUMN_JOIN_AND); + } + foreach ($customFilters->customFilter as $filterRule) { + $column->createRule()->setRule( + (string) $filterRule['operator'], + (string) $filterRule['val'] + )->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); + } + } + } + + private function readDynamicAutoFilter(\SimpleXMLElement $filterColumn, Column $column) + { + if ($filterColumn->dynamicFilter) { + $column->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER); + // We should only ever have one dynamic filter + foreach ($filterColumn->dynamicFilter as $filterRule) { + // Operator is undefined, but always treated as EQUAL + $column->createRule()->setRule( + null, + (string) $filterRule['val'], + (string) $filterRule['type'] + )->setRuleType(Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER); + if (isset($filterRule['val'])) { + $column->setAttribute('val', (string) $filterRule['val']); + } + if (isset($filterRule['maxVal'])) { + $column->setAttribute('maxVal', (string) $filterRule['maxVal']); + } + } + } + } + + private function readTopTenAutoFilter(\SimpleXMLElement $filterColumn, Column $column) + { + if ($filterColumn->top10) { + $column->setFilterType(Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER); + // We should only ever have one top10 filter + foreach ($filterColumn->top10 as $filterRule) { + $column->createRule()->setRule( + (((isset($filterRule['percent'])) && ($filterRule['percent'] == 1)) + ? Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT + : Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE + ), + (string) $filterRule['val'], + (((isset($filterRule['top'])) && ($filterRule['top'] == 1)) + ? Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP + : Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM + ) + )->setRuleType(Rule::AUTOFILTER_RULETYPE_TOPTENFILTER); + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php new file mode 100644 index 0000000..1679f01 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/BaseParserClass.php @@ -0,0 +1,19 @@ +attributes(); + if (isset($attributes[$name])) { + if ($format == 'string') { + return (string) $attributes[$name]; + } elseif ($format == 'integer') { + return (int) $attributes[$name]; + } elseif ($format == 'boolean') { + return (bool) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true; + } + + return (float) $attributes[$name]; + } + + return null; + } + + private static function readColor($color, $background = false) + { + if (isset($color['rgb'])) { + return (string) $color['rgb']; + } elseif (isset($color['indexed'])) { + return Color::indexedColor($color['indexed'] - 7, $background)->getARGB(); + } + } + + /** + * @param SimpleXMLElement $chartElements + * @param string $chartName + * + * @return \PhpOffice\PhpSpreadsheet\Chart\Chart + */ + public static function readChart(SimpleXMLElement $chartElements, $chartName) + { + $namespacesChartMeta = $chartElements->getNamespaces(true); + $chartElementsC = $chartElements->children($namespacesChartMeta['c']); + + $XaxisLabel = $YaxisLabel = $legend = $title = null; + $dispBlanksAs = $plotVisOnly = null; + + foreach ($chartElementsC as $chartElementKey => $chartElement) { + switch ($chartElementKey) { + case 'chart': + foreach ($chartElement as $chartDetailsKey => $chartDetails) { + $chartDetailsC = $chartDetails->children($namespacesChartMeta['c']); + switch ($chartDetailsKey) { + case 'plotArea': + $plotAreaLayout = $XaxisLable = $YaxisLable = null; + $plotSeries = $plotAttributes = []; + foreach ($chartDetails as $chartDetailKey => $chartDetail) { + switch ($chartDetailKey) { + case 'layout': + $plotAreaLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta); + + break; + case 'catAx': + if (isset($chartDetail->title)) { + $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta); + } + + break; + case 'dateAx': + if (isset($chartDetail->title)) { + $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta); + } + + break; + case 'valAx': + if (isset($chartDetail->title)) { + $YaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta); + } + + break; + case 'barChart': + case 'bar3DChart': + $barDirection = self::getAttribute($chartDetail->barDir, 'val', 'string'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotSer->setPlotDirection($barDirection); + $plotSeries[] = $plotSer; + $plotAttributes = self::readChartAttributes($chartDetail); + + break; + case 'lineChart': + case 'line3DChart': + $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotAttributes = self::readChartAttributes($chartDetail); + + break; + case 'areaChart': + case 'area3DChart': + $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotAttributes = self::readChartAttributes($chartDetail); + + break; + case 'doughnutChart': + case 'pieChart': + case 'pie3DChart': + $explosion = isset($chartDetail->ser->explosion); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotSer->setPlotStyle($explosion); + $plotSeries[] = $plotSer; + $plotAttributes = self::readChartAttributes($chartDetail); + + break; + case 'scatterChart': + $scatterStyle = self::getAttribute($chartDetail->scatterStyle, 'val', 'string'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotSer->setPlotStyle($scatterStyle); + $plotSeries[] = $plotSer; + $plotAttributes = self::readChartAttributes($chartDetail); + + break; + case 'bubbleChart': + $bubbleScale = self::getAttribute($chartDetail->bubbleScale, 'val', 'integer'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotSer->setPlotStyle($bubbleScale); + $plotSeries[] = $plotSer; + $plotAttributes = self::readChartAttributes($chartDetail); + + break; + case 'radarChart': + $radarStyle = self::getAttribute($chartDetail->radarStyle, 'val', 'string'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotSer->setPlotStyle($radarStyle); + $plotSeries[] = $plotSer; + $plotAttributes = self::readChartAttributes($chartDetail); + + break; + case 'surfaceChart': + case 'surface3DChart': + $wireFrame = self::getAttribute($chartDetail->wireframe, 'val', 'boolean'); + $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotSer->setPlotStyle($wireFrame); + $plotSeries[] = $plotSer; + $plotAttributes = self::readChartAttributes($chartDetail); + + break; + case 'stockChart': + $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey); + $plotAttributes = self::readChartAttributes($plotAreaLayout); + + break; + } + } + if ($plotAreaLayout == null) { + $plotAreaLayout = new Layout(); + } + $plotArea = new PlotArea($plotAreaLayout, $plotSeries); + self::setChartAttributes($plotAreaLayout, $plotAttributes); + + break; + case 'plotVisOnly': + $plotVisOnly = self::getAttribute($chartDetails, 'val', 'string'); + + break; + case 'dispBlanksAs': + $dispBlanksAs = self::getAttribute($chartDetails, 'val', 'string'); + + break; + case 'title': + $title = self::chartTitle($chartDetails, $namespacesChartMeta); + + break; + case 'legend': + $legendPos = 'r'; + $legendLayout = null; + $legendOverlay = false; + foreach ($chartDetails as $chartDetailKey => $chartDetail) { + switch ($chartDetailKey) { + case 'legendPos': + $legendPos = self::getAttribute($chartDetail, 'val', 'string'); + + break; + case 'overlay': + $legendOverlay = self::getAttribute($chartDetail, 'val', 'boolean'); + + break; + case 'layout': + $legendLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta); + + break; + } + } + $legend = new Legend($legendPos, $legendLayout, $legendOverlay); + + break; + } + } + } + } + $chart = new \PhpOffice\PhpSpreadsheet\Chart\Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel); + + return $chart; + } + + private static function chartTitle(SimpleXMLElement $titleDetails, array $namespacesChartMeta) + { + $caption = []; + $titleLayout = null; + foreach ($titleDetails as $titleDetailKey => $chartDetail) { + switch ($titleDetailKey) { + case 'tx': + $titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']); + foreach ($titleDetails as $titleKey => $titleDetail) { + switch ($titleKey) { + case 'p': + $titleDetailPart = $titleDetail->children($namespacesChartMeta['a']); + $caption[] = self::parseRichText($titleDetailPart); + } + } + + break; + case 'layout': + $titleLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta); + + break; + } + } + + return new Title($caption, $titleLayout); + } + + private static function chartLayoutDetails($chartDetail, $namespacesChartMeta) + { + if (!isset($chartDetail->manualLayout)) { + return null; + } + $details = $chartDetail->manualLayout->children($namespacesChartMeta['c']); + if ($details === null) { + return null; + } + $layout = []; + foreach ($details as $detailKey => $detail) { + $layout[$detailKey] = self::getAttribute($detail, 'val', 'string'); + } + + return new Layout($layout); + } + + private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType) + { + $multiSeriesType = null; + $smoothLine = false; + $seriesLabel = $seriesCategory = $seriesValues = $plotOrder = []; + + $seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']); + foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) { + switch ($seriesDetailKey) { + case 'grouping': + $multiSeriesType = self::getAttribute($chartDetail->grouping, 'val', 'string'); + + break; + case 'ser': + $marker = null; + $seriesIndex = ''; + foreach ($seriesDetails as $seriesKey => $seriesDetail) { + switch ($seriesKey) { + case 'idx': + $seriesIndex = self::getAttribute($seriesDetail, 'val', 'integer'); + + break; + case 'order': + $seriesOrder = self::getAttribute($seriesDetail, 'val', 'integer'); + $plotOrder[$seriesIndex] = $seriesOrder; + + break; + case 'tx': + $seriesLabel[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); + + break; + case 'marker': + $marker = self::getAttribute($seriesDetail->symbol, 'val', 'string'); + + break; + case 'smooth': + $smoothLine = self::getAttribute($seriesDetail, 'val', 'boolean'); + + break; + case 'cat': + $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta); + + break; + case 'val': + $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); + + break; + case 'xVal': + $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); + + break; + case 'yVal': + $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker); + + break; + } + } + } + } + + return new DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine); + } + + private static function chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null) + { + if (isset($seriesDetail->strRef)) { + $seriesSource = (string) $seriesDetail->strRef->f; + $seriesData = self::chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's'); + + return new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker); + } elseif (isset($seriesDetail->numRef)) { + $seriesSource = (string) $seriesDetail->numRef->f; + $seriesData = self::chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c'])); + + return new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker); + } elseif (isset($seriesDetail->multiLvlStrRef)) { + $seriesSource = (string) $seriesDetail->multiLvlStrRef->f; + $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's'); + $seriesData['pointCount'] = count($seriesData['dataValues']); + + return new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker); + } elseif (isset($seriesDetail->multiLvlNumRef)) { + $seriesSource = (string) $seriesDetail->multiLvlNumRef->f; + $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's'); + $seriesData['pointCount'] = count($seriesData['dataValues']); + + return new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker); + } + + return null; + } + + private static function chartDataSeriesValues($seriesValueSet, $dataType = 'n') + { + $seriesVal = []; + $formatCode = ''; + $pointCount = 0; + + foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) { + switch ($seriesValueIdx) { + case 'ptCount': + $pointCount = self::getAttribute($seriesValue, 'val', 'integer'); + + break; + case 'formatCode': + $formatCode = (string) $seriesValue; + + break; + case 'pt': + $pointVal = self::getAttribute($seriesValue, 'idx', 'integer'); + if ($dataType == 's') { + $seriesVal[$pointVal] = (string) $seriesValue->v; + } elseif ($seriesValue->v === Functions::NA()) { + $seriesVal[$pointVal] = null; + } else { + $seriesVal[$pointVal] = (float) $seriesValue->v; + } + + break; + } + } + + return [ + 'formatCode' => $formatCode, + 'pointCount' => $pointCount, + 'dataValues' => $seriesVal, + ]; + } + + private static function chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n') + { + $seriesVal = []; + $formatCode = ''; + $pointCount = 0; + + foreach ($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) { + foreach ($seriesLevel as $seriesValueIdx => $seriesValue) { + switch ($seriesValueIdx) { + case 'ptCount': + $pointCount = self::getAttribute($seriesValue, 'val', 'integer'); + + break; + case 'formatCode': + $formatCode = (string) $seriesValue; + + break; + case 'pt': + $pointVal = self::getAttribute($seriesValue, 'idx', 'integer'); + if ($dataType == 's') { + $seriesVal[$pointVal][] = (string) $seriesValue->v; + } elseif ($seriesValue->v === Functions::NA()) { + $seriesVal[$pointVal] = null; + } else { + $seriesVal[$pointVal][] = (float) $seriesValue->v; + } + + break; + } + } + } + + return [ + 'formatCode' => $formatCode, + 'pointCount' => $pointCount, + 'dataValues' => $seriesVal, + ]; + } + + private static function parseRichText(SimpleXMLElement $titleDetailPart) + { + $value = new RichText(); + $objText = null; + foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) { + if (isset($titleDetailElement->t)) { + $objText = $value->createTextRun((string) $titleDetailElement->t); + } + if (isset($titleDetailElement->rPr)) { + if (isset($titleDetailElement->rPr->rFont['val'])) { + $objText->getFont()->setName((string) $titleDetailElement->rPr->rFont['val']); + } + + $fontSize = (self::getAttribute($titleDetailElement->rPr, 'sz', 'integer')); + if ($fontSize !== null) { + $objText->getFont()->setSize(floor($fontSize / 100)); + } + + $fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string')); + if ($fontColor !== null) { + $objText->getFont()->setColor(new Color(self::readColor($fontColor))); + } + + $bold = self::getAttribute($titleDetailElement->rPr, 'b', 'boolean'); + if ($bold !== null) { + $objText->getFont()->setBold($bold); + } + + $italic = self::getAttribute($titleDetailElement->rPr, 'i', 'boolean'); + if ($italic !== null) { + $objText->getFont()->setItalic($italic); + } + + $baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer'); + if ($baseline !== null) { + if ($baseline > 0) { + $objText->getFont()->setSuperscript(true); + } elseif ($baseline < 0) { + $objText->getFont()->setSubscript(true); + } + } + + $underscore = (self::getAttribute($titleDetailElement->rPr, 'u', 'string')); + if ($underscore !== null) { + if ($underscore == 'sng') { + $objText->getFont()->setUnderline(Font::UNDERLINE_SINGLE); + } elseif ($underscore == 'dbl') { + $objText->getFont()->setUnderline(Font::UNDERLINE_DOUBLE); + } else { + $objText->getFont()->setUnderline(Font::UNDERLINE_NONE); + } + } + + $strikethrough = (self::getAttribute($titleDetailElement->rPr, 's', 'string')); + if ($strikethrough !== null) { + if ($strikethrough == 'noStrike') { + $objText->getFont()->setStrikethrough(false); + } else { + $objText->getFont()->setStrikethrough(true); + } + } + } + } + + return $value; + } + + private static function readChartAttributes($chartDetail) + { + $plotAttributes = []; + if (isset($chartDetail->dLbls)) { + if (isset($chartDetail->dLbls->howLegendKey)) { + $plotAttributes['showLegendKey'] = self::getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string'); + } + if (isset($chartDetail->dLbls->showVal)) { + $plotAttributes['showVal'] = self::getAttribute($chartDetail->dLbls->showVal, 'val', 'string'); + } + if (isset($chartDetail->dLbls->showCatName)) { + $plotAttributes['showCatName'] = self::getAttribute($chartDetail->dLbls->showCatName, 'val', 'string'); + } + if (isset($chartDetail->dLbls->showSerName)) { + $plotAttributes['showSerName'] = self::getAttribute($chartDetail->dLbls->showSerName, 'val', 'string'); + } + if (isset($chartDetail->dLbls->showPercent)) { + $plotAttributes['showPercent'] = self::getAttribute($chartDetail->dLbls->showPercent, 'val', 'string'); + } + if (isset($chartDetail->dLbls->showBubbleSize)) { + $plotAttributes['showBubbleSize'] = self::getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string'); + } + if (isset($chartDetail->dLbls->showLeaderLines)) { + $plotAttributes['showLeaderLines'] = self::getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string'); + } + } + + return $plotAttributes; + } + + /** + * @param Layout $plotArea + * @param mixed $plotAttributes + */ + private static function setChartAttributes(Layout $plotArea, $plotAttributes) + { + foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) { + switch ($plotAttributeKey) { + case 'showLegendKey': + $plotArea->setShowLegendKey($plotAttributeValue); + + break; + case 'showVal': + $plotArea->setShowVal($plotAttributeValue); + + break; + case 'showCatName': + $plotArea->setShowCatName($plotAttributeValue); + + break; + case 'showSerName': + $plotArea->setShowSerName($plotAttributeValue); + + break; + case 'showPercent': + $plotArea->setShowPercent($plotAttributeValue); + + break; + case 'showBubbleSize': + $plotArea->setShowBubbleSize($plotAttributeValue); + + break; + case 'showLeaderLines': + $plotArea->setShowLeaderLines($plotAttributeValue); + + break; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php new file mode 100644 index 0000000..e901d99 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php @@ -0,0 +1,204 @@ +worksheet = $workSheet; + $this->worksheetXml = $worksheetXml; + } + + /** + * Set Worksheet column attributes by attributes array passed. + * + * @param string $columnAddress A, B, ... DX, ... + * @param array $columnAttributes array of attributes (indexes are attribute name, values are value) + * 'xfIndex', 'visible', 'collapsed', 'outlineLevel', 'width', ... ? + */ + private function setColumnAttributes($columnAddress, array $columnAttributes) + { + if (isset($columnAttributes['xfIndex'])) { + $this->worksheet->getColumnDimension($columnAddress)->setXfIndex($columnAttributes['xfIndex']); + } + if (isset($columnAttributes['visible'])) { + $this->worksheet->getColumnDimension($columnAddress)->setVisible($columnAttributes['visible']); + } + if (isset($columnAttributes['collapsed'])) { + $this->worksheet->getColumnDimension($columnAddress)->setCollapsed($columnAttributes['collapsed']); + } + if (isset($columnAttributes['outlineLevel'])) { + $this->worksheet->getColumnDimension($columnAddress)->setOutlineLevel($columnAttributes['outlineLevel']); + } + if (isset($columnAttributes['width'])) { + $this->worksheet->getColumnDimension($columnAddress)->setWidth($columnAttributes['width']); + } + } + + /** + * Set Worksheet row attributes by attributes array passed. + * + * @param int $rowNumber 1, 2, 3, ... 99, ... + * @param array $rowAttributes array of attributes (indexes are attribute name, values are value) + * 'xfIndex', 'visible', 'collapsed', 'outlineLevel', 'rowHeight', ... ? + */ + private function setRowAttributes($rowNumber, array $rowAttributes) + { + if (isset($rowAttributes['xfIndex'])) { + $this->worksheet->getRowDimension($rowNumber)->setXfIndex($rowAttributes['xfIndex']); + } + if (isset($rowAttributes['visible'])) { + $this->worksheet->getRowDimension($rowNumber)->setVisible($rowAttributes['visible']); + } + if (isset($rowAttributes['collapsed'])) { + $this->worksheet->getRowDimension($rowNumber)->setCollapsed($rowAttributes['collapsed']); + } + if (isset($rowAttributes['outlineLevel'])) { + $this->worksheet->getRowDimension($rowNumber)->setOutlineLevel($rowAttributes['outlineLevel']); + } + if (isset($rowAttributes['rowHeight'])) { + $this->worksheet->getRowDimension($rowNumber)->setRowHeight($rowAttributes['rowHeight']); + } + } + + /** + * @param IReadFilter $readFilter + * @param bool $readDataOnly + */ + public function load(IReadFilter $readFilter = null, $readDataOnly = false) + { + if ($this->worksheetXml === null) { + return; + } + + $columnsAttributes = []; + $rowsAttributes = []; + if (isset($this->worksheetXml->cols)) { + $columnsAttributes = $this->readColumnAttributes($this->worksheetXml->cols, $readDataOnly); + } + + if ($this->worksheetXml->sheetData && $this->worksheetXml->sheetData->row) { + $rowsAttributes = $this->readRowAttributes($this->worksheetXml->sheetData->row, $readDataOnly); + } + + // set columns/rows attributes + $columnsAttributesAreSet = []; + foreach ($columnsAttributes as $columnCoordinate => $columnAttributes) { + if ($readFilter === null || + !$this->isFilteredColumn($readFilter, $columnCoordinate, $rowsAttributes)) { + if (!isset($columnsAttributesAreSet[$columnCoordinate])) { + $this->setColumnAttributes($columnCoordinate, $columnAttributes); + $columnsAttributesAreSet[$columnCoordinate] = true; + } + } + } + + $rowsAttributesAreSet = []; + foreach ($rowsAttributes as $rowCoordinate => $rowAttributes) { + if ($readFilter === null || + !$this->isFilteredRow($readFilter, $rowCoordinate, $columnsAttributes)) { + if (!isset($rowsAttributesAreSet[$rowCoordinate])) { + $this->setRowAttributes($rowCoordinate, $rowAttributes); + $rowsAttributesAreSet[$rowCoordinate] = true; + } + } + } + } + + private function isFilteredColumn(IReadFilter $readFilter, $columnCoordinate, array $rowsAttributes) + { + foreach ($rowsAttributes as $rowCoordinate => $rowAttributes) { + if (!$readFilter->readCell($columnCoordinate, $rowCoordinate, $this->worksheet->getTitle())) { + return true; + } + } + + return false; + } + + private function readColumnAttributes(\SimpleXMLElement $worksheetCols, $readDataOnly) + { + $columnAttributes = []; + + foreach ($worksheetCols->col as $column) { + $startColumn = Coordinate::stringFromColumnIndex((int) $column['min']); + $endColumn = Coordinate::stringFromColumnIndex((int) $column['max']); + ++$endColumn; + for ($columnAddress = $startColumn; $columnAddress !== $endColumn; ++$columnAddress) { + $columnAttributes[$columnAddress] = $this->readColumnRangeAttributes($column, $readDataOnly); + + if ((int) ($column['max']) == 16384) { + break; + } + } + } + + return $columnAttributes; + } + + private function readColumnRangeAttributes(\SimpleXMLElement $column, $readDataOnly) + { + $columnAttributes = []; + + if ($column['style'] && !$readDataOnly) { + $columnAttributes['xfIndex'] = (int) $column['style']; + } + if (self::boolean($column['hidden'])) { + $columnAttributes['visible'] = false; + } + if (self::boolean($column['collapsed'])) { + $columnAttributes['collapsed'] = true; + } + if (((int) $column['outlineLevel']) > 0) { + $columnAttributes['outlineLevel'] = (int) $column['outlineLevel']; + } + $columnAttributes['width'] = (float) $column['width']; + + return $columnAttributes; + } + + private function isFilteredRow(IReadFilter $readFilter, $rowCoordinate, array $columnsAttributes) + { + foreach ($columnsAttributes as $columnCoordinate => $columnAttributes) { + if (!$readFilter->readCell($columnCoordinate, $rowCoordinate, $this->worksheet->getTitle())) { + return true; + } + } + + return false; + } + + private function readRowAttributes(\SimpleXMLElement $worksheetRow, $readDataOnly) + { + $rowAttributes = []; + + foreach ($worksheetRow as $row) { + if ($row['ht'] && !$readDataOnly) { + $rowAttributes[(int) $row['r']]['rowHeight'] = (float) $row['ht']; + } + if (self::boolean($row['hidden'])) { + $rowAttributes[(int) $row['r']]['visible'] = false; + } + if (self::boolean($row['collapsed'])) { + $rowAttributes[(int) $row['r']]['collapsed'] = true; + } + if ((int) $row['outlineLevel'] > 0) { + $rowAttributes[(int) $row['r']]['outlineLevel'] = (int) $row['outlineLevel']; + } + if ($row['s'] && !$readDataOnly) { + $rowAttributes[(int) $row['r']]['xfIndex'] = (int) $row['s']; + } + } + + return $rowAttributes; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php new file mode 100644 index 0000000..722b779 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ConditionalStyles.php @@ -0,0 +1,94 @@ +worksheet = $workSheet; + $this->worksheetXml = $worksheetXml; + $this->dxfs = $dxfs; + } + + public function load() + { + $this->setConditionalStyles( + $this->worksheet, + $this->readConditionalStyles($this->worksheetXml) + ); + } + + private function readConditionalStyles($xmlSheet) + { + $conditionals = []; + foreach ($xmlSheet->conditionalFormatting as $conditional) { + foreach ($conditional->cfRule as $cfRule) { + if (((string) $cfRule['type'] == Conditional::CONDITION_NONE + || (string) $cfRule['type'] == Conditional::CONDITION_CELLIS + || (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSTEXT + || (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSBLANKS + || (string) $cfRule['type'] == Conditional::CONDITION_NOTCONTAINSBLANKS + || (string) $cfRule['type'] == Conditional::CONDITION_EXPRESSION) + && isset($this->dxfs[(int) ($cfRule['dxfId'])])) { + $conditionals[(string) $conditional['sqref']][(int) ($cfRule['priority'])] = $cfRule; + } + } + } + + return $conditionals; + } + + private function setConditionalStyles(Worksheet $worksheet, array $conditionals) + { + foreach ($conditionals as $ref => $cfRules) { + ksort($cfRules); + $conditionalStyles = $this->readStyleRules($cfRules); + + // Extract all cell references in $ref + $cellBlocks = explode(' ', str_replace('$', '', strtoupper($ref))); + foreach ($cellBlocks as $cellBlock) { + $worksheet->getStyle($cellBlock)->setConditionalStyles($conditionalStyles); + } + } + } + + private function readStyleRules($cfRules) + { + $conditionalStyles = []; + foreach ($cfRules as $cfRule) { + $objConditional = new Conditional(); + $objConditional->setConditionType((string) $cfRule['type']); + $objConditional->setOperatorType((string) $cfRule['operator']); + + if ((string) $cfRule['text'] != '') { + $objConditional->setText((string) $cfRule['text']); + } + + if (isset($cfRule['stopIfTrue']) && (int) $cfRule['stopIfTrue'] === 1) { + $objConditional->setStopIfTrue(true); + } + + if (count($cfRule->formula) > 1) { + foreach ($cfRule->formula as $formula) { + $objConditional->addCondition((string) $formula); + } + } else { + $objConditional->addCondition((string) $cfRule->formula); + } + $objConditional->setStyle(clone $this->dxfs[(int) ($cfRule['dxfId'])]); + $conditionalStyles[] = $objConditional; + } + + return $conditionalStyles; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php new file mode 100644 index 0000000..4bb4412 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php @@ -0,0 +1,50 @@ +worksheet = $workSheet; + $this->worksheetXml = $worksheetXml; + } + + public function load() + { + foreach ($this->worksheetXml->dataValidations->dataValidation as $dataValidation) { + // Uppercase coordinate + $range = strtoupper($dataValidation['sqref']); + $rangeSet = explode(' ', $range); + foreach ($rangeSet as $range) { + $stRange = $this->worksheet->shrinkRangeToFit($range); + + // Extract all cell references in $range + foreach (Coordinate::extractAllCellReferencesInRange($stRange) as $reference) { + // Create validation + $docValidation = $this->worksheet->getCell($reference)->getDataValidation(); + $docValidation->setType((string) $dataValidation['type']); + $docValidation->setErrorStyle((string) $dataValidation['errorStyle']); + $docValidation->setOperator((string) $dataValidation['operator']); + $docValidation->setAllowBlank($dataValidation['allowBlank'] != 0); + $docValidation->setShowDropDown($dataValidation['showDropDown'] == 0); + $docValidation->setShowInputMessage($dataValidation['showInputMessage'] != 0); + $docValidation->setShowErrorMessage($dataValidation['showErrorMessage'] != 0); + $docValidation->setErrorTitle((string) $dataValidation['errorTitle']); + $docValidation->setError((string) $dataValidation['error']); + $docValidation->setPromptTitle((string) $dataValidation['promptTitle']); + $docValidation->setPrompt((string) $dataValidation['prompt']); + $docValidation->setFormula1((string) $dataValidation->formula1); + $docValidation->setFormula2((string) $dataValidation->formula2); + } + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php new file mode 100644 index 0000000..400b272 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php @@ -0,0 +1,58 @@ +worksheet = $workSheet; + } + + public function readHyperlinks(\SimpleXMLElement $relsWorksheet) + { + foreach ($relsWorksheet->Relationship as $element) { + if ($element['Type'] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink') { + $this->hyperlinks[(string) $element['Id']] = (string) $element['Target']; + } + } + } + + public function setHyperlinks(\SimpleXMLElement $worksheetXml) + { + foreach ($worksheetXml->hyperlink as $hyperlink) { + $this->setHyperlink($hyperlink, $this->worksheet); + } + } + + private function setHyperlink(\SimpleXMLElement $hyperlink, Worksheet $worksheet) + { + // Link url + $linkRel = $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + foreach (Coordinate::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { + $cell = $worksheet->getCell($cellReference); + if (isset($linkRel['id'])) { + $hyperlinkUrl = $this->hyperlinks[(string) $linkRel['id']]; + if (isset($hyperlink['location'])) { + $hyperlinkUrl .= '#' . (string) $hyperlink['location']; + } + $cell->getHyperlink()->setUrl($hyperlinkUrl); + } elseif (isset($hyperlink['location'])) { + $cell->getHyperlink()->setUrl('sheet://' . (string) $hyperlink['location']); + } + + // Tooltip + if (isset($hyperlink['tooltip'])) { + $cell->getHyperlink()->setTooltip((string) $hyperlink['tooltip']); + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php new file mode 100644 index 0000000..6f28676 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/PageSetup.php @@ -0,0 +1,150 @@ +worksheet = $workSheet; + $this->worksheetXml = $worksheetXml; + } + + public function load(array $unparsedLoadedData) + { + if (!$this->worksheetXml) { + return $unparsedLoadedData; + } + + $this->margins($this->worksheetXml, $this->worksheet); + $unparsedLoadedData = $this->pageSetup($this->worksheetXml, $this->worksheet, $unparsedLoadedData); + $this->headerFooter($this->worksheetXml, $this->worksheet); + $this->pageBreaks($this->worksheetXml, $this->worksheet); + + return $unparsedLoadedData; + } + + private function margins(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + { + if ($xmlSheet->pageMargins) { + $docPageMargins = $worksheet->getPageMargins(); + $docPageMargins->setLeft((float) ($xmlSheet->pageMargins['left'])); + $docPageMargins->setRight((float) ($xmlSheet->pageMargins['right'])); + $docPageMargins->setTop((float) ($xmlSheet->pageMargins['top'])); + $docPageMargins->setBottom((float) ($xmlSheet->pageMargins['bottom'])); + $docPageMargins->setHeader((float) ($xmlSheet->pageMargins['header'])); + $docPageMargins->setFooter((float) ($xmlSheet->pageMargins['footer'])); + } + } + + private function pageSetup(\SimpleXMLElement $xmlSheet, Worksheet $worksheet, array $unparsedLoadedData) + { + if ($xmlSheet->pageSetup) { + $docPageSetup = $worksheet->getPageSetup(); + + if (isset($xmlSheet->pageSetup['orientation'])) { + $docPageSetup->setOrientation((string) $xmlSheet->pageSetup['orientation']); + } + if (isset($xmlSheet->pageSetup['paperSize'])) { + $docPageSetup->setPaperSize((int) ($xmlSheet->pageSetup['paperSize'])); + } + if (isset($xmlSheet->pageSetup['scale'])) { + $docPageSetup->setScale((int) ($xmlSheet->pageSetup['scale']), false); + } + if (isset($xmlSheet->pageSetup['fitToHeight']) && (int) ($xmlSheet->pageSetup['fitToHeight']) >= 0) { + $docPageSetup->setFitToHeight((int) ($xmlSheet->pageSetup['fitToHeight']), false); + } + if (isset($xmlSheet->pageSetup['fitToWidth']) && (int) ($xmlSheet->pageSetup['fitToWidth']) >= 0) { + $docPageSetup->setFitToWidth((int) ($xmlSheet->pageSetup['fitToWidth']), false); + } + if (isset($xmlSheet->pageSetup['firstPageNumber'], $xmlSheet->pageSetup['useFirstPageNumber']) && + self::boolean((string) $xmlSheet->pageSetup['useFirstPageNumber'])) { + $docPageSetup->setFirstPageNumber((int) ($xmlSheet->pageSetup['firstPageNumber'])); + } + + $relAttributes = $xmlSheet->pageSetup->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + if (isset($relAttributes['id'])) { + $unparsedLoadedData['sheets'][$worksheet->getCodeName()]['pageSetupRelId'] = (string) $relAttributes['id']; + } + } + + return $unparsedLoadedData; + } + + private function headerFooter(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + { + if ($xmlSheet->headerFooter) { + $docHeaderFooter = $worksheet->getHeaderFooter(); + + if (isset($xmlSheet->headerFooter['differentOddEven']) && + self::boolean((string) $xmlSheet->headerFooter['differentOddEven'])) { + $docHeaderFooter->setDifferentOddEven(true); + } else { + $docHeaderFooter->setDifferentOddEven(false); + } + if (isset($xmlSheet->headerFooter['differentFirst']) && + self::boolean((string) $xmlSheet->headerFooter['differentFirst'])) { + $docHeaderFooter->setDifferentFirst(true); + } else { + $docHeaderFooter->setDifferentFirst(false); + } + if (isset($xmlSheet->headerFooter['scaleWithDoc']) && + !self::boolean((string) $xmlSheet->headerFooter['scaleWithDoc'])) { + $docHeaderFooter->setScaleWithDocument(false); + } else { + $docHeaderFooter->setScaleWithDocument(true); + } + if (isset($xmlSheet->headerFooter['alignWithMargins']) && + !self::boolean((string) $xmlSheet->headerFooter['alignWithMargins'])) { + $docHeaderFooter->setAlignWithMargins(false); + } else { + $docHeaderFooter->setAlignWithMargins(true); + } + + $docHeaderFooter->setOddHeader((string) $xmlSheet->headerFooter->oddHeader); + $docHeaderFooter->setOddFooter((string) $xmlSheet->headerFooter->oddFooter); + $docHeaderFooter->setEvenHeader((string) $xmlSheet->headerFooter->evenHeader); + $docHeaderFooter->setEvenFooter((string) $xmlSheet->headerFooter->evenFooter); + $docHeaderFooter->setFirstHeader((string) $xmlSheet->headerFooter->firstHeader); + $docHeaderFooter->setFirstFooter((string) $xmlSheet->headerFooter->firstFooter); + } + } + + private function pageBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + { + if ($xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk) { + $this->rowBreaks($xmlSheet, $worksheet); + } + if ($xmlSheet->colBreaks && $xmlSheet->colBreaks->brk) { + $this->columnBreaks($xmlSheet, $worksheet); + } + } + + private function rowBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + { + foreach ($xmlSheet->rowBreaks->brk as $brk) { + if ($brk['man']) { + $worksheet->setBreak("A{$brk['id']}", Worksheet::BREAK_ROW); + } + } + } + + private function columnBreaks(\SimpleXMLElement $xmlSheet, Worksheet $worksheet) + { + foreach ($xmlSheet->colBreaks->brk as $brk) { + if ($brk['man']) { + $worksheet->setBreak( + Coordinate::stringFromColumnIndex(((int) $brk['id']) + 1) . '1', + Worksheet::BREAK_COLUMN + ); + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Properties.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Properties.php new file mode 100644 index 0000000..bf8e57d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Properties.php @@ -0,0 +1,91 @@ +securityScanner = $securityScanner; + $this->docProps = $docProps; + } + + private function extractPropertyData($propertyData) + { + return simplexml_load_string( + $this->securityScanner->scan($propertyData), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + } + + public function readCoreProperties($propertyData) + { + $xmlCore = $this->extractPropertyData($propertyData); + + if (is_object($xmlCore)) { + $xmlCore->registerXPathNamespace('dc', 'http://purl.org/dc/elements/1.1/'); + $xmlCore->registerXPathNamespace('dcterms', 'http://purl.org/dc/terms/'); + $xmlCore->registerXPathNamespace('cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties'); + + $this->docProps->setCreator((string) self::getArrayItem($xmlCore->xpath('dc:creator'))); + $this->docProps->setLastModifiedBy((string) self::getArrayItem($xmlCore->xpath('cp:lastModifiedBy'))); + $this->docProps->setCreated(strtotime(self::getArrayItem($xmlCore->xpath('dcterms:created')))); //! respect xsi:type + $this->docProps->setModified(strtotime(self::getArrayItem($xmlCore->xpath('dcterms:modified')))); //! respect xsi:type + $this->docProps->setTitle((string) self::getArrayItem($xmlCore->xpath('dc:title'))); + $this->docProps->setDescription((string) self::getArrayItem($xmlCore->xpath('dc:description'))); + $this->docProps->setSubject((string) self::getArrayItem($xmlCore->xpath('dc:subject'))); + $this->docProps->setKeywords((string) self::getArrayItem($xmlCore->xpath('cp:keywords'))); + $this->docProps->setCategory((string) self::getArrayItem($xmlCore->xpath('cp:category'))); + } + } + + public function readExtendedProperties($propertyData) + { + $xmlCore = $this->extractPropertyData($propertyData); + + if (is_object($xmlCore)) { + if (isset($xmlCore->Company)) { + $this->docProps->setCompany((string) $xmlCore->Company); + } + if (isset($xmlCore->Manager)) { + $this->docProps->setManager((string) $xmlCore->Manager); + } + } + } + + public function readCustomProperties($propertyData) + { + $xmlCore = $this->extractPropertyData($propertyData); + + if (is_object($xmlCore)) { + foreach ($xmlCore as $xmlProperty) { + /** @var \SimpleXMLElement $xmlProperty */ + $cellDataOfficeAttributes = $xmlProperty->attributes(); + if (isset($cellDataOfficeAttributes['name'])) { + $propertyName = (string) $cellDataOfficeAttributes['name']; + $cellDataOfficeChildren = $xmlProperty->children('http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'); + + $attributeType = $cellDataOfficeChildren->getName(); + $attributeValue = (string) $cellDataOfficeChildren->{$attributeType}; + $attributeValue = DocumentProperties::convertProperty($attributeValue, $attributeType); + $attributeType = DocumentProperties::convertPropertyType($attributeType); + $this->docProps->setCustomProperty($propertyName, $attributeValue, $attributeType); + } + } + } + } + + private static function getArrayItem(array $array, $key = 0) + { + return $array[$key] ?? null; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php new file mode 100644 index 0000000..eb61a5d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViewOptions.php @@ -0,0 +1,124 @@ +worksheet = $workSheet; + $this->worksheetXml = $worksheetXml; + } + + /** + * @param bool $readDataOnly + */ + public function load($readDataOnly = false) + { + if ($this->worksheetXml === null) { + return; + } + + if (isset($this->worksheetXml->sheetPr)) { + $this->tabColor($this->worksheetXml->sheetPr); + $this->codeName($this->worksheetXml->sheetPr); + $this->outlines($this->worksheetXml->sheetPr); + $this->pageSetup($this->worksheetXml->sheetPr); + } + + if (isset($this->worksheetXml->sheetFormatPr)) { + $this->sheetFormat($this->worksheetXml->sheetFormatPr); + } + + if (!$readDataOnly && isset($this->worksheetXml->printOptions)) { + $this->printOptions($this->worksheetXml->printOptions); + } + } + + private function tabColor(\SimpleXMLElement $sheetPr) + { + if (isset($sheetPr->tabColor, $sheetPr->tabColor['rgb'])) { + $this->worksheet->getTabColor()->setARGB((string) $sheetPr->tabColor['rgb']); + } + } + + private function codeName(\SimpleXMLElement $sheetPr) + { + if (isset($sheetPr['codeName'])) { + $this->worksheet->setCodeName((string) $sheetPr['codeName'], false); + } + } + + private function outlines(\SimpleXMLElement $sheetPr) + { + if (isset($sheetPr->outlinePr)) { + if (isset($sheetPr->outlinePr['summaryRight']) && + !self::boolean((string) $sheetPr->outlinePr['summaryRight'])) { + $this->worksheet->setShowSummaryRight(false); + } else { + $this->worksheet->setShowSummaryRight(true); + } + + if (isset($sheetPr->outlinePr['summaryBelow']) && + !self::boolean((string) $sheetPr->outlinePr['summaryBelow'])) { + $this->worksheet->setShowSummaryBelow(false); + } else { + $this->worksheet->setShowSummaryBelow(true); + } + } + } + + private function pageSetup(\SimpleXMLElement $sheetPr) + { + if (isset($sheetPr->pageSetUpPr)) { + if (isset($sheetPr->pageSetUpPr['fitToPage']) && + !self::boolean((string) $sheetPr->pageSetUpPr['fitToPage'])) { + $this->worksheet->getPageSetup()->setFitToPage(false); + } else { + $this->worksheet->getPageSetup()->setFitToPage(true); + } + } + } + + private function sheetFormat(\SimpleXMLElement $sheetFormatPr) + { + if (isset($sheetFormatPr['customHeight']) && + self::boolean((string) $sheetFormatPr['customHeight']) && + isset($sheetFormatPr['defaultRowHeight'])) { + $this->worksheet->getDefaultRowDimension() + ->setRowHeight((float) $sheetFormatPr['defaultRowHeight']); + } + + if (isset($sheetFormatPr['defaultColWidth'])) { + $this->worksheet->getDefaultColumnDimension() + ->setWidth((float) $sheetFormatPr['defaultColWidth']); + } + + if (isset($sheetFormatPr['zeroHeight']) && + ((string) $sheetFormatPr['zeroHeight'] === '1')) { + $this->worksheet->getDefaultRowDimension()->setZeroHeight(true); + } + } + + private function printOptions(\SimpleXMLElement $printOptions) + { + if (self::boolean((string) $printOptions['gridLinesSet'])) { + $this->worksheet->setShowGridlines(true); + } + if (self::boolean((string) $printOptions['gridLines'])) { + $this->worksheet->setPrintGridlines(true); + } + if (self::boolean((string) $printOptions['horizontalCentered'])) { + $this->worksheet->getPageSetup()->setHorizontalCentered(true); + } + if (self::boolean((string) $printOptions['verticalCentered'])) { + $this->worksheet->getPageSetup()->setVerticalCentered(true); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php new file mode 100644 index 0000000..88c01ea --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/SheetViews.php @@ -0,0 +1,137 @@ +sheetViewXml = $sheetViewXml; + $this->worksheet = $workSheet; + } + + public function load() + { + $this->zoomScale(); + $this->view(); + $this->gridLines(); + $this->headers(); + $this->direction(); + $this->showZeros(); + + if (isset($this->sheetViewXml->pane)) { + $this->pane(); + } + if (isset($this->sheetViewXml->selection, $this->sheetViewXml->selection['sqref'])) { + $this->selection(); + } + } + + private function zoomScale() + { + if (isset($this->sheetViewXml['zoomScale'])) { + $zoomScale = (int) ($this->sheetViewXml['zoomScale']); + if ($zoomScale <= 0) { + // setZoomScale will throw an Exception if the scale is less than or equals 0 + // that is OK when manually creating documents, but we should be able to read all documents + $zoomScale = 100; + } + + $this->worksheet->getSheetView()->setZoomScale($zoomScale); + } + + if (isset($this->sheetViewXml['zoomScaleNormal'])) { + $zoomScaleNormal = (int) ($this->sheetViewXml['zoomScaleNormal']); + if ($zoomScaleNormal <= 0) { + // setZoomScaleNormal will throw an Exception if the scale is less than or equals 0 + // that is OK when manually creating documents, but we should be able to read all documents + $zoomScaleNormal = 100; + } + + $this->worksheet->getSheetView()->setZoomScaleNormal($zoomScaleNormal); + } + } + + private function view() + { + if (isset($this->sheetViewXml['view'])) { + $this->worksheet->getSheetView()->setView((string) $this->sheetViewXml['view']); + } + } + + private function gridLines() + { + if (isset($this->sheetViewXml['showGridLines'])) { + $this->worksheet->setShowGridLines( + self::boolean((string) $this->sheetViewXml['showGridLines']) + ); + } + } + + private function headers() + { + if (isset($this->sheetViewXml['showRowColHeaders'])) { + $this->worksheet->setShowRowColHeaders( + self::boolean((string) $this->sheetViewXml['showRowColHeaders']) + ); + } + } + + private function direction() + { + if (isset($this->sheetViewXml['rightToLeft'])) { + $this->worksheet->setRightToLeft( + self::boolean((string) $this->sheetViewXml['rightToLeft']) + ); + } + } + + private function showZeros() + { + if (isset($this->sheetViewXml['showZeros'])) { + $this->worksheet->getSheetView()->setShowZeros( + self::boolean((string) $this->sheetViewXml['showZeros']) + ); + } + } + + private function pane() + { + $xSplit = 0; + $ySplit = 0; + $topLeftCell = null; + + if (isset($this->sheetViewXml->pane['xSplit'])) { + $xSplit = (int) ($this->sheetViewXml->pane['xSplit']); + } + + if (isset($this->sheetViewXml->pane['ySplit'])) { + $ySplit = (int) ($this->sheetViewXml->pane['ySplit']); + } + + if (isset($this->sheetViewXml->pane['topLeftCell'])) { + $topLeftCell = (string) $this->sheetViewXml->pane['topLeftCell']; + } + + $this->worksheet->freezePane( + Coordinate::stringFromColumnIndex($xSplit + 1) . ($ySplit + 1), + $topLeftCell + ); + } + + private function selection() + { + $sqref = (string) $this->sheetViewXml->selection['sqref']; + $sqref = explode(' ', $sqref); + $sqref = $sqref[0]; + + $this->worksheet->setSelectedCells($sqref); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php new file mode 100644 index 0000000..4010625 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Styles.php @@ -0,0 +1,281 @@ +styleXml = $styleXml; + } + + public function setStyleBaseData(Theme $theme = null, $styles = [], $cellStyles = []) + { + self::$theme = $theme; + $this->styles = $styles; + $this->cellStyles = $cellStyles; + } + + private static function readFontStyle(Font $fontStyle, \SimpleXMLElement $fontStyleXml) + { + $fontStyle->setName((string) $fontStyleXml->name['val']); + $fontStyle->setSize((float) $fontStyleXml->sz['val']); + + if (isset($fontStyleXml->b)) { + $fontStyle->setBold(!isset($fontStyleXml->b['val']) || self::boolean((string) $fontStyleXml->b['val'])); + } + if (isset($fontStyleXml->i)) { + $fontStyle->setItalic(!isset($fontStyleXml->i['val']) || self::boolean((string) $fontStyleXml->i['val'])); + } + if (isset($fontStyleXml->strike)) { + $fontStyle->setStrikethrough(!isset($fontStyleXml->strike['val']) || self::boolean((string) $fontStyleXml->strike['val'])); + } + $fontStyle->getColor()->setARGB(self::readColor($fontStyleXml->color)); + + if (isset($fontStyleXml->u) && !isset($fontStyleXml->u['val'])) { + $fontStyle->setUnderline(Font::UNDERLINE_SINGLE); + } elseif (isset($fontStyleXml->u, $fontStyleXml->u['val'])) { + $fontStyle->setUnderline((string) $fontStyleXml->u['val']); + } + + if (isset($fontStyleXml->vertAlign, $fontStyleXml->vertAlign['val'])) { + $verticalAlign = strtolower((string) $fontStyleXml->vertAlign['val']); + if ($verticalAlign === 'superscript') { + $fontStyle->setSuperscript(true); + } + if ($verticalAlign === 'subscript') { + $fontStyle->setSubscript(true); + } + } + } + + private static function readNumberFormat(NumberFormat $numfmtStyle, \SimpleXMLElement $numfmtStyleXml) + { + if ($numfmtStyleXml->count() === 0) { + return; + } + $numfmt = $numfmtStyleXml->attributes(); + if ($numfmt->count() > 0 && isset($numfmt['formatCode'])) { + $numfmtStyle->setFormatCode((string) $numfmt['formatCode']); + } + } + + private static function readFillStyle(Fill $fillStyle, \SimpleXMLElement $fillStyleXml) + { + if ($fillStyleXml->gradientFill) { + /** @var \SimpleXMLElement $gradientFill */ + $gradientFill = $fillStyleXml->gradientFill[0]; + if (!empty($gradientFill['type'])) { + $fillStyle->setFillType((string) $gradientFill['type']); + } + $fillStyle->setRotation((float) ($gradientFill['degree'])); + $gradientFill->registerXPathNamespace('sml', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $fillStyle->getStartColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=0]'))->color)); + $fillStyle->getEndColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath('sml:stop[@position=1]'))->color)); + } elseif ($fillStyleXml->patternFill) { + $patternType = (string) $fillStyleXml->patternFill['patternType'] != '' ? (string) $fillStyleXml->patternFill['patternType'] : 'solid'; + $fillStyle->setFillType($patternType); + if ($fillStyleXml->patternFill->fgColor) { + $fillStyle->getStartColor()->setARGB(self::readColor($fillStyleXml->patternFill->fgColor, true)); + } else { + $fillStyle->getStartColor()->setARGB('FF000000'); + } + if ($fillStyleXml->patternFill->bgColor) { + $fillStyle->getEndColor()->setARGB(self::readColor($fillStyleXml->patternFill->bgColor, true)); + } + } + } + + private static function readBorderStyle(Borders $borderStyle, \SimpleXMLElement $borderStyleXml) + { + $diagonalUp = self::boolean((string) $borderStyleXml['diagonalUp']); + $diagonalDown = self::boolean((string) $borderStyleXml['diagonalDown']); + if (!$diagonalUp && !$diagonalDown) { + $borderStyle->setDiagonalDirection(Borders::DIAGONAL_NONE); + } elseif ($diagonalUp && !$diagonalDown) { + $borderStyle->setDiagonalDirection(Borders::DIAGONAL_UP); + } elseif (!$diagonalUp && $diagonalDown) { + $borderStyle->setDiagonalDirection(Borders::DIAGONAL_DOWN); + } else { + $borderStyle->setDiagonalDirection(Borders::DIAGONAL_BOTH); + } + + self::readBorder($borderStyle->getLeft(), $borderStyleXml->left); + self::readBorder($borderStyle->getRight(), $borderStyleXml->right); + self::readBorder($borderStyle->getTop(), $borderStyleXml->top); + self::readBorder($borderStyle->getBottom(), $borderStyleXml->bottom); + self::readBorder($borderStyle->getDiagonal(), $borderStyleXml->diagonal); + } + + private static function readBorder(Border $border, \SimpleXMLElement $borderXml) + { + if (isset($borderXml['style'])) { + $border->setBorderStyle((string) $borderXml['style']); + } + if (isset($borderXml->color)) { + $border->getColor()->setARGB(self::readColor($borderXml->color)); + } + } + + private static function readAlignmentStyle(Alignment $alignment, \SimpleXMLElement $alignmentXml) + { + $alignment->setHorizontal((string) $alignmentXml->alignment['horizontal']); + $alignment->setVertical((string) $alignmentXml->alignment['vertical']); + + $textRotation = 0; + if ((int) $alignmentXml->alignment['textRotation'] <= 90) { + $textRotation = (int) $alignmentXml->alignment['textRotation']; + } elseif ((int) $alignmentXml->alignment['textRotation'] > 90) { + $textRotation = 90 - (int) $alignmentXml->alignment['textRotation']; + } + + $alignment->setTextRotation((int) $textRotation); + $alignment->setWrapText(self::boolean((string) $alignmentXml->alignment['wrapText'])); + $alignment->setShrinkToFit(self::boolean((string) $alignmentXml->alignment['shrinkToFit'])); + $alignment->setIndent((int) ((string) $alignmentXml->alignment['indent']) > 0 ? (int) ((string) $alignmentXml->alignment['indent']) : 0); + $alignment->setReadOrder((int) ((string) $alignmentXml->alignment['readingOrder']) > 0 ? (int) ((string) $alignmentXml->alignment['readingOrder']) : 0); + } + + private function readStyle(Style $docStyle, $style) + { + if ($style->numFmt instanceof \SimpleXMLElement) { + self::readNumberFormat($docStyle->getNumberFormat(), $style->numFmt); + } else { + $docStyle->getNumberFormat()->setFormatCode($style->numFmt); + } + + if (isset($style->font)) { + self::readFontStyle($docStyle->getFont(), $style->font); + } + + if (isset($style->fill)) { + self::readFillStyle($docStyle->getFill(), $style->fill); + } + + if (isset($style->border)) { + self::readBorderStyle($docStyle->getBorders(), $style->border); + } + + if (isset($style->alignment->alignment)) { + self::readAlignmentStyle($docStyle->getAlignment(), $style->alignment); + } + + // protection + if (isset($style->protection)) { + $this->readProtectionLocked($docStyle, $style); + $this->readProtectionHidden($docStyle, $style); + } + + // top-level style settings + if (isset($style->quotePrefix)) { + $docStyle->setQuotePrefix(true); + } + } + + private function readProtectionLocked(Style $docStyle, $style) + { + if (isset($style->protection['locked'])) { + if (self::boolean((string) $style->protection['locked'])) { + $docStyle->getProtection()->setLocked(Protection::PROTECTION_PROTECTED); + } else { + $docStyle->getProtection()->setLocked(Protection::PROTECTION_UNPROTECTED); + } + } + } + + private function readProtectionHidden(Style $docStyle, $style) + { + if (isset($style->protection['hidden'])) { + if (self::boolean((string) $style->protection['hidden'])) { + $docStyle->getProtection()->setHidden(Protection::PROTECTION_PROTECTED); + } else { + $docStyle->getProtection()->setHidden(Protection::PROTECTION_UNPROTECTED); + } + } + } + + private static function readColor($color, $background = false) + { + if (isset($color['rgb'])) { + return (string) $color['rgb']; + } elseif (isset($color['indexed'])) { + return Color::indexedColor($color['indexed'] - 7, $background)->getARGB(); + } elseif (isset($color['theme'])) { + if (self::$theme !== null) { + $returnColour = self::$theme->getColourByIndex((int) $color['theme']); + if (isset($color['tint'])) { + $tintAdjust = (float) $color['tint']; + $returnColour = Color::changeBrightness($returnColour, $tintAdjust); + } + + return 'FF' . $returnColour; + } + } + + return ($background) ? 'FFFFFFFF' : 'FF000000'; + } + + public function dxfs($readDataOnly = false) + { + $dxfs = []; + if (!$readDataOnly && $this->styleXml) { + // Conditional Styles + if ($this->styleXml->dxfs) { + foreach ($this->styleXml->dxfs->dxf as $dxf) { + $style = new Style(false, true); + $this->readStyle($style, $dxf); + $dxfs[] = $style; + } + } + // Cell Styles + if ($this->styleXml->cellStyles) { + foreach ($this->styleXml->cellStyles->cellStyle as $cellStyle) { + if ((int) ($cellStyle['builtinId']) == 0) { + if (isset($this->cellStyles[(int) ($cellStyle['xfId'])])) { + // Set default style + $style = new Style(); + $this->readStyle($style, $this->cellStyles[(int) ($cellStyle['xfId'])]); + + // normal style, currently not using it for anything + } + } + } + } + } + + return $dxfs; + } + + public function styles() + { + return $this->styles; + } + + private static function getArrayItem($array, $key = 0) + { + return $array[$key] ?? null; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Theme.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Theme.php new file mode 100644 index 0000000..c105f3c --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Theme.php @@ -0,0 +1,93 @@ +themeName = $themeName; + $this->colourSchemeName = $colourSchemeName; + $this->colourMap = $colourMap; + } + + /** + * Get Theme Name. + * + * @return string + */ + public function getThemeName() + { + return $this->themeName; + } + + /** + * Get colour Scheme Name. + * + * @return string + */ + public function getColourSchemeName() + { + return $this->colourSchemeName; + } + + /** + * Get colour Map Value by Position. + * + * @param mixed $index + * + * @return string + */ + public function getColourByIndex($index) + { + if (isset($this->colourMap[$index])) { + return $this->colourMap[$index]; + } + + return null; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ((is_object($value)) && ($key != '_parent')) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php new file mode 100644 index 0000000..b4fffa4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml.php @@ -0,0 +1,881 @@ +securityScanner = XmlScanner::getInstance($this); + } + + /** + * Can the current IReader read the file? + * + * @param string $pFilename + * + * @throws Exception + * + * @return bool + */ + public function canRead($pFilename) + { + // Office xmlns:o="urn:schemas-microsoft-com:office:office" + // Excel xmlns:x="urn:schemas-microsoft-com:office:excel" + // XML Spreadsheet xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" + // Spreadsheet component xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" + // XML schema xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" + // XML data type xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" + // MS-persist recordset xmlns:rs="urn:schemas-microsoft-com:rowset" + // Rowset xmlns:z="#RowsetSchema" + // + + $signature = [ + '', + ]; + + // Open file + $this->openFile($pFilename); + $fileHandle = $this->fileHandle; + + // Read sample data (first 2 KB will do) + $data = fread($fileHandle, 2048); + fclose($fileHandle); + $data = str_replace("'", '"', $data); // fix headers with single quote + + $valid = true; + foreach ($signature as $match) { + // every part of the signature must be present + if (strpos($data, $match) === false) { + $valid = false; + + break; + } + } + + // Retrieve charset encoding + if (preg_match('//um', $data, $matches)) { + $this->charSet = strtoupper($matches[1]); + } + + return $valid; + } + + /** + * Check if the file is a valid SimpleXML. + * + * @param string $pFilename + * + * @throws Exception + * + * @return false|\SimpleXMLElement + */ + public function trySimpleXMLLoadString($pFilename) + { + try { + $xml = simplexml_load_string( + $this->securityScanner->scan(file_get_contents($pFilename)), + 'SimpleXMLElement', + Settings::getLibXmlLoaderOptions() + ); + } catch (\Exception $e) { + throw new Exception('Cannot load invalid XML file: ' . $pFilename, 0, $e); + } + + return $xml; + } + + /** + * Reads names of the worksheets from a file, without parsing the whole file to a Spreadsheet object. + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetNames($pFilename) + { + File::assertFile($pFilename); + if (!$this->canRead($pFilename)) { + throw new Exception($pFilename . ' is an Invalid Spreadsheet file.'); + } + + $worksheetNames = []; + + $xml = $this->trySimpleXMLLoadString($pFilename); + + $namespaces = $xml->getNamespaces(true); + + $xml_ss = $xml->children($namespaces['ss']); + foreach ($xml_ss->Worksheet as $worksheet) { + $worksheet_ss = $worksheet->attributes($namespaces['ss']); + $worksheetNames[] = self::convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet); + } + + return $worksheetNames; + } + + /** + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns). + * + * @param string $pFilename + * + * @throws Exception + * + * @return array + */ + public function listWorksheetInfo($pFilename) + { + File::assertFile($pFilename); + + $worksheetInfo = []; + + $xml = $this->trySimpleXMLLoadString($pFilename); + + $namespaces = $xml->getNamespaces(true); + + $worksheetID = 1; + $xml_ss = $xml->children($namespaces['ss']); + foreach ($xml_ss->Worksheet as $worksheet) { + $worksheet_ss = $worksheet->attributes($namespaces['ss']); + + $tmpInfo = []; + $tmpInfo['worksheetName'] = ''; + $tmpInfo['lastColumnLetter'] = 'A'; + $tmpInfo['lastColumnIndex'] = 0; + $tmpInfo['totalRows'] = 0; + $tmpInfo['totalColumns'] = 0; + + if (isset($worksheet_ss['Name'])) { + $tmpInfo['worksheetName'] = (string) $worksheet_ss['Name']; + } else { + $tmpInfo['worksheetName'] = "Worksheet_{$worksheetID}"; + } + + if (isset($worksheet->Table->Row)) { + $rowIndex = 0; + + foreach ($worksheet->Table->Row as $rowData) { + $columnIndex = 0; + $rowHasData = false; + + foreach ($rowData->Cell as $cell) { + if (isset($cell->Data)) { + $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex); + $rowHasData = true; + } + + ++$columnIndex; + } + + ++$rowIndex; + + if ($rowHasData) { + $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex); + } + } + } + + $tmpInfo['lastColumnLetter'] = Coordinate::stringFromColumnIndex($tmpInfo['lastColumnIndex'] + 1); + $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1; + + $worksheetInfo[] = $tmpInfo; + ++$worksheetID; + } + + return $worksheetInfo; + } + + /** + * Loads Spreadsheet from file. + * + * @param string $pFilename + * + * @throws Exception + * + * @return Spreadsheet + */ + public function load($pFilename) + { + // Create new Spreadsheet + $spreadsheet = new Spreadsheet(); + $spreadsheet->removeSheetByIndex(0); + + // Load into this instance + return $this->loadIntoExisting($pFilename, $spreadsheet); + } + + private static function identifyFixedStyleValue($styleList, &$styleAttributeValue) + { + $styleAttributeValue = strtolower($styleAttributeValue); + foreach ($styleList as $style) { + if ($styleAttributeValue == strtolower($style)) { + $styleAttributeValue = $style; + + return true; + } + } + + return false; + } + + /** + * pixel units to excel width units(units of 1/256th of a character width). + * + * @param float $pxs + * + * @return float + */ + protected static function pixel2WidthUnits($pxs) + { + $UNIT_OFFSET_MAP = [0, 36, 73, 109, 146, 182, 219]; + + $widthUnits = 256 * ($pxs / 7); + $widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)]; + + return $widthUnits; + } + + /** + * excel width units(units of 1/256th of a character width) to pixel units. + * + * @param float $widthUnits + * + * @return float + */ + protected static function widthUnits2Pixel($widthUnits) + { + $pixels = ($widthUnits / 256) * 7; + $offsetWidthUnits = $widthUnits % 256; + + return $pixels + round($offsetWidthUnits / (256 / 7)); + } + + protected static function hex2str($hex) + { + return chr(hexdec($hex[1])); + } + + /** + * Loads from file into Spreadsheet instance. + * + * @param string $pFilename + * @param Spreadsheet $spreadsheet + * + * @throws Exception + * + * @return Spreadsheet + */ + public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet) + { + File::assertFile($pFilename); + if (!$this->canRead($pFilename)) { + throw new Exception($pFilename . ' is an Invalid Spreadsheet file.'); + } + + $xml = $this->trySimpleXMLLoadString($pFilename); + + $namespaces = $xml->getNamespaces(true); + + $docProps = $spreadsheet->getProperties(); + if (isset($xml->DocumentProperties[0])) { + foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) { + switch ($propertyName) { + case 'Title': + $docProps->setTitle(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + case 'Subject': + $docProps->setSubject(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + case 'Author': + $docProps->setCreator(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + case 'Created': + $creationDate = strtotime($propertyValue); + $docProps->setCreated($creationDate); + + break; + case 'LastAuthor': + $docProps->setLastModifiedBy(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + case 'LastSaved': + $lastSaveDate = strtotime($propertyValue); + $docProps->setModified($lastSaveDate); + + break; + case 'Company': + $docProps->setCompany(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + case 'Category': + $docProps->setCategory(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + case 'Manager': + $docProps->setManager(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + case 'Keywords': + $docProps->setKeywords(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + case 'Description': + $docProps->setDescription(self::convertStringEncoding($propertyValue, $this->charSet)); + + break; + } + } + } + if (isset($xml->CustomDocumentProperties)) { + foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { + $propertyAttributes = $propertyValue->attributes($namespaces['dt']); + $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', ['self', 'hex2str'], $propertyName); + $propertyType = Properties::PROPERTY_TYPE_UNKNOWN; + switch ((string) $propertyAttributes) { + case 'string': + $propertyType = Properties::PROPERTY_TYPE_STRING; + $propertyValue = trim($propertyValue); + + break; + case 'boolean': + $propertyType = Properties::PROPERTY_TYPE_BOOLEAN; + $propertyValue = (bool) $propertyValue; + + break; + case 'integer': + $propertyType = Properties::PROPERTY_TYPE_INTEGER; + $propertyValue = (int) $propertyValue; + + break; + case 'float': + $propertyType = Properties::PROPERTY_TYPE_FLOAT; + $propertyValue = (float) $propertyValue; + + break; + case 'dateTime.tz': + $propertyType = Properties::PROPERTY_TYPE_DATE; + $propertyValue = strtotime(trim($propertyValue)); + + break; + } + $docProps->setCustomProperty($propertyName, $propertyValue, $propertyType); + } + } + + $this->parseStyles($xml, $namespaces); + + $worksheetID = 0; + $xml_ss = $xml->children($namespaces['ss']); + + foreach ($xml_ss->Worksheet as $worksheet) { + $worksheet_ss = $worksheet->attributes($namespaces['ss']); + + if ((isset($this->loadSheetsOnly)) && (isset($worksheet_ss['Name'])) && + (!in_array($worksheet_ss['Name'], $this->loadSheetsOnly))) { + continue; + } + + // Create new Worksheet + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex($worksheetID); + if (isset($worksheet_ss['Name'])) { + $worksheetName = self::convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet); + // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in + // formula cells... during the load, all formulae should be correct, and we're simply bringing + // the worksheet name in line with the formula, not the reverse + $spreadsheet->getActiveSheet()->setTitle($worksheetName, false, false); + } + + $columnID = 'A'; + if (isset($worksheet->Table->Column)) { + foreach ($worksheet->Table->Column as $columnData) { + $columnData_ss = $columnData->attributes($namespaces['ss']); + if (isset($columnData_ss['Index'])) { + $columnID = Coordinate::stringFromColumnIndex((int) $columnData_ss['Index']); + } + if (isset($columnData_ss['Width'])) { + $columnWidth = $columnData_ss['Width']; + $spreadsheet->getActiveSheet()->getColumnDimension($columnID)->setWidth($columnWidth / 5.4); + } + ++$columnID; + } + } + + $rowID = 1; + if (isset($worksheet->Table->Row)) { + $additionalMergedCells = 0; + foreach ($worksheet->Table->Row as $rowData) { + $rowHasData = false; + $row_ss = $rowData->attributes($namespaces['ss']); + if (isset($row_ss['Index'])) { + $rowID = (int) $row_ss['Index']; + } + + $columnID = 'A'; + foreach ($rowData->Cell as $cell) { + $cell_ss = $cell->attributes($namespaces['ss']); + if (isset($cell_ss['Index'])) { + $columnID = Coordinate::stringFromColumnIndex((int) $cell_ss['Index']); + } + $cellRange = $columnID . $rowID; + + if ($this->getReadFilter() !== null) { + if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { + ++$columnID; + + continue; + } + } + + if (isset($cell_ss['HRef'])) { + $spreadsheet->getActiveSheet()->getCell($cellRange)->getHyperlink()->setUrl($cell_ss['HRef']); + } + + if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) { + $columnTo = $columnID; + if (isset($cell_ss['MergeAcross'])) { + $additionalMergedCells += (int) $cell_ss['MergeAcross']; + $columnTo = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($columnID) + $cell_ss['MergeAcross']); + } + $rowTo = $rowID; + if (isset($cell_ss['MergeDown'])) { + $rowTo = $rowTo + $cell_ss['MergeDown']; + } + $cellRange .= ':' . $columnTo . $rowTo; + $spreadsheet->getActiveSheet()->mergeCells($cellRange); + } + + $cellIsSet = $hasCalculatedValue = false; + $cellDataFormula = ''; + if (isset($cell_ss['Formula'])) { + $cellDataFormula = $cell_ss['Formula']; + $hasCalculatedValue = true; + } + if (isset($cell->Data)) { + $cellValue = $cellData = $cell->Data; + $type = DataType::TYPE_NULL; + $cellData_ss = $cellData->attributes($namespaces['ss']); + if (isset($cellData_ss['Type'])) { + $cellDataType = $cellData_ss['Type']; + switch ($cellDataType) { + /* + const TYPE_STRING = 's'; + const TYPE_FORMULA = 'f'; + const TYPE_NUMERIC = 'n'; + const TYPE_BOOL = 'b'; + const TYPE_NULL = 'null'; + const TYPE_INLINE = 'inlineStr'; + const TYPE_ERROR = 'e'; + */ + case 'String': + $cellValue = self::convertStringEncoding($cellValue, $this->charSet); + $type = DataType::TYPE_STRING; + + break; + case 'Number': + $type = DataType::TYPE_NUMERIC; + $cellValue = (float) $cellValue; + if (floor($cellValue) == $cellValue) { + $cellValue = (int) $cellValue; + } + + break; + case 'Boolean': + $type = DataType::TYPE_BOOL; + $cellValue = ($cellValue != 0); + + break; + case 'DateTime': + $type = DataType::TYPE_NUMERIC; + $cellValue = Date::PHPToExcel(strtotime($cellValue)); + + break; + case 'Error': + $type = DataType::TYPE_ERROR; + + break; + } + } + + if ($hasCalculatedValue) { + $type = DataType::TYPE_FORMULA; + $columnNumber = Coordinate::columnIndexFromString($columnID); + if (substr($cellDataFormula, 0, 3) == 'of:') { + $cellDataFormula = substr($cellDataFormula, 3); + $temp = explode('"', $cellDataFormula); + $key = false; + foreach ($temp as &$value) { + // Only replace in alternate array entries (i.e. non-quoted blocks) + if ($key = !$key) { + $value = str_replace(['[.', '.', ']'], '', $value); + } + } + } else { + // Convert R1C1 style references to A1 style references (but only when not quoted) + $temp = explode('"', $cellDataFormula); + $key = false; + foreach ($temp as &$value) { + // Only replace in alternate array entries (i.e. non-quoted blocks) + if ($key = !$key) { + preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); + // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way + // through the formula from left to right. Reversing means that we work right to left.through + // the formula + $cellReferences = array_reverse($cellReferences); + // Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent, + // then modify the formula to use that new reference + foreach ($cellReferences as $cellReference) { + $rowReference = $cellReference[2][0]; + // Empty R reference is the current row + if ($rowReference == '') { + $rowReference = $rowID; + } + // Bracketed R references are relative to the current row + if ($rowReference[0] == '[') { + $rowReference = $rowID + trim($rowReference, '[]'); + } + $columnReference = $cellReference[4][0]; + // Empty C reference is the current column + if ($columnReference == '') { + $columnReference = $columnNumber; + } + // Bracketed C references are relative to the current column + if ($columnReference[0] == '[') { + $columnReference = $columnNumber + trim($columnReference, '[]'); + } + $A1CellReference = Coordinate::stringFromColumnIndex($columnReference) . $rowReference; + $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); + } + } + } + } + unset($value); + // Then rebuild the formula string + $cellDataFormula = implode('"', $temp); + } + + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type); + if ($hasCalculatedValue) { + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setCalculatedValue($cellValue); + } + $cellIsSet = $rowHasData = true; + } + + if (isset($cell->Comment)) { + $commentAttributes = $cell->Comment->attributes($namespaces['ss']); + $author = 'unknown'; + if (isset($commentAttributes->Author)) { + $author = (string) $commentAttributes->Author; + } + $node = $cell->Comment->Data->asXML(); + $annotation = strip_tags($node); + $spreadsheet->getActiveSheet()->getComment($columnID . $rowID)->setAuthor(self::convertStringEncoding($author, $this->charSet))->setText($this->parseRichText($annotation)); + } + + if (($cellIsSet) && (isset($cell_ss['StyleID']))) { + $style = (string) $cell_ss['StyleID']; + if ((isset($this->styles[$style])) && (!empty($this->styles[$style]))) { + if (!$spreadsheet->getActiveSheet()->cellExists($columnID . $rowID)) { + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setValue(null); + } + $spreadsheet->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]); + } + } + ++$columnID; + while ($additionalMergedCells > 0) { + ++$columnID; + --$additionalMergedCells; + } + } + + if ($rowHasData) { + if (isset($row_ss['Height'])) { + $rowHeight = $row_ss['Height']; + $spreadsheet->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight); + } + } + + ++$rowID; + } + } + ++$worksheetID; + } + + // Return + return $spreadsheet; + } + + protected static function convertStringEncoding($string, $charset) + { + if ($charset != 'UTF-8') { + return StringHelper::convertEncoding($string, 'UTF-8', $charset); + } + + return $string; + } + + protected function parseRichText($is) + { + $value = new RichText(); + + $value->createText(self::convertStringEncoding($is, $this->charSet)); + + return $value; + } + + /** + * @param SimpleXMLElement $xml + * @param array $namespaces + */ + private function parseStyles(SimpleXMLElement $xml, array $namespaces) + { + if (!isset($xml->Styles)) { + return; + } + + foreach ($xml->Styles[0] as $style) { + $style_ss = $style->attributes($namespaces['ss']); + $styleID = (string) $style_ss['ID']; + $this->styles[$styleID] = (isset($this->styles['Default'])) ? $this->styles['Default'] : []; + foreach ($style as $styleType => $styleData) { + $styleAttributes = $styleData->attributes($namespaces['ss']); + switch ($styleType) { + case 'Alignment': + $this->parseStyleAlignment($styleID, $styleAttributes); + + break; + case 'Borders': + $this->parseStyleBorders($styleID, $styleData, $namespaces); + + break; + case 'Font': + $this->parseStyleFont($styleID, $styleAttributes); + + break; + case 'Interior': + $this->parseStyleInterior($styleID, $styleAttributes); + + break; + case 'NumberFormat': + $this->parseStyleNumberFormat($styleID, $styleAttributes); + + break; + } + } + } + } + + /** + * @param string $styleID + * @param SimpleXMLElement $styleAttributes + */ + private function parseStyleAlignment($styleID, SimpleXMLElement $styleAttributes) + { + $verticalAlignmentStyles = [ + Alignment::VERTICAL_BOTTOM, + Alignment::VERTICAL_TOP, + Alignment::VERTICAL_CENTER, + Alignment::VERTICAL_JUSTIFY, + ]; + $horizontalAlignmentStyles = [ + Alignment::HORIZONTAL_GENERAL, + Alignment::HORIZONTAL_LEFT, + Alignment::HORIZONTAL_RIGHT, + Alignment::HORIZONTAL_CENTER, + Alignment::HORIZONTAL_CENTER_CONTINUOUS, + Alignment::HORIZONTAL_JUSTIFY, + ]; + + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { + $styleAttributeValue = (string) $styleAttributeValue; + switch ($styleAttributeKey) { + case 'Vertical': + if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) { + $this->styles[$styleID]['alignment']['vertical'] = $styleAttributeValue; + } + + break; + case 'Horizontal': + if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) { + $this->styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue; + } + + break; + case 'WrapText': + $this->styles[$styleID]['alignment']['wrapText'] = true; + + break; + } + } + } + + /** + * @param $styleID + * @param SimpleXMLElement $styleData + * @param array $namespaces + */ + private function parseStyleBorders($styleID, SimpleXMLElement $styleData, array $namespaces) + { + foreach ($styleData->Border as $borderStyle) { + $borderAttributes = $borderStyle->attributes($namespaces['ss']); + $thisBorder = []; + foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) { + switch ($borderStyleKey) { + case 'LineStyle': + $thisBorder['borderStyle'] = Border::BORDER_MEDIUM; + + break; + case 'Weight': + break; + case 'Position': + $borderPosition = strtolower($borderStyleValue); + + break; + case 'Color': + $borderColour = substr($borderStyleValue, 1); + $thisBorder['color']['rgb'] = $borderColour; + + break; + } + } + if (!empty($thisBorder)) { + if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) { + $this->styles[$styleID]['borders'][$borderPosition] = $thisBorder; + } + } + } + } + + /** + * @param $styleID + * @param SimpleXMLElement $styleAttributes + */ + private function parseStyleFont($styleID, SimpleXMLElement $styleAttributes) + { + $underlineStyles = [ + Font::UNDERLINE_NONE, + Font::UNDERLINE_DOUBLE, + Font::UNDERLINE_DOUBLEACCOUNTING, + Font::UNDERLINE_SINGLE, + Font::UNDERLINE_SINGLEACCOUNTING, + ]; + + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { + $styleAttributeValue = (string) $styleAttributeValue; + switch ($styleAttributeKey) { + case 'FontName': + $this->styles[$styleID]['font']['name'] = $styleAttributeValue; + + break; + case 'Size': + $this->styles[$styleID]['font']['size'] = $styleAttributeValue; + + break; + case 'Color': + $this->styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1); + + break; + case 'Bold': + $this->styles[$styleID]['font']['bold'] = true; + + break; + case 'Italic': + $this->styles[$styleID]['font']['italic'] = true; + + break; + case 'Underline': + if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) { + $this->styles[$styleID]['font']['underline'] = $styleAttributeValue; + } + + break; + } + } + } + + /** + * @param $styleID + * @param SimpleXMLElement $styleAttributes + */ + private function parseStyleInterior($styleID, SimpleXMLElement $styleAttributes) + { + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { + switch ($styleAttributeKey) { + case 'Color': + $this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1); + + break; + case 'Pattern': + $this->styles[$styleID]['fill']['fillType'] = strtolower($styleAttributeValue); + + break; + } + } + } + + /** + * @param $styleID + * @param SimpleXMLElement $styleAttributes + */ + private function parseStyleNumberFormat($styleID, SimpleXMLElement $styleAttributes) + { + $fromFormats = ['\-', '\ ']; + $toFormats = ['-', ' ']; + + foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { + $styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue); + switch ($styleAttributeValue) { + case 'Short Date': + $styleAttributeValue = 'dd/mm/yyyy'; + + break; + } + + if ($styleAttributeValue > '') { + $this->styles[$styleID]['numberFormat']['formatCode'] = $styleAttributeValue; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/chunkReadFilter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/chunkReadFilter.php new file mode 100644 index 0000000..78738b3 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/chunkReadFilter.php @@ -0,0 +1,35 @@ +startRow = $startRow; + $this->endRow = $startRow + $chunkSize; + } + + public function readCell($column, $row, $worksheetName = '') + { + // Only read the heading row, and the rows that were configured in the constructor + if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) + { + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php new file mode 100644 index 0000000..143e80d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/ReferenceHelper.php @@ -0,0 +1,910 @@ += ($beforeRow + $pNumRows)) && + ($cellRow < $beforeRow)) { + return true; + } elseif ($pNumCols < 0 && + ($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) && + ($cellColumnIndex < $beforeColumnIndex)) { + return true; + } + + return false; + } + + /** + * Update page breaks when inserting/deleting rows/columns. + * + * @param Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $beforeRow Number of the row we're inserting/deleting before + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustPageBreaks(Worksheet $pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aBreaks = $pSheet->getBreaks(); + ($pNumCols > 0 || $pNumRows > 0) ? + uksort($aBreaks, ['self', 'cellReverseSort']) : uksort($aBreaks, ['self', 'cellSort']); + + foreach ($aBreaks as $key => $value) { + if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) { + // If we're deleting, then clear any defined breaks that are within the range + // of rows/columns that we're deleting + $pSheet->setBreak($key, Worksheet::BREAK_NONE); + } else { + // Otherwise update any affected breaks by inserting a new break at the appropriate point + // and removing the old affected break + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setBreak($newReference, $value) + ->setBreak($key, Worksheet::BREAK_NONE); + } + } + } + } + + /** + * Update cell comments when inserting/deleting rows/columns. + * + * @param Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $beforeRow Number of the row we're inserting/deleting before + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aComments = $pSheet->getComments(); + $aNewComments = []; // the new array of all comments + + foreach ($aComments as $key => &$value) { + // Any comments inside a deleted range will be ignored + if (!self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) { + // Otherwise build a new array of comments indexed by the adjusted cell reference + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + $aNewComments[$newReference] = $value; + } + } + // Replace the comments array with the new set of comments + $pSheet->setComments($aNewComments); + } + + /** + * Update hyperlinks when inserting/deleting rows/columns. + * + * @param Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $beforeRow Number of the row we're inserting/deleting before + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aHyperlinkCollection = $pSheet->getHyperlinkCollection(); + ($pNumCols > 0 || $pNumRows > 0) ? + uksort($aHyperlinkCollection, ['self', 'cellReverseSort']) : uksort($aHyperlinkCollection, ['self', 'cellSort']); + + foreach ($aHyperlinkCollection as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setHyperlink($newReference, $value); + $pSheet->setHyperlink($key, null); + } + } + } + + /** + * Update data validations when inserting/deleting rows/columns. + * + * @param Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $beforeRow Number of the row we're inserting/deleting before + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aDataValidationCollection = $pSheet->getDataValidationCollection(); + ($pNumCols > 0 || $pNumRows > 0) ? + uksort($aDataValidationCollection, ['self', 'cellReverseSort']) : uksort($aDataValidationCollection, ['self', 'cellSort']); + + foreach ($aDataValidationCollection as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->setDataValidation($newReference, $value); + $pSheet->setDataValidation($key, null); + } + } + } + + /** + * Update merged cells when inserting/deleting rows/columns. + * + * @param Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $beforeRow Number of the row we're inserting/deleting before + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aMergeCells = $pSheet->getMergeCells(); + $aNewMergeCells = []; // the new array of all merge cells + foreach ($aMergeCells as $key => &$value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + $aNewMergeCells[$newReference] = $newReference; + } + $pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array + } + + /** + * Update protected cells when inserting/deleting rows/columns. + * + * @param Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $beforeRow Number of the row we're inserting/deleting before + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aProtectedCells = $pSheet->getProtectedCells(); + ($pNumCols > 0 || $pNumRows > 0) ? + uksort($aProtectedCells, ['self', 'cellReverseSort']) : uksort($aProtectedCells, ['self', 'cellSort']); + foreach ($aProtectedCells as $key => $value) { + $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); + if ($key != $newReference) { + $pSheet->protectCells($newReference, $value, true); + $pSheet->unprotectCells($key); + } + } + } + + /** + * Update column dimensions when inserting/deleting rows/columns. + * + * @param Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $beforeRow Number of the row we're inserting/deleting before + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); + if (!empty($aColumnDimensions)) { + foreach ($aColumnDimensions as $objColumnDimension) { + $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); + [$newReference] = Coordinate::coordinateFromString($newReference); + if ($objColumnDimension->getColumnIndex() != $newReference) { + $objColumnDimension->setColumnIndex($newReference); + } + } + $pSheet->refreshColumnDimensions(); + } + } + + /** + * Update row dimensions when inserting/deleting rows/columns. + * + * @param Worksheet $pSheet The worksheet that we're editing + * @param string $pBefore Insert/Delete before this cell address (e.g. 'A1') + * @param int $beforeColumnIndex Index number of the column we're inserting/deleting before + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $beforeRow Number of the row we're inserting/deleting before + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + */ + protected function adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows) + { + $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); + if (!empty($aRowDimensions)) { + foreach ($aRowDimensions as $objRowDimension) { + $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); + [, $newReference] = Coordinate::coordinateFromString($newReference); + if ($objRowDimension->getRowIndex() != $newReference) { + $objRowDimension->setRowIndex($newReference); + } + } + $pSheet->refreshRowDimensions(); + + $copyDimension = $pSheet->getRowDimension($beforeRow - 1); + for ($i = $beforeRow; $i <= $beforeRow - 1 + $pNumRows; ++$i) { + $newDimension = $pSheet->getRowDimension($i); + $newDimension->setRowHeight($copyDimension->getRowHeight()); + $newDimension->setVisible($copyDimension->getVisible()); + $newDimension->setOutlineLevel($copyDimension->getOutlineLevel()); + $newDimension->setCollapsed($copyDimension->getCollapsed()); + } + } + } + + /** + * Insert a new column or row, updating all possible related data. + * + * @param string $pBefore Insert before this cell address (e.g. 'A1') + * @param int $pNumCols Number of columns to insert/delete (negative values indicate deletion) + * @param int $pNumRows Number of rows to insert/delete (negative values indicate deletion) + * @param Worksheet $pSheet The worksheet that we're editing + * + * @throws Exception + */ + public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pSheet) + { + $remove = ($pNumCols < 0 || $pNumRows < 0); + $allCoordinates = $pSheet->getCoordinates(); + + // Get coordinate of $pBefore + [$beforeColumn, $beforeRow] = Coordinate::coordinateFromString($pBefore); + $beforeColumnIndex = Coordinate::columnIndexFromString($beforeColumn); + + // Clear cells if we are removing columns or rows + $highestColumn = $pSheet->getHighestColumn(); + $highestRow = $pSheet->getHighestRow(); + + // 1. Clear column strips if we are removing columns + if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) { + for ($i = 1; $i <= $highestRow - 1; ++$i) { + for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) { + $coordinate = Coordinate::stringFromColumnIndex($j + 1) . $i; + $pSheet->removeConditionalStyles($coordinate); + if ($pSheet->cellExists($coordinate)) { + $pSheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); + $pSheet->getCell($coordinate)->setXfIndex(0); + } + } + } + } + + // 2. Clear row strips if we are removing rows + if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) { + for ($i = $beforeColumnIndex - 1; $i <= Coordinate::columnIndexFromString($highestColumn) - 1; ++$i) { + for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) { + $coordinate = Coordinate::stringFromColumnIndex($i + 1) . $j; + $pSheet->removeConditionalStyles($coordinate); + if ($pSheet->cellExists($coordinate)) { + $pSheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); + $pSheet->getCell($coordinate)->setXfIndex(0); + } + } + } + } + + // Loop through cells, bottom-up, and change cell coordinate + if ($remove) { + // It's faster to reverse and pop than to use unshift, especially with large cell collections + $allCoordinates = array_reverse($allCoordinates); + } + while ($coordinate = array_pop($allCoordinates)) { + $cell = $pSheet->getCell($coordinate); + $cellIndex = Coordinate::columnIndexFromString($cell->getColumn()); + + if ($cellIndex - 1 + $pNumCols < 0) { + continue; + } + + // New coordinate + $newCoordinate = Coordinate::stringFromColumnIndex($cellIndex + $pNumCols) . ($cell->getRow() + $pNumRows); + + // Should the cell be updated? Move value and cellXf index from one cell to another. + if (($cellIndex >= $beforeColumnIndex) && ($cell->getRow() >= $beforeRow)) { + // Update cell styles + $pSheet->getCell($newCoordinate)->setXfIndex($cell->getXfIndex()); + + // Insert this cell at its new location + if ($cell->getDataType() == DataType::TYPE_FORMULA) { + // Formula should be adjusted + $pSheet->getCell($newCoordinate) + ->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle())); + } else { + // Formula should not be adjusted + $pSheet->getCell($newCoordinate)->setValue($cell->getValue()); + } + + // Clear the original cell + $pSheet->getCellCollection()->delete($coordinate); + } else { + /* We don't need to update styles for rows/columns before our insertion position, + but we do still need to adjust any formulae in those cells */ + if ($cell->getDataType() == DataType::TYPE_FORMULA) { + // Formula should be adjusted + $cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle())); + } + } + } + + // Duplicate styles for the newly inserted cells + $highestColumn = $pSheet->getHighestColumn(); + $highestRow = $pSheet->getHighestRow(); + + if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) { + for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { + // Style + $coordinate = Coordinate::stringFromColumnIndex($beforeColumnIndex - 1) . $i; + if ($pSheet->cellExists($coordinate)) { + $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); + $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? + $pSheet->getConditionalStyles($coordinate) : false; + for ($j = $beforeColumnIndex; $j <= $beforeColumnIndex - 1 + $pNumCols; ++$j) { + $pSheet->getCellByColumnAndRow($j, $i)->setXfIndex($xfIndex); + if ($conditionalStyles) { + $cloned = []; + foreach ($conditionalStyles as $conditionalStyle) { + $cloned[] = clone $conditionalStyle; + } + $pSheet->setConditionalStyles(Coordinate::stringFromColumnIndex($j) . $i, $cloned); + } + } + } + } + } + + if ($pNumRows > 0 && $beforeRow - 1 > 0) { + for ($i = $beforeColumnIndex; $i <= Coordinate::columnIndexFromString($highestColumn); ++$i) { + // Style + $coordinate = Coordinate::stringFromColumnIndex($i) . ($beforeRow - 1); + if ($pSheet->cellExists($coordinate)) { + $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); + $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? + $pSheet->getConditionalStyles($coordinate) : false; + for ($j = $beforeRow; $j <= $beforeRow - 1 + $pNumRows; ++$j) { + $pSheet->getCell(Coordinate::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); + if ($conditionalStyles) { + $cloned = []; + foreach ($conditionalStyles as $conditionalStyle) { + $cloned[] = clone $conditionalStyle; + } + $pSheet->setConditionalStyles(Coordinate::stringFromColumnIndex($i) . $j, $cloned); + } + } + } + } + } + + // Update worksheet: column dimensions + $this->adjustColumnDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + + // Update worksheet: row dimensions + $this->adjustRowDimensions($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + + // Update worksheet: page breaks + $this->adjustPageBreaks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + + // Update worksheet: comments + $this->adjustComments($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + + // Update worksheet: hyperlinks + $this->adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + + // Update worksheet: data validations + $this->adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + + // Update worksheet: merge cells + $this->adjustMergeCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + + // Update worksheet: protected cells + $this->adjustProtectedCells($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows); + + // Update worksheet: autofilter + $autoFilter = $pSheet->getAutoFilter(); + $autoFilterRange = $autoFilter->getRange(); + if (!empty($autoFilterRange)) { + if ($pNumCols != 0) { + $autoFilterColumns = $autoFilter->getColumns(); + if (count($autoFilterColumns) > 0) { + $column = ''; + $row = 0; + sscanf($pBefore, '%[A-Z]%d', $column, $row); + $columnIndex = Coordinate::columnIndexFromString($column); + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($autoFilterRange); + if ($columnIndex <= $rangeEnd[0]) { + if ($pNumCols < 0) { + // If we're actually deleting any columns that fall within the autofilter range, + // then we delete any rules for those columns + $deleteColumn = $columnIndex + $pNumCols - 1; + $deleteCount = abs($pNumCols); + for ($i = 1; $i <= $deleteCount; ++$i) { + if (isset($autoFilterColumns[Coordinate::stringFromColumnIndex($deleteColumn + 1)])) { + $autoFilter->clearColumn(Coordinate::stringFromColumnIndex($deleteColumn + 1)); + } + ++$deleteColumn; + } + } + $startCol = ($columnIndex > $rangeStart[0]) ? $columnIndex : $rangeStart[0]; + + // Shuffle columns in autofilter range + if ($pNumCols > 0) { + $startColRef = $startCol; + $endColRef = $rangeEnd[0]; + $toColRef = $rangeEnd[0] + $pNumCols; + + do { + $autoFilter->shiftColumn(Coordinate::stringFromColumnIndex($endColRef), Coordinate::stringFromColumnIndex($toColRef)); + --$endColRef; + --$toColRef; + } while ($startColRef <= $endColRef); + } else { + // For delete, we shuffle from beginning to end to avoid overwriting + $startColID = Coordinate::stringFromColumnIndex($startCol); + $toColID = Coordinate::stringFromColumnIndex($startCol + $pNumCols); + $endColID = Coordinate::stringFromColumnIndex($rangeEnd[0] + 1); + do { + $autoFilter->shiftColumn($startColID, $toColID); + ++$startColID; + ++$toColID; + } while ($startColID != $endColID); + } + } + } + } + $pSheet->setAutoFilter($this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows)); + } + + // Update worksheet: freeze pane + if ($pSheet->getFreezePane()) { + $splitCell = $pSheet->getFreezePane(); + $topLeftCell = $pSheet->getTopLeftCell(); + + $splitCell = $this->updateCellReference($splitCell, $pBefore, $pNumCols, $pNumRows); + $topLeftCell = $this->updateCellReference($topLeftCell, $pBefore, $pNumCols, $pNumRows); + + $pSheet->freezePane($splitCell, $topLeftCell); + } + + // Page setup + if ($pSheet->getPageSetup()->isPrintAreaSet()) { + $pSheet->getPageSetup()->setPrintArea($this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows)); + } + + // Update worksheet: drawings + $aDrawings = $pSheet->getDrawingCollection(); + foreach ($aDrawings as $objDrawing) { + $newReference = $this->updateCellReference($objDrawing->getCoordinates(), $pBefore, $pNumCols, $pNumRows); + if ($objDrawing->getCoordinates() != $newReference) { + $objDrawing->setCoordinates($newReference); + } + } + + // Update workbook: named ranges + if (count($pSheet->getParent()->getNamedRanges()) > 0) { + foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) { + if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) { + $namedRange->setRange($this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows)); + } + } + } + + // Garbage collect + $pSheet->garbageCollect(); + } + + /** + * Update references within formulas. + * + * @param string $pFormula Formula to update + * @param string $pBefore Insert before this one + * @param int $pNumCols Number of columns to insert + * @param int $pNumRows Number of rows to insert + * @param string $sheetName Worksheet name/title + * + * @throws Exception + * + * @return string Updated formula + */ + public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') + { + // Update cell references in the formula + $formulaBlocks = explode('"', $pFormula); + $i = false; + foreach ($formulaBlocks as &$formulaBlock) { + // Ignore blocks that were enclosed in quotes (alternating entries in the $formulaBlocks array after the explode) + if ($i = !$i) { + $adjustCount = 0; + $newCellTokens = $cellTokens = []; + // Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5) + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_ROWRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); + if ($matchCount > 0) { + foreach ($matches as $match) { + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; + $fromString .= $match[3] . ':' . $match[4]; + $modified3 = substr($this->updateCellReference('$A' . $match[3], $pBefore, $pNumCols, $pNumRows), 2); + $modified4 = substr($this->updateCellReference('$A' . $match[4], $pBefore, $pNumCols, $pNumRows), 2); + + if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { + if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { + $toString = ($match[2] > '') ? $match[2] . '!' : ''; + $toString .= $modified3 . ':' . $modified4; + // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more + $column = 100000; + $row = 10000000 + trim($match[3], '$'); + $cellIndex = $column . $row; + + $newCellTokens[$cellIndex] = preg_quote($toString, '/'); + $cellTokens[$cellIndex] = '/(? 0) { + foreach ($matches as $match) { + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; + $fromString .= $match[3] . ':' . $match[4]; + $modified3 = substr($this->updateCellReference($match[3] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2); + $modified4 = substr($this->updateCellReference($match[4] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2); + + if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { + if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { + $toString = ($match[2] > '') ? $match[2] . '!' : ''; + $toString .= $modified3 . ':' . $modified4; + // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more + $column = Coordinate::columnIndexFromString(trim($match[3], '$')) + 100000; + $row = 10000000; + $cellIndex = $column . $row; + + $newCellTokens[$cellIndex] = preg_quote($toString, '/'); + $cellTokens[$cellIndex] = '/(? 0) { + foreach ($matches as $match) { + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; + $fromString .= $match[3] . ':' . $match[4]; + $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); + $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows); + + if ($match[3] . $match[4] !== $modified3 . $modified4) { + if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { + $toString = ($match[2] > '') ? $match[2] . '!' : ''; + $toString .= $modified3 . ':' . $modified4; + [$column, $row] = Coordinate::coordinateFromString($match[3]); + // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more + $column = Coordinate::columnIndexFromString(trim($column, '$')) + 100000; + $row = trim($row, '$') + 10000000; + $cellIndex = $column . $row; + + $newCellTokens[$cellIndex] = preg_quote($toString, '/'); + $cellTokens[$cellIndex] = '/(? 0) { + foreach ($matches as $match) { + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; + $fromString .= $match[3]; + + $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); + if ($match[3] !== $modified3) { + if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { + $toString = ($match[2] > '') ? $match[2] . '!' : ''; + $toString .= $modified3; + [$column, $row] = Coordinate::coordinateFromString($match[3]); + // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more + $column = Coordinate::columnIndexFromString(trim($column, '$')) + 100000; + $row = trim($row, '$') + 10000000; + $cellIndex = $row . $column; + + $newCellTokens[$cellIndex] = preg_quote($toString, '/'); + $cellTokens[$cellIndex] = '/(? 0) { + if ($pNumCols > 0 || $pNumRows > 0) { + krsort($cellTokens); + krsort($newCellTokens); + } else { + ksort($cellTokens); + ksort($newCellTokens); + } // Update cell references in the formula + $formulaBlock = str_replace('\\', '', preg_replace($cellTokens, $newCellTokens, $formulaBlock)); + } + } + } + unset($formulaBlock); + + // Then rebuild the formula string + return implode('"', $formulaBlocks); + } + + /** + * Update cell reference. + * + * @param string $pCellRange Cell range + * @param string $pBefore Insert before this one + * @param int $pNumCols Number of columns to increment + * @param int $pNumRows Number of rows to increment + * + * @throws Exception + * + * @return string Updated cell range + */ + public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) + { + // Is it in another worksheet? Will not have to update anything. + if (strpos($pCellRange, '!') !== false) { + return $pCellRange; + // Is it a range or a single cell? + } elseif (!Coordinate::coordinateIsRange($pCellRange)) { + // Single cell + return $this->updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows); + } elseif (Coordinate::coordinateIsRange($pCellRange)) { + // Range + return $this->updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows); + } + + // Return original + return $pCellRange; + } + + /** + * Update named formulas (i.e. containing worksheet references / named ranges). + * + * @param Spreadsheet $spreadsheet Object to update + * @param string $oldName Old name (name to replace) + * @param string $newName New name + */ + public function updateNamedFormulas(Spreadsheet $spreadsheet, $oldName = '', $newName = '') + { + if ($oldName == '') { + return; + } + + foreach ($spreadsheet->getWorksheetIterator() as $sheet) { + foreach ($sheet->getCoordinates(false) as $coordinate) { + $cell = $sheet->getCell($coordinate); + if (($cell !== null) && ($cell->getDataType() == DataType::TYPE_FORMULA)) { + $formula = $cell->getValue(); + if (strpos($formula, $oldName) !== false) { + $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); + $formula = str_replace($oldName . '!', $newName . '!', $formula); + $cell->setValueExplicit($formula, DataType::TYPE_FORMULA); + } + } + } + } + } + + /** + * Update cell range. + * + * @param string $pCellRange Cell range (e.g. 'B2:D4', 'B:C' or '2:3') + * @param string $pBefore Insert before this one + * @param int $pNumCols Number of columns to increment + * @param int $pNumRows Number of rows to increment + * + * @throws Exception + * + * @return string Updated cell range + */ + private function updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) + { + if (!Coordinate::coordinateIsRange($pCellRange)) { + throw new Exception('Only cell ranges may be passed to this method.'); + } + + // Update range + $range = Coordinate::splitRange($pCellRange); + $ic = count($range); + for ($i = 0; $i < $ic; ++$i) { + $jc = count($range[$i]); + for ($j = 0; $j < $jc; ++$j) { + if (ctype_alpha($range[$i][$j])) { + $r = Coordinate::coordinateFromString($this->updateSingleCellReference($range[$i][$j] . '1', $pBefore, $pNumCols, $pNumRows)); + $range[$i][$j] = $r[0]; + } elseif (ctype_digit($range[$i][$j])) { + $r = Coordinate::coordinateFromString($this->updateSingleCellReference('A' . $range[$i][$j], $pBefore, $pNumCols, $pNumRows)); + $range[$i][$j] = $r[1]; + } else { + $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows); + } + } + } + + // Recreate range string + return Coordinate::buildRange($range); + } + + /** + * Update single cell reference. + * + * @param string $pCellReference Single cell reference + * @param string $pBefore Insert before this one + * @param int $pNumCols Number of columns to increment + * @param int $pNumRows Number of rows to increment + * + * @throws Exception + * + * @return string Updated cell reference + */ + private function updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) + { + if (Coordinate::coordinateIsRange($pCellReference)) { + throw new Exception('Only single cell references may be passed to this method.'); + } + + // Get coordinate of $pBefore + [$beforeColumn, $beforeRow] = Coordinate::coordinateFromString($pBefore); + + // Get coordinate of $pCellReference + [$newColumn, $newRow] = Coordinate::coordinateFromString($pCellReference); + + // Verify which parts should be updated + $updateColumn = (($newColumn[0] != '$') && ($beforeColumn[0] != '$') && (Coordinate::columnIndexFromString($newColumn) >= Coordinate::columnIndexFromString($beforeColumn))); + $updateRow = (($newRow[0] != '$') && ($beforeRow[0] != '$') && $newRow >= $beforeRow); + + // Create new column reference + if ($updateColumn) { + $newColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($newColumn) + $pNumCols); + } + + // Create new row reference + if ($updateRow) { + $newRow = $newRow + $pNumRows; + } + + // Return new reference + return $newColumn . $newRow; + } + + /** + * __clone implementation. Cloning should not be allowed in a Singleton! + * + * @throws Exception + */ + final public function __clone() + { + throw new Exception('Cloning a Singleton is not allowed!'); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/ITextElement.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/ITextElement.php new file mode 100644 index 0000000..6995467 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/ITextElement.php @@ -0,0 +1,36 @@ +richTextElements = []; + + // Rich-Text string attached to cell? + if ($pCell !== null) { + // Add cell text and style + if ($pCell->getValue() != '') { + $objRun = new Run($pCell->getValue()); + $objRun->setFont(clone $pCell->getWorksheet()->getStyle($pCell->getCoordinate())->getFont()); + $this->addText($objRun); + } + + // Set parent value + $pCell->setValueExplicit($this, DataType::TYPE_STRING); + } + } + + /** + * Add text. + * + * @param ITextElement $pText Rich text element + * + * @return $this + */ + public function addText(ITextElement $pText) + { + $this->richTextElements[] = $pText; + + return $this; + } + + /** + * Create text. + * + * @param string $pText Text + * + * @throws Exception + * + * @return TextElement + */ + public function createText($pText) + { + $objText = new TextElement($pText); + $this->addText($objText); + + return $objText; + } + + /** + * Create text run. + * + * @param string $pText Text + * + * @throws Exception + * + * @return Run + */ + public function createTextRun($pText) + { + $objText = new Run($pText); + $this->addText($objText); + + return $objText; + } + + /** + * Get plain text. + * + * @return string + */ + public function getPlainText() + { + // Return value + $returnValue = ''; + + // Loop through all ITextElements + foreach ($this->richTextElements as $text) { + $returnValue .= $text->getText(); + } + + return $returnValue; + } + + /** + * Convert to string. + * + * @return string + */ + public function __toString() + { + return $this->getPlainText(); + } + + /** + * Get Rich Text elements. + * + * @return ITextElement[] + */ + public function getRichTextElements() + { + return $this->richTextElements; + } + + /** + * Set Rich Text elements. + * + * @param ITextElement[] $textElements Array of elements + * + * @return $this + */ + public function setRichTextElements(array $textElements) + { + $this->richTextElements = $textElements; + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + $hashElements = ''; + foreach ($this->richTextElements as $element) { + $hashElements .= $element->getHashCode(); + } + + return md5( + $hashElements . + __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/Run.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/Run.php new file mode 100644 index 0000000..aa4a8e4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/Run.php @@ -0,0 +1,65 @@ +font = new Font(); + } + + /** + * Get font. + * + * @return null|\PhpOffice\PhpSpreadsheet\Style\Font + */ + public function getFont() + { + return $this->font; + } + + /** + * Set font. + * + * @param Font $pFont Font + * + * @return $this + */ + public function setFont(Font $pFont = null) + { + $this->font = $pFont; + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->getText() . + $this->font->getHashCode() . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/TextElement.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/TextElement.php new file mode 100644 index 0000000..f8be5d5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/TextElement.php @@ -0,0 +1,86 @@ +text = $pText; + } + + /** + * Get text. + * + * @return string Text + */ + public function getText() + { + return $this->text; + } + + /** + * Set text. + * + * @param $text string Text + * + * @return $this + */ + public function setText($text) + { + $this->text = $text; + + return $this; + } + + /** + * Get font. + * + * @return null|\PhpOffice\PhpSpreadsheet\Style\Font + */ + public function getFont() + { + return null; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->text . + __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php new file mode 100644 index 0000000..03fa6ac --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Settings.php @@ -0,0 +1,167 @@ +setLocale($locale); + } + + /** + * Identify to PhpSpreadsheet the external library to use for rendering charts. + * + * @param string $rendererClass Class name of the chart renderer + * eg: PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph + * + * @throws Exception + */ + public static function setChartRenderer($rendererClass) + { + if (!is_a($rendererClass, IRenderer::class, true)) { + throw new Exception('Chart renderer must implement ' . IRenderer::class); + } + + self::$chartRenderer = $rendererClass; + } + + /** + * Return the Chart Rendering Library that PhpSpreadsheet is currently configured to use. + * + * @return null|string Class name of the chart renderer + * eg: PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph + */ + public static function getChartRenderer() + { + return self::$chartRenderer; + } + + /** + * Set default options for libxml loader. + * + * @param int $options Default options for libxml loader + */ + public static function setLibXmlLoaderOptions($options) + { + if ($options === null && defined('LIBXML_DTDLOAD')) { + $options = LIBXML_DTDLOAD | LIBXML_DTDATTR; + } + self::$libXmlLoaderOptions = $options; + } + + /** + * Get default options for libxml loader. + * Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly. + * + * @return int Default options for libxml loader + */ + public static function getLibXmlLoaderOptions() + { + if (self::$libXmlLoaderOptions === null && defined('LIBXML_DTDLOAD')) { + self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR); + } elseif (self::$libXmlLoaderOptions === null) { + self::$libXmlLoaderOptions = true; + } + + return self::$libXmlLoaderOptions; + } + + /** + * Enable/Disable the entity loader for libxml loader. + * Allow/disallow libxml_disable_entity_loader() call when not thread safe. + * Default behaviour is to do the check, but if you're running PHP versions + * 7.2 < 7.2.1 + * 7.1 < 7.1.13 + * 7.0 < 7.0.27 + * then you may need to disable this check to prevent unwanted behaviour in other threads + * SECURITY WARNING: Changing this flag to false is not recommended. + * + * @param bool $state + */ + public static function setLibXmlDisableEntityLoader($state) + { + self::$libXmlDisableEntityLoader = (bool) $state; + } + + /** + * Return the state of the entity loader (disabled/enabled) for libxml loader. + * + * @return bool $state + */ + public static function getLibXmlDisableEntityLoader() + { + return self::$libXmlDisableEntityLoader; + } + + /** + * Sets the implementation of cache that should be used for cell collection. + * + * @param CacheInterface $cache + */ + public static function setCache(CacheInterface $cache) + { + self::$cache = $cache; + } + + /** + * Gets the implementation of cache that should be used for cell collection. + * + * @return CacheInterface + */ + public static function getCache() + { + if (!self::$cache) { + self::$cache = new Memory(); + } + + return self::$cache; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/CodePage.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/CodePage.php new file mode 100644 index 0000000..4b57824 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/CodePage.php @@ -0,0 +1,138 @@ + 'January', + 'Feb' => 'February', + 'Mar' => 'March', + 'Apr' => 'April', + 'May' => 'May', + 'Jun' => 'June', + 'Jul' => 'July', + 'Aug' => 'August', + 'Sep' => 'September', + 'Oct' => 'October', + 'Nov' => 'November', + 'Dec' => 'December', + ]; + + /** + * @var string[] + */ + public static $numberSuffixes = [ + 'st', + 'nd', + 'rd', + 'th', + ]; + + /** + * Base calendar year to use for calculations + * Value is either CALENDAR_WINDOWS_1900 (1900) or CALENDAR_MAC_1904 (1904). + * + * @var int + */ + protected static $excelCalendar = self::CALENDAR_WINDOWS_1900; + + /** + * Default timezone to use for DateTime objects. + * + * @var null|\DateTimeZone + */ + protected static $defaultTimeZone; + + /** + * Set the Excel calendar (Windows 1900 or Mac 1904). + * + * @param int $baseDate Excel base date (1900 or 1904) + * + * @return bool Success or failure + */ + public static function setExcelCalendar($baseDate) + { + if (($baseDate == self::CALENDAR_WINDOWS_1900) || + ($baseDate == self::CALENDAR_MAC_1904)) { + self::$excelCalendar = $baseDate; + + return true; + } + + return false; + } + + /** + * Return the Excel calendar (Windows 1900 or Mac 1904). + * + * @return int Excel base date (1900 or 1904) + */ + public static function getExcelCalendar() + { + return self::$excelCalendar; + } + + /** + * Set the Default timezone to use for dates. + * + * @param DateTimeZone|string $timeZone The timezone to set for all Excel datetimestamp to PHP DateTime Object conversions + * + * @throws \Exception + * + * @return bool Success or failure + * @return bool Success or failure + */ + public static function setDefaultTimezone($timeZone) + { + if ($timeZone = self::validateTimeZone($timeZone)) { + self::$defaultTimeZone = $timeZone; + + return true; + } + + return false; + } + + /** + * Return the Default timezone being used for dates. + * + * @return DateTimeZone The timezone being used as default for Excel timestamp to PHP DateTime object + */ + public static function getDefaultTimezone() + { + if (self::$defaultTimeZone === null) { + self::$defaultTimeZone = new DateTimeZone('UTC'); + } + + return self::$defaultTimeZone; + } + + /** + * Validate a timezone. + * + * @param DateTimeZone|string $timeZone The timezone to validate, either as a timezone string or object + * + * @throws \Exception + * + * @return DateTimeZone The timezone as a timezone object + * @return DateTimeZone The timezone as a timezone object + */ + protected static function validateTimeZone($timeZone) + { + if (is_object($timeZone) && $timeZone instanceof DateTimeZone) { + return $timeZone; + } elseif (is_string($timeZone)) { + return new DateTimeZone($timeZone); + } + + throw new \Exception('Invalid timezone'); + } + + /** + * Convert a MS serialized datetime value from Excel to a PHP Date/Time object. + * + * @param float|int $excelTimestamp MS Excel serialized date/time value + * @param null|DateTimeZone|string $timeZone The timezone to assume for the Excel timestamp, + * if you don't want to treat it as a UTC value + * Use the default (UST) unless you absolutely need a conversion + * + * @throws \Exception + * + * @return \DateTime PHP date/time object + */ + public static function excelToDateTimeObject($excelTimestamp, $timeZone = null) + { + $timeZone = ($timeZone === null) ? self::getDefaultTimezone() : self::validateTimeZone($timeZone); + if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_EXCEL) { + if ($excelTimestamp < 1.0) { + // Unix timestamp base date + $baseDate = new \DateTime('1970-01-01', $timeZone); + } else { + // MS Excel calendar base dates + if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) { + // Allow adjustment for 1900 Leap Year in MS Excel + $baseDate = ($excelTimestamp < 60) ? new \DateTime('1899-12-31', $timeZone) : new \DateTime('1899-12-30', $timeZone); + } else { + $baseDate = new \DateTime('1904-01-01', $timeZone); + } + } + } else { + $baseDate = new \DateTime('1899-12-30', $timeZone); + } + + $days = floor($excelTimestamp); + $partDay = $excelTimestamp - $days; + $hours = floor($partDay * 24); + $partDay = $partDay * 24 - $hours; + $minutes = floor($partDay * 60); + $partDay = $partDay * 60 - $minutes; + $seconds = round($partDay * 60); + + if ($days >= 0) { + $days = '+' . $days; + } + $interval = $days . ' days'; + + return $baseDate->modify($interval) + ->setTime((int) $hours, (int) $minutes, (int) $seconds); + } + + /** + * Convert a MS serialized datetime value from Excel to a unix timestamp. + * + * @param float|int $excelTimestamp MS Excel serialized date/time value + * @param null|DateTimeZone|string $timeZone The timezone to assume for the Excel timestamp, + * if you don't want to treat it as a UTC value + * Use the default (UST) unless you absolutely need a conversion + * + * @throws \Exception + * + * @return int Unix timetamp for this date/time + */ + public static function excelToTimestamp($excelTimestamp, $timeZone = null) + { + return (int) self::excelToDateTimeObject($excelTimestamp, $timeZone) + ->format('U'); + } + + /** + * Convert a date from PHP to an MS Excel serialized date/time value. + * + * @param mixed $dateValue Unix Timestamp or PHP DateTime object or a string + * + * @return bool|float Excel date/time value + * or boolean FALSE on failure + */ + public static function PHPToExcel($dateValue) + { + if ((is_object($dateValue)) && ($dateValue instanceof DateTimeInterface)) { + return self::dateTimeToExcel($dateValue); + } elseif (is_numeric($dateValue)) { + return self::timestampToExcel($dateValue); + } elseif (is_string($dateValue)) { + return self::stringToExcel($dateValue); + } + + return false; + } + + /** + * Convert a PHP DateTime object to an MS Excel serialized date/time value. + * + * @param DateTimeInterface $dateValue PHP DateTime object + * + * @return float MS Excel serialized date/time value + */ + public static function dateTimeToExcel(DateTimeInterface $dateValue) + { + return self::formattedPHPToExcel( + (int) $dateValue->format('Y'), + (int) $dateValue->format('m'), + (int) $dateValue->format('d'), + (int) $dateValue->format('H'), + (int) $dateValue->format('i'), + (int) $dateValue->format('s') + ); + } + + /** + * Convert a Unix timestamp to an MS Excel serialized date/time value. + * + * @param int $dateValue Unix Timestamp + * + * @return float MS Excel serialized date/time value + */ + public static function timestampToExcel($dateValue) + { + if (!is_numeric($dateValue)) { + return false; + } + + return self::dateTimeToExcel(new \DateTime('@' . $dateValue)); + } + + /** + * formattedPHPToExcel. + * + * @param int $year + * @param int $month + * @param int $day + * @param int $hours + * @param int $minutes + * @param int $seconds + * + * @return float Excel date/time value + */ + public static function formattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0) + { + if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) { + // + // Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel + // This affects every date following 28th February 1900 + // + $excel1900isLeapYear = true; + if (($year == 1900) && ($month <= 2)) { + $excel1900isLeapYear = false; + } + $myexcelBaseDate = 2415020; + } else { + $myexcelBaseDate = 2416481; + $excel1900isLeapYear = false; + } + + // Julian base date Adjustment + if ($month > 2) { + $month -= 3; + } else { + $month += 9; + --$year; + } + + // Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0) + $century = substr($year, 0, 2); + $decade = substr($year, 2, 2); + $excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear; + + $excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400; + + return (float) $excelDate + $excelTime; + } + + /** + * Is a given cell a date/time? + * + * @param Cell $pCell + * + * @return bool + */ + public static function isDateTime(Cell $pCell) + { + return is_numeric($pCell->getValue()) && + self::isDateTimeFormat( + $pCell->getWorksheet()->getStyle( + $pCell->getCoordinate() + )->getNumberFormat() + ); + } + + /** + * Is a given number format a date/time? + * + * @param NumberFormat $pFormat + * + * @return bool + */ + public static function isDateTimeFormat(NumberFormat $pFormat) + { + return self::isDateTimeFormatCode($pFormat->getFormatCode()); + } + + private static $possibleDateFormatCharacters = 'eymdHs'; + + /** + * Is a given number format code a date/time? + * + * @param string $pFormatCode + * + * @return bool + */ + public static function isDateTimeFormatCode($pFormatCode) + { + if (strtolower($pFormatCode) === strtolower(NumberFormat::FORMAT_GENERAL)) { + // "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check) + return false; + } + if (preg_match('/[0#]E[+-]0/i', $pFormatCode)) { + // Scientific format + return false; + } + + // Switch on formatcode + switch ($pFormatCode) { + // Explicitly defined date formats + case NumberFormat::FORMAT_DATE_YYYYMMDD: + case NumberFormat::FORMAT_DATE_YYYYMMDD2: + case NumberFormat::FORMAT_DATE_DDMMYYYY: + case NumberFormat::FORMAT_DATE_DMYSLASH: + case NumberFormat::FORMAT_DATE_DMYMINUS: + case NumberFormat::FORMAT_DATE_DMMINUS: + case NumberFormat::FORMAT_DATE_MYMINUS: + case NumberFormat::FORMAT_DATE_DATETIME: + case NumberFormat::FORMAT_DATE_TIME1: + case NumberFormat::FORMAT_DATE_TIME2: + case NumberFormat::FORMAT_DATE_TIME3: + case NumberFormat::FORMAT_DATE_TIME4: + case NumberFormat::FORMAT_DATE_TIME5: + case NumberFormat::FORMAT_DATE_TIME6: + case NumberFormat::FORMAT_DATE_TIME7: + case NumberFormat::FORMAT_DATE_TIME8: + case NumberFormat::FORMAT_DATE_YYYYMMDDSLASH: + case NumberFormat::FORMAT_DATE_XLSX14: + case NumberFormat::FORMAT_DATE_XLSX15: + case NumberFormat::FORMAT_DATE_XLSX16: + case NumberFormat::FORMAT_DATE_XLSX17: + case NumberFormat::FORMAT_DATE_XLSX22: + return true; + } + + // Typically number, currency or accounting (or occasionally fraction) formats + if ((substr($pFormatCode, 0, 1) == '_') || (substr($pFormatCode, 0, 2) == '0 ')) { + return false; + } + // Try checking for any of the date formatting characters that don't appear within square braces + if (preg_match('/(^|\])[^\[]*[' . self::$possibleDateFormatCharacters . ']/i', $pFormatCode)) { + // We might also have a format mask containing quoted strings... + // we don't want to test for any of our characters within the quoted blocks + if (strpos($pFormatCode, '"') !== false) { + $segMatcher = false; + foreach (explode('"', $pFormatCode) as $subVal) { + // Only test in alternate array entries (the non-quoted blocks) + if (($segMatcher = !$segMatcher) && + (preg_match('/(^|\])[^\[]*[' . self::$possibleDateFormatCharacters . ']/i', $subVal))) { + return true; + } + } + + return false; + } + + return true; + } + + // No date... + return false; + } + + /** + * Convert a date/time string to Excel time. + * + * @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10' + * + * @return false|float Excel date/time serial value + */ + public static function stringToExcel($dateValue) + { + if (strlen($dateValue) < 2) { + return false; + } + if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue)) { + return false; + } + + $dateValueNew = DateTime::DATEVALUE($dateValue); + + if ($dateValueNew === Functions::VALUE()) { + return false; + } + + if (strpos($dateValue, ':') !== false) { + $timeValue = DateTime::TIMEVALUE($dateValue); + if ($timeValue === Functions::VALUE()) { + return false; + } + $dateValueNew += $timeValue; + } + + return $dateValueNew; + } + + /** + * Converts a month name (either a long or a short name) to a month number. + * + * @param string $month Month name or abbreviation + * + * @return int|string Month number (1 - 12), or the original string argument if it isn't a valid month name + */ + public static function monthStringToNumber($month) + { + $monthIndex = 1; + foreach (self::$monthNames as $shortMonthName => $longMonthName) { + if (($month === $longMonthName) || ($month === $shortMonthName)) { + return $monthIndex; + } + ++$monthIndex; + } + + return $month; + } + + /** + * Strips an ordinal from a numeric value. + * + * @param string $day Day number with an ordinal + * + * @return int|string The integer value with any ordinal stripped, or the original string argument if it isn't a valid numeric + */ + public static function dayStringToNumber($day) + { + $strippedDayValue = (str_replace(self::$numberSuffixes, '', $day)); + if (is_numeric($strippedDayValue)) { + return (int) $strippedDayValue; + } + + return $day; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php new file mode 100644 index 0000000..25d6910 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Drawing.php @@ -0,0 +1,249 @@ +getName(); + $size = $pDefaultFont->getSize(); + + if (isset(Font::$defaultColumnWidths[$name][$size])) { + // Exact width can be determined + $colWidth = $pValue * Font::$defaultColumnWidths[$name][$size]['width'] / Font::$defaultColumnWidths[$name][$size]['px']; + } else { + // We don't have data for this particular font and size, use approximation by + // extrapolating from Calibri 11 + $colWidth = $pValue * 11 * Font::$defaultColumnWidths['Calibri'][11]['width'] / Font::$defaultColumnWidths['Calibri'][11]['px'] / $size; + } + + return $colWidth; + } + + /** + * Convert column width from (intrinsic) Excel units to pixels. + * + * @param float $pValue Value in cell dimension + * @param \PhpOffice\PhpSpreadsheet\Style\Font $pDefaultFont Default font of the workbook + * + * @return int Value in pixels + */ + public static function cellDimensionToPixels($pValue, \PhpOffice\PhpSpreadsheet\Style\Font $pDefaultFont) + { + // Font name and size + $name = $pDefaultFont->getName(); + $size = $pDefaultFont->getSize(); + + if (isset(Font::$defaultColumnWidths[$name][$size])) { + // Exact width can be determined + $colWidth = $pValue * Font::$defaultColumnWidths[$name][$size]['px'] / Font::$defaultColumnWidths[$name][$size]['width']; + } else { + // We don't have data for this particular font and size, use approximation by + // extrapolating from Calibri 11 + $colWidth = $pValue * $size * Font::$defaultColumnWidths['Calibri'][11]['px'] / Font::$defaultColumnWidths['Calibri'][11]['width'] / 11; + } + + // Round pixels to closest integer + $colWidth = (int) round($colWidth); + + return $colWidth; + } + + /** + * Convert pixels to points. + * + * @param int $pValue Value in pixels + * + * @return float Value in points + */ + public static function pixelsToPoints($pValue) + { + return $pValue * 0.67777777; + } + + /** + * Convert points to pixels. + * + * @param int $pValue Value in points + * + * @return int Value in pixels + */ + public static function pointsToPixels($pValue) + { + if ($pValue != 0) { + return (int) ceil($pValue * 1.333333333); + } + + return 0; + } + + /** + * Convert degrees to angle. + * + * @param int $pValue Degrees + * + * @return int Angle + */ + public static function degreesToAngle($pValue) + { + return (int) round($pValue * 60000); + } + + /** + * Convert angle to degrees. + * + * @param int $pValue Angle + * + * @return int Degrees + */ + public static function angleToDegrees($pValue) + { + if ($pValue != 0) { + return round($pValue / 60000); + } + + return 0; + } + + /** + * Create a new image from file. By alexander at alexauto dot nl. + * + * @see http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214 + * + * @param string $p_sFile Path to Windows DIB (BMP) image + * + * @return resource + */ + public static function imagecreatefrombmp($p_sFile) + { + // Load the image into a string + $file = fopen($p_sFile, 'rb'); + $read = fread($file, 10); + while (!feof($file) && ($read != '')) { + $read .= fread($file, 1024); + } + + $temp = unpack('H*', $read); + $hex = $temp[1]; + $header = substr($hex, 0, 108); + + // Process the header + // Structure: http://www.fastgraph.com/help/bmp_header_format.html + if (substr($header, 0, 4) == '424d') { + // Cut it in parts of 2 bytes + $header_parts = str_split($header, 2); + + // Get the width 4 bytes + $width = hexdec($header_parts[19] . $header_parts[18]); + + // Get the height 4 bytes + $height = hexdec($header_parts[23] . $header_parts[22]); + + // Unset the header params + unset($header_parts); + } + + // Define starting X and Y + $x = 0; + $y = 1; + + // Create newimage + $image = imagecreatetruecolor($width, $height); + + // Grab the body from the image + $body = substr($hex, 108); + + // Calculate if padding at the end-line is needed + // Divided by two to keep overview. + // 1 byte = 2 HEX-chars + $body_size = (strlen($body) / 2); + $header_size = ($width * $height); + + // Use end-line padding? Only when needed + $usePadding = ($body_size > ($header_size * 3) + 4); + + // Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption + // Calculate the next DWORD-position in the body + for ($i = 0; $i < $body_size; $i += 3) { + // Calculate line-ending and padding + if ($x >= $width) { + // If padding needed, ignore image-padding + // Shift i to the ending of the current 32-bit-block + if ($usePadding) { + $i += $width % 4; + } + + // Reset horizontal position + $x = 0; + + // Raise the height-position (bottom-up) + ++$y; + + // Reached the image-height? Break the for-loop + if ($y > $height) { + break; + } + } + + // Calculation of the RGB-pixel (defined as BGR in image-data) + // Define $i_pos as absolute position in the body + $i_pos = $i * 2; + $r = hexdec($body[$i_pos + 4] . $body[$i_pos + 5]); + $g = hexdec($body[$i_pos + 2] . $body[$i_pos + 3]); + $b = hexdec($body[$i_pos] . $body[$i_pos + 1]); + + // Calculate and draw the pixel + $color = imagecolorallocate($image, $r, $g, $b); + imagesetpixel($image, $x, $height - $y, $color); + + // Raise the horizontal position + ++$x; + } + + // Unset the body / free the memory + unset($body); + + // Return image-object + return $image; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher.php new file mode 100644 index 0000000..c6d0a6f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher.php @@ -0,0 +1,64 @@ +dggContainer; + } + + /** + * Set Drawing Group Container. + * + * @param Escher\DggContainer $dggContainer + * + * @return Escher\DggContainer + */ + public function setDggContainer($dggContainer) + { + return $this->dggContainer = $dggContainer; + } + + /** + * Get Drawing Container. + * + * @return Escher\DgContainer + */ + public function getDgContainer() + { + return $this->dgContainer; + } + + /** + * Set Drawing Container. + * + * @param Escher\DgContainer $dgContainer + * + * @return Escher\DgContainer + */ + public function setDgContainer($dgContainer) + { + return $this->dgContainer = $dgContainer; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer.php new file mode 100644 index 0000000..e9d387d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer.php @@ -0,0 +1,52 @@ +dgId; + } + + public function setDgId($value) + { + $this->dgId = $value; + } + + public function getLastSpId() + { + return $this->lastSpId; + } + + public function setLastSpId($value) + { + $this->lastSpId = $value; + } + + public function getSpgrContainer() + { + return $this->spgrContainer; + } + + public function setSpgrContainer($spgrContainer) + { + return $this->spgrContainer = $spgrContainer; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php new file mode 100644 index 0000000..7e2c346 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php @@ -0,0 +1,79 @@ +parent = $parent; + } + + /** + * Get the parent Shape Group Container if any. + * + * @return null|\PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer + */ + public function getParent() + { + return $this->parent; + } + + /** + * Add a child. This will be either spgrContainer or spContainer. + * + * @param mixed $child + */ + public function addChild($child) + { + $this->children[] = $child; + $child->setParent($this); + } + + /** + * Get collection of Shape Containers. + */ + public function getChildren() + { + return $this->children; + } + + /** + * Recursively get all spContainers within this spgrContainer. + * + * @return SpgrContainer\SpContainer[] + */ + public function getAllSpContainers() + { + $allSpContainers = []; + + foreach ($this->children as $child) { + if ($child instanceof self) { + $allSpContainers = array_merge($allSpContainers, $child->getAllSpContainers()); + } else { + $allSpContainers[] = $child; + } + } + + return $allSpContainers; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php new file mode 100644 index 0000000..bbf51df --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php @@ -0,0 +1,369 @@ +parent = $parent; + } + + /** + * Get the parent Shape Group Container. + * + * @return SpgrContainer + */ + public function getParent() + { + return $this->parent; + } + + /** + * Set whether this is a group shape. + * + * @param bool $value + */ + public function setSpgr($value) + { + $this->spgr = $value; + } + + /** + * Get whether this is a group shape. + * + * @return bool + */ + public function getSpgr() + { + return $this->spgr; + } + + /** + * Set the shape type. + * + * @param int $value + */ + public function setSpType($value) + { + $this->spType = $value; + } + + /** + * Get the shape type. + * + * @return int + */ + public function getSpType() + { + return $this->spType; + } + + /** + * Set the shape flag. + * + * @param int $value + */ + public function setSpFlag($value) + { + $this->spFlag = $value; + } + + /** + * Get the shape flag. + * + * @return int + */ + public function getSpFlag() + { + return $this->spFlag; + } + + /** + * Set the shape index. + * + * @param int $value + */ + public function setSpId($value) + { + $this->spId = $value; + } + + /** + * Get the shape index. + * + * @return int + */ + public function getSpId() + { + return $this->spId; + } + + /** + * Set an option for the Shape Group Container. + * + * @param int $property The number specifies the option + * @param mixed $value + */ + public function setOPT($property, $value) + { + $this->OPT[$property] = $value; + } + + /** + * Get an option for the Shape Group Container. + * + * @param int $property The number specifies the option + * + * @return mixed + */ + public function getOPT($property) + { + if (isset($this->OPT[$property])) { + return $this->OPT[$property]; + } + + return null; + } + + /** + * Get the collection of options. + * + * @return array + */ + public function getOPTCollection() + { + return $this->OPT; + } + + /** + * Set cell coordinates of upper-left corner of shape. + * + * @param string $value eg: 'A1' + */ + public function setStartCoordinates($value) + { + $this->startCoordinates = $value; + } + + /** + * Get cell coordinates of upper-left corner of shape. + * + * @return string + */ + public function getStartCoordinates() + { + return $this->startCoordinates; + } + + /** + * Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width. + * + * @param int $startOffsetX + */ + public function setStartOffsetX($startOffsetX) + { + $this->startOffsetX = $startOffsetX; + } + + /** + * Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width. + * + * @return int + */ + public function getStartOffsetX() + { + return $this->startOffsetX; + } + + /** + * Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height. + * + * @param int $startOffsetY + */ + public function setStartOffsetY($startOffsetY) + { + $this->startOffsetY = $startOffsetY; + } + + /** + * Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height. + * + * @return int + */ + public function getStartOffsetY() + { + return $this->startOffsetY; + } + + /** + * Set cell coordinates of bottom-right corner of shape. + * + * @param string $value eg: 'A1' + */ + public function setEndCoordinates($value) + { + $this->endCoordinates = $value; + } + + /** + * Get cell coordinates of bottom-right corner of shape. + * + * @return string + */ + public function getEndCoordinates() + { + return $this->endCoordinates; + } + + /** + * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width. + * + * @param int $endOffsetX + */ + public function setEndOffsetX($endOffsetX) + { + $this->endOffsetX = $endOffsetX; + } + + /** + * Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width. + * + * @return int + */ + public function getEndOffsetX() + { + return $this->endOffsetX; + } + + /** + * Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height. + * + * @param int $endOffsetY + */ + public function setEndOffsetY($endOffsetY) + { + $this->endOffsetY = $endOffsetY; + } + + /** + * Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height. + * + * @return int + */ + public function getEndOffsetY() + { + return $this->endOffsetY; + } + + /** + * Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and + * the dgContainer. A value of 1 = immediately within first spgrContainer + * Higher nesting level occurs if and only if spContainer is part of a shape group. + * + * @return int Nesting level + */ + public function getNestingLevel() + { + $nestingLevel = 0; + + $parent = $this->getParent(); + while ($parent instanceof SpgrContainer) { + ++$nestingLevel; + $parent = $parent->getParent(); + } + + return $nestingLevel; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer.php new file mode 100644 index 0000000..96da321 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer.php @@ -0,0 +1,175 @@ +spIdMax; + } + + /** + * Set maximum shape index of all shapes in all drawings (plus one). + * + * @param int $value + */ + public function setSpIdMax($value) + { + $this->spIdMax = $value; + } + + /** + * Get total number of drawings saved. + * + * @return int + */ + public function getCDgSaved() + { + return $this->cDgSaved; + } + + /** + * Set total number of drawings saved. + * + * @param int $value + */ + public function setCDgSaved($value) + { + $this->cDgSaved = $value; + } + + /** + * Get total number of shapes saved (including group shapes). + * + * @return int + */ + public function getCSpSaved() + { + return $this->cSpSaved; + } + + /** + * Set total number of shapes saved (including group shapes). + * + * @param int $value + */ + public function setCSpSaved($value) + { + $this->cSpSaved = $value; + } + + /** + * Get BLIP Store Container. + * + * @return DggContainer\BstoreContainer + */ + public function getBstoreContainer() + { + return $this->bstoreContainer; + } + + /** + * Set BLIP Store Container. + * + * @param DggContainer\BstoreContainer $bstoreContainer + */ + public function setBstoreContainer($bstoreContainer) + { + $this->bstoreContainer = $bstoreContainer; + } + + /** + * Set an option for the drawing group. + * + * @param int $property The number specifies the option + * @param mixed $value + */ + public function setOPT($property, $value) + { + $this->OPT[$property] = $value; + } + + /** + * Get an option for the drawing group. + * + * @param int $property The number specifies the option + * + * @return mixed + */ + public function getOPT($property) + { + if (isset($this->OPT[$property])) { + return $this->OPT[$property]; + } + + return null; + } + + /** + * Get identifier clusters. + * + * @return array + */ + public function getIDCLs() + { + return $this->IDCLs; + } + + /** + * Set identifier clusters. [ => , ...]. + * + * @param array $pValue + */ + public function setIDCLs($pValue) + { + $this->IDCLs = $pValue; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php new file mode 100644 index 0000000..9d1e68e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer.php @@ -0,0 +1,34 @@ +BSECollection[] = $BSE; + $BSE->setParent($this); + } + + /** + * Get the collection of BLIP Store Entries. + * + * @return BstoreContainer\BSE[] + */ + public function getBSECollection() + { + return $this->BSECollection; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php new file mode 100644 index 0000000..f83bdc7 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE.php @@ -0,0 +1,89 @@ +parent = $parent; + } + + /** + * Get the BLIP. + * + * @return BSE\Blip + */ + public function getBlip() + { + return $this->blip; + } + + /** + * Set the BLIP. + * + * @param BSE\Blip $blip + */ + public function setBlip($blip) + { + $this->blip = $blip; + $blip->setParent($this); + } + + /** + * Get the BLIP type. + * + * @return int + */ + public function getBlipType() + { + return $this->blipType; + } + + /** + * Set the BLIP type. + * + * @param int $blipType + */ + public function setBlipType($blipType) + { + $this->blipType = $blipType; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php new file mode 100644 index 0000000..88bc117 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php @@ -0,0 +1,60 @@ +data; + } + + /** + * Set the raw image data. + * + * @param string $data + */ + public function setData($data) + { + $this->data = $data; + } + + /** + * Set parent BSE. + * + * @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE $parent + */ + public function setParent($parent) + { + $this->parent = $parent; + } + + /** + * Get parent BSE. + * + * @return \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE $parent + */ + public function getParent() + { + return $this->parent; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php new file mode 100644 index 0000000..239c837 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/File.php @@ -0,0 +1,144 @@ +open($zipFile) === true) { + $returnValue = ($zip->getFromName($archiveFile) !== false); + $zip->close(); + + return $returnValue; + } + + return false; + } + + return file_exists($pFilename); + } + + /** + * Returns canonicalized absolute pathname, also for ZIP archives. + * + * @param string $pFilename + * + * @return string + */ + public static function realpath($pFilename) + { + // Returnvalue + $returnValue = ''; + + // Try using realpath() + if (file_exists($pFilename)) { + $returnValue = realpath($pFilename); + } + + // Found something? + if ($returnValue == '' || ($returnValue === null)) { + $pathArray = explode('/', $pFilename); + while (in_array('..', $pathArray) && $pathArray[0] != '..') { + $iMax = count($pathArray); + for ($i = 0; $i < $iMax; ++$i) { + if ($pathArray[$i] == '..' && $i > 0) { + unset($pathArray[$i], $pathArray[$i - 1]); + + break; + } + } + } + $returnValue = implode('/', $pathArray); + } + + // Return + return $returnValue; + } + + /** + * Get the systems temporary directory. + * + * @return string + */ + public static function sysGetTempDir() + { + if (self::$useUploadTempDirectory) { + // use upload-directory when defined to allow running on environments having very restricted + // open_basedir configs + if (ini_get('upload_tmp_dir') !== false) { + if ($temp = ini_get('upload_tmp_dir')) { + if (file_exists($temp)) { + return realpath($temp); + } + } + } + } + + return realpath(sys_get_temp_dir()); + } + + /** + * Assert that given path is an existing file and is readable, otherwise throw exception. + * + * @param string $filename + * + * @throws InvalidArgumentException + */ + public static function assertFile($filename) + { + if (!is_file($filename)) { + throw new InvalidArgumentException('File "' . $filename . '" does not exist.'); + } + + if (!is_readable($filename)) { + throw new InvalidArgumentException('Could not open "' . $filename . '" for reading.'); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php new file mode 100644 index 0000000..bee13e2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Font.php @@ -0,0 +1,762 @@ + [ + 1 => ['px' => 24, 'width' => 12.00000000], + 2 => ['px' => 24, 'width' => 12.00000000], + 3 => ['px' => 32, 'width' => 10.66406250], + 4 => ['px' => 32, 'width' => 10.66406250], + 5 => ['px' => 40, 'width' => 10.00000000], + 6 => ['px' => 48, 'width' => 9.59765625], + 7 => ['px' => 48, 'width' => 9.59765625], + 8 => ['px' => 56, 'width' => 9.33203125], + 9 => ['px' => 64, 'width' => 9.14062500], + 10 => ['px' => 64, 'width' => 9.14062500], + ], + 'Calibri' => [ + 1 => ['px' => 24, 'width' => 12.00000000], + 2 => ['px' => 24, 'width' => 12.00000000], + 3 => ['px' => 32, 'width' => 10.66406250], + 4 => ['px' => 32, 'width' => 10.66406250], + 5 => ['px' => 40, 'width' => 10.00000000], + 6 => ['px' => 48, 'width' => 9.59765625], + 7 => ['px' => 48, 'width' => 9.59765625], + 8 => ['px' => 56, 'width' => 9.33203125], + 9 => ['px' => 56, 'width' => 9.33203125], + 10 => ['px' => 64, 'width' => 9.14062500], + 11 => ['px' => 64, 'width' => 9.14062500], + ], + 'Verdana' => [ + 1 => ['px' => 24, 'width' => 12.00000000], + 2 => ['px' => 24, 'width' => 12.00000000], + 3 => ['px' => 32, 'width' => 10.66406250], + 4 => ['px' => 32, 'width' => 10.66406250], + 5 => ['px' => 40, 'width' => 10.00000000], + 6 => ['px' => 48, 'width' => 9.59765625], + 7 => ['px' => 48, 'width' => 9.59765625], + 8 => ['px' => 64, 'width' => 9.14062500], + 9 => ['px' => 72, 'width' => 9.00000000], + 10 => ['px' => 72, 'width' => 9.00000000], + ], + ]; + + /** + * Set autoSize method. + * + * @param string $pValue see self::AUTOSIZE_METHOD_* + * + * @return bool Success or failure + */ + public static function setAutoSizeMethod($pValue) + { + if (!in_array($pValue, self::$autoSizeMethods)) { + return false; + } + self::$autoSizeMethod = $pValue; + + return true; + } + + /** + * Get autoSize method. + * + * @return string + */ + public static function getAutoSizeMethod() + { + return self::$autoSizeMethod; + } + + /** + * Set the path to the folder containing .ttf files. There should be a trailing slash. + * Typical locations on variout some platforms: + *
    + *
  • C:/Windows/Fonts/
  • + *
  • /usr/share/fonts/truetype/
  • + *
  • ~/.fonts/
  • + *
. + * + * @param string $pValue + */ + public static function setTrueTypeFontPath($pValue) + { + self::$trueTypeFontPath = $pValue; + } + + /** + * Get the path to the folder containing .ttf files. + * + * @return string + */ + public static function getTrueTypeFontPath() + { + return self::$trueTypeFontPath; + } + + /** + * Calculate an (approximate) OpenXML column width, based on font size and text contained. + * + * @param \PhpOffice\PhpSpreadsheet\Style\Font $font Font object + * @param RichText|string $cellText Text to calculate width + * @param int $rotation Rotation angle + * @param null|\PhpOffice\PhpSpreadsheet\Style\Font $defaultFont Font object + * + * @return int Column width + */ + public static function calculateColumnWidth(\PhpOffice\PhpSpreadsheet\Style\Font $font, $cellText = '', $rotation = 0, \PhpOffice\PhpSpreadsheet\Style\Font $defaultFont = null) + { + // If it is rich text, use plain text + if ($cellText instanceof RichText) { + $cellText = $cellText->getPlainText(); + } + + // Special case if there are one or more newline characters ("\n") + if (strpos($cellText, "\n") !== false) { + $lineTexts = explode("\n", $cellText); + $lineWidths = []; + foreach ($lineTexts as $lineText) { + $lineWidths[] = self::calculateColumnWidth($font, $lineText, $rotation = 0, $defaultFont); + } + + return max($lineWidths); // width of longest line in cell + } + + // Try to get the exact text width in pixels + $approximate = self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX; + if (!$approximate) { + $columnWidthAdjust = ceil(self::getTextWidthPixelsExact('n', $font, 0) * 1.07); + + try { + // Width of text in pixels excl. padding + // and addition because Excel adds some padding, just use approx width of 'n' glyph + $columnWidth = self::getTextWidthPixelsExact($cellText, $font, $rotation) + $columnWidthAdjust; + } catch (PhpSpreadsheetException $e) { + $approximate = true; + } + } + + if ($approximate) { + $columnWidthAdjust = self::getTextWidthPixelsApprox('n', $font, 0); + // Width of text in pixels excl. padding, approximation + // and addition because Excel adds some padding, just use approx width of 'n' glyph + $columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation) + $columnWidthAdjust; + } + + // Convert from pixel width to column width + $columnWidth = Drawing::pixelsToCellDimension($columnWidth, $defaultFont); + + // Return + return round($columnWidth, 6); + } + + /** + * Get GD text width in pixels for a string of text in a certain font at a certain rotation angle. + * + * @param string $text + * @param \PhpOffice\PhpSpreadsheet\Style\Font + * @param int $rotation + * + * @throws PhpSpreadsheetException + * + * @return int + */ + public static function getTextWidthPixelsExact($text, \PhpOffice\PhpSpreadsheet\Style\Font $font, $rotation = 0) + { + if (!function_exists('imagettfbbox')) { + throw new PhpSpreadsheetException('GD library needs to be enabled'); + } + + // font size should really be supplied in pixels in GD2, + // but since GD2 seems to assume 72dpi, pixels and points are the same + $fontFile = self::getTrueTypeFontFileFromFont($font); + $textBox = imagettfbbox($font->getSize(), $rotation, $fontFile, $text); + + // Get corners positions + $lowerLeftCornerX = $textBox[0]; + $lowerRightCornerX = $textBox[2]; + $upperRightCornerX = $textBox[4]; + $upperLeftCornerX = $textBox[6]; + + // Consider the rotation when calculating the width + return max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX); + } + + /** + * Get approximate width in pixels for a string of text in a certain font at a certain rotation angle. + * + * @param string $columnText + * @param \PhpOffice\PhpSpreadsheet\Style\Font $font + * @param int $rotation + * + * @return int Text width in pixels (no padding added) + */ + public static function getTextWidthPixelsApprox($columnText, \PhpOffice\PhpSpreadsheet\Style\Font $font, $rotation = 0) + { + $fontName = $font->getName(); + $fontSize = $font->getSize(); + + // Calculate column width in pixels. We assume fixed glyph width. Result varies with font name and size. + switch ($fontName) { + case 'Calibri': + // value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font. + $columnWidth = (int) (8.26 * StringHelper::countCharacters($columnText)); + $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size + break; + case 'Arial': + // value 8 was set because of experience in different exports at Arial 10 font. + $columnWidth = (int) (8 * StringHelper::countCharacters($columnText)); + $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size + break; + case 'Verdana': + // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font. + $columnWidth = (int) (8 * StringHelper::countCharacters($columnText)); + $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size + break; + default: + // just assume Calibri + $columnWidth = (int) (8.26 * StringHelper::countCharacters($columnText)); + $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size + break; + } + + // Calculate approximate rotated column width + if ($rotation !== 0) { + if ($rotation == -165) { + // stacked text + $columnWidth = 4; // approximation + } else { + // rotated text + $columnWidth = $columnWidth * cos(deg2rad($rotation)) + + $fontSize * abs(sin(deg2rad($rotation))) / 5; // approximation + } + } + + // pixel width is an integer + return (int) $columnWidth; + } + + /** + * Calculate an (approximate) pixel size, based on a font points size. + * + * @param int $fontSizeInPoints Font size (in points) + * + * @return int Font size (in pixels) + */ + public static function fontSizeToPixels($fontSizeInPoints) + { + return (int) ((4 / 3) * $fontSizeInPoints); + } + + /** + * Calculate an (approximate) pixel size, based on inch size. + * + * @param int $sizeInInch Font size (in inch) + * + * @return int Size (in pixels) + */ + public static function inchSizeToPixels($sizeInInch) + { + return $sizeInInch * 96; + } + + /** + * Calculate an (approximate) pixel size, based on centimeter size. + * + * @param int $sizeInCm Font size (in centimeters) + * + * @return float Size (in pixels) + */ + public static function centimeterSizeToPixels($sizeInCm) + { + return $sizeInCm * 37.795275591; + } + + /** + * Returns the font path given the font. + * + * @param \PhpOffice\PhpSpreadsheet\Style\Font $font + * + * @return string Path to TrueType font file + */ + public static function getTrueTypeFontFileFromFont($font) + { + if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) { + throw new PhpSpreadsheetException('Valid directory to TrueType Font files not specified'); + } + + $name = $font->getName(); + $bold = $font->getBold(); + $italic = $font->getItalic(); + + // Check if we can map font to true type font file + switch ($name) { + case 'Arial': + $fontFile = ( + $bold ? ($italic ? self::ARIAL_BOLD_ITALIC : self::ARIAL_BOLD) + : ($italic ? self::ARIAL_ITALIC : self::ARIAL) + ); + + break; + case 'Calibri': + $fontFile = ( + $bold ? ($italic ? self::CALIBRI_BOLD_ITALIC : self::CALIBRI_BOLD) + : ($italic ? self::CALIBRI_ITALIC : self::CALIBRI) + ); + + break; + case 'Courier New': + $fontFile = ( + $bold ? ($italic ? self::COURIER_NEW_BOLD_ITALIC : self::COURIER_NEW_BOLD) + : ($italic ? self::COURIER_NEW_ITALIC : self::COURIER_NEW) + ); + + break; + case 'Comic Sans MS': + $fontFile = ( + $bold ? self::COMIC_SANS_MS_BOLD : self::COMIC_SANS_MS + ); + + break; + case 'Georgia': + $fontFile = ( + $bold ? ($italic ? self::GEORGIA_BOLD_ITALIC : self::GEORGIA_BOLD) + : ($italic ? self::GEORGIA_ITALIC : self::GEORGIA) + ); + + break; + case 'Impact': + $fontFile = self::IMPACT; + + break; + case 'Liberation Sans': + $fontFile = ( + $bold ? ($italic ? self::LIBERATION_SANS_BOLD_ITALIC : self::LIBERATION_SANS_BOLD) + : ($italic ? self::LIBERATION_SANS_ITALIC : self::LIBERATION_SANS) + ); + + break; + case 'Lucida Console': + $fontFile = self::LUCIDA_CONSOLE; + + break; + case 'Lucida Sans Unicode': + $fontFile = self::LUCIDA_SANS_UNICODE; + + break; + case 'Microsoft Sans Serif': + $fontFile = self::MICROSOFT_SANS_SERIF; + + break; + case 'Palatino Linotype': + $fontFile = ( + $bold ? ($italic ? self::PALATINO_LINOTYPE_BOLD_ITALIC : self::PALATINO_LINOTYPE_BOLD) + : ($italic ? self::PALATINO_LINOTYPE_ITALIC : self::PALATINO_LINOTYPE) + ); + + break; + case 'Symbol': + $fontFile = self::SYMBOL; + + break; + case 'Tahoma': + $fontFile = ( + $bold ? self::TAHOMA_BOLD : self::TAHOMA + ); + + break; + case 'Times New Roman': + $fontFile = ( + $bold ? ($italic ? self::TIMES_NEW_ROMAN_BOLD_ITALIC : self::TIMES_NEW_ROMAN_BOLD) + : ($italic ? self::TIMES_NEW_ROMAN_ITALIC : self::TIMES_NEW_ROMAN) + ); + + break; + case 'Trebuchet MS': + $fontFile = ( + $bold ? ($italic ? self::TREBUCHET_MS_BOLD_ITALIC : self::TREBUCHET_MS_BOLD) + : ($italic ? self::TREBUCHET_MS_ITALIC : self::TREBUCHET_MS) + ); + + break; + case 'Verdana': + $fontFile = ( + $bold ? ($italic ? self::VERDANA_BOLD_ITALIC : self::VERDANA_BOLD) + : ($italic ? self::VERDANA_ITALIC : self::VERDANA) + ); + + break; + default: + throw new PhpSpreadsheetException('Unknown font name "' . $name . '". Cannot map to TrueType font file'); + + break; + } + + $fontFile = self::$trueTypeFontPath . $fontFile; + + // Check if file actually exists + if (!file_exists($fontFile)) { + throw new PhpSpreadsheetException('TrueType Font file not found'); + } + + return $fontFile; + } + + /** + * Returns the associated charset for the font name. + * + * @param string $name Font name + * + * @return int Character set code + */ + public static function getCharsetFromFontName($name) + { + switch ($name) { + // Add more cases. Check FONT records in real Excel files. + case 'EucrosiaUPC': + return self::CHARSET_ANSI_THAI; + case 'Wingdings': + return self::CHARSET_SYMBOL; + case 'Wingdings 2': + return self::CHARSET_SYMBOL; + case 'Wingdings 3': + return self::CHARSET_SYMBOL; + default: + return self::CHARSET_ANSI_LATIN; + } + } + + /** + * Get the effective column width for columns without a column dimension or column with width -1 + * For example, for Calibri 11 this is 9.140625 (64 px). + * + * @param \PhpOffice\PhpSpreadsheet\Style\Font $font The workbooks default font + * @param bool $pPixels true = return column width in pixels, false = return in OOXML units + * + * @return mixed Column width + */ + public static function getDefaultColumnWidthByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font, $pPixels = false) + { + if (isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) { + // Exact width can be determined + $columnWidth = $pPixels ? + self::$defaultColumnWidths[$font->getName()][$font->getSize()]['px'] + : self::$defaultColumnWidths[$font->getName()][$font->getSize()]['width']; + } else { + // We don't have data for this particular font and size, use approximation by + // extrapolating from Calibri 11 + $columnWidth = $pPixels ? + self::$defaultColumnWidths['Calibri'][11]['px'] + : self::$defaultColumnWidths['Calibri'][11]['width']; + $columnWidth = $columnWidth * $font->getSize() / 11; + + // Round pixels to closest integer + if ($pPixels) { + $columnWidth = (int) round($columnWidth); + } + } + + return $columnWidth; + } + + /** + * Get the effective row height for rows without a row dimension or rows with height -1 + * For example, for Calibri 11 this is 15 points. + * + * @param \PhpOffice\PhpSpreadsheet\Style\Font $font The workbooks default font + * + * @return float Row height in points + */ + public static function getDefaultRowHeightByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font) + { + switch ($font->getName()) { + case 'Arial': + switch ($font->getSize()) { + case 10: + // inspection of Arial 10 workbook says 12.75pt ~17px + $rowHeight = 12.75; + + break; + case 9: + // inspection of Arial 9 workbook says 12.00pt ~16px + $rowHeight = 12; + + break; + case 8: + // inspection of Arial 8 workbook says 11.25pt ~15px + $rowHeight = 11.25; + + break; + case 7: + // inspection of Arial 7 workbook says 9.00pt ~12px + $rowHeight = 9; + + break; + case 6: + case 5: + // inspection of Arial 5,6 workbook says 8.25pt ~11px + $rowHeight = 8.25; + + break; + case 4: + // inspection of Arial 4 workbook says 6.75pt ~9px + $rowHeight = 6.75; + + break; + case 3: + // inspection of Arial 3 workbook says 6.00pt ~8px + $rowHeight = 6; + + break; + case 2: + case 1: + // inspection of Arial 1,2 workbook says 5.25pt ~7px + $rowHeight = 5.25; + + break; + default: + // use Arial 10 workbook as an approximation, extrapolation + $rowHeight = 12.75 * $font->getSize() / 10; + + break; + } + + break; + case 'Calibri': + switch ($font->getSize()) { + case 11: + // inspection of Calibri 11 workbook says 15.00pt ~20px + $rowHeight = 15; + + break; + case 10: + // inspection of Calibri 10 workbook says 12.75pt ~17px + $rowHeight = 12.75; + + break; + case 9: + // inspection of Calibri 9 workbook says 12.00pt ~16px + $rowHeight = 12; + + break; + case 8: + // inspection of Calibri 8 workbook says 11.25pt ~15px + $rowHeight = 11.25; + + break; + case 7: + // inspection of Calibri 7 workbook says 9.00pt ~12px + $rowHeight = 9; + + break; + case 6: + case 5: + // inspection of Calibri 5,6 workbook says 8.25pt ~11px + $rowHeight = 8.25; + + break; + case 4: + // inspection of Calibri 4 workbook says 6.75pt ~9px + $rowHeight = 6.75; + + break; + case 3: + // inspection of Calibri 3 workbook says 6.00pt ~8px + $rowHeight = 6.00; + + break; + case 2: + case 1: + // inspection of Calibri 1,2 workbook says 5.25pt ~7px + $rowHeight = 5.25; + + break; + default: + // use Calibri 11 workbook as an approximation, extrapolation + $rowHeight = 15 * $font->getSize() / 11; + + break; + } + + break; + case 'Verdana': + switch ($font->getSize()) { + case 10: + // inspection of Verdana 10 workbook says 12.75pt ~17px + $rowHeight = 12.75; + + break; + case 9: + // inspection of Verdana 9 workbook says 11.25pt ~15px + $rowHeight = 11.25; + + break; + case 8: + // inspection of Verdana 8 workbook says 10.50pt ~14px + $rowHeight = 10.50; + + break; + case 7: + // inspection of Verdana 7 workbook says 9.00pt ~12px + $rowHeight = 9.00; + + break; + case 6: + case 5: + // inspection of Verdana 5,6 workbook says 8.25pt ~11px + $rowHeight = 8.25; + + break; + case 4: + // inspection of Verdana 4 workbook says 6.75pt ~9px + $rowHeight = 6.75; + + break; + case 3: + // inspection of Verdana 3 workbook says 6.00pt ~8px + $rowHeight = 6; + + break; + case 2: + case 1: + // inspection of Verdana 1,2 workbook says 5.25pt ~7px + $rowHeight = 5.25; + + break; + default: + // use Verdana 10 workbook as an approximation, extrapolation + $rowHeight = 12.75 * $font->getSize() / 10; + + break; + } + + break; + default: + // just use Calibri as an approximation + $rowHeight = 15 * $font->getSize() / 11; + + break; + } + + return $rowHeight; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CHANGELOG.TXT b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CHANGELOG.TXT new file mode 100644 index 0000000..1c18a5d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CHANGELOG.TXT @@ -0,0 +1,16 @@ +Mar 1, 2005 11:15 AST by PM + ++ For consistency, renamed Math.php to Maths.java, utils to util, + tests to test, docs to doc - + ++ Removed conditional logic from top of Matrix class. + ++ Switched to using hypo function in Maths.php for all php-hypot calls. + NOTE TO SELF: Need to make sure that all decompositions have been + switched over to using the bundled hypo. + +Feb 25, 2005 at 10:00 AST by PM + ++ Recommend using simpler Error.php instead of JAMA_Error.php but + can be persuaded otherwise. + diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php new file mode 100644 index 0000000..2b241d5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php @@ -0,0 +1,147 @@ +L = $A->getArray(); + $this->m = $A->getRowDimension(); + + for ($i = 0; $i < $this->m; ++$i) { + for ($j = $i; $j < $this->m; ++$j) { + for ($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) { + $sum -= $this->L[$i][$k] * $this->L[$j][$k]; + } + if ($i == $j) { + if ($sum >= 0) { + $this->L[$i][$i] = sqrt($sum); + } else { + $this->isspd = false; + } + } else { + if ($this->L[$i][$i] != 0) { + $this->L[$j][$i] = $sum / $this->L[$i][$i]; + } + } + } + + for ($k = $i + 1; $k < $this->m; ++$k) { + $this->L[$i][$k] = 0.0; + } + } + } + + /** + * Is the matrix symmetric and positive definite? + * + * @return bool + */ + public function isSPD() + { + return $this->isspd; + } + + /** + * getL. + * + * Return triangular factor. + * + * @return Matrix Lower triangular matrix + */ + public function getL() + { + return new Matrix($this->L); + } + + /** + * Solve A*X = B. + * + * @param $B Row-equal matrix + * + * @return Matrix L * L' * X = B + */ + public function solve(Matrix $B) + { + if ($B->getRowDimension() == $this->m) { + if ($this->isspd) { + $X = $B->getArrayCopy(); + $nx = $B->getColumnDimension(); + + for ($k = 0; $k < $this->m; ++$k) { + for ($i = $k + 1; $i < $this->m; ++$i) { + for ($j = 0; $j < $nx; ++$j) { + $X[$i][$j] -= $X[$k][$j] * $this->L[$i][$k]; + } + } + for ($j = 0; $j < $nx; ++$j) { + $X[$k][$j] /= $this->L[$k][$k]; + } + } + + for ($k = $this->m - 1; $k >= 0; --$k) { + for ($j = 0; $j < $nx; ++$j) { + $X[$k][$j] /= $this->L[$k][$k]; + } + for ($i = 0; $i < $k; ++$i) { + for ($j = 0; $j < $nx; ++$j) { + $X[$i][$j] -= $X[$k][$j] * $this->L[$k][$i]; + } + } + } + + return new Matrix($X, $this->m, $nx); + } + + throw new CalculationException(Matrix::MATRIX_SPD_EXCEPTION); + } + + throw new CalculationException(Matrix::MATRIX_DIMENSION_EXCEPTION); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php new file mode 100644 index 0000000..ba59e0e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php @@ -0,0 +1,861 @@ +d = $this->V[$this->n - 1]; + // Householder reduction to tridiagonal form. + for ($i = $this->n - 1; $i > 0; --$i) { + $i_ = $i - 1; + // Scale to avoid under/overflow. + $h = $scale = 0.0; + $scale += array_sum(array_map('abs', $this->d)); + if ($scale == 0.0) { + $this->e[$i] = $this->d[$i_]; + $this->d = array_slice($this->V[$i_], 0, $i_); + for ($j = 0; $j < $i; ++$j) { + $this->V[$j][$i] = $this->V[$i][$j] = 0.0; + } + } else { + // Generate Householder vector. + for ($k = 0; $k < $i; ++$k) { + $this->d[$k] /= $scale; + $h += pow($this->d[$k], 2); + } + $f = $this->d[$i_]; + $g = sqrt($h); + if ($f > 0) { + $g = -$g; + } + $this->e[$i] = $scale * $g; + $h = $h - $f * $g; + $this->d[$i_] = $f - $g; + for ($j = 0; $j < $i; ++$j) { + $this->e[$j] = 0.0; + } + // Apply similarity transformation to remaining columns. + for ($j = 0; $j < $i; ++$j) { + $f = $this->d[$j]; + $this->V[$j][$i] = $f; + $g = $this->e[$j] + $this->V[$j][$j] * $f; + for ($k = $j + 1; $k <= $i_; ++$k) { + $g += $this->V[$k][$j] * $this->d[$k]; + $this->e[$k] += $this->V[$k][$j] * $f; + } + $this->e[$j] = $g; + } + $f = 0.0; + for ($j = 0; $j < $i; ++$j) { + $this->e[$j] /= $h; + $f += $this->e[$j] * $this->d[$j]; + } + $hh = $f / (2 * $h); + for ($j = 0; $j < $i; ++$j) { + $this->e[$j] -= $hh * $this->d[$j]; + } + for ($j = 0; $j < $i; ++$j) { + $f = $this->d[$j]; + $g = $this->e[$j]; + for ($k = $j; $k <= $i_; ++$k) { + $this->V[$k][$j] -= ($f * $this->e[$k] + $g * $this->d[$k]); + } + $this->d[$j] = $this->V[$i - 1][$j]; + $this->V[$i][$j] = 0.0; + } + } + $this->d[$i] = $h; + } + + // Accumulate transformations. + for ($i = 0; $i < $this->n - 1; ++$i) { + $this->V[$this->n - 1][$i] = $this->V[$i][$i]; + $this->V[$i][$i] = 1.0; + $h = $this->d[$i + 1]; + if ($h != 0.0) { + for ($k = 0; $k <= $i; ++$k) { + $this->d[$k] = $this->V[$k][$i + 1] / $h; + } + for ($j = 0; $j <= $i; ++$j) { + $g = 0.0; + for ($k = 0; $k <= $i; ++$k) { + $g += $this->V[$k][$i + 1] * $this->V[$k][$j]; + } + for ($k = 0; $k <= $i; ++$k) { + $this->V[$k][$j] -= $g * $this->d[$k]; + } + } + } + for ($k = 0; $k <= $i; ++$k) { + $this->V[$k][$i + 1] = 0.0; + } + } + + $this->d = $this->V[$this->n - 1]; + $this->V[$this->n - 1] = array_fill(0, $j, 0.0); + $this->V[$this->n - 1][$this->n - 1] = 1.0; + $this->e[0] = 0.0; + } + + /** + * Symmetric tridiagonal QL algorithm. + * + * This is derived from the Algol procedures tql2, by + * Bowdler, Martin, Reinsch, and Wilkinson, Handbook for + * Auto. Comp., Vol.ii-Linear Algebra, and the corresponding + * Fortran subroutine in EISPACK. + */ + private function tql2() + { + for ($i = 1; $i < $this->n; ++$i) { + $this->e[$i - 1] = $this->e[$i]; + } + $this->e[$this->n - 1] = 0.0; + $f = 0.0; + $tst1 = 0.0; + $eps = pow(2.0, -52.0); + + for ($l = 0; $l < $this->n; ++$l) { + // Find small subdiagonal element + $tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l])); + $m = $l; + while ($m < $this->n) { + if (abs($this->e[$m]) <= $eps * $tst1) { + break; + } + ++$m; + } + // If m == l, $this->d[l] is an eigenvalue, + // otherwise, iterate. + if ($m > $l) { + $iter = 0; + do { + // Could check iteration count here. + $iter += 1; + // Compute implicit shift + $g = $this->d[$l]; + $p = ($this->d[$l + 1] - $g) / (2.0 * $this->e[$l]); + $r = hypo($p, 1.0); + if ($p < 0) { + $r *= -1; + } + $this->d[$l] = $this->e[$l] / ($p + $r); + $this->d[$l + 1] = $this->e[$l] * ($p + $r); + $dl1 = $this->d[$l + 1]; + $h = $g - $this->d[$l]; + for ($i = $l + 2; $i < $this->n; ++$i) { + $this->d[$i] -= $h; + } + $f += $h; + // Implicit QL transformation. + $p = $this->d[$m]; + $c = 1.0; + $c2 = $c3 = $c; + $el1 = $this->e[$l + 1]; + $s = $s2 = 0.0; + for ($i = $m - 1; $i >= $l; --$i) { + $c3 = $c2; + $c2 = $c; + $s2 = $s; + $g = $c * $this->e[$i]; + $h = $c * $p; + $r = hypo($p, $this->e[$i]); + $this->e[$i + 1] = $s * $r; + $s = $this->e[$i] / $r; + $c = $p / $r; + $p = $c * $this->d[$i] - $s * $g; + $this->d[$i + 1] = $h + $s * ($c * $g + $s * $this->d[$i]); + // Accumulate transformation. + for ($k = 0; $k < $this->n; ++$k) { + $h = $this->V[$k][$i + 1]; + $this->V[$k][$i + 1] = $s * $this->V[$k][$i] + $c * $h; + $this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h; + } + } + $p = -$s * $s2 * $c3 * $el1 * $this->e[$l] / $dl1; + $this->e[$l] = $s * $p; + $this->d[$l] = $c * $p; + // Check for convergence. + } while (abs($this->e[$l]) > $eps * $tst1); + } + $this->d[$l] = $this->d[$l] + $f; + $this->e[$l] = 0.0; + } + + // Sort eigenvalues and corresponding vectors. + for ($i = 0; $i < $this->n - 1; ++$i) { + $k = $i; + $p = $this->d[$i]; + for ($j = $i + 1; $j < $this->n; ++$j) { + if ($this->d[$j] < $p) { + $k = $j; + $p = $this->d[$j]; + } + } + if ($k != $i) { + $this->d[$k] = $this->d[$i]; + $this->d[$i] = $p; + for ($j = 0; $j < $this->n; ++$j) { + $p = $this->V[$j][$i]; + $this->V[$j][$i] = $this->V[$j][$k]; + $this->V[$j][$k] = $p; + } + } + } + } + + /** + * Nonsymmetric reduction to Hessenberg form. + * + * This is derived from the Algol procedures orthes and ortran, + * by Martin and Wilkinson, Handbook for Auto. Comp., + * Vol.ii-Linear Algebra, and the corresponding + * Fortran subroutines in EISPACK. + */ + private function orthes() + { + $low = 0; + $high = $this->n - 1; + + for ($m = $low + 1; $m <= $high - 1; ++$m) { + // Scale column. + $scale = 0.0; + for ($i = $m; $i <= $high; ++$i) { + $scale = $scale + abs($this->H[$i][$m - 1]); + } + if ($scale != 0.0) { + // Compute Householder transformation. + $h = 0.0; + for ($i = $high; $i >= $m; --$i) { + $this->ort[$i] = $this->H[$i][$m - 1] / $scale; + $h += $this->ort[$i] * $this->ort[$i]; + } + $g = sqrt($h); + if ($this->ort[$m] > 0) { + $g *= -1; + } + $h -= $this->ort[$m] * $g; + $this->ort[$m] -= $g; + // Apply Householder similarity transformation + // H = (I -u * u' / h) * H * (I -u * u') / h) + for ($j = $m; $j < $this->n; ++$j) { + $f = 0.0; + for ($i = $high; $i >= $m; --$i) { + $f += $this->ort[$i] * $this->H[$i][$j]; + } + $f /= $h; + for ($i = $m; $i <= $high; ++$i) { + $this->H[$i][$j] -= $f * $this->ort[$i]; + } + } + for ($i = 0; $i <= $high; ++$i) { + $f = 0.0; + for ($j = $high; $j >= $m; --$j) { + $f += $this->ort[$j] * $this->H[$i][$j]; + } + $f = $f / $h; + for ($j = $m; $j <= $high; ++$j) { + $this->H[$i][$j] -= $f * $this->ort[$j]; + } + } + $this->ort[$m] = $scale * $this->ort[$m]; + $this->H[$m][$m - 1] = $scale * $g; + } + } + + // Accumulate transformations (Algol's ortran). + for ($i = 0; $i < $this->n; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $this->V[$i][$j] = ($i == $j ? 1.0 : 0.0); + } + } + for ($m = $high - 1; $m >= $low + 1; --$m) { + if ($this->H[$m][$m - 1] != 0.0) { + for ($i = $m + 1; $i <= $high; ++$i) { + $this->ort[$i] = $this->H[$i][$m - 1]; + } + for ($j = $m; $j <= $high; ++$j) { + $g = 0.0; + for ($i = $m; $i <= $high; ++$i) { + $g += $this->ort[$i] * $this->V[$i][$j]; + } + // Double division avoids possible underflow + $g = ($g / $this->ort[$m]) / $this->H[$m][$m - 1]; + for ($i = $m; $i <= $high; ++$i) { + $this->V[$i][$j] += $g * $this->ort[$i]; + } + } + } + } + } + + /** + * Performs complex division. + * + * @param mixed $xr + * @param mixed $xi + * @param mixed $yr + * @param mixed $yi + */ + private function cdiv($xr, $xi, $yr, $yi) + { + if (abs($yr) > abs($yi)) { + $r = $yi / $yr; + $d = $yr + $r * $yi; + $this->cdivr = ($xr + $r * $xi) / $d; + $this->cdivi = ($xi - $r * $xr) / $d; + } else { + $r = $yr / $yi; + $d = $yi + $r * $yr; + $this->cdivr = ($r * $xr + $xi) / $d; + $this->cdivi = ($r * $xi - $xr) / $d; + } + } + + /** + * Nonsymmetric reduction from Hessenberg to real Schur form. + * + * Code is derived from the Algol procedure hqr2, + * by Martin and Wilkinson, Handbook for Auto. Comp., + * Vol.ii-Linear Algebra, and the corresponding + * Fortran subroutine in EISPACK. + */ + private function hqr2() + { + // Initialize + $nn = $this->n; + $n = $nn - 1; + $low = 0; + $high = $nn - 1; + $eps = pow(2.0, -52.0); + $exshift = 0.0; + $p = $q = $r = $s = $z = 0; + // Store roots isolated by balanc and compute matrix norm + $norm = 0.0; + + for ($i = 0; $i < $nn; ++$i) { + if (($i < $low) or ($i > $high)) { + $this->d[$i] = $this->H[$i][$i]; + $this->e[$i] = 0.0; + } + for ($j = max($i - 1, 0); $j < $nn; ++$j) { + $norm = $norm + abs($this->H[$i][$j]); + } + } + + // Outer loop over eigenvalue index + $iter = 0; + while ($n >= $low) { + // Look for single small sub-diagonal element + $l = $n; + while ($l > $low) { + $s = abs($this->H[$l - 1][$l - 1]) + abs($this->H[$l][$l]); + if ($s == 0.0) { + $s = $norm; + } + if (abs($this->H[$l][$l - 1]) < $eps * $s) { + break; + } + --$l; + } + // Check for convergence + // One root found + if ($l == $n) { + $this->H[$n][$n] = $this->H[$n][$n] + $exshift; + $this->d[$n] = $this->H[$n][$n]; + $this->e[$n] = 0.0; + --$n; + $iter = 0; + // Two roots found + } elseif ($l == $n - 1) { + $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n]; + $p = ($this->H[$n - 1][$n - 1] - $this->H[$n][$n]) / 2.0; + $q = $p * $p + $w; + $z = sqrt(abs($q)); + $this->H[$n][$n] = $this->H[$n][$n] + $exshift; + $this->H[$n - 1][$n - 1] = $this->H[$n - 1][$n - 1] + $exshift; + $x = $this->H[$n][$n]; + // Real pair + if ($q >= 0) { + if ($p >= 0) { + $z = $p + $z; + } else { + $z = $p - $z; + } + $this->d[$n - 1] = $x + $z; + $this->d[$n] = $this->d[$n - 1]; + if ($z != 0.0) { + $this->d[$n] = $x - $w / $z; + } + $this->e[$n - 1] = 0.0; + $this->e[$n] = 0.0; + $x = $this->H[$n][$n - 1]; + $s = abs($x) + abs($z); + $p = $x / $s; + $q = $z / $s; + $r = sqrt($p * $p + $q * $q); + $p = $p / $r; + $q = $q / $r; + // Row modification + for ($j = $n - 1; $j < $nn; ++$j) { + $z = $this->H[$n - 1][$j]; + $this->H[$n - 1][$j] = $q * $z + $p * $this->H[$n][$j]; + $this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z; + } + // Column modification + for ($i = 0; $i <= $n; ++$i) { + $z = $this->H[$i][$n - 1]; + $this->H[$i][$n - 1] = $q * $z + $p * $this->H[$i][$n]; + $this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z; + } + // Accumulate transformations + for ($i = $low; $i <= $high; ++$i) { + $z = $this->V[$i][$n - 1]; + $this->V[$i][$n - 1] = $q * $z + $p * $this->V[$i][$n]; + $this->V[$i][$n] = $q * $this->V[$i][$n] - $p * $z; + } + // Complex pair + } else { + $this->d[$n - 1] = $x + $p; + $this->d[$n] = $x + $p; + $this->e[$n - 1] = $z; + $this->e[$n] = -$z; + } + $n = $n - 2; + $iter = 0; + // No convergence yet + } else { + // Form shift + $x = $this->H[$n][$n]; + $y = 0.0; + $w = 0.0; + if ($l < $n) { + $y = $this->H[$n - 1][$n - 1]; + $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n]; + } + // Wilkinson's original ad hoc shift + if ($iter == 10) { + $exshift += $x; + for ($i = $low; $i <= $n; ++$i) { + $this->H[$i][$i] -= $x; + } + $s = abs($this->H[$n][$n - 1]) + abs($this->H[$n - 1][$n - 2]); + $x = $y = 0.75 * $s; + $w = -0.4375 * $s * $s; + } + // MATLAB's new ad hoc shift + if ($iter == 30) { + $s = ($y - $x) / 2.0; + $s = $s * $s + $w; + if ($s > 0) { + $s = sqrt($s); + if ($y < $x) { + $s = -$s; + } + $s = $x - $w / (($y - $x) / 2.0 + $s); + for ($i = $low; $i <= $n; ++$i) { + $this->H[$i][$i] -= $s; + } + $exshift += $s; + $x = $y = $w = 0.964; + } + } + // Could check iteration count here. + $iter = $iter + 1; + // Look for two consecutive small sub-diagonal elements + $m = $n - 2; + while ($m >= $l) { + $z = $this->H[$m][$m]; + $r = $x - $z; + $s = $y - $z; + $p = ($r * $s - $w) / $this->H[$m + 1][$m] + $this->H[$m][$m + 1]; + $q = $this->H[$m + 1][$m + 1] - $z - $r - $s; + $r = $this->H[$m + 2][$m + 1]; + $s = abs($p) + abs($q) + abs($r); + $p = $p / $s; + $q = $q / $s; + $r = $r / $s; + if ($m == $l) { + break; + } + if (abs($this->H[$m][$m - 1]) * (abs($q) + abs($r)) < + $eps * (abs($p) * (abs($this->H[$m - 1][$m - 1]) + abs($z) + abs($this->H[$m + 1][$m + 1])))) { + break; + } + --$m; + } + for ($i = $m + 2; $i <= $n; ++$i) { + $this->H[$i][$i - 2] = 0.0; + if ($i > $m + 2) { + $this->H[$i][$i - 3] = 0.0; + } + } + // Double QR step involving rows l:n and columns m:n + for ($k = $m; $k <= $n - 1; ++$k) { + $notlast = ($k != $n - 1); + if ($k != $m) { + $p = $this->H[$k][$k - 1]; + $q = $this->H[$k + 1][$k - 1]; + $r = ($notlast ? $this->H[$k + 2][$k - 1] : 0.0); + $x = abs($p) + abs($q) + abs($r); + if ($x != 0.0) { + $p = $p / $x; + $q = $q / $x; + $r = $r / $x; + } + } + if ($x == 0.0) { + break; + } + $s = sqrt($p * $p + $q * $q + $r * $r); + if ($p < 0) { + $s = -$s; + } + if ($s != 0) { + if ($k != $m) { + $this->H[$k][$k - 1] = -$s * $x; + } elseif ($l != $m) { + $this->H[$k][$k - 1] = -$this->H[$k][$k - 1]; + } + $p = $p + $s; + $x = $p / $s; + $y = $q / $s; + $z = $r / $s; + $q = $q / $p; + $r = $r / $p; + // Row modification + for ($j = $k; $j < $nn; ++$j) { + $p = $this->H[$k][$j] + $q * $this->H[$k + 1][$j]; + if ($notlast) { + $p = $p + $r * $this->H[$k + 2][$j]; + $this->H[$k + 2][$j] = $this->H[$k + 2][$j] - $p * $z; + } + $this->H[$k][$j] = $this->H[$k][$j] - $p * $x; + $this->H[$k + 1][$j] = $this->H[$k + 1][$j] - $p * $y; + } + // Column modification + $iMax = min($n, $k + 3); + for ($i = 0; $i <= $iMax; ++$i) { + $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k + 1]; + if ($notlast) { + $p = $p + $z * $this->H[$i][$k + 2]; + $this->H[$i][$k + 2] = $this->H[$i][$k + 2] - $p * $r; + } + $this->H[$i][$k] = $this->H[$i][$k] - $p; + $this->H[$i][$k + 1] = $this->H[$i][$k + 1] - $p * $q; + } + // Accumulate transformations + for ($i = $low; $i <= $high; ++$i) { + $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k + 1]; + if ($notlast) { + $p = $p + $z * $this->V[$i][$k + 2]; + $this->V[$i][$k + 2] = $this->V[$i][$k + 2] - $p * $r; + } + $this->V[$i][$k] = $this->V[$i][$k] - $p; + $this->V[$i][$k + 1] = $this->V[$i][$k + 1] - $p * $q; + } + } // ($s != 0) + } // k loop + } // check convergence + } // while ($n >= $low) + + // Backsubstitute to find vectors of upper triangular form + if ($norm == 0.0) { + return; + } + + for ($n = $nn - 1; $n >= 0; --$n) { + $p = $this->d[$n]; + $q = $this->e[$n]; + // Real vector + if ($q == 0) { + $l = $n; + $this->H[$n][$n] = 1.0; + for ($i = $n - 1; $i >= 0; --$i) { + $w = $this->H[$i][$i] - $p; + $r = 0.0; + for ($j = $l; $j <= $n; ++$j) { + $r = $r + $this->H[$i][$j] * $this->H[$j][$n]; + } + if ($this->e[$i] < 0.0) { + $z = $w; + $s = $r; + } else { + $l = $i; + if ($this->e[$i] == 0.0) { + if ($w != 0.0) { + $this->H[$i][$n] = -$r / $w; + } else { + $this->H[$i][$n] = -$r / ($eps * $norm); + } + // Solve real equations + } else { + $x = $this->H[$i][$i + 1]; + $y = $this->H[$i + 1][$i]; + $q = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i]; + $t = ($x * $s - $z * $r) / $q; + $this->H[$i][$n] = $t; + if (abs($x) > abs($z)) { + $this->H[$i + 1][$n] = (-$r - $w * $t) / $x; + } else { + $this->H[$i + 1][$n] = (-$s - $y * $t) / $z; + } + } + // Overflow control + $t = abs($this->H[$i][$n]); + if (($eps * $t) * $t > 1) { + for ($j = $i; $j <= $n; ++$j) { + $this->H[$j][$n] = $this->H[$j][$n] / $t; + } + } + } + } + // Complex vector + } elseif ($q < 0) { + $l = $n - 1; + // Last vector component imaginary so matrix is triangular + if (abs($this->H[$n][$n - 1]) > abs($this->H[$n - 1][$n])) { + $this->H[$n - 1][$n - 1] = $q / $this->H[$n][$n - 1]; + $this->H[$n - 1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n - 1]; + } else { + $this->cdiv(0.0, -$this->H[$n - 1][$n], $this->H[$n - 1][$n - 1] - $p, $q); + $this->H[$n - 1][$n - 1] = $this->cdivr; + $this->H[$n - 1][$n] = $this->cdivi; + } + $this->H[$n][$n - 1] = 0.0; + $this->H[$n][$n] = 1.0; + for ($i = $n - 2; $i >= 0; --$i) { + // double ra,sa,vr,vi; + $ra = 0.0; + $sa = 0.0; + for ($j = $l; $j <= $n; ++$j) { + $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n - 1]; + $sa = $sa + $this->H[$i][$j] * $this->H[$j][$n]; + } + $w = $this->H[$i][$i] - $p; + if ($this->e[$i] < 0.0) { + $z = $w; + $r = $ra; + $s = $sa; + } else { + $l = $i; + if ($this->e[$i] == 0) { + $this->cdiv(-$ra, -$sa, $w, $q); + $this->H[$i][$n - 1] = $this->cdivr; + $this->H[$i][$n] = $this->cdivi; + } else { + // Solve complex equations + $x = $this->H[$i][$i + 1]; + $y = $this->H[$i + 1][$i]; + $vr = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i] - $q * $q; + $vi = ($this->d[$i] - $p) * 2.0 * $q; + if ($vr == 0.0 & $vi == 0.0) { + $vr = $eps * $norm * (abs($w) + abs($q) + abs($x) + abs($y) + abs($z)); + } + $this->cdiv($x * $r - $z * $ra + $q * $sa, $x * $s - $z * $sa - $q * $ra, $vr, $vi); + $this->H[$i][$n - 1] = $this->cdivr; + $this->H[$i][$n] = $this->cdivi; + if (abs($x) > (abs($z) + abs($q))) { + $this->H[$i + 1][$n - 1] = (-$ra - $w * $this->H[$i][$n - 1] + $q * $this->H[$i][$n]) / $x; + $this->H[$i + 1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n - 1]) / $x; + } else { + $this->cdiv(-$r - $y * $this->H[$i][$n - 1], -$s - $y * $this->H[$i][$n], $z, $q); + $this->H[$i + 1][$n - 1] = $this->cdivr; + $this->H[$i + 1][$n] = $this->cdivi; + } + } + // Overflow control + $t = max(abs($this->H[$i][$n - 1]), abs($this->H[$i][$n])); + if (($eps * $t) * $t > 1) { + for ($j = $i; $j <= $n; ++$j) { + $this->H[$j][$n - 1] = $this->H[$j][$n - 1] / $t; + $this->H[$j][$n] = $this->H[$j][$n] / $t; + } + } + } // end else + } // end for + } // end else for complex case + } // end for + + // Vectors of isolated roots + for ($i = 0; $i < $nn; ++$i) { + if ($i < $low | $i > $high) { + for ($j = $i; $j < $nn; ++$j) { + $this->V[$i][$j] = $this->H[$i][$j]; + } + } + } + + // Back transformation to get eigenvectors of original matrix + for ($j = $nn - 1; $j >= $low; --$j) { + for ($i = $low; $i <= $high; ++$i) { + $z = 0.0; + $kMax = min($j, $high); + for ($k = $low; $k <= $kMax; ++$k) { + $z = $z + $this->V[$i][$k] * $this->H[$k][$j]; + } + $this->V[$i][$j] = $z; + } + } + } + + // end hqr2 + + /** + * Constructor: Check for symmetry, then construct the eigenvalue decomposition. + * + * @param mixed $Arg A Square matrix + */ + public function __construct($Arg) + { + $this->A = $Arg->getArray(); + $this->n = $Arg->getColumnDimension(); + + $issymmetric = true; + for ($j = 0; ($j < $this->n) & $issymmetric; ++$j) { + for ($i = 0; ($i < $this->n) & $issymmetric; ++$i) { + $issymmetric = ($this->A[$i][$j] == $this->A[$j][$i]); + } + } + + if ($issymmetric) { + $this->V = $this->A; + // Tridiagonalize. + $this->tred2(); + // Diagonalize. + $this->tql2(); + } else { + $this->H = $this->A; + $this->ort = []; + // Reduce to Hessenberg form. + $this->orthes(); + // Reduce Hessenberg to real Schur form. + $this->hqr2(); + } + } + + /** + * Return the eigenvector matrix. + * + * @return Matrix V + */ + public function getV() + { + return new Matrix($this->V, $this->n, $this->n); + } + + /** + * Return the real parts of the eigenvalues. + * + * @return array real(diag(D)) + */ + public function getRealEigenvalues() + { + return $this->d; + } + + /** + * Return the imaginary parts of the eigenvalues. + * + * @return array imag(diag(D)) + */ + public function getImagEigenvalues() + { + return $this->e; + } + + /** + * Return the block diagonal eigenvalue matrix. + * + * @return Matrix D + */ + public function getD() + { + for ($i = 0; $i < $this->n; ++$i) { + $D[$i] = array_fill(0, $this->n, 0.0); + $D[$i][$i] = $this->d[$i]; + if ($this->e[$i] == 0) { + continue; + } + $o = ($this->e[$i] > 0) ? $i + 1 : $i - 1; + $D[$i][$o] = $this->e[$i]; + } + + return new Matrix($D); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php new file mode 100644 index 0000000..bb2b4b0 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php @@ -0,0 +1,285 @@ += n, the LU decomposition is an m-by-n + * unit lower triangular matrix L, an n-by-n upper triangular matrix U, + * and a permutation vector piv of length m so that A(piv,:) = L*U. + * If m < n, then L is m-by-m and U is m-by-n. + * + * The LU decompostion with pivoting always exists, even if the matrix is + * singular, so the constructor will never fail. The primary use of the + * LU decomposition is in the solution of square systems of simultaneous + * linear equations. This will fail if isNonsingular() returns false. + * + * @author Paul Meagher + * @author Bartosz Matosiuk + * @author Michael Bommarito + * + * @version 1.1 + */ +class LUDecomposition +{ + const MATRIX_SINGULAR_EXCEPTION = 'Can only perform operation on singular matrix.'; + const MATRIX_SQUARE_EXCEPTION = 'Mismatched Row dimension'; + + /** + * Decomposition storage. + * + * @var array + */ + private $LU = []; + + /** + * Row dimension. + * + * @var int + */ + private $m; + + /** + * Column dimension. + * + * @var int + */ + private $n; + + /** + * Pivot sign. + * + * @var int + */ + private $pivsign; + + /** + * Internal storage of pivot vector. + * + * @var array + */ + private $piv = []; + + /** + * LU Decomposition constructor. + * + * @param Matrix $A Rectangular matrix + */ + public function __construct($A) + { + if ($A instanceof Matrix) { + // Use a "left-looking", dot-product, Crout/Doolittle algorithm. + $this->LU = $A->getArray(); + $this->m = $A->getRowDimension(); + $this->n = $A->getColumnDimension(); + for ($i = 0; $i < $this->m; ++$i) { + $this->piv[$i] = $i; + } + $this->pivsign = 1; + $LUrowi = $LUcolj = []; + + // Outer loop. + for ($j = 0; $j < $this->n; ++$j) { + // Make a copy of the j-th column to localize references. + for ($i = 0; $i < $this->m; ++$i) { + $LUcolj[$i] = &$this->LU[$i][$j]; + } + // Apply previous transformations. + for ($i = 0; $i < $this->m; ++$i) { + $LUrowi = $this->LU[$i]; + // Most of the time is spent in the following dot product. + $kmax = min($i, $j); + $s = 0.0; + for ($k = 0; $k < $kmax; ++$k) { + $s += $LUrowi[$k] * $LUcolj[$k]; + } + $LUrowi[$j] = $LUcolj[$i] -= $s; + } + // Find pivot and exchange if necessary. + $p = $j; + for ($i = $j + 1; $i < $this->m; ++$i) { + if (abs($LUcolj[$i]) > abs($LUcolj[$p])) { + $p = $i; + } + } + if ($p != $j) { + for ($k = 0; $k < $this->n; ++$k) { + $t = $this->LU[$p][$k]; + $this->LU[$p][$k] = $this->LU[$j][$k]; + $this->LU[$j][$k] = $t; + } + $k = $this->piv[$p]; + $this->piv[$p] = $this->piv[$j]; + $this->piv[$j] = $k; + $this->pivsign = $this->pivsign * -1; + } + // Compute multipliers. + if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) { + for ($i = $j + 1; $i < $this->m; ++$i) { + $this->LU[$i][$j] /= $this->LU[$j][$j]; + } + } + } + } else { + throw new CalculationException(Matrix::ARGUMENT_TYPE_EXCEPTION); + } + } + + // function __construct() + + /** + * Get lower triangular factor. + * + * @return Matrix Lower triangular factor + */ + public function getL() + { + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + if ($i > $j) { + $L[$i][$j] = $this->LU[$i][$j]; + } elseif ($i == $j) { + $L[$i][$j] = 1.0; + } else { + $L[$i][$j] = 0.0; + } + } + } + + return new Matrix($L); + } + + // function getL() + + /** + * Get upper triangular factor. + * + * @return Matrix Upper triangular factor + */ + public function getU() + { + for ($i = 0; $i < $this->n; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + if ($i <= $j) { + $U[$i][$j] = $this->LU[$i][$j]; + } else { + $U[$i][$j] = 0.0; + } + } + } + + return new Matrix($U); + } + + // function getU() + + /** + * Return pivot permutation vector. + * + * @return array Pivot vector + */ + public function getPivot() + { + return $this->piv; + } + + // function getPivot() + + /** + * Alias for getPivot. + * + * @see getPivot + */ + public function getDoublePivot() + { + return $this->getPivot(); + } + + // function getDoublePivot() + + /** + * Is the matrix nonsingular? + * + * @return bool true if U, and hence A, is nonsingular + */ + public function isNonsingular() + { + for ($j = 0; $j < $this->n; ++$j) { + if ($this->LU[$j][$j] == 0) { + return false; + } + } + + return true; + } + + // function isNonsingular() + + /** + * Count determinants. + * + * @return array d matrix deterninat + */ + public function det() + { + if ($this->m == $this->n) { + $d = $this->pivsign; + for ($j = 0; $j < $this->n; ++$j) { + $d *= $this->LU[$j][$j]; + } + + return $d; + } + + throw new CalculationException(Matrix::MATRIX_DIMENSION_EXCEPTION); + } + + // function det() + + /** + * Solve A*X = B. + * + * @param mixed $B a Matrix with as many rows as A and any number of columns + * + * @throws CalculationException illegalArgumentException Matrix row dimensions must agree + * @throws CalculationException runtimeException Matrix is singular + * + * @return Matrix X so that L*U*X = B(piv,:) + */ + public function solve($B) + { + if ($B->getRowDimension() == $this->m) { + if ($this->isNonsingular()) { + // Copy right hand side with pivoting + $nx = $B->getColumnDimension(); + $X = $B->getMatrix($this->piv, 0, $nx - 1); + // Solve L*Y = B(piv,:) + for ($k = 0; $k < $this->n; ++$k) { + for ($i = $k + 1; $i < $this->n; ++$i) { + for ($j = 0; $j < $nx; ++$j) { + $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k]; + } + } + } + // Solve U*X = Y; + for ($k = $this->n - 1; $k >= 0; --$k) { + for ($j = 0; $j < $nx; ++$j) { + $X->A[$k][$j] /= $this->LU[$k][$k]; + } + for ($i = 0; $i < $k; ++$i) { + for ($j = 0; $j < $nx; ++$j) { + $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k]; + } + } + } + + return $X; + } + + throw new CalculationException(self::MATRIX_SINGULAR_EXCEPTION); + } + + throw new CalculationException(self::MATRIX_SQUARE_EXCEPTION); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php new file mode 100644 index 0000000..a67b6c2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -0,0 +1,1233 @@ + 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + //Rectangular matrix - m x n initialized from 2D array + case 'array': + $this->m = count($args[0]); + $this->n = count($args[0][0]); + $this->A = $args[0]; + + break; + //Square matrix - n x n + case 'integer': + $this->m = $args[0]; + $this->n = $args[0]; + $this->A = array_fill(0, $this->m, array_fill(0, $this->n, 0)); + + break; + //Rectangular matrix - m x n + case 'integer,integer': + $this->m = $args[0]; + $this->n = $args[1]; + $this->A = array_fill(0, $this->m, array_fill(0, $this->n, 0)); + + break; + //Rectangular matrix - m x n initialized from packed array + case 'array,integer': + $this->m = $args[1]; + if ($this->m != 0) { + $this->n = count($args[0]) / $this->m; + } else { + $this->n = 0; + } + if (($this->m * $this->n) == count($args[0])) { + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $this->A[$i][$j] = $args[0][$i + $j * $this->m]; + } + } + } else { + throw new CalculationException(self::ARRAY_LENGTH_EXCEPTION); + } + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + } else { + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + } + + /** + * getArray. + * + * @return array Matrix array + */ + public function getArray() + { + return $this->A; + } + + /** + * getRowDimension. + * + * @return int Row dimension + */ + public function getRowDimension() + { + return $this->m; + } + + /** + * getColumnDimension. + * + * @return int Column dimension + */ + public function getColumnDimension() + { + return $this->n; + } + + /** + * get. + * + * Get the i,j-th element of the matrix. + * + * @param int $i Row position + * @param int $j Column position + * + * @return mixed Element (int/float/double) + */ + public function get($i = null, $j = null) + { + return $this->A[$i][$j]; + } + + /** + * getMatrix. + * + * Get a submatrix + * + * @param int $i0 Initial row index + * @param int $iF Final row index + * @param int $j0 Initial column index + * @param int $jF Final column index + * + * @return Matrix Submatrix + */ + public function getMatrix(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + //A($i0...; $j0...) + case 'integer,integer': + [$i0, $j0] = $args; + if ($i0 >= 0) { + $m = $this->m - $i0; + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + if ($j0 >= 0) { + $n = $this->n - $j0; + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + $R = new self($m, $n); + for ($i = $i0; $i < $this->m; ++$i) { + for ($j = $j0; $j < $this->n; ++$j) { + $R->set($i, $j, $this->A[$i][$j]); + } + } + + return $R; + + break; + //A($i0...$iF; $j0...$jF) + case 'integer,integer,integer,integer': + [$i0, $iF, $j0, $jF] = $args; + if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { + $m = $iF - $i0; + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { + $n = $jF - $j0; + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + $R = new self($m + 1, $n + 1); + for ($i = $i0; $i <= $iF; ++$i) { + for ($j = $j0; $j <= $jF; ++$j) { + $R->set($i - $i0, $j - $j0, $this->A[$i][$j]); + } + } + + return $R; + + break; + //$R = array of row indices; $C = array of column indices + case 'array,array': + [$RL, $CL] = $args; + if (count($RL) > 0) { + $m = count($RL); + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + if (count($CL) > 0) { + $n = count($CL); + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + $R = new self($m, $n); + for ($i = 0; $i < $m; ++$i) { + for ($j = 0; $j < $n; ++$j) { + $R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]); + } + } + + return $R; + + break; + //A($i0...$iF); $CL = array of column indices + case 'integer,integer,array': + [$i0, $iF, $CL] = $args; + if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { + $m = $iF - $i0; + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + if (count($CL) > 0) { + $n = count($CL); + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + $R = new self($m, $n); + for ($i = $i0; $i < $iF; ++$i) { + for ($j = 0; $j < $n; ++$j) { + $R->set($i - $i0, $j, $this->A[$i][$CL[$j]]); + } + } + + return $R; + + break; + //$RL = array of row indices + case 'array,integer,integer': + [$RL, $j0, $jF] = $args; + if (count($RL) > 0) { + $m = count($RL); + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { + $n = $jF - $j0; + } else { + throw new CalculationException(self::ARGUMENT_BOUNDS_EXCEPTION); + } + $R = new self($m, $n + 1); + for ($i = 0; $i < $m; ++$i) { + for ($j = $j0; $j <= $jF; ++$j) { + $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]); + } + } + + return $R; + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + } else { + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + } + + /** + * checkMatrixDimensions. + * + * Is matrix B the same size? + * + * @param Matrix $B Matrix B + * + * @return bool + */ + public function checkMatrixDimensions($B = null) + { + if ($B instanceof self) { + if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) { + return true; + } + + throw new CalculationException(self::MATRIX_DIMENSION_EXCEPTION); + } + + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + // function checkMatrixDimensions() + + /** + * set. + * + * Set the i,j-th element of the matrix. + * + * @param int $i Row position + * @param int $j Column position + * @param mixed $c Int/float/double value + * + * @return mixed Element (int/float/double) + */ + public function set($i = null, $j = null, $c = null) + { + // Optimized set version just has this + $this->A[$i][$j] = $c; + } + + // function set() + + /** + * identity. + * + * Generate an identity matrix. + * + * @param int $m Row dimension + * @param int $n Column dimension + * + * @return Matrix Identity matrix + */ + public function identity($m = null, $n = null) + { + return $this->diagonal($m, $n, 1); + } + + /** + * diagonal. + * + * Generate a diagonal matrix + * + * @param int $m Row dimension + * @param int $n Column dimension + * @param mixed $c Diagonal value + * + * @return Matrix Diagonal matrix + */ + public function diagonal($m = null, $n = null, $c = 1) + { + $R = new self($m, $n); + for ($i = 0; $i < $m; ++$i) { + $R->set($i, $i, $c); + } + + return $R; + } + + /** + * getMatrixByRow. + * + * Get a submatrix by row index/range + * + * @param int $i0 Initial row index + * @param int $iF Final row index + * + * @return Matrix Submatrix + */ + public function getMatrixByRow($i0 = null, $iF = null) + { + if (is_int($i0)) { + if (is_int($iF)) { + return $this->getMatrix($i0, 0, $iF + 1, $this->n); + } + + return $this->getMatrix($i0, 0, $i0 + 1, $this->n); + } + + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + /** + * getMatrixByCol. + * + * Get a submatrix by column index/range + * + * @param int $j0 Initial column index + * @param int $jF Final column index + * + * @return Matrix Submatrix + */ + public function getMatrixByCol($j0 = null, $jF = null) + { + if (is_int($j0)) { + if (is_int($jF)) { + return $this->getMatrix(0, $j0, $this->m, $jF + 1); + } + + return $this->getMatrix(0, $j0, $this->m, $j0 + 1); + } + + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + /** + * transpose. + * + * Tranpose matrix + * + * @return Matrix Transposed matrix + */ + public function transpose() + { + $R = new self($this->n, $this->m); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $R->set($j, $i, $this->A[$i][$j]); + } + } + + return $R; + } + + // function transpose() + + /** + * trace. + * + * Sum of diagonal elements + * + * @return float Sum of diagonal elements + */ + public function trace() + { + $s = 0; + $n = min($this->m, $this->n); + for ($i = 0; $i < $n; ++$i) { + $s += $this->A[$i][$i]; + } + + return $s; + } + + /** + * uminus. + * + * Unary minus matrix -A + * + * @return Matrix Unary minus matrix + */ + public function uminus() + { + } + + /** + * plus. + * + * A + B + * + * @param mixed $B Matrix/Array + * + * @return Matrix Sum + */ + public function plus(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]); + } + } + + return $M; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * plusEquals. + * + * A = A + B + * + * @param mixed $B Matrix/Array + * + * @return $this + */ + public function plusEquals(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $validValues = true; + $value = $M->get($i, $j); + if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { + $this->A[$i][$j] = trim($this->A[$i][$j], '"'); + $validValues &= StringHelper::convertToNumberIfFraction($this->A[$i][$j]); + } + if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { + $value = trim($value, '"'); + $validValues &= StringHelper::convertToNumberIfFraction($value); + } + if ($validValues) { + $this->A[$i][$j] += $value; + } else { + $this->A[$i][$j] = Functions::NAN(); + } + } + } + + return $this; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * minus. + * + * A - B + * + * @param mixed $B Matrix/Array + * + * @return Matrix Sum + */ + public function minus(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $M->set($i, $j, $M->get($i, $j) - $this->A[$i][$j]); + } + } + + return $M; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * minusEquals. + * + * A = A - B + * + * @param mixed $B Matrix/Array + * + * @return $this + */ + public function minusEquals(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $validValues = true; + $value = $M->get($i, $j); + if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { + $this->A[$i][$j] = trim($this->A[$i][$j], '"'); + $validValues &= StringHelper::convertToNumberIfFraction($this->A[$i][$j]); + } + if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { + $value = trim($value, '"'); + $validValues &= StringHelper::convertToNumberIfFraction($value); + } + if ($validValues) { + $this->A[$i][$j] -= $value; + } else { + $this->A[$i][$j] = Functions::NAN(); + } + } + } + + return $this; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * arrayTimes. + * + * Element-by-element multiplication + * Cij = Aij * Bij + * + * @param mixed $B Matrix/Array + * + * @return Matrix Matrix Cij + */ + public function arrayTimes(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $M->set($i, $j, $M->get($i, $j) * $this->A[$i][$j]); + } + } + + return $M; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * arrayTimesEquals. + * + * Element-by-element multiplication + * Aij = Aij * Bij + * + * @param mixed $B Matrix/Array + * + * @return $this + */ + public function arrayTimesEquals(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $validValues = true; + $value = $M->get($i, $j); + if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { + $this->A[$i][$j] = trim($this->A[$i][$j], '"'); + $validValues &= StringHelper::convertToNumberIfFraction($this->A[$i][$j]); + } + if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { + $value = trim($value, '"'); + $validValues &= StringHelper::convertToNumberIfFraction($value); + } + if ($validValues) { + $this->A[$i][$j] *= $value; + } else { + $this->A[$i][$j] = Functions::NAN(); + } + } + } + + return $this; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * arrayRightDivide. + * + * Element-by-element right division + * A / B + * + * @param Matrix $B Matrix B + * + * @return Matrix Division result + */ + public function arrayRightDivide(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $validValues = true; + $value = $M->get($i, $j); + if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { + $this->A[$i][$j] = trim($this->A[$i][$j], '"'); + $validValues &= StringHelper::convertToNumberIfFraction($this->A[$i][$j]); + } + if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { + $value = trim($value, '"'); + $validValues &= StringHelper::convertToNumberIfFraction($value); + } + if ($validValues) { + if ($value == 0) { + // Trap for Divide by Zero error + $M->set($i, $j, '#DIV/0!'); + } else { + $M->set($i, $j, $this->A[$i][$j] / $value); + } + } else { + $M->set($i, $j, Functions::NAN()); + } + } + } + + return $M; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * arrayRightDivideEquals. + * + * Element-by-element right division + * Aij = Aij / Bij + * + * @param mixed $B Matrix/Array + * + * @return Matrix Matrix Aij + */ + public function arrayRightDivideEquals(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $this->A[$i][$j] = $this->A[$i][$j] / $M->get($i, $j); + } + } + + return $M; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * arrayLeftDivide. + * + * Element-by-element Left division + * A / B + * + * @param Matrix $B Matrix B + * + * @return Matrix Division result + */ + public function arrayLeftDivide(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $M->set($i, $j, $M->get($i, $j) / $this->A[$i][$j]); + } + } + + return $M; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * arrayLeftDivideEquals. + * + * Element-by-element Left division + * Aij = Aij / Bij + * + * @param mixed $B Matrix/Array + * + * @return Matrix Matrix Aij + */ + public function arrayLeftDivideEquals(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $this->A[$i][$j] = $M->get($i, $j) / $this->A[$i][$j]; + } + } + + return $M; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * times. + * + * Matrix multiplication + * + * @param mixed $n Matrix/Array/Scalar + * + * @return Matrix Product + */ + public function times(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $B = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + if ($this->n == $B->m) { + $C = new self($this->m, $B->n); + for ($j = 0; $j < $B->n; ++$j) { + $Bcolj = []; + for ($k = 0; $k < $this->n; ++$k) { + $Bcolj[$k] = $B->A[$k][$j]; + } + for ($i = 0; $i < $this->m; ++$i) { + $Arowi = $this->A[$i]; + $s = 0; + for ($k = 0; $k < $this->n; ++$k) { + $s += $Arowi[$k] * $Bcolj[$k]; + } + $C->A[$i][$j] = $s; + } + } + + return $C; + } + + throw new CalculationException(self::MATRIX_DIMENSION_EXCEPTION); + case 'array': + $B = new self($args[0]); + if ($this->n == $B->m) { + $C = new self($this->m, $B->n); + for ($i = 0; $i < $C->m; ++$i) { + for ($j = 0; $j < $C->n; ++$j) { + $s = '0'; + for ($k = 0; $k < $C->n; ++$k) { + $s += $this->A[$i][$k] * $B->A[$k][$j]; + } + $C->A[$i][$j] = $s; + } + } + + return $C; + } + + throw new CalculationException(self::MATRIX_DIMENSION_EXCEPTION); + case 'integer': + $C = new self($this->A); + for ($i = 0; $i < $C->m; ++$i) { + for ($j = 0; $j < $C->n; ++$j) { + $C->A[$i][$j] *= $args[0]; + } + } + + return $C; + case 'double': + $C = new self($this->m, $this->n); + for ($i = 0; $i < $C->m; ++$i) { + for ($j = 0; $j < $C->n; ++$j) { + $C->A[$i][$j] = $args[0] * $this->A[$i][$j]; + } + } + + return $C; + case 'float': + $C = new self($this->A); + for ($i = 0; $i < $C->m; ++$i) { + for ($j = 0; $j < $C->n; ++$j) { + $C->A[$i][$j] *= $args[0]; + } + } + + return $C; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + } else { + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + } + + /** + * power. + * + * A = A ^ B + * + * @param mixed $B Matrix/Array + * + * @return $this + */ + public function power(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $validValues = true; + $value = $M->get($i, $j); + if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) { + $this->A[$i][$j] = trim($this->A[$i][$j], '"'); + $validValues &= StringHelper::convertToNumberIfFraction($this->A[$i][$j]); + } + if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { + $value = trim($value, '"'); + $validValues &= StringHelper::convertToNumberIfFraction($value); + } + if ($validValues) { + $this->A[$i][$j] = pow($this->A[$i][$j], $value); + } else { + $this->A[$i][$j] = Functions::NAN(); + } + } + } + + return $this; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * concat. + * + * A = A & B + * + * @param mixed $B Matrix/Array + * + * @return $this + */ + public function concat(...$args) + { + if (count($args) > 0) { + $match = implode(',', array_map('gettype', $args)); + + switch ($match) { + case 'object': + if ($args[0] instanceof self) { + $M = $args[0]; + } else { + throw new CalculationException(self::ARGUMENT_TYPE_EXCEPTION); + } + + break; + case 'array': + $M = new self($args[0]); + + break; + default: + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + + break; + } + $this->checkMatrixDimensions($M); + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $this->A[$i][$j] = trim($this->A[$i][$j], '"') . trim($M->get($i, $j), '"'); + } + } + + return $this; + } + + throw new CalculationException(self::POLYMORPHIC_ARGUMENT_EXCEPTION); + } + + /** + * Solve A*X = B. + * + * @param Matrix $B Right hand side + * + * @return Matrix ... Solution if A is square, least squares solution otherwise + */ + public function solve($B) + { + if ($this->m == $this->n) { + $LU = new LUDecomposition($this); + + return $LU->solve($B); + } + $QR = new QRDecomposition($this); + + return $QR->solve($B); + } + + /** + * Matrix inverse or pseudoinverse. + * + * @return Matrix ... Inverse(A) if A is square, pseudoinverse otherwise. + */ + public function inverse() + { + return $this->solve($this->identity($this->m, $this->m)); + } + + /** + * det. + * + * Calculate determinant + * + * @return float Determinant + */ + public function det() + { + $L = new LUDecomposition($this); + + return $L->det(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php new file mode 100644 index 0000000..3bb8a10 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php @@ -0,0 +1,249 @@ += n, the QR decomposition is an m-by-n + * orthogonal matrix Q and an n-by-n upper triangular matrix R so that + * A = Q*R. + * + * The QR decompostion always exists, even if the matrix does not have + * full rank, so the constructor will never fail. The primary use of the + * QR decomposition is in the least squares solution of nonsquare systems + * of simultaneous linear equations. This will fail if isFullRank() + * returns false. + * + * @author Paul Meagher + * + * @version 1.1 + */ +class QRDecomposition +{ + const MATRIX_RANK_EXCEPTION = 'Can only perform operation on full-rank matrix.'; + + /** + * Array for internal storage of decomposition. + * + * @var array + */ + private $QR = []; + + /** + * Row dimension. + * + * @var int + */ + private $m; + + /** + * Column dimension. + * + * @var int + */ + private $n; + + /** + * Array for internal storage of diagonal of R. + * + * @var array + */ + private $Rdiag = []; + + /** + * QR Decomposition computed by Householder reflections. + * + * @param matrix $A Rectangular matrix + */ + public function __construct($A) + { + if ($A instanceof Matrix) { + // Initialize. + $this->QR = $A->getArray(); + $this->m = $A->getRowDimension(); + $this->n = $A->getColumnDimension(); + // Main loop. + for ($k = 0; $k < $this->n; ++$k) { + // Compute 2-norm of k-th column without under/overflow. + $nrm = 0.0; + for ($i = $k; $i < $this->m; ++$i) { + $nrm = hypo($nrm, $this->QR[$i][$k]); + } + if ($nrm != 0.0) { + // Form k-th Householder vector. + if ($this->QR[$k][$k] < 0) { + $nrm = -$nrm; + } + for ($i = $k; $i < $this->m; ++$i) { + $this->QR[$i][$k] /= $nrm; + } + $this->QR[$k][$k] += 1.0; + // Apply transformation to remaining columns. + for ($j = $k + 1; $j < $this->n; ++$j) { + $s = 0.0; + for ($i = $k; $i < $this->m; ++$i) { + $s += $this->QR[$i][$k] * $this->QR[$i][$j]; + } + $s = -$s / $this->QR[$k][$k]; + for ($i = $k; $i < $this->m; ++$i) { + $this->QR[$i][$j] += $s * $this->QR[$i][$k]; + } + } + } + $this->Rdiag[$k] = -$nrm; + } + } else { + throw new CalculationException(Matrix::ARGUMENT_TYPE_EXCEPTION); + } + } + + // function __construct() + + /** + * Is the matrix full rank? + * + * @return bool true if R, and hence A, has full rank, else false + */ + public function isFullRank() + { + for ($j = 0; $j < $this->n; ++$j) { + if ($this->Rdiag[$j] == 0) { + return false; + } + } + + return true; + } + + // function isFullRank() + + /** + * Return the Householder vectors. + * + * @return Matrix Lower trapezoidal matrix whose columns define the reflections + */ + public function getH() + { + $H = []; + for ($i = 0; $i < $this->m; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + if ($i >= $j) { + $H[$i][$j] = $this->QR[$i][$j]; + } else { + $H[$i][$j] = 0.0; + } + } + } + + return new Matrix($H); + } + + // function getH() + + /** + * Return the upper triangular factor. + * + * @return Matrix upper triangular factor + */ + public function getR() + { + $R = []; + for ($i = 0; $i < $this->n; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + if ($i < $j) { + $R[$i][$j] = $this->QR[$i][$j]; + } elseif ($i == $j) { + $R[$i][$j] = $this->Rdiag[$i]; + } else { + $R[$i][$j] = 0.0; + } + } + } + + return new Matrix($R); + } + + // function getR() + + /** + * Generate and return the (economy-sized) orthogonal factor. + * + * @return Matrix orthogonal factor + */ + public function getQ() + { + $Q = []; + for ($k = $this->n - 1; $k >= 0; --$k) { + for ($i = 0; $i < $this->m; ++$i) { + $Q[$i][$k] = 0.0; + } + $Q[$k][$k] = 1.0; + for ($j = $k; $j < $this->n; ++$j) { + if ($this->QR[$k][$k] != 0) { + $s = 0.0; + for ($i = $k; $i < $this->m; ++$i) { + $s += $this->QR[$i][$k] * $Q[$i][$j]; + } + $s = -$s / $this->QR[$k][$k]; + for ($i = $k; $i < $this->m; ++$i) { + $Q[$i][$j] += $s * $this->QR[$i][$k]; + } + } + } + } + + return new Matrix($Q); + } + + // function getQ() + + /** + * Least squares solution of A*X = B. + * + * @param Matrix $B a Matrix with as many rows as A and any number of columns + * + * @return Matrix matrix that minimizes the two norm of Q*R*X-B + */ + public function solve($B) + { + if ($B->getRowDimension() == $this->m) { + if ($this->isFullRank()) { + // Copy right hand side + $nx = $B->getColumnDimension(); + $X = $B->getArrayCopy(); + // Compute Y = transpose(Q)*B + for ($k = 0; $k < $this->n; ++$k) { + for ($j = 0; $j < $nx; ++$j) { + $s = 0.0; + for ($i = $k; $i < $this->m; ++$i) { + $s += $this->QR[$i][$k] * $X[$i][$j]; + } + $s = -$s / $this->QR[$k][$k]; + for ($i = $k; $i < $this->m; ++$i) { + $X[$i][$j] += $s * $this->QR[$i][$k]; + } + } + } + // Solve R*X = Y; + for ($k = $this->n - 1; $k >= 0; --$k) { + for ($j = 0; $j < $nx; ++$j) { + $X[$k][$j] /= $this->Rdiag[$k]; + } + for ($i = 0; $i < $k; ++$i) { + for ($j = 0; $j < $nx; ++$j) { + $X[$i][$j] -= $X[$k][$j] * $this->QR[$i][$k]; + } + } + } + $X = new Matrix($X); + + return $X->getMatrix(0, $this->n - 1, 0, $nx); + } + + throw new CalculationException(self::MATRIX_RANK_EXCEPTION); + } + + throw new CalculationException(Matrix::MATRIX_DIMENSION_EXCEPTION); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php new file mode 100644 index 0000000..3ca9561 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php @@ -0,0 +1,528 @@ += n, the singular value decomposition is + * an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and + * an n-by-n orthogonal matrix V so that A = U*S*V'. + * + * The singular values, sigma[$k] = S[$k][$k], are ordered so that + * sigma[0] >= sigma[1] >= ... >= sigma[n-1]. + * + * The singular value decompostion always exists, so the constructor will + * never fail. The matrix condition number and the effective numerical + * rank can be computed from this decomposition. + * + * @author Paul Meagher + * + * @version 1.1 + */ +class SingularValueDecomposition +{ + /** + * Internal storage of U. + * + * @var array + */ + private $U = []; + + /** + * Internal storage of V. + * + * @var array + */ + private $V = []; + + /** + * Internal storage of singular values. + * + * @var array + */ + private $s = []; + + /** + * Row dimension. + * + * @var int + */ + private $m; + + /** + * Column dimension. + * + * @var int + */ + private $n; + + /** + * Construct the singular value decomposition. + * + * Derived from LINPACK code. + * + * @param mixed $Arg Rectangular matrix + */ + public function __construct($Arg) + { + // Initialize. + $A = $Arg->getArrayCopy(); + $this->m = $Arg->getRowDimension(); + $this->n = $Arg->getColumnDimension(); + $nu = min($this->m, $this->n); + $e = []; + $work = []; + $wantu = true; + $wantv = true; + $nct = min($this->m - 1, $this->n); + $nrt = max(0, min($this->n - 2, $this->m)); + + // Reduce A to bidiagonal form, storing the diagonal elements + // in s and the super-diagonal elements in e. + $kMax = max($nct, $nrt); + for ($k = 0; $k < $kMax; ++$k) { + if ($k < $nct) { + // Compute the transformation for the k-th column and + // place the k-th diagonal in s[$k]. + // Compute 2-norm of k-th column without under/overflow. + $this->s[$k] = 0; + for ($i = $k; $i < $this->m; ++$i) { + $this->s[$k] = hypo($this->s[$k], $A[$i][$k]); + } + if ($this->s[$k] != 0.0) { + if ($A[$k][$k] < 0.0) { + $this->s[$k] = -$this->s[$k]; + } + for ($i = $k; $i < $this->m; ++$i) { + $A[$i][$k] /= $this->s[$k]; + } + $A[$k][$k] += 1.0; + } + $this->s[$k] = -$this->s[$k]; + } + + for ($j = $k + 1; $j < $this->n; ++$j) { + if (($k < $nct) & ($this->s[$k] != 0.0)) { + // Apply the transformation. + $t = 0; + for ($i = $k; $i < $this->m; ++$i) { + $t += $A[$i][$k] * $A[$i][$j]; + } + $t = -$t / $A[$k][$k]; + for ($i = $k; $i < $this->m; ++$i) { + $A[$i][$j] += $t * $A[$i][$k]; + } + // Place the k-th row of A into e for the + // subsequent calculation of the row transformation. + $e[$j] = $A[$k][$j]; + } + } + + if ($wantu and ($k < $nct)) { + // Place the transformation in U for subsequent back + // multiplication. + for ($i = $k; $i < $this->m; ++$i) { + $this->U[$i][$k] = $A[$i][$k]; + } + } + + if ($k < $nrt) { + // Compute the k-th row transformation and place the + // k-th super-diagonal in e[$k]. + // Compute 2-norm without under/overflow. + $e[$k] = 0; + for ($i = $k + 1; $i < $this->n; ++$i) { + $e[$k] = hypo($e[$k], $e[$i]); + } + if ($e[$k] != 0.0) { + if ($e[$k + 1] < 0.0) { + $e[$k] = -$e[$k]; + } + for ($i = $k + 1; $i < $this->n; ++$i) { + $e[$i] /= $e[$k]; + } + $e[$k + 1] += 1.0; + } + $e[$k] = -$e[$k]; + if (($k + 1 < $this->m) and ($e[$k] != 0.0)) { + // Apply the transformation. + for ($i = $k + 1; $i < $this->m; ++$i) { + $work[$i] = 0.0; + } + for ($j = $k + 1; $j < $this->n; ++$j) { + for ($i = $k + 1; $i < $this->m; ++$i) { + $work[$i] += $e[$j] * $A[$i][$j]; + } + } + for ($j = $k + 1; $j < $this->n; ++$j) { + $t = -$e[$j] / $e[$k + 1]; + for ($i = $k + 1; $i < $this->m; ++$i) { + $A[$i][$j] += $t * $work[$i]; + } + } + } + if ($wantv) { + // Place the transformation in V for subsequent + // back multiplication. + for ($i = $k + 1; $i < $this->n; ++$i) { + $this->V[$i][$k] = $e[$i]; + } + } + } + } + + // Set up the final bidiagonal matrix or order p. + $p = min($this->n, $this->m + 1); + if ($nct < $this->n) { + $this->s[$nct] = $A[$nct][$nct]; + } + if ($this->m < $p) { + $this->s[$p - 1] = 0.0; + } + if ($nrt + 1 < $p) { + $e[$nrt] = $A[$nrt][$p - 1]; + } + $e[$p - 1] = 0.0; + // If required, generate U. + if ($wantu) { + for ($j = $nct; $j < $nu; ++$j) { + for ($i = 0; $i < $this->m; ++$i) { + $this->U[$i][$j] = 0.0; + } + $this->U[$j][$j] = 1.0; + } + for ($k = $nct - 1; $k >= 0; --$k) { + if ($this->s[$k] != 0.0) { + for ($j = $k + 1; $j < $nu; ++$j) { + $t = 0; + for ($i = $k; $i < $this->m; ++$i) { + $t += $this->U[$i][$k] * $this->U[$i][$j]; + } + $t = -$t / $this->U[$k][$k]; + for ($i = $k; $i < $this->m; ++$i) { + $this->U[$i][$j] += $t * $this->U[$i][$k]; + } + } + for ($i = $k; $i < $this->m; ++$i) { + $this->U[$i][$k] = -$this->U[$i][$k]; + } + $this->U[$k][$k] = 1.0 + $this->U[$k][$k]; + for ($i = 0; $i < $k - 1; ++$i) { + $this->U[$i][$k] = 0.0; + } + } else { + for ($i = 0; $i < $this->m; ++$i) { + $this->U[$i][$k] = 0.0; + } + $this->U[$k][$k] = 1.0; + } + } + } + + // If required, generate V. + if ($wantv) { + for ($k = $this->n - 1; $k >= 0; --$k) { + if (($k < $nrt) and ($e[$k] != 0.0)) { + for ($j = $k + 1; $j < $nu; ++$j) { + $t = 0; + for ($i = $k + 1; $i < $this->n; ++$i) { + $t += $this->V[$i][$k] * $this->V[$i][$j]; + } + $t = -$t / $this->V[$k + 1][$k]; + for ($i = $k + 1; $i < $this->n; ++$i) { + $this->V[$i][$j] += $t * $this->V[$i][$k]; + } + } + } + for ($i = 0; $i < $this->n; ++$i) { + $this->V[$i][$k] = 0.0; + } + $this->V[$k][$k] = 1.0; + } + } + + // Main iteration loop for the singular values. + $pp = $p - 1; + $iter = 0; + $eps = pow(2.0, -52.0); + + while ($p > 0) { + // Here is where a test for too many iterations would go. + // This section of the program inspects for negligible + // elements in the s and e arrays. On completion the + // variables kase and k are set as follows: + // kase = 1 if s(p) and e[k-1] are negligible and k

= -1; --$k) { + if ($k == -1) { + break; + } + if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k + 1]))) { + $e[$k] = 0.0; + + break; + } + } + if ($k == $p - 2) { + $kase = 4; + } else { + for ($ks = $p - 1; $ks >= $k; --$ks) { + if ($ks == $k) { + break; + } + $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks - 1]) : 0.); + if (abs($this->s[$ks]) <= $eps * $t) { + $this->s[$ks] = 0.0; + + break; + } + } + if ($ks == $k) { + $kase = 3; + } elseif ($ks == $p - 1) { + $kase = 1; + } else { + $kase = 2; + $k = $ks; + } + } + ++$k; + + // Perform the task indicated by kase. + switch ($kase) { + // Deflate negligible s(p). + case 1: + $f = $e[$p - 2]; + $e[$p - 2] = 0.0; + for ($j = $p - 2; $j >= $k; --$j) { + $t = hypo($this->s[$j], $f); + $cs = $this->s[$j] / $t; + $sn = $f / $t; + $this->s[$j] = $t; + if ($j != $k) { + $f = -$sn * $e[$j - 1]; + $e[$j - 1] = $cs * $e[$j - 1]; + } + if ($wantv) { + for ($i = 0; $i < $this->n; ++$i) { + $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p - 1]; + $this->V[$i][$p - 1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p - 1]; + $this->V[$i][$j] = $t; + } + } + } + + break; + // Split at negligible s(k). + case 2: + $f = $e[$k - 1]; + $e[$k - 1] = 0.0; + for ($j = $k; $j < $p; ++$j) { + $t = hypo($this->s[$j], $f); + $cs = $this->s[$j] / $t; + $sn = $f / $t; + $this->s[$j] = $t; + $f = -$sn * $e[$j]; + $e[$j] = $cs * $e[$j]; + if ($wantu) { + for ($i = 0; $i < $this->m; ++$i) { + $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k - 1]; + $this->U[$i][$k - 1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k - 1]; + $this->U[$i][$j] = $t; + } + } + } + + break; + // Perform one qr step. + case 3: + // Calculate the shift. + $scale = max(max(max(max(abs($this->s[$p - 1]), abs($this->s[$p - 2])), abs($e[$p - 2])), abs($this->s[$k])), abs($e[$k])); + $sp = $this->s[$p - 1] / $scale; + $spm1 = $this->s[$p - 2] / $scale; + $epm1 = $e[$p - 2] / $scale; + $sk = $this->s[$k] / $scale; + $ek = $e[$k] / $scale; + $b = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0; + $c = ($sp * $epm1) * ($sp * $epm1); + $shift = 0.0; + if (($b != 0.0) || ($c != 0.0)) { + $shift = sqrt($b * $b + $c); + if ($b < 0.0) { + $shift = -$shift; + } + $shift = $c / ($b + $shift); + } + $f = ($sk + $sp) * ($sk - $sp) + $shift; + $g = $sk * $ek; + // Chase zeros. + for ($j = $k; $j < $p - 1; ++$j) { + $t = hypo($f, $g); + $cs = $f / $t; + $sn = $g / $t; + if ($j != $k) { + $e[$j - 1] = $t; + } + $f = $cs * $this->s[$j] + $sn * $e[$j]; + $e[$j] = $cs * $e[$j] - $sn * $this->s[$j]; + $g = $sn * $this->s[$j + 1]; + $this->s[$j + 1] = $cs * $this->s[$j + 1]; + if ($wantv) { + for ($i = 0; $i < $this->n; ++$i) { + $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j + 1]; + $this->V[$i][$j + 1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j + 1]; + $this->V[$i][$j] = $t; + } + } + $t = hypo($f, $g); + $cs = $f / $t; + $sn = $g / $t; + $this->s[$j] = $t; + $f = $cs * $e[$j] + $sn * $this->s[$j + 1]; + $this->s[$j + 1] = -$sn * $e[$j] + $cs * $this->s[$j + 1]; + $g = $sn * $e[$j + 1]; + $e[$j + 1] = $cs * $e[$j + 1]; + if ($wantu && ($j < $this->m - 1)) { + for ($i = 0; $i < $this->m; ++$i) { + $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j + 1]; + $this->U[$i][$j + 1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j + 1]; + $this->U[$i][$j] = $t; + } + } + } + $e[$p - 2] = $f; + $iter = $iter + 1; + + break; + // Convergence. + case 4: + // Make the singular values positive. + if ($this->s[$k] <= 0.0) { + $this->s[$k] = ($this->s[$k] < 0.0 ? -$this->s[$k] : 0.0); + if ($wantv) { + for ($i = 0; $i <= $pp; ++$i) { + $this->V[$i][$k] = -$this->V[$i][$k]; + } + } + } + // Order the singular values. + while ($k < $pp) { + if ($this->s[$k] >= $this->s[$k + 1]) { + break; + } + $t = $this->s[$k]; + $this->s[$k] = $this->s[$k + 1]; + $this->s[$k + 1] = $t; + if ($wantv and ($k < $this->n - 1)) { + for ($i = 0; $i < $this->n; ++$i) { + $t = $this->V[$i][$k + 1]; + $this->V[$i][$k + 1] = $this->V[$i][$k]; + $this->V[$i][$k] = $t; + } + } + if ($wantu and ($k < $this->m - 1)) { + for ($i = 0; $i < $this->m; ++$i) { + $t = $this->U[$i][$k + 1]; + $this->U[$i][$k + 1] = $this->U[$i][$k]; + $this->U[$i][$k] = $t; + } + } + ++$k; + } + $iter = 0; + --$p; + + break; + } // end switch + } // end while + } + + /** + * Return the left singular vectors. + * + * @return Matrix U + */ + public function getU() + { + return new Matrix($this->U, $this->m, min($this->m + 1, $this->n)); + } + + /** + * Return the right singular vectors. + * + * @return Matrix V + */ + public function getV() + { + return new Matrix($this->V); + } + + /** + * Return the one-dimensional array of singular values. + * + * @return array diagonal of S + */ + public function getSingularValues() + { + return $this->s; + } + + /** + * Return the diagonal matrix of singular values. + * + * @return Matrix S + */ + public function getS() + { + for ($i = 0; $i < $this->n; ++$i) { + for ($j = 0; $j < $this->n; ++$j) { + $S[$i][$j] = 0.0; + } + $S[$i][$i] = $this->s[$i]; + } + + return new Matrix($S); + } + + /** + * Two norm. + * + * @return float max(S) + */ + public function norm2() + { + return $this->s[0]; + } + + /** + * Two norm condition number. + * + * @return float max(S)/min(S) + */ + public function cond() + { + return $this->s[0] / $this->s[min($this->m, $this->n) - 1]; + } + + /** + * Effective numerical matrix rank. + * + * @return int Number of nonnegligible singular values + */ + public function rank() + { + $eps = pow(2.0, -52.0); + $tol = max($this->m, $this->n) * $this->s[0] * $eps; + $r = 0; + $iMax = count($this->s); + for ($i = 0; $i < $iMax; ++$i) { + if ($this->s[$i] > $tol) { + ++$r; + } + } + + return $r; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/utils/Maths.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/utils/Maths.php new file mode 100644 index 0000000..68c3864 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/JAMA/utils/Maths.php @@ -0,0 +1,30 @@ + abs($b)) { + $r = $b / $a; + $r = abs($a) * sqrt(1 + $r * $r); + } elseif ($b != 0) { + $r = $a / $b; + $r = abs($b) * sqrt(1 + $r * $r); + } else { + $r = 0.0; + } + + return $r; +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php new file mode 100644 index 0000000..efa7522 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE.php @@ -0,0 +1,573 @@ + | +// | Based on OLE::Storage_Lite by Kawai, Takanori | +// +----------------------------------------------------------------------+ +// + +use PhpOffice\PhpSpreadsheet\Reader\Exception as ReaderException; +use PhpOffice\PhpSpreadsheet\Shared\OLE\ChainedBlockStream; +use PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\Root; + +/* + * Array for storing OLE instances that are accessed from + * OLE_ChainedBlockStream::stream_open(). + * + * @var array + */ +$GLOBALS['_OLE_INSTANCES'] = []; + +/** + * OLE package base class. + * + * @author Xavier Noguer + * @author Christian Schmidt + * + * @category PhpSpreadsheet + */ +class OLE +{ + const OLE_PPS_TYPE_ROOT = 5; + const OLE_PPS_TYPE_DIR = 1; + const OLE_PPS_TYPE_FILE = 2; + const OLE_DATA_SIZE_SMALL = 0x1000; + const OLE_LONG_INT_SIZE = 4; + const OLE_PPS_SIZE = 0x80; + + /** + * The file handle for reading an OLE container. + * + * @var resource + */ + public $_file_handle; + + /** + * Array of PPS's found on the OLE container. + * + * @var array + */ + public $_list = []; + + /** + * Root directory of OLE container. + * + * @var Root + */ + public $root; + + /** + * Big Block Allocation Table. + * + * @var array (blockId => nextBlockId) + */ + public $bbat; + + /** + * Short Block Allocation Table. + * + * @var array (blockId => nextBlockId) + */ + public $sbat; + + /** + * Size of big blocks. This is usually 512. + * + * @var int number of octets per block + */ + public $bigBlockSize; + + /** + * Size of small blocks. This is usually 64. + * + * @var int number of octets per block + */ + public $smallBlockSize; + + /** + * Threshold for big blocks. + * + * @var int + */ + public $bigBlockThreshold; + + /** + * Reads an OLE container from the contents of the file given. + * + * @acces public + * + * @param string $file + * + * @throws ReaderException + * + * @return bool true on success, PEAR_Error on failure + */ + public function read($file) + { + $fh = fopen($file, 'r'); + if (!$fh) { + throw new ReaderException("Can't open file $file"); + } + $this->_file_handle = $fh; + + $signature = fread($fh, 8); + if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) { + throw new ReaderException("File doesn't seem to be an OLE container."); + } + fseek($fh, 28); + if (fread($fh, 2) != "\xFE\xFF") { + // This shouldn't be a problem in practice + throw new ReaderException('Only Little-Endian encoding is supported.'); + } + // Size of blocks and short blocks in bytes + $this->bigBlockSize = pow(2, self::_readInt2($fh)); + $this->smallBlockSize = pow(2, self::_readInt2($fh)); + + // Skip UID, revision number and version number + fseek($fh, 44); + // Number of blocks in Big Block Allocation Table + $bbatBlockCount = self::_readInt4($fh); + + // Root chain 1st block + $directoryFirstBlockId = self::_readInt4($fh); + + // Skip unused bytes + fseek($fh, 56); + // Streams shorter than this are stored using small blocks + $this->bigBlockThreshold = self::_readInt4($fh); + // Block id of first sector in Short Block Allocation Table + $sbatFirstBlockId = self::_readInt4($fh); + // Number of blocks in Short Block Allocation Table + $sbbatBlockCount = self::_readInt4($fh); + // Block id of first sector in Master Block Allocation Table + $mbatFirstBlockId = self::_readInt4($fh); + // Number of blocks in Master Block Allocation Table + $mbbatBlockCount = self::_readInt4($fh); + $this->bbat = []; + + // Remaining 4 * 109 bytes of current block is beginning of Master + // Block Allocation Table + $mbatBlocks = []; + for ($i = 0; $i < 109; ++$i) { + $mbatBlocks[] = self::_readInt4($fh); + } + + // Read rest of Master Block Allocation Table (if any is left) + $pos = $this->_getBlockOffset($mbatFirstBlockId); + for ($i = 0; $i < $mbbatBlockCount; ++$i) { + fseek($fh, $pos); + for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) { + $mbatBlocks[] = self::_readInt4($fh); + } + // Last block id in each block points to next block + $pos = $this->_getBlockOffset(self::_readInt4($fh)); + } + + // Read Big Block Allocation Table according to chain specified by $mbatBlocks + for ($i = 0; $i < $bbatBlockCount; ++$i) { + $pos = $this->_getBlockOffset($mbatBlocks[$i]); + fseek($fh, $pos); + for ($j = 0; $j < $this->bigBlockSize / 4; ++$j) { + $this->bbat[] = self::_readInt4($fh); + } + } + + // Read short block allocation table (SBAT) + $this->sbat = []; + $shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4; + $sbatFh = $this->getStream($sbatFirstBlockId); + for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) { + $this->sbat[$blockId] = self::_readInt4($sbatFh); + } + fclose($sbatFh); + + $this->_readPpsWks($directoryFirstBlockId); + + return true; + } + + /** + * @param int $blockId byte offset from beginning of file + * + * @return int + */ + public function _getBlockOffset($blockId) + { + return 512 + $blockId * $this->bigBlockSize; + } + + /** + * Returns a stream for use with fread() etc. External callers should + * use \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\File::getStream(). + * + * @param int|OLE\PPS $blockIdOrPps block id or PPS + * + * @return resource read-only stream + */ + public function getStream($blockIdOrPps) + { + static $isRegistered = false; + if (!$isRegistered) { + stream_wrapper_register('ole-chainedblockstream', ChainedBlockStream::class); + $isRegistered = true; + } + + // Store current instance in global array, so that it can be accessed + // in OLE_ChainedBlockStream::stream_open(). + // Object is removed from self::$instances in OLE_Stream::close(). + $GLOBALS['_OLE_INSTANCES'][] = $this; + $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES'])); + + $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId; + if ($blockIdOrPps instanceof OLE\PPS) { + $path .= '&blockId=' . $blockIdOrPps->startBlock; + $path .= '&size=' . $blockIdOrPps->Size; + } else { + $path .= '&blockId=' . $blockIdOrPps; + } + + return fopen($path, 'r'); + } + + /** + * Reads a signed char. + * + * @param resource $fh file handle + * + * @return int + */ + private static function _readInt1($fh) + { + [, $tmp] = unpack('c', fread($fh, 1)); + + return $tmp; + } + + /** + * Reads an unsigned short (2 octets). + * + * @param resource $fh file handle + * + * @return int + */ + private static function _readInt2($fh) + { + [, $tmp] = unpack('v', fread($fh, 2)); + + return $tmp; + } + + /** + * Reads an unsigned long (4 octets). + * + * @param resource $fh file handle + * + * @return int + */ + private static function _readInt4($fh) + { + [, $tmp] = unpack('V', fread($fh, 4)); + + return $tmp; + } + + /** + * Gets information about all PPS's on the OLE container from the PPS WK's + * creates an OLE_PPS object for each one. + * + * @param int $blockId the block id of the first block + * + * @return bool true on success, PEAR_Error on failure + */ + public function _readPpsWks($blockId) + { + $fh = $this->getStream($blockId); + for ($pos = 0; true; $pos += 128) { + fseek($fh, $pos, SEEK_SET); + $nameUtf16 = fread($fh, 64); + $nameLength = self::_readInt2($fh); + $nameUtf16 = substr($nameUtf16, 0, $nameLength - 2); + // Simple conversion from UTF-16LE to ISO-8859-1 + $name = str_replace("\x00", '', $nameUtf16); + $type = self::_readInt1($fh); + switch ($type) { + case self::OLE_PPS_TYPE_ROOT: + $pps = new OLE\PPS\Root(null, null, []); + $this->root = $pps; + + break; + case self::OLE_PPS_TYPE_DIR: + $pps = new OLE\PPS(null, null, null, null, null, null, null, null, null, []); + + break; + case self::OLE_PPS_TYPE_FILE: + $pps = new OLE\PPS\File($name); + + break; + default: + break; + } + fseek($fh, 1, SEEK_CUR); + $pps->Type = $type; + $pps->Name = $name; + $pps->PrevPps = self::_readInt4($fh); + $pps->NextPps = self::_readInt4($fh); + $pps->DirPps = self::_readInt4($fh); + fseek($fh, 20, SEEK_CUR); + $pps->Time1st = self::OLE2LocalDate(fread($fh, 8)); + $pps->Time2nd = self::OLE2LocalDate(fread($fh, 8)); + $pps->startBlock = self::_readInt4($fh); + $pps->Size = self::_readInt4($fh); + $pps->No = count($this->_list); + $this->_list[] = $pps; + + // check if the PPS tree (starting from root) is complete + if (isset($this->root) && $this->_ppsTreeComplete($this->root->No)) { + break; + } + } + fclose($fh); + + // Initialize $pps->children on directories + foreach ($this->_list as $pps) { + if ($pps->Type == self::OLE_PPS_TYPE_DIR || $pps->Type == self::OLE_PPS_TYPE_ROOT) { + $nos = [$pps->DirPps]; + $pps->children = []; + while ($nos) { + $no = array_pop($nos); + if ($no != -1) { + $childPps = $this->_list[$no]; + $nos[] = $childPps->PrevPps; + $nos[] = $childPps->NextPps; + $pps->children[] = $childPps; + } + } + } + } + + return true; + } + + /** + * It checks whether the PPS tree is complete (all PPS's read) + * starting with the given PPS (not necessarily root). + * + * @param int $index The index of the PPS from which we are checking + * + * @return bool Whether the PPS tree for the given PPS is complete + */ + public function _ppsTreeComplete($index) + { + return isset($this->_list[$index]) && + ($pps = $this->_list[$index]) && + ($pps->PrevPps == -1 || + $this->_ppsTreeComplete($pps->PrevPps)) && + ($pps->NextPps == -1 || + $this->_ppsTreeComplete($pps->NextPps)) && + ($pps->DirPps == -1 || + $this->_ppsTreeComplete($pps->DirPps)); + } + + /** + * Checks whether a PPS is a File PPS or not. + * If there is no PPS for the index given, it will return false. + * + * @param int $index The index for the PPS + * + * @return bool true if it's a File PPS, false otherwise + */ + public function isFile($index) + { + if (isset($this->_list[$index])) { + return $this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE; + } + + return false; + } + + /** + * Checks whether a PPS is a Root PPS or not. + * If there is no PPS for the index given, it will return false. + * + * @param int $index the index for the PPS + * + * @return bool true if it's a Root PPS, false otherwise + */ + public function isRoot($index) + { + if (isset($this->_list[$index])) { + return $this->_list[$index]->Type == self::OLE_PPS_TYPE_ROOT; + } + + return false; + } + + /** + * Gives the total number of PPS's found in the OLE container. + * + * @return int The total number of PPS's found in the OLE container + */ + public function ppsTotal() + { + return count($this->_list); + } + + /** + * Gets data from a PPS + * If there is no PPS for the index given, it will return an empty string. + * + * @param int $index The index for the PPS + * @param int $position The position from which to start reading + * (relative to the PPS) + * @param int $length The amount of bytes to read (at most) + * + * @return string The binary string containing the data requested + * + * @see OLE_PPS_File::getStream() + */ + public function getData($index, $position, $length) + { + // if position is not valid return empty string + if (!isset($this->_list[$index]) || ($position >= $this->_list[$index]->Size) || ($position < 0)) { + return ''; + } + $fh = $this->getStream($this->_list[$index]); + $data = stream_get_contents($fh, $length, $position); + fclose($fh); + + return $data; + } + + /** + * Gets the data length from a PPS + * If there is no PPS for the index given, it will return 0. + * + * @param int $index The index for the PPS + * + * @return int The amount of bytes in data the PPS has + */ + public function getDataLength($index) + { + if (isset($this->_list[$index])) { + return $this->_list[$index]->Size; + } + + return 0; + } + + /** + * Utility function to transform ASCII text to Unicode. + * + * @param string $ascii The ASCII string to transform + * + * @return string The string in Unicode + */ + public static function ascToUcs($ascii) + { + $rawname = ''; + $iMax = strlen($ascii); + for ($i = 0; $i < $iMax; ++$i) { + $rawname .= $ascii[$i] + . "\x00"; + } + + return $rawname; + } + + /** + * Utility function + * Returns a string for the OLE container with the date given. + * + * @param int $date A timestamp + * + * @return string The string for the OLE container + */ + public static function localDateToOLE($date) + { + if (!isset($date)) { + return "\x00\x00\x00\x00\x00\x00\x00\x00"; + } + + // factor used for separating numbers into 4 bytes parts + $factor = pow(2, 32); + + // days from 1-1-1601 until the beggining of UNIX era + $days = 134774; + // calculate seconds + $big_date = $days * 24 * 3600 + gmmktime(date('H', $date), date('i', $date), date('s', $date), date('m', $date), date('d', $date), date('Y', $date)); + // multiply just to make MS happy + $big_date *= 10000000; + + $high_part = floor($big_date / $factor); + // lower 4 bytes + $low_part = floor((($big_date / $factor) - $high_part) * $factor); + + // Make HEX string + $res = ''; + + for ($i = 0; $i < 4; ++$i) { + $hex = $low_part % 0x100; + $res .= pack('c', $hex); + $low_part /= 0x100; + } + for ($i = 0; $i < 4; ++$i) { + $hex = $high_part % 0x100; + $res .= pack('c', $hex); + $high_part /= 0x100; + } + + return $res; + } + + /** + * Returns a timestamp from an OLE container's date. + * + * @param string $oleTimestamp A binary string with the encoded date + * + * @throws ReaderException + * + * @return int The Unix timestamp corresponding to the string + */ + public static function OLE2LocalDate($oleTimestamp) + { + if (strlen($oleTimestamp) != 8) { + throw new ReaderException('Expecting 8 byte string'); + } + + // convert to units of 100 ns since 1601: + $unpackedTimestamp = unpack('v4', $oleTimestamp); + $timestampHigh = (float) $unpackedTimestamp[4] * 65536 + (float) $unpackedTimestamp[3]; + $timestampLow = (float) $unpackedTimestamp[2] * 65536 + (float) $unpackedTimestamp[1]; + + // translate to seconds since 1601: + $timestampHigh /= 10000000; + $timestampLow /= 10000000; + + // days from 1601 to 1970: + $days = 134774; + + // translate to seconds since 1970: + $unixTimestamp = floor(65536.0 * 65536.0 * $timestampHigh + $timestampLow - $days * 24 * 3600 + 0.5); + + if ((int) $unixTimestamp == $unixTimestamp) { + return (int) $unixTimestamp; + } + + return $unixTimestamp >= 0.0 ? PHP_INT_MAX : PHP_INT_MIN; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php new file mode 100644 index 0000000..e6ba724 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/ChainedBlockStream.php @@ -0,0 +1,196 @@ +params); + if (!isset($this->params['oleInstanceId'], $this->params['blockId'], $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) { + if ($options & STREAM_REPORT_ERRORS) { + trigger_error('OLE stream not found', E_USER_WARNING); + } + + return false; + } + $this->ole = $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']]; + + $blockId = $this->params['blockId']; + $this->data = ''; + if (isset($this->params['size']) && $this->params['size'] < $this->ole->bigBlockThreshold && $blockId != $this->ole->root->startBlock) { + // Block id refers to small blocks + $rootPos = $this->ole->_getBlockOffset($this->ole->root->startBlock); + while ($blockId != -2) { + $pos = $rootPos + $blockId * $this->ole->bigBlockSize; + $blockId = $this->ole->sbat[$blockId]; + fseek($this->ole->_file_handle, $pos); + $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize); + } + } else { + // Block id refers to big blocks + while ($blockId != -2) { + $pos = $this->ole->_getBlockOffset($blockId); + fseek($this->ole->_file_handle, $pos); + $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize); + $blockId = $this->ole->bbat[$blockId]; + } + } + if (isset($this->params['size'])) { + $this->data = substr($this->data, 0, $this->params['size']); + } + + if ($options & STREAM_USE_PATH) { + $openedPath = $path; + } + + return true; + } + + /** + * Implements support for fclose(). + */ + public function stream_close() // @codingStandardsIgnoreLine + { + $this->ole = null; + unset($GLOBALS['_OLE_INSTANCES']); + } + + /** + * Implements support for fread(), fgets() etc. + * + * @param int $count maximum number of bytes to read + * + * @return string + */ + public function stream_read($count) // @codingStandardsIgnoreLine + { + if ($this->stream_eof()) { + return false; + } + $s = substr($this->data, $this->pos, $count); + $this->pos += $count; + + return $s; + } + + /** + * Implements support for feof(). + * + * @return bool TRUE if the file pointer is at EOF; otherwise FALSE + */ + public function stream_eof() // @codingStandardsIgnoreLine + { + return $this->pos >= strlen($this->data); + } + + /** + * Returns the position of the file pointer, i.e. its offset into the file + * stream. Implements support for ftell(). + * + * @return int + */ + public function stream_tell() // @codingStandardsIgnoreLine + { + return $this->pos; + } + + /** + * Implements support for fseek(). + * + * @param int $offset byte offset + * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END + * + * @return bool + */ + public function stream_seek($offset, $whence) // @codingStandardsIgnoreLine + { + if ($whence == SEEK_SET && $offset >= 0) { + $this->pos = $offset; + } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) { + $this->pos += $offset; + } elseif ($whence == SEEK_END && -$offset <= count($this->data)) { + $this->pos = strlen($this->data) + $offset; + } else { + return false; + } + + return true; + } + + /** + * Implements support for fstat(). Currently the only supported field is + * "size". + * + * @return array + */ + public function stream_stat() // @codingStandardsIgnoreLine + { + return [ + 'size' => strlen($this->data), + ]; + } + + // Methods used by stream_wrapper_register() that are not implemented: + // bool stream_flush ( void ) + // int stream_write ( string data ) + // bool rename ( string path_from, string path_to ) + // bool mkdir ( string path, int mode, int options ) + // bool rmdir ( string path, int options ) + // bool dir_opendir ( string path, int options ) + // array url_stat ( string path, int flags ) + // string dir_readdir ( void ) + // bool dir_rewinddir ( void ) + // bool dir_closedir ( void ) +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS.php new file mode 100644 index 0000000..e53f257 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS.php @@ -0,0 +1,238 @@ + | +// | Based on OLE::Storage_Lite by Kawai, Takanori | +// +----------------------------------------------------------------------+ +// +use PhpOffice\PhpSpreadsheet\Shared\OLE; + +/** + * Class for creating PPS's for OLE containers. + * + * @author Xavier Noguer + * + * @category PhpSpreadsheet + */ +class PPS +{ + /** + * The PPS index. + * + * @var int + */ + public $No; + + /** + * The PPS name (in Unicode). + * + * @var string + */ + public $Name; + + /** + * The PPS type. Dir, Root or File. + * + * @var int + */ + public $Type; + + /** + * The index of the previous PPS. + * + * @var int + */ + public $PrevPps; + + /** + * The index of the next PPS. + * + * @var int + */ + public $NextPps; + + /** + * The index of it's first child if this is a Dir or Root PPS. + * + * @var int + */ + public $DirPps; + + /** + * A timestamp. + * + * @var int + */ + public $Time1st; + + /** + * A timestamp. + * + * @var int + */ + public $Time2nd; + + /** + * Starting block (small or big) for this PPS's data inside the container. + * + * @var int + */ + public $startBlock; + + /** + * The size of the PPS's data (in bytes). + * + * @var int + */ + public $Size; + + /** + * The PPS's data (only used if it's not using a temporary file). + * + * @var string + */ + public $_data; + + /** + * Array of child PPS's (only used by Root and Dir PPS's). + * + * @var array + */ + public $children = []; + + /** + * Pointer to OLE container. + * + * @var OLE + */ + public $ole; + + /** + * The constructor. + * + * @param int $No The PPS index + * @param string $name The PPS name + * @param int $type The PPS type. Dir, Root or File + * @param int $prev The index of the previous PPS + * @param int $next The index of the next PPS + * @param int $dir The index of it's first child if this is a Dir or Root PPS + * @param int $time_1st A timestamp + * @param int $time_2nd A timestamp + * @param string $data The (usually binary) source data of the PPS + * @param array $children Array containing children PPS for this PPS + */ + public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children) + { + $this->No = $No; + $this->Name = $name; + $this->Type = $type; + $this->PrevPps = $prev; + $this->NextPps = $next; + $this->DirPps = $dir; + $this->Time1st = $time_1st; + $this->Time2nd = $time_2nd; + $this->_data = $data; + $this->children = $children; + if ($data != '') { + $this->Size = strlen($data); + } else { + $this->Size = 0; + } + } + + /** + * Returns the amount of data saved for this PPS. + * + * @return int The amount of data (in bytes) + */ + public function getDataLen() + { + if (!isset($this->_data)) { + return 0; + } + + return strlen($this->_data); + } + + /** + * Returns a string with the PPS's WK (What is a WK?). + * + * @return string The binary string + */ + public function _getPpsWk() + { + $ret = str_pad($this->Name, 64, "\x00"); + + $ret .= pack('v', strlen($this->Name) + 2) // 66 + . pack('c', $this->Type) // 67 + . pack('c', 0x00) //UK // 68 + . pack('V', $this->PrevPps) //Prev // 72 + . pack('V', $this->NextPps) //Next // 76 + . pack('V', $this->DirPps) //Dir // 80 + . "\x00\x09\x02\x00" // 84 + . "\x00\x00\x00\x00" // 88 + . "\xc0\x00\x00\x00" // 92 + . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root + . "\x00\x00\x00\x00" // 100 + . OLE::localDateToOLE($this->Time1st) // 108 + . OLE::localDateToOLE($this->Time2nd) // 116 + . pack('V', isset($this->startBlock) ? $this->startBlock : 0) // 120 + . pack('V', $this->Size) // 124 + . pack('V', 0); // 128 + return $ret; + } + + /** + * Updates index and pointers to previous, next and children PPS's for this + * PPS. I don't think it'll work with Dir PPS's. + * + * @param array &$raList Reference to the array of PPS's for the whole OLE + * container + * @param mixed $to_save + * @param mixed $depth + * + * @return int The index for this PPS + */ + public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0) + { + if (!is_array($to_save) || (empty($to_save))) { + return 0xFFFFFFFF; + } elseif (count($to_save) == 1) { + $cnt = count($raList); + // If the first entry, it's the root... Don't clone it! + $raList[$cnt] = ($depth == 0) ? $to_save[0] : clone $to_save[0]; + $raList[$cnt]->No = $cnt; + $raList[$cnt]->PrevPps = 0xFFFFFFFF; + $raList[$cnt]->NextPps = 0xFFFFFFFF; + $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++); + } else { + $iPos = floor(count($to_save) / 2); + $aPrev = array_slice($to_save, 0, $iPos); + $aNext = array_slice($to_save, $iPos + 1); + $cnt = count($raList); + // If the first entry, it's the root... Don't clone it! + $raList[$cnt] = ($depth == 0) ? $to_save[$iPos] : clone $to_save[$iPos]; + $raList[$cnt]->No = $cnt; + $raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++); + $raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++); + $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++); + } + + return $cnt; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/File.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/File.php new file mode 100644 index 0000000..68f50a5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/File.php @@ -0,0 +1,66 @@ + | +// | Based on OLE::Storage_Lite by Kawai, Takanori | +// +----------------------------------------------------------------------+ +// +use PhpOffice\PhpSpreadsheet\Shared\OLE; +use PhpOffice\PhpSpreadsheet\Shared\OLE\PPS; + +/** + * Class for creating File PPS's for OLE containers. + * + * @author Xavier Noguer + * + * @category PhpSpreadsheet + */ +class File extends PPS +{ + /** + * The constructor. + * + * @param string $name The name of the file (in Unicode) + * + * @see OLE::ascToUcs() + */ + public function __construct($name) + { + parent::__construct(null, $name, OLE::OLE_PPS_TYPE_FILE, null, null, null, null, null, '', []); + } + + /** + * Initialization method. Has to be called right after OLE_PPS_File(). + * + * @return mixed true on success + */ + public function init() + { + return true; + } + + /** + * Append data to PPS. + * + * @param string $data The data to append + */ + public function append($data) + { + $this->_data .= $data; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php new file mode 100644 index 0000000..c52cea2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php @@ -0,0 +1,466 @@ + | +// | Based on OLE::Storage_Lite by Kawai, Takanori | +// +----------------------------------------------------------------------+ +// +use PhpOffice\PhpSpreadsheet\Shared\OLE; +use PhpOffice\PhpSpreadsheet\Shared\OLE\PPS; +use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException; + +/** + * Class for creating Root PPS's for OLE containers. + * + * @author Xavier Noguer + * + * @category PhpSpreadsheet + */ +class Root extends PPS +{ + /** + * Directory for temporary files. + * + * @var string + */ + protected $tempDirectory; + + /** + * @var resource + */ + private $fileHandle; + + /** + * @var string + */ + private $tempFilename; + + /** + * @var int + */ + private $smallBlockSize; + + /** + * @var int + */ + private $bigBlockSize; + + /** + * @param int $time_1st A timestamp + * @param int $time_2nd A timestamp + * @param File[] $raChild + */ + public function __construct($time_1st, $time_2nd, $raChild) + { + $this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir(); + + parent::__construct(null, OLE::ascToUcs('Root Entry'), OLE::OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild); + } + + /** + * Method for saving the whole OLE container (including files). + * In fact, if called with an empty argument (or '-'), it saves to a + * temporary file and then outputs it's contents to stdout. + * If a resource pointer to a stream created by fopen() is passed + * it will be used, but you have to close such stream by yourself. + * + * @param resource|string $filename the name of the file or stream where to save the OLE container + * + * @throws WriterException + * + * @return bool true on success + */ + public function save($filename) + { + // Initial Setting for saving + $this->bigBlockSize = pow( + 2, + (isset($this->bigBlockSize)) ? self::adjust2($this->bigBlockSize) : 9 + ); + $this->smallBlockSize = pow( + 2, + (isset($this->smallBlockSize)) ? self::adjust2($this->smallBlockSize) : 6 + ); + + if (is_resource($filename)) { + $this->fileHandle = $filename; + } elseif ($filename == '-' || $filename == '') { + if ($this->tempDirectory === null) { + $this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir(); + } + $this->tempFilename = tempnam($this->tempDirectory, 'OLE_PPS_Root'); + $this->fileHandle = fopen($this->tempFilename, 'w+b'); + if ($this->fileHandle == false) { + throw new WriterException("Can't create temporary file."); + } + } else { + $this->fileHandle = fopen($filename, 'wb'); + } + if ($this->fileHandle == false) { + throw new WriterException("Can't open $filename. It may be in use or protected."); + } + // Make an array of PPS's (for Save) + $aList = []; + PPS::_savePpsSetPnt($aList, [$this]); + // calculate values for header + [$iSBDcnt, $iBBcnt, $iPPScnt] = $this->_calcSize($aList); //, $rhInfo); + // Save Header + $this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt); + + // Make Small Data string (write SBD) + $this->_data = $this->_makeSmallData($aList); + + // Write BB + $this->_saveBigData($iSBDcnt, $aList); + // Write PPS + $this->_savePps($aList); + // Write Big Block Depot and BDList and Adding Header informations + $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt); + + if (!is_resource($filename)) { + fclose($this->fileHandle); + } + + return true; + } + + /** + * Calculate some numbers. + * + * @param array $raList Reference to an array of PPS's + * + * @return float[] The array of numbers + */ + public function _calcSize(&$raList) + { + // Calculate Basic Setting + [$iSBDcnt, $iBBcnt, $iPPScnt] = [0, 0, 0]; + $iSmallLen = 0; + $iSBcnt = 0; + $iCount = count($raList); + for ($i = 0; $i < $iCount; ++$i) { + if ($raList[$i]->Type == OLE::OLE_PPS_TYPE_FILE) { + $raList[$i]->Size = $raList[$i]->getDataLen(); + if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) { + $iSBcnt += floor($raList[$i]->Size / $this->smallBlockSize) + + (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0); + } else { + $iBBcnt += (floor($raList[$i]->Size / $this->bigBlockSize) + + (($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0)); + } + } + } + $iSmallLen = $iSBcnt * $this->smallBlockSize; + $iSlCnt = floor($this->bigBlockSize / OLE::OLE_LONG_INT_SIZE); + $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0); + $iBBcnt += (floor($iSmallLen / $this->bigBlockSize) + + (($iSmallLen % $this->bigBlockSize) ? 1 : 0)); + $iCnt = count($raList); + $iBdCnt = $this->bigBlockSize / OLE::OLE_PPS_SIZE; + $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0)); + + return [$iSBDcnt, $iBBcnt, $iPPScnt]; + } + + /** + * Helper function for caculating a magic value for block sizes. + * + * @param int $i2 The argument + * + * @see save() + * + * @return float + */ + private static function adjust2($i2) + { + $iWk = log($i2) / log(2); + + return ($iWk > floor($iWk)) ? floor($iWk) + 1 : $iWk; + } + + /** + * Save OLE header. + * + * @param int $iSBDcnt + * @param int $iBBcnt + * @param int $iPPScnt + */ + public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt) + { + $FILE = $this->fileHandle; + + // Calculate Basic Setting + $iBlCnt = $this->bigBlockSize / OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->bigBlockSize - 0x4C) / OLE::OLE_LONG_INT_SIZE; + + $iBdExL = 0; + $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; + $iAllW = $iAll; + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); + $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); + + // Calculate BD count + if ($iBdCnt > $i1stBdL) { + while (1) { + ++$iBdExL; + ++$iAllW; + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); + if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) { + break; + } + } + } + + // Save Header + fwrite( + $FILE, + "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" + . "\x00\x00\x00\x00" + . "\x00\x00\x00\x00" + . "\x00\x00\x00\x00" + . "\x00\x00\x00\x00" + . pack('v', 0x3b) + . pack('v', 0x03) + . pack('v', -2) + . pack('v', 9) + . pack('v', 6) + . pack('v', 0) + . "\x00\x00\x00\x00" + . "\x00\x00\x00\x00" + . pack('V', $iBdCnt) + . pack('V', $iBBcnt + $iSBDcnt) //ROOT START + . pack('V', 0) + . pack('V', 0x1000) + . pack('V', $iSBDcnt ? 0 : -2) //Small Block Depot + . pack('V', $iSBDcnt) + ); + // Extra BDList Start, Count + if ($iBdCnt < $i1stBdL) { + fwrite( + $FILE, + pack('V', -2) // Extra BDList Start + . pack('V', 0)// Extra BDList Count + ); + } else { + fwrite($FILE, pack('V', $iAll + $iBdCnt) . pack('V', $iBdExL)); + } + + // BDList + for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) { + fwrite($FILE, pack('V', $iAll + $i)); + } + if ($i < $i1stBdL) { + $jB = $i1stBdL - $i; + for ($j = 0; $j < $jB; ++$j) { + fwrite($FILE, (pack('V', -1))); + } + } + } + + /** + * Saving big data (PPS's with data bigger than \PhpOffice\PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL). + * + * @param int $iStBlk + * @param array &$raList Reference to array of PPS's + */ + public function _saveBigData($iStBlk, &$raList) + { + $FILE = $this->fileHandle; + + // cycle through PPS's + $iCount = count($raList); + for ($i = 0; $i < $iCount; ++$i) { + if ($raList[$i]->Type != OLE::OLE_PPS_TYPE_DIR) { + $raList[$i]->Size = $raList[$i]->getDataLen(); + if (($raList[$i]->Size >= OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) { + fwrite($FILE, $raList[$i]->_data); + + if ($raList[$i]->Size % $this->bigBlockSize) { + fwrite($FILE, str_repeat("\x00", $this->bigBlockSize - ($raList[$i]->Size % $this->bigBlockSize))); + } + // Set For PPS + $raList[$i]->startBlock = $iStBlk; + $iStBlk += + (floor($raList[$i]->Size / $this->bigBlockSize) + + (($raList[$i]->Size % $this->bigBlockSize) ? 1 : 0)); + } + } + } + } + + /** + * get small data (PPS's with data smaller than \PhpOffice\PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL). + * + * @param array &$raList Reference to array of PPS's + * + * @return string + */ + public function _makeSmallData(&$raList) + { + $sRes = ''; + $FILE = $this->fileHandle; + $iSmBlk = 0; + + $iCount = count($raList); + for ($i = 0; $i < $iCount; ++$i) { + // Make SBD, small data string + if ($raList[$i]->Type == OLE::OLE_PPS_TYPE_FILE) { + if ($raList[$i]->Size <= 0) { + continue; + } + if ($raList[$i]->Size < OLE::OLE_DATA_SIZE_SMALL) { + $iSmbCnt = floor($raList[$i]->Size / $this->smallBlockSize) + + (($raList[$i]->Size % $this->smallBlockSize) ? 1 : 0); + // Add to SBD + $jB = $iSmbCnt - 1; + for ($j = 0; $j < $jB; ++$j) { + fwrite($FILE, pack('V', $j + $iSmBlk + 1)); + } + fwrite($FILE, pack('V', -2)); + + // Add to Data String(this will be written for RootEntry) + $sRes .= $raList[$i]->_data; + if ($raList[$i]->Size % $this->smallBlockSize) { + $sRes .= str_repeat("\x00", $this->smallBlockSize - ($raList[$i]->Size % $this->smallBlockSize)); + } + // Set for PPS + $raList[$i]->startBlock = $iSmBlk; + $iSmBlk += $iSmbCnt; + } + } + } + $iSbCnt = floor($this->bigBlockSize / OLE::OLE_LONG_INT_SIZE); + if ($iSmBlk % $iSbCnt) { + $iB = $iSbCnt - ($iSmBlk % $iSbCnt); + for ($i = 0; $i < $iB; ++$i) { + fwrite($FILE, pack('V', -1)); + } + } + + return $sRes; + } + + /** + * Saves all the PPS's WKs. + * + * @param array $raList Reference to an array with all PPS's + */ + public function _savePps(&$raList) + { + // Save each PPS WK + $iC = count($raList); + for ($i = 0; $i < $iC; ++$i) { + fwrite($this->fileHandle, $raList[$i]->_getPpsWk()); + } + // Adjust for Block + $iCnt = count($raList); + $iBCnt = $this->bigBlockSize / OLE::OLE_PPS_SIZE; + if ($iCnt % $iBCnt) { + fwrite($this->fileHandle, str_repeat("\x00", ($iBCnt - ($iCnt % $iBCnt)) * OLE::OLE_PPS_SIZE)); + } + } + + /** + * Saving Big Block Depot. + * + * @param int $iSbdSize + * @param int $iBsize + * @param int $iPpsCnt + */ + public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt) + { + $FILE = $this->fileHandle; + // Calculate Basic Setting + $iBbCnt = $this->bigBlockSize / OLE::OLE_LONG_INT_SIZE; + $i1stBdL = ($this->bigBlockSize - 0x4C) / OLE::OLE_LONG_INT_SIZE; + + $iBdExL = 0; + $iAll = $iBsize + $iPpsCnt + $iSbdSize; + $iAllW = $iAll; + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); + $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); + // Calculate BD count + if ($iBdCnt > $i1stBdL) { + while (1) { + ++$iBdExL; + ++$iAllW; + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); + if ($iBdCnt <= ($iBdExL * $iBbCnt + $i1stBdL)) { + break; + } + } + } + + // Making BD + // Set for SBD + if ($iSbdSize > 0) { + for ($i = 0; $i < ($iSbdSize - 1); ++$i) { + fwrite($FILE, pack('V', $i + 1)); + } + fwrite($FILE, pack('V', -2)); + } + // Set for B + for ($i = 0; $i < ($iBsize - 1); ++$i) { + fwrite($FILE, pack('V', $i + $iSbdSize + 1)); + } + fwrite($FILE, pack('V', -2)); + + // Set for PPS + for ($i = 0; $i < ($iPpsCnt - 1); ++$i) { + fwrite($FILE, pack('V', $i + $iSbdSize + $iBsize + 1)); + } + fwrite($FILE, pack('V', -2)); + // Set for BBD itself ( 0xFFFFFFFD : BBD) + for ($i = 0; $i < $iBdCnt; ++$i) { + fwrite($FILE, pack('V', 0xFFFFFFFD)); + } + // Set for ExtraBDList + for ($i = 0; $i < $iBdExL; ++$i) { + fwrite($FILE, pack('V', 0xFFFFFFFC)); + } + // Adjust for Block + if (($iAllW + $iBdCnt) % $iBbCnt) { + $iBlock = ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt)); + for ($i = 0; $i < $iBlock; ++$i) { + fwrite($FILE, pack('V', -1)); + } + } + // Extra BDList + if ($iBdCnt > $i1stBdL) { + $iN = 0; + $iNb = 0; + for ($i = $i1stBdL; $i < $iBdCnt; $i++, ++$iN) { + if ($iN >= ($iBbCnt - 1)) { + $iN = 0; + ++$iNb; + fwrite($FILE, pack('V', $iAll + $iBdCnt + $iNb)); + } + fwrite($FILE, pack('V', $iBsize + $iSbdSize + $iPpsCnt + $i)); + } + if (($iBdCnt - $i1stBdL) % ($iBbCnt - 1)) { + $iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1)); + for ($i = 0; $i < $iB; ++$i) { + fwrite($FILE, pack('V', -1)); + } + } + fwrite($FILE, pack('V', -2)); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php new file mode 100644 index 0000000..3af3970 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php @@ -0,0 +1,352 @@ +data = file_get_contents($pFilename, false, null, 0, 8); + + // Check OLE identifier + $identifierOle = pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1); + if ($this->data != $identifierOle) { + throw new ReaderException('The filename ' . $pFilename . ' is not recognised as an OLE file'); + } + + // Get the file data + $this->data = file_get_contents($pFilename); + + // Total number of sectors used for the SAT + $this->numBigBlockDepotBlocks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); + + // SecID of the first sector of the directory stream + $this->rootStartBlock = self::getInt4d($this->data, self::ROOT_START_BLOCK_POS); + + // SecID of the first sector of the SSAT (or -2 if not extant) + $this->sbdStartBlock = self::getInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS); + + // SecID of the first sector of the MSAT (or -2 if no additional sectors are used) + $this->extensionBlock = self::getInt4d($this->data, self::EXTENSION_BLOCK_POS); + + // Total number of sectors used by MSAT + $this->numExtensionBlocks = self::getInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS); + + $bigBlockDepotBlocks = []; + $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS; + + $bbdBlocks = $this->numBigBlockDepotBlocks; + + if ($this->numExtensionBlocks != 0) { + $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS) / 4; + } + + for ($i = 0; $i < $bbdBlocks; ++$i) { + $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); + $pos += 4; + } + + for ($j = 0; $j < $this->numExtensionBlocks; ++$j) { + $pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE; + $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); + + for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) { + $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); + $pos += 4; + } + + $bbdBlocks += $blocksToRead; + if ($bbdBlocks < $this->numBigBlockDepotBlocks) { + $this->extensionBlock = self::getInt4d($this->data, $pos); + } + } + + $pos = 0; + $this->bigBlockChain = ''; + $bbs = self::BIG_BLOCK_SIZE / 4; + for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) { + $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE; + + $this->bigBlockChain .= substr($this->data, $pos, 4 * $bbs); + $pos += 4 * $bbs; + } + + $pos = 0; + $sbdBlock = $this->sbdStartBlock; + $this->smallBlockChain = ''; + while ($sbdBlock != -2) { + $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE; + + $this->smallBlockChain .= substr($this->data, $pos, 4 * $bbs); + $pos += 4 * $bbs; + + $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock * 4); + } + + // read the directory stream + $block = $this->rootStartBlock; + $this->entry = $this->_readData($block); + + $this->readPropertySets(); + } + + /** + * Extract binary stream data. + * + * @param int $stream + * + * @return string + */ + public function getStream($stream) + { + if ($stream === null) { + return null; + } + + $streamData = ''; + + if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) { + $rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']); + + $block = $this->props[$stream]['startBlock']; + + while ($block != -2) { + $pos = $block * self::SMALL_BLOCK_SIZE; + $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE); + + $block = self::getInt4d($this->smallBlockChain, $block * 4); + } + + return $streamData; + } + $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE; + if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) { + ++$numBlocks; + } + + if ($numBlocks == 0) { + return ''; + } + + $block = $this->props[$stream]['startBlock']; + + while ($block != -2) { + $pos = ($block + 1) * self::BIG_BLOCK_SIZE; + $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); + $block = self::getInt4d($this->bigBlockChain, $block * 4); + } + + return $streamData; + } + + /** + * Read a standard stream (by joining sectors using information from SAT). + * + * @param int $bl Sector ID where the stream starts + * + * @return string Data for standard stream + */ + private function _readData($bl) + { + $block = $bl; + $data = ''; + + while ($block != -2) { + $pos = ($block + 1) * self::BIG_BLOCK_SIZE; + $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); + $block = self::getInt4d($this->bigBlockChain, $block * 4); + } + + return $data; + } + + /** + * Read entries in the directory stream. + */ + private function readPropertySets() + { + $offset = 0; + + // loop through entires, each entry is 128 bytes + $entryLen = strlen($this->entry); + while ($offset < $entryLen) { + // entry data (128 bytes) + $d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE); + + // size in bytes of name + $nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS + 1]) << 8); + + // type of entry + $type = ord($d[self::TYPE_POS]); + + // sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook) + // sectorID of first sector of the short-stream container stream, if this entry is root entry + $startBlock = self::getInt4d($d, self::START_BLOCK_POS); + + $size = self::getInt4d($d, self::SIZE_POS); + + $name = str_replace("\x00", '', substr($d, 0, $nameSize)); + + $this->props[] = [ + 'name' => $name, + 'type' => $type, + 'startBlock' => $startBlock, + 'size' => $size, + ]; + + // tmp helper to simplify checks + $upName = strtoupper($name); + + // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook) + if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) { + $this->wrkbook = count($this->props) - 1; + } elseif ($upName === 'ROOT ENTRY' || $upName === 'R') { + // Root entry + $this->rootentry = count($this->props) - 1; + } + + // Summary information + if ($name == chr(5) . 'SummaryInformation') { + $this->summaryInformation = count($this->props) - 1; + } + + // Additional Document Summary information + if ($name == chr(5) . 'DocumentSummaryInformation') { + $this->documentSummaryInformation = count($this->props) - 1; + } + + $offset += self::PROPERTY_STORAGE_BLOCK_SIZE; + } + } + + /** + * Read 4 bytes of data at specified position. + * + * @param string $data + * @param int $pos + * + * @return int + */ + private static function getInt4d($data, $pos) + { + if ($pos < 0) { + // Invalid position + throw new ReaderException('Parameter pos=' . $pos . ' is invalid.'); + } + + $len = strlen($data); + if ($len < $pos + 4) { + $data .= str_repeat("\0", $pos + 4 - $len); + } + + // FIX: represent numbers correctly on 64-bit system + // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 + // Changed by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems + $_or_24 = ord($data[$pos + 3]); + if ($_or_24 >= 128) { + // negative number + $_ord_24 = -abs((256 - $_or_24) << 24); + } else { + $_ord_24 = ($_or_24 & 127) << 24; + } + + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/PasswordHasher.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/PasswordHasher.php new file mode 100644 index 0000000..9b0080b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/PasswordHasher.php @@ -0,0 +1,37 @@ +. + * + * @param string $pPassword Password to hash + * + * @return string Hashed password + */ + public static function hashPassword($pPassword) + { + $password = 0x0000; + $charPos = 1; // char position + + // split the plain text password in its component characters + $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY); + foreach ($chars as $char) { + $value = ord($char) << $charPos++; // shifted ASCII value + $rotated_bits = $value >> 15; // rotated bits beyond bit 15 + $value &= 0x7fff; // first 15 bits + $password ^= ($value | $rotated_bits); + } + + $password ^= strlen($pPassword); + $password ^= 0xCE4B; + + return strtoupper(dechex($password)); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php new file mode 100644 index 0000000..d949203 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php @@ -0,0 +1,722 @@ + chr(0), + "\x1B 1" => chr(1), + "\x1B 2" => chr(2), + "\x1B 3" => chr(3), + "\x1B 4" => chr(4), + "\x1B 5" => chr(5), + "\x1B 6" => chr(6), + "\x1B 7" => chr(7), + "\x1B 8" => chr(8), + "\x1B 9" => chr(9), + "\x1B :" => chr(10), + "\x1B ;" => chr(11), + "\x1B <" => chr(12), + "\x1B =" => chr(13), + "\x1B >" => chr(14), + "\x1B ?" => chr(15), + "\x1B!0" => chr(16), + "\x1B!1" => chr(17), + "\x1B!2" => chr(18), + "\x1B!3" => chr(19), + "\x1B!4" => chr(20), + "\x1B!5" => chr(21), + "\x1B!6" => chr(22), + "\x1B!7" => chr(23), + "\x1B!8" => chr(24), + "\x1B!9" => chr(25), + "\x1B!:" => chr(26), + "\x1B!;" => chr(27), + "\x1B!<" => chr(28), + "\x1B!=" => chr(29), + "\x1B!>" => chr(30), + "\x1B!?" => chr(31), + "\x1B'?" => chr(127), + "\x1B(0" => '€', // 128 in CP1252 + "\x1B(2" => '‚', // 130 in CP1252 + "\x1B(3" => 'ƒ', // 131 in CP1252 + "\x1B(4" => '„', // 132 in CP1252 + "\x1B(5" => '…', // 133 in CP1252 + "\x1B(6" => '†', // 134 in CP1252 + "\x1B(7" => '‡', // 135 in CP1252 + "\x1B(8" => 'ˆ', // 136 in CP1252 + "\x1B(9" => '‰', // 137 in CP1252 + "\x1B(:" => 'Š', // 138 in CP1252 + "\x1B(;" => '‹', // 139 in CP1252 + "\x1BNj" => 'Œ', // 140 in CP1252 + "\x1B(>" => 'Ž', // 142 in CP1252 + "\x1B)1" => '‘', // 145 in CP1252 + "\x1B)2" => '’', // 146 in CP1252 + "\x1B)3" => '“', // 147 in CP1252 + "\x1B)4" => '”', // 148 in CP1252 + "\x1B)5" => '•', // 149 in CP1252 + "\x1B)6" => '–', // 150 in CP1252 + "\x1B)7" => '—', // 151 in CP1252 + "\x1B)8" => '˜', // 152 in CP1252 + "\x1B)9" => '™', // 153 in CP1252 + "\x1B):" => 'š', // 154 in CP1252 + "\x1B);" => '›', // 155 in CP1252 + "\x1BNz" => 'œ', // 156 in CP1252 + "\x1B)>" => 'ž', // 158 in CP1252 + "\x1B)?" => 'Ÿ', // 159 in CP1252 + "\x1B*0" => ' ', // 160 in CP1252 + "\x1BN!" => '¡', // 161 in CP1252 + "\x1BN\"" => '¢', // 162 in CP1252 + "\x1BN#" => '£', // 163 in CP1252 + "\x1BN(" => '¤', // 164 in CP1252 + "\x1BN%" => '¥', // 165 in CP1252 + "\x1B*6" => '¦', // 166 in CP1252 + "\x1BN'" => '§', // 167 in CP1252 + "\x1BNH " => '¨', // 168 in CP1252 + "\x1BNS" => '©', // 169 in CP1252 + "\x1BNc" => 'ª', // 170 in CP1252 + "\x1BN+" => '«', // 171 in CP1252 + "\x1B*<" => '¬', // 172 in CP1252 + "\x1B*=" => '­', // 173 in CP1252 + "\x1BNR" => '®', // 174 in CP1252 + "\x1B*?" => '¯', // 175 in CP1252 + "\x1BN0" => '°', // 176 in CP1252 + "\x1BN1" => '±', // 177 in CP1252 + "\x1BN2" => '²', // 178 in CP1252 + "\x1BN3" => '³', // 179 in CP1252 + "\x1BNB " => '´', // 180 in CP1252 + "\x1BN5" => 'µ', // 181 in CP1252 + "\x1BN6" => '¶', // 182 in CP1252 + "\x1BN7" => '·', // 183 in CP1252 + "\x1B+8" => '¸', // 184 in CP1252 + "\x1BNQ" => '¹', // 185 in CP1252 + "\x1BNk" => 'º', // 186 in CP1252 + "\x1BN;" => '»', // 187 in CP1252 + "\x1BN<" => '¼', // 188 in CP1252 + "\x1BN=" => '½', // 189 in CP1252 + "\x1BN>" => '¾', // 190 in CP1252 + "\x1BN?" => '¿', // 191 in CP1252 + "\x1BNAA" => 'À', // 192 in CP1252 + "\x1BNBA" => 'Á', // 193 in CP1252 + "\x1BNCA" => 'Â', // 194 in CP1252 + "\x1BNDA" => 'Ã', // 195 in CP1252 + "\x1BNHA" => 'Ä', // 196 in CP1252 + "\x1BNJA" => 'Å', // 197 in CP1252 + "\x1BNa" => 'Æ', // 198 in CP1252 + "\x1BNKC" => 'Ç', // 199 in CP1252 + "\x1BNAE" => 'È', // 200 in CP1252 + "\x1BNBE" => 'É', // 201 in CP1252 + "\x1BNCE" => 'Ê', // 202 in CP1252 + "\x1BNHE" => 'Ë', // 203 in CP1252 + "\x1BNAI" => 'Ì', // 204 in CP1252 + "\x1BNBI" => 'Í', // 205 in CP1252 + "\x1BNCI" => 'Î', // 206 in CP1252 + "\x1BNHI" => 'Ï', // 207 in CP1252 + "\x1BNb" => 'Ð', // 208 in CP1252 + "\x1BNDN" => 'Ñ', // 209 in CP1252 + "\x1BNAO" => 'Ò', // 210 in CP1252 + "\x1BNBO" => 'Ó', // 211 in CP1252 + "\x1BNCO" => 'Ô', // 212 in CP1252 + "\x1BNDO" => 'Õ', // 213 in CP1252 + "\x1BNHO" => 'Ö', // 214 in CP1252 + "\x1B-7" => '×', // 215 in CP1252 + "\x1BNi" => 'Ø', // 216 in CP1252 + "\x1BNAU" => 'Ù', // 217 in CP1252 + "\x1BNBU" => 'Ú', // 218 in CP1252 + "\x1BNCU" => 'Û', // 219 in CP1252 + "\x1BNHU" => 'Ü', // 220 in CP1252 + "\x1B-=" => 'Ý', // 221 in CP1252 + "\x1BNl" => 'Þ', // 222 in CP1252 + "\x1BN{" => 'ß', // 223 in CP1252 + "\x1BNAa" => 'à', // 224 in CP1252 + "\x1BNBa" => 'á', // 225 in CP1252 + "\x1BNCa" => 'â', // 226 in CP1252 + "\x1BNDa" => 'ã', // 227 in CP1252 + "\x1BNHa" => 'ä', // 228 in CP1252 + "\x1BNJa" => 'å', // 229 in CP1252 + "\x1BNq" => 'æ', // 230 in CP1252 + "\x1BNKc" => 'ç', // 231 in CP1252 + "\x1BNAe" => 'è', // 232 in CP1252 + "\x1BNBe" => 'é', // 233 in CP1252 + "\x1BNCe" => 'ê', // 234 in CP1252 + "\x1BNHe" => 'ë', // 235 in CP1252 + "\x1BNAi" => 'ì', // 236 in CP1252 + "\x1BNBi" => 'í', // 237 in CP1252 + "\x1BNCi" => 'î', // 238 in CP1252 + "\x1BNHi" => 'ï', // 239 in CP1252 + "\x1BNs" => 'ð', // 240 in CP1252 + "\x1BNDn" => 'ñ', // 241 in CP1252 + "\x1BNAo" => 'ò', // 242 in CP1252 + "\x1BNBo" => 'ó', // 243 in CP1252 + "\x1BNCo" => 'ô', // 244 in CP1252 + "\x1BNDo" => 'õ', // 245 in CP1252 + "\x1BNHo" => 'ö', // 246 in CP1252 + "\x1B/7" => '÷', // 247 in CP1252 + "\x1BNy" => 'ø', // 248 in CP1252 + "\x1BNAu" => 'ù', // 249 in CP1252 + "\x1BNBu" => 'ú', // 250 in CP1252 + "\x1BNCu" => 'û', // 251 in CP1252 + "\x1BNHu" => 'ü', // 252 in CP1252 + "\x1B/=" => 'ý', // 253 in CP1252 + "\x1BN|" => 'þ', // 254 in CP1252 + "\x1BNHy" => 'ÿ', // 255 in CP1252 + ]; + } + + /** + * Get whether iconv extension is available. + * + * @return bool + */ + public static function getIsIconvEnabled() + { + if (isset(self::$isIconvEnabled)) { + return self::$isIconvEnabled; + } + + // Assume no problems with iconv + self::$isIconvEnabled = true; + + // Fail if iconv doesn't exist + if (!function_exists('iconv')) { + self::$isIconvEnabled = false; + } elseif (!@iconv('UTF-8', 'UTF-16LE', 'x')) { + // Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false, + self::$isIconvEnabled = false; + } elseif (defined('PHP_OS') && @stristr(PHP_OS, 'AIX') && defined('ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) { + // CUSTOM: IBM AIX iconv() does not work + self::$isIconvEnabled = false; + } + + // Deactivate iconv default options if they fail (as seen on IMB i) + if (self::$isIconvEnabled && !@iconv('UTF-8', 'UTF-16LE' . self::$iconvOptions, 'x')) { + self::$iconvOptions = ''; + } + + return self::$isIconvEnabled; + } + + private static function buildCharacterSets() + { + if (empty(self::$controlCharacters)) { + self::buildControlCharacters(); + } + + if (empty(self::$SYLKCharacters)) { + self::buildSYLKCharacters(); + } + } + + /** + * Convert from OpenXML escaped control character to PHP control character. + * + * Excel 2007 team: + * ---------------- + * That's correct, control characters are stored directly in the shared-strings table. + * We do encode characters that cannot be represented in XML using the following escape sequence: + * _xHHHH_ where H represents a hexadecimal character in the character's value... + * So you could end up with something like _x0008_ in a string (either in a cell value () + * element or in the shared string element. + * + * @param string $value Value to unescape + * + * @return string + */ + public static function controlCharacterOOXML2PHP($value) + { + self::buildCharacterSets(); + + return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value); + } + + /** + * Convert from PHP control character to OpenXML escaped control character. + * + * Excel 2007 team: + * ---------------- + * That's correct, control characters are stored directly in the shared-strings table. + * We do encode characters that cannot be represented in XML using the following escape sequence: + * _xHHHH_ where H represents a hexadecimal character in the character's value... + * So you could end up with something like _x0008_ in a string (either in a cell value () + * element or in the shared string element. + * + * @param string $value Value to escape + * + * @return string + */ + public static function controlCharacterPHP2OOXML($value) + { + self::buildCharacterSets(); + + return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value); + } + + /** + * Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters. + * + * @param string $value + * + * @return string + */ + public static function sanitizeUTF8($value) + { + if (self::getIsIconvEnabled()) { + $value = @iconv('UTF-8', 'UTF-8', $value); + + return $value; + } + + $value = mb_convert_encoding($value, 'UTF-8', 'UTF-8'); + + return $value; + } + + /** + * Check if a string contains UTF8 data. + * + * @param string $value + * + * @return bool + */ + public static function isUTF8($value) + { + return $value === '' || preg_match('/^./su', $value) === 1; + } + + /** + * Formats a numeric value as a string for output in various output writers forcing + * point as decimal separator in case locale is other than English. + * + * @param mixed $value + * + * @return string + */ + public static function formatNumber($value) + { + if (is_float($value)) { + return str_replace(',', '.', $value); + } + + return (string) $value; + } + + /** + * Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length) + * Writes the string using uncompressed notation, no rich text, no Asian phonetics + * If mbstring extension is not available, ASCII is assumed, and compressed notation is used + * although this will give wrong results for non-ASCII strings + * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3. + * + * @param string $value UTF-8 encoded string + * @param mixed[] $arrcRuns Details of rich text runs in $value + * + * @return string + */ + public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = []) + { + // character count + $ln = self::countCharacters($value, 'UTF-8'); + // option flags + if (empty($arrcRuns)) { + $data = pack('CC', $ln, 0x0001); + // characters + $data .= self::convertEncoding($value, 'UTF-16LE', 'UTF-8'); + } else { + $data = pack('vC', $ln, 0x09); + $data .= pack('v', count($arrcRuns)); + // characters + $data .= self::convertEncoding($value, 'UTF-16LE', 'UTF-8'); + foreach ($arrcRuns as $cRun) { + $data .= pack('v', $cRun['strlen']); + $data .= pack('v', $cRun['fontidx']); + } + } + + return $data; + } + + /** + * Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length) + * Writes the string using uncompressed notation, no rich text, no Asian phonetics + * If mbstring extension is not available, ASCII is assumed, and compressed notation is used + * although this will give wrong results for non-ASCII strings + * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3. + * + * @param string $value UTF-8 encoded string + * + * @return string + */ + public static function UTF8toBIFF8UnicodeLong($value) + { + // character count + $ln = self::countCharacters($value, 'UTF-8'); + + // characters + $chars = self::convertEncoding($value, 'UTF-16LE', 'UTF-8'); + + return pack('vC', $ln, 0x0001) . $chars; + } + + /** + * Convert string from one encoding to another. + * + * @param string $value + * @param string $to Encoding to convert to, e.g. 'UTF-8' + * @param string $from Encoding to convert from, e.g. 'UTF-16LE' + * + * @return string + */ + public static function convertEncoding($value, $to, $from) + { + if (self::getIsIconvEnabled()) { + $result = iconv($from, $to . self::$iconvOptions, $value); + if (false !== $result) { + return $result; + } + } + + return mb_convert_encoding($value, $to, $from); + } + + /** + * Get character count. + * + * @param string $value + * @param string $enc Encoding + * + * @return int Character count + */ + public static function countCharacters($value, $enc = 'UTF-8') + { + return mb_strlen($value, $enc); + } + + /** + * Get a substring of a UTF-8 encoded string. + * + * @param string $pValue UTF-8 encoded string + * @param int $pStart Start offset + * @param int $pLength Maximum number of characters in substring + * + * @return string + */ + public static function substring($pValue, $pStart, $pLength = 0) + { + return mb_substr($pValue, $pStart, $pLength, 'UTF-8'); + } + + /** + * Convert a UTF-8 encoded string to upper case. + * + * @param string $pValue UTF-8 encoded string + * + * @return string + */ + public static function strToUpper($pValue) + { + return mb_convert_case($pValue, MB_CASE_UPPER, 'UTF-8'); + } + + /** + * Convert a UTF-8 encoded string to lower case. + * + * @param string $pValue UTF-8 encoded string + * + * @return string + */ + public static function strToLower($pValue) + { + return mb_convert_case($pValue, MB_CASE_LOWER, 'UTF-8'); + } + + /** + * Convert a UTF-8 encoded string to title/proper case + * (uppercase every first character in each word, lower case all other characters). + * + * @param string $pValue UTF-8 encoded string + * + * @return string + */ + public static function strToTitle($pValue) + { + return mb_convert_case($pValue, MB_CASE_TITLE, 'UTF-8'); + } + + public static function mbIsUpper($char) + { + return mb_strtolower($char, 'UTF-8') != $char; + } + + public static function mbStrSplit($string) + { + // Split at all position not after the start: ^ + // and not before the end: $ + return preg_split('/(?_calculateFormulaValue($fractionFormula); + + return true; + } + + return false; + } + + // function convertToNumberIfFraction() + + /** + * Get the decimal separator. If it has not yet been set explicitly, try to obtain number + * formatting information from locale. + * + * @return string + */ + public static function getDecimalSeparator() + { + if (!isset(self::$decimalSeparator)) { + $localeconv = localeconv(); + self::$decimalSeparator = ($localeconv['decimal_point'] != '') + ? $localeconv['decimal_point'] : $localeconv['mon_decimal_point']; + + if (self::$decimalSeparator == '') { + // Default to . + self::$decimalSeparator = '.'; + } + } + + return self::$decimalSeparator; + } + + /** + * Set the decimal separator. Only used by NumberFormat::toFormattedString() + * to format output by \PhpOffice\PhpSpreadsheet\Writer\Html and \PhpOffice\PhpSpreadsheet\Writer\Pdf. + * + * @param string $pValue Character for decimal separator + */ + public static function setDecimalSeparator($pValue) + { + self::$decimalSeparator = $pValue; + } + + /** + * Get the thousands separator. If it has not yet been set explicitly, try to obtain number + * formatting information from locale. + * + * @return string + */ + public static function getThousandsSeparator() + { + if (!isset(self::$thousandsSeparator)) { + $localeconv = localeconv(); + self::$thousandsSeparator = ($localeconv['thousands_sep'] != '') + ? $localeconv['thousands_sep'] : $localeconv['mon_thousands_sep']; + + if (self::$thousandsSeparator == '') { + // Default to . + self::$thousandsSeparator = ','; + } + } + + return self::$thousandsSeparator; + } + + /** + * Set the thousands separator. Only used by NumberFormat::toFormattedString() + * to format output by \PhpOffice\PhpSpreadsheet\Writer\Html and \PhpOffice\PhpSpreadsheet\Writer\Pdf. + * + * @param string $pValue Character for thousands separator + */ + public static function setThousandsSeparator($pValue) + { + self::$thousandsSeparator = $pValue; + } + + /** + * Get the currency code. If it has not yet been set explicitly, try to obtain the + * symbol information from locale. + * + * @return string + */ + public static function getCurrencyCode() + { + if (!empty(self::$currencyCode)) { + return self::$currencyCode; + } + self::$currencyCode = '$'; + $localeconv = localeconv(); + if (!empty($localeconv['currency_symbol'])) { + self::$currencyCode = $localeconv['currency_symbol']; + + return self::$currencyCode; + } + if (!empty($localeconv['int_curr_symbol'])) { + self::$currencyCode = $localeconv['int_curr_symbol']; + + return self::$currencyCode; + } + + return self::$currencyCode; + } + + /** + * Set the currency code. Only used by NumberFormat::toFormattedString() + * to format output by \PhpOffice\PhpSpreadsheet\Writer\Html and \PhpOffice\PhpSpreadsheet\Writer\Pdf. + * + * @param string $pValue Character for currency code + */ + public static function setCurrencyCode($pValue) + { + self::$currencyCode = $pValue; + } + + /** + * Convert SYLK encoded string to UTF-8. + * + * @param string $pValue + * + * @return string UTF-8 encoded string + */ + public static function SYLKtoUTF8($pValue) + { + self::buildCharacterSets(); + + // If there is no escape character in the string there is nothing to do + if (strpos($pValue, '') === false) { + return $pValue; + } + + foreach (self::$SYLKCharacters as $k => $v) { + $pValue = str_replace($k, $v, $pValue); + } + + return $pValue; + } + + /** + * Retrieve any leading numeric part of a string, or return the full string if no leading numeric + * (handles basic integer or float, but not exponent or non decimal). + * + * @param string $value + * + * @return mixed string or only the leading numeric part of the string + */ + public static function testStringAsNumeric($value) + { + if (is_numeric($value)) { + return $value; + } + $v = (float) $value; + + return (is_numeric(substr($value, 0, strlen($v)))) ? $v : $value; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/TimeZone.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/TimeZone.php new file mode 100644 index 0000000..e5a99b9 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/TimeZone.php @@ -0,0 +1,87 @@ +getTransitions($timestamp, $timestamp); + + return (count($transitions) > 0) ? $transitions[0]['offset'] : 0; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/BestFit.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/BestFit.php new file mode 100644 index 0000000..d8e63d5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/BestFit.php @@ -0,0 +1,463 @@ +error; + } + + public function getBestFitType() + { + return $this->bestFitType; + } + + /** + * Return the Y-Value for a specified value of X. + * + * @param float $xValue X-Value + * + * @return bool Y-Value + */ + public function getValueOfYForX($xValue) + { + return false; + } + + /** + * Return the X-Value for a specified value of Y. + * + * @param float $yValue Y-Value + * + * @return bool X-Value + */ + public function getValueOfXForY($yValue) + { + return false; + } + + /** + * Return the original set of X-Values. + * + * @return float[] X-Values + */ + public function getXValues() + { + return $this->xValues; + } + + /** + * Return the Equation of the best-fit line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return bool + */ + public function getEquation($dp = 0) + { + return false; + } + + /** + * Return the Slope of the line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return float + */ + public function getSlope($dp = 0) + { + if ($dp != 0) { + return round($this->slope, $dp); + } + + return $this->slope; + } + + /** + * Return the standard error of the Slope. + * + * @param int $dp Number of places of decimal precision to display + * + * @return float + */ + public function getSlopeSE($dp = 0) + { + if ($dp != 0) { + return round($this->slopeSE, $dp); + } + + return $this->slopeSE; + } + + /** + * Return the Value of X where it intersects Y = 0. + * + * @param int $dp Number of places of decimal precision to display + * + * @return float + */ + public function getIntersect($dp = 0) + { + if ($dp != 0) { + return round($this->intersect, $dp); + } + + return $this->intersect; + } + + /** + * Return the standard error of the Intersect. + * + * @param int $dp Number of places of decimal precision to display + * + * @return float + */ + public function getIntersectSE($dp = 0) + { + if ($dp != 0) { + return round($this->intersectSE, $dp); + } + + return $this->intersectSE; + } + + /** + * Return the goodness of fit for this regression. + * + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getGoodnessOfFit($dp = 0) + { + if ($dp != 0) { + return round($this->goodnessOfFit, $dp); + } + + return $this->goodnessOfFit; + } + + /** + * Return the goodness of fit for this regression. + * + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getGoodnessOfFitPercent($dp = 0) + { + if ($dp != 0) { + return round($this->goodnessOfFit * 100, $dp); + } + + return $this->goodnessOfFit * 100; + } + + /** + * Return the standard deviation of the residuals for this regression. + * + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getStdevOfResiduals($dp = 0) + { + if ($dp != 0) { + return round($this->stdevOfResiduals, $dp); + } + + return $this->stdevOfResiduals; + } + + /** + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getSSRegression($dp = 0) + { + if ($dp != 0) { + return round($this->SSRegression, $dp); + } + + return $this->SSRegression; + } + + /** + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getSSResiduals($dp = 0) + { + if ($dp != 0) { + return round($this->SSResiduals, $dp); + } + + return $this->SSResiduals; + } + + /** + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getDFResiduals($dp = 0) + { + if ($dp != 0) { + return round($this->DFResiduals, $dp); + } + + return $this->DFResiduals; + } + + /** + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getF($dp = 0) + { + if ($dp != 0) { + return round($this->f, $dp); + } + + return $this->f; + } + + /** + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getCovariance($dp = 0) + { + if ($dp != 0) { + return round($this->covariance, $dp); + } + + return $this->covariance; + } + + /** + * @param int $dp Number of places of decimal precision to return + * + * @return float + */ + public function getCorrelation($dp = 0) + { + if ($dp != 0) { + return round($this->correlation, $dp); + } + + return $this->correlation; + } + + /** + * @return float[] + */ + public function getYBestFitValues() + { + return $this->yBestFitValues; + } + + protected function calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const) + { + $SSres = $SScov = $SScor = $SStot = $SSsex = 0.0; + foreach ($this->xValues as $xKey => $xValue) { + $bestFitY = $this->yBestFitValues[$xKey] = $this->getValueOfYForX($xValue); + + $SSres += ($this->yValues[$xKey] - $bestFitY) * ($this->yValues[$xKey] - $bestFitY); + if ($const) { + $SStot += ($this->yValues[$xKey] - $meanY) * ($this->yValues[$xKey] - $meanY); + } else { + $SStot += $this->yValues[$xKey] * $this->yValues[$xKey]; + } + $SScov += ($this->xValues[$xKey] - $meanX) * ($this->yValues[$xKey] - $meanY); + if ($const) { + $SSsex += ($this->xValues[$xKey] - $meanX) * ($this->xValues[$xKey] - $meanX); + } else { + $SSsex += $this->xValues[$xKey] * $this->xValues[$xKey]; + } + } + + $this->SSResiduals = $SSres; + $this->DFResiduals = $this->valueCount - 1 - $const; + + if ($this->DFResiduals == 0.0) { + $this->stdevOfResiduals = 0.0; + } else { + $this->stdevOfResiduals = sqrt($SSres / $this->DFResiduals); + } + if (($SStot == 0.0) || ($SSres == $SStot)) { + $this->goodnessOfFit = 1; + } else { + $this->goodnessOfFit = 1 - ($SSres / $SStot); + } + + $this->SSRegression = $this->goodnessOfFit * $SStot; + $this->covariance = $SScov / $this->valueCount; + $this->correlation = ($this->valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->valueCount * $sumX2 - pow($sumX, 2)) * ($this->valueCount * $sumY2 - pow($sumY, 2))); + $this->slopeSE = $this->stdevOfResiduals / sqrt($SSsex); + $this->intersectSE = $this->stdevOfResiduals * sqrt(1 / ($this->valueCount - ($sumX * $sumX) / $sumX2)); + if ($this->SSResiduals != 0.0) { + if ($this->DFResiduals == 0.0) { + $this->f = 0.0; + } else { + $this->f = $this->SSRegression / ($this->SSResiduals / $this->DFResiduals); + } + } else { + if ($this->DFResiduals == 0.0) { + $this->f = 0.0; + } else { + $this->f = $this->SSRegression / $this->DFResiduals; + } + } + } + + /** + * @param float[] $yValues + * @param float[] $xValues + * @param bool $const + */ + protected function leastSquareFit(array $yValues, array $xValues, $const) + { + // calculate sums + $x_sum = array_sum($xValues); + $y_sum = array_sum($yValues); + $meanX = $x_sum / $this->valueCount; + $meanY = $y_sum / $this->valueCount; + $mBase = $mDivisor = $xx_sum = $xy_sum = $yy_sum = 0.0; + for ($i = 0; $i < $this->valueCount; ++$i) { + $xy_sum += $xValues[$i] * $yValues[$i]; + $xx_sum += $xValues[$i] * $xValues[$i]; + $yy_sum += $yValues[$i] * $yValues[$i]; + + if ($const) { + $mBase += ($xValues[$i] - $meanX) * ($yValues[$i] - $meanY); + $mDivisor += ($xValues[$i] - $meanX) * ($xValues[$i] - $meanX); + } else { + $mBase += $xValues[$i] * $yValues[$i]; + $mDivisor += $xValues[$i] * $xValues[$i]; + } + } + + // calculate slope + $this->slope = $mBase / $mDivisor; + + // calculate intersect + if ($const) { + $this->intersect = $meanY - ($this->slope * $meanX); + } else { + $this->intersect = 0; + } + + $this->calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, $meanX, $meanY, $const); + } + + /** + * Define the regression. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + public function __construct($yValues, $xValues = [], $const = true) + { + // Calculate number of points + $nY = count($yValues); + $nX = count($xValues); + + // Define X Values if necessary + if ($nX == 0) { + $xValues = range(1, $nY); + } elseif ($nY != $nX) { + // Ensure both arrays of points are the same size + $this->error = true; + } + + $this->valueCount = $nY; + $this->xValues = $xValues; + $this->yValues = $yValues; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php new file mode 100644 index 0000000..5b57f4b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php @@ -0,0 +1,122 @@ +getIntersect() * pow($this->getSlope(), ($xValue - $this->xOffset)); + } + + /** + * Return the X-Value for a specified value of Y. + * + * @param float $yValue Y-Value + * + * @return float X-Value + */ + public function getValueOfXForY($yValue) + { + return log(($yValue + $this->yOffset) / $this->getIntersect()) / log($this->getSlope()); + } + + /** + * Return the Equation of the best-fit line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return string + */ + public function getEquation($dp = 0) + { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + return 'Y = ' . $intersect . ' * ' . $slope . '^X'; + } + + /** + * Return the Slope of the line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return float + */ + public function getSlope($dp = 0) + { + if ($dp != 0) { + return round(exp($this->slope), $dp); + } + + return exp($this->slope); + } + + /** + * Return the Value of X where it intersects Y = 0. + * + * @param int $dp Number of places of decimal precision to display + * + * @return float + */ + public function getIntersect($dp = 0) + { + if ($dp != 0) { + return round(exp($this->intersect), $dp); + } + + return exp($this->intersect); + } + + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + private function exponentialRegression($yValues, $xValues, $const) + { + foreach ($yValues as &$value) { + if ($value < 0.0) { + $value = 0 - log(abs($value)); + } elseif ($value > 0.0) { + $value = log($value); + } + } + unset($value); + + $this->leastSquareFit($yValues, $xValues, $const); + } + + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + public function __construct($yValues, $xValues = [], $const = true) + { + parent::__construct($yValues, $xValues); + + if (!$this->error) { + $this->exponentialRegression($yValues, $xValues, $const); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php new file mode 100644 index 0000000..217f096 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php @@ -0,0 +1,81 @@ +getIntersect() + $this->getSlope() * $xValue; + } + + /** + * Return the X-Value for a specified value of Y. + * + * @param float $yValue Y-Value + * + * @return float X-Value + */ + public function getValueOfXForY($yValue) + { + return ($yValue - $this->getIntersect()) / $this->getSlope(); + } + + /** + * Return the Equation of the best-fit line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return string + */ + public function getEquation($dp = 0) + { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + return 'Y = ' . $intersect . ' + ' . $slope . ' * X'; + } + + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + private function linearRegression($yValues, $xValues, $const) + { + $this->leastSquareFit($yValues, $xValues, $const); + } + + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + public function __construct($yValues, $xValues = [], $const = true) + { + parent::__construct($yValues, $xValues); + + if (!$this->error) { + $this->linearRegression($yValues, $xValues, $const); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php new file mode 100644 index 0000000..96ca2ed --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php @@ -0,0 +1,90 @@ +getIntersect() + $this->getSlope() * log($xValue - $this->xOffset); + } + + /** + * Return the X-Value for a specified value of Y. + * + * @param float $yValue Y-Value + * + * @return float X-Value + */ + public function getValueOfXForY($yValue) + { + return exp(($yValue - $this->getIntersect()) / $this->getSlope()); + } + + /** + * Return the Equation of the best-fit line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return string + */ + public function getEquation($dp = 0) + { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + return 'Y = ' . $intersect . ' + ' . $slope . ' * log(X)'; + } + + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + private function logarithmicRegression($yValues, $xValues, $const) + { + foreach ($xValues as &$value) { + if ($value < 0.0) { + $value = 0 - log(abs($value)); + } elseif ($value > 0.0) { + $value = log($value); + } + } + unset($value); + + $this->leastSquareFit($yValues, $xValues, $const); + } + + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + public function __construct($yValues, $xValues = [], $const = true) + { + parent::__construct($yValues, $xValues); + + if (!$this->error) { + $this->logarithmicRegression($yValues, $xValues, $const); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php new file mode 100644 index 0000000..a151049 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php @@ -0,0 +1,200 @@ +order; + } + + /** + * Return the Y-Value for a specified value of X. + * + * @param float $xValue X-Value + * + * @return float Y-Value + */ + public function getValueOfYForX($xValue) + { + $retVal = $this->getIntersect(); + $slope = $this->getSlope(); + foreach ($slope as $key => $value) { + if ($value != 0.0) { + $retVal += $value * pow($xValue, $key + 1); + } + } + + return $retVal; + } + + /** + * Return the X-Value for a specified value of Y. + * + * @param float $yValue Y-Value + * + * @return float X-Value + */ + public function getValueOfXForY($yValue) + { + return ($yValue - $this->getIntersect()) / $this->getSlope(); + } + + /** + * Return the Equation of the best-fit line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return string + */ + public function getEquation($dp = 0) + { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + $equation = 'Y = ' . $intersect; + foreach ($slope as $key => $value) { + if ($value != 0.0) { + $equation .= ' + ' . $value . ' * X'; + if ($key > 0) { + $equation .= '^' . ($key + 1); + } + } + } + + return $equation; + } + + /** + * Return the Slope of the line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return string + */ + public function getSlope($dp = 0) + { + if ($dp != 0) { + $coefficients = []; + foreach ($this->slope as $coefficient) { + $coefficients[] = round($coefficient, $dp); + } + + return $coefficients; + } + + return $this->slope; + } + + public function getCoefficients($dp = 0) + { + return array_merge([$this->getIntersect($dp)], $this->getSlope($dp)); + } + + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param int $order Order of Polynomial for this regression + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + */ + private function polynomialRegression($order, $yValues, $xValues) + { + // calculate sums + $x_sum = array_sum($xValues); + $y_sum = array_sum($yValues); + $xx_sum = $xy_sum = $yy_sum = 0; + for ($i = 0; $i < $this->valueCount; ++$i) { + $xy_sum += $xValues[$i] * $yValues[$i]; + $xx_sum += $xValues[$i] * $xValues[$i]; + $yy_sum += $yValues[$i] * $yValues[$i]; + } + /* + * This routine uses logic from the PHP port of polyfit version 0.1 + * written by Michael Bommarito and Paul Meagher + * + * The function fits a polynomial function of order $order through + * a series of x-y data points using least squares. + * + */ + $A = []; + $B = []; + for ($i = 0; $i < $this->valueCount; ++$i) { + for ($j = 0; $j <= $order; ++$j) { + $A[$i][$j] = pow($xValues[$i], $j); + } + } + for ($i = 0; $i < $this->valueCount; ++$i) { + $B[$i] = [$yValues[$i]]; + } + $matrixA = new Matrix($A); + $matrixB = new Matrix($B); + $C = $matrixA->solve($matrixB); + + $coefficients = []; + for ($i = 0; $i < $C->getRowDimension(); ++$i) { + $r = $C->get($i, 0); + if (abs($r) <= pow(10, -9)) { + $r = 0; + } + $coefficients[] = $r; + } + + $this->intersect = array_shift($coefficients); + $this->slope = $coefficients; + + $this->calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, 0, 0, 0); + foreach ($this->xValues as $xKey => $xValue) { + $this->yBestFitValues[$xKey] = $this->getValueOfYForX($xValue); + } + } + + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param int $order Order of Polynomial for this regression + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + public function __construct($order, $yValues, $xValues = [], $const = true) + { + parent::__construct($yValues, $xValues); + + if (!$this->error) { + if ($order < $this->valueCount) { + $this->bestFitType .= '_' . $order; + $this->order = $order; + $this->polynomialRegression($order, $yValues, $xValues); + if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) { + $this->error = true; + } + } else { + $this->error = true; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php new file mode 100644 index 0000000..4eefec8 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php @@ -0,0 +1,114 @@ +getIntersect() * pow(($xValue - $this->xOffset), $this->getSlope()); + } + + /** + * Return the X-Value for a specified value of Y. + * + * @param float $yValue Y-Value + * + * @return float X-Value + */ + public function getValueOfXForY($yValue) + { + return pow((($yValue + $this->yOffset) / $this->getIntersect()), (1 / $this->getSlope())); + } + + /** + * Return the Equation of the best-fit line. + * + * @param int $dp Number of places of decimal precision to display + * + * @return string + */ + public function getEquation($dp = 0) + { + $slope = $this->getSlope($dp); + $intersect = $this->getIntersect($dp); + + return 'Y = ' . $intersect . ' * X^' . $slope; + } + + /** + * Return the Value of X where it intersects Y = 0. + * + * @param int $dp Number of places of decimal precision to display + * + * @return float + */ + public function getIntersect($dp = 0) + { + if ($dp != 0) { + return round(exp($this->intersect), $dp); + } + + return exp($this->intersect); + } + + /** + * Execute the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + private function powerRegression($yValues, $xValues, $const) + { + foreach ($xValues as &$value) { + if ($value < 0.0) { + $value = 0 - log(abs($value)); + } elseif ($value > 0.0) { + $value = log($value); + } + } + unset($value); + foreach ($yValues as &$value) { + if ($value < 0.0) { + $value = 0 - log(abs($value)); + } elseif ($value > 0.0) { + $value = log($value); + } + } + unset($value); + + $this->leastSquareFit($yValues, $xValues, $const); + } + + /** + * Define the regression and calculate the goodness of fit for a set of X and Y data values. + * + * @param float[] $yValues The set of Y-values for this regression + * @param float[] $xValues The set of X-values for this regression + * @param bool $const + */ + public function __construct($yValues, $xValues = [], $const = true) + { + parent::__construct($yValues, $xValues); + + if (!$this->error) { + $this->powerRegression($yValues, $xValues, $const); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php new file mode 100644 index 0000000..1b7b390 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Trend/Trend.php @@ -0,0 +1,120 @@ +getGoodnessOfFit(); + } + if ($trendType != self::TREND_BEST_FIT_NO_POLY) { + foreach (self::$trendTypePolynomialOrders as $trendMethod) { + $order = substr($trendMethod, -1); + $bestFit[$trendMethod] = new PolynomialBestFit($order, $yValues, $xValues, $const); + if ($bestFit[$trendMethod]->getError()) { + unset($bestFit[$trendMethod]); + } else { + $bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit(); + } + } + } + // Determine which of our Trend lines is the best fit, and then we return the instance of that Trend class + arsort($bestFitValue); + $bestFitType = key($bestFitValue); + + return $bestFit[$bestFitType]; + default: + return false; + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php new file mode 100644 index 0000000..4f7a6a0 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/XMLWriter.php @@ -0,0 +1,92 @@ +openMemory(); + } else { + // Create temporary filename + if ($pTemporaryStorageFolder === null) { + $pTemporaryStorageFolder = File::sysGetTempDir(); + } + $this->tempFileName = @tempnam($pTemporaryStorageFolder, 'xml'); + + // Open storage + if ($this->openUri($this->tempFileName) === false) { + // Fallback to memory... + $this->openMemory(); + } + } + + // Set default values + if (self::$debugEnabled) { + $this->setIndent(true); + } + } + + /** + * Destructor. + */ + public function __destruct() + { + // Unlink temporary files + if ($this->tempFileName != '') { + @unlink($this->tempFileName); + } + } + + /** + * Get written data. + * + * @return string + */ + public function getData() + { + if ($this->tempFileName == '') { + return $this->outputMemory(true); + } + $this->flush(); + + return file_get_contents($this->tempFileName); + } + + /** + * Wrapper method for writeRaw. + * + * @param string|string[] $text + * + * @return bool + */ + public function writeRawData($text) + { + if (is_array($text)) { + $text = implode("\n", $text); + } + + return $this->writeRaw(htmlspecialchars($text)); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Xls.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Xls.php new file mode 100644 index 0000000..b8ce5e2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/Xls.php @@ -0,0 +1,281 @@ +getParent()->getDefaultStyle()->getFont(); + + $columnDimensions = $sheet->getColumnDimensions(); + + // first find the true column width in pixels (uncollapsed and unhidden) + if (isset($columnDimensions[$col]) and $columnDimensions[$col]->getWidth() != -1) { + // then we have column dimension with explicit width + $columnDimension = $columnDimensions[$col]; + $width = $columnDimension->getWidth(); + $pixelWidth = Drawing::cellDimensionToPixels($width, $font); + } elseif ($sheet->getDefaultColumnDimension()->getWidth() != -1) { + // then we have default column dimension with explicit width + $defaultColumnDimension = $sheet->getDefaultColumnDimension(); + $width = $defaultColumnDimension->getWidth(); + $pixelWidth = Drawing::cellDimensionToPixels($width, $font); + } else { + // we don't even have any default column dimension. Width depends on default font + $pixelWidth = Font::getDefaultColumnWidthByFont($font, true); + } + + // now find the effective column width in pixels + if (isset($columnDimensions[$col]) and !$columnDimensions[$col]->getVisible()) { + $effectivePixelWidth = 0; + } else { + $effectivePixelWidth = $pixelWidth; + } + + return $effectivePixelWidth; + } + + /** + * Convert the height of a cell from user's units to pixels. By interpolation + * the relationship is: y = 4/3x. If the height hasn't been set by the user we + * use the default value. If the row is hidden we use a value of zero. + * + * @param Worksheet $sheet The sheet + * @param int $row The row index (1-based) + * + * @return int The width in pixels + */ + public static function sizeRow($sheet, $row = 1) + { + // default font of the workbook + $font = $sheet->getParent()->getDefaultStyle()->getFont(); + + $rowDimensions = $sheet->getRowDimensions(); + + // first find the true row height in pixels (uncollapsed and unhidden) + if (isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) { + // then we have a row dimension + $rowDimension = $rowDimensions[$row]; + $rowHeight = $rowDimension->getRowHeight(); + $pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10 + } elseif ($sheet->getDefaultRowDimension()->getRowHeight() != -1) { + // then we have a default row dimension with explicit height + $defaultRowDimension = $sheet->getDefaultRowDimension(); + $rowHeight = $defaultRowDimension->getRowHeight(); + $pixelRowHeight = Drawing::pointsToPixels($rowHeight); + } else { + // we don't even have any default row dimension. Height depends on default font + $pointRowHeight = Font::getDefaultRowHeightByFont($font); + $pixelRowHeight = Font::fontSizeToPixels($pointRowHeight); + } + + // now find the effective row height in pixels + if (isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible()) { + $effectivePixelRowHeight = 0; + } else { + $effectivePixelRowHeight = $pixelRowHeight; + } + + return $effectivePixelRowHeight; + } + + /** + * Get the horizontal distance in pixels between two anchors + * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets. + * + * @param Worksheet $sheet + * @param string $startColumn + * @param int $startOffsetX Offset within start cell measured in 1/1024 of the cell width + * @param string $endColumn + * @param int $endOffsetX Offset within end cell measured in 1/1024 of the cell width + * + * @return int Horizontal measured in pixels + */ + public static function getDistanceX(Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0) + { + $distanceX = 0; + + // add the widths of the spanning columns + $startColumnIndex = Coordinate::columnIndexFromString($startColumn); + $endColumnIndex = Coordinate::columnIndexFromString($endColumn); + for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) { + $distanceX += self::sizeCol($sheet, Coordinate::stringFromColumnIndex($i)); + } + + // correct for offsetX in startcell + $distanceX -= (int) floor(self::sizeCol($sheet, $startColumn) * $startOffsetX / 1024); + + // correct for offsetX in endcell + $distanceX -= (int) floor(self::sizeCol($sheet, $endColumn) * (1 - $endOffsetX / 1024)); + + return $distanceX; + } + + /** + * Get the vertical distance in pixels between two anchors + * The distanceY is found as sum of all the spanning rows minus two offsets. + * + * @param Worksheet $sheet + * @param int $startRow (1-based) + * @param int $startOffsetY Offset within start cell measured in 1/256 of the cell height + * @param int $endRow (1-based) + * @param int $endOffsetY Offset within end cell measured in 1/256 of the cell height + * + * @return int Vertical distance measured in pixels + */ + public static function getDistanceY(Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0) + { + $distanceY = 0; + + // add the widths of the spanning rows + for ($row = $startRow; $row <= $endRow; ++$row) { + $distanceY += self::sizeRow($sheet, $row); + } + + // correct for offsetX in startcell + $distanceY -= (int) floor(self::sizeRow($sheet, $startRow) * $startOffsetY / 256); + + // correct for offsetX in endcell + $distanceY -= (int) floor(self::sizeRow($sheet, $endRow) * (1 - $endOffsetY / 256)); + + return $distanceY; + } + + /** + * Convert 1-cell anchor coordinates to 2-cell anchor coordinates + * This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications. + * + * Calculate the vertices that define the position of the image as required by + * the OBJ record. + * + * +------------+------------+ + * | A | B | + * +-----+------------+------------+ + * | |(x1,y1) | | + * | 1 |(A1)._______|______ | + * | | | | | + * | | | | | + * +-----+----| BITMAP |-----+ + * | | | | | + * | 2 | |______________. | + * | | | (B2)| + * | | | (x2,y2)| + * +---- +------------+------------+ + * + * Example of a bitmap that covers some of the area from cell A1 to cell B2. + * + * Based on the width and height of the bitmap we need to calculate 8 vars: + * $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2. + * The width and height of the cells are also variable and have to be taken into + * account. + * The values of $col_start and $row_start are passed in from the calling + * function. The values of $col_end and $row_end are calculated by subtracting + * the width and height of the bitmap from the width and height of the + * underlying cells. + * The vertices are expressed as a percentage of the underlying cell width as + * follows (rhs values are in pixels): + * + * x1 = X / W *1024 + * y1 = Y / H *256 + * x2 = (X-1) / W *1024 + * y2 = (Y-1) / H *256 + * + * Where: X is distance from the left side of the underlying cell + * Y is distance from the top of the underlying cell + * W is the width of the cell + * H is the height of the cell + * + * @param Worksheet $sheet + * @param string $coordinates E.g. 'A1' + * @param int $offsetX Horizontal offset in pixels + * @param int $offsetY Vertical offset in pixels + * @param int $width Width in pixels + * @param int $height Height in pixels + * + * @return array + */ + public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height) + { + [$column, $row] = Coordinate::coordinateFromString($coordinates); + $col_start = Coordinate::columnIndexFromString($column); + $row_start = $row - 1; + + $x1 = $offsetX; + $y1 = $offsetY; + + // Initialise end cell to the same as the start cell + $col_end = $col_start; // Col containing lower right corner of object + $row_end = $row_start; // Row containing bottom right corner of object + + // Zero the specified offset if greater than the cell dimensions + if ($x1 >= self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_start))) { + $x1 = 0; + } + if ($y1 >= self::sizeRow($sheet, $row_start + 1)) { + $y1 = 0; + } + + $width = $width + $x1 - 1; + $height = $height + $y1 - 1; + + // Subtract the underlying cell widths to find the end cell of the image + while ($width >= self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_end))) { + $width -= self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_end)); + ++$col_end; + } + + // Subtract the underlying cell heights to find the end cell of the image + while ($height >= self::sizeRow($sheet, $row_end + 1)) { + $height -= self::sizeRow($sheet, $row_end + 1); + ++$row_end; + } + + // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell + // with zero height or width. + if (self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_start)) == 0) { + return; + } + if (self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_end)) == 0) { + return; + } + if (self::sizeRow($sheet, $row_start + 1) == 0) { + return; + } + if (self::sizeRow($sheet, $row_end + 1) == 0) { + return; + } + + // Convert the pixel values to the percentage value expected by Excel + $x1 = $x1 / self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_start)) * 1024; + $y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256; + $x2 = ($width + 1) / self::sizeCol($sheet, Coordinate::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object + $y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object + + $startCoordinates = Coordinate::stringFromColumnIndex($col_start) . ($row_start + 1); + $endCoordinates = Coordinate::stringFromColumnIndex($col_end) . ($row_end + 1); + + return [ + 'startCoordinates' => $startCoordinates, + 'startOffsetX' => $x1, + 'startOffsetY' => $y1, + 'endCoordinates' => $endCoordinates, + 'endOffsetX' => $x2, + 'endOffsetY' => $y2, + ]; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php new file mode 100644 index 0000000..d33a987 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php @@ -0,0 +1,1490 @@ +hasMacros; + } + + /** + * Define if a workbook has macros. + * + * @param bool $hasMacros true|false + */ + public function setHasMacros($hasMacros) + { + $this->hasMacros = (bool) $hasMacros; + } + + /** + * Set the macros code. + * + * @param string $macroCode string|null + */ + public function setMacrosCode($macroCode) + { + $this->macrosCode = $macroCode; + $this->setHasMacros($macroCode !== null); + } + + /** + * Return the macros code. + * + * @return null|string + */ + public function getMacrosCode() + { + return $this->macrosCode; + } + + /** + * Set the macros certificate. + * + * @param null|string $certificate + */ + public function setMacrosCertificate($certificate) + { + $this->macrosCertificate = $certificate; + } + + /** + * Is the project signed ? + * + * @return bool true|false + */ + public function hasMacrosCertificate() + { + return $this->macrosCertificate !== null; + } + + /** + * Return the macros certificate. + * + * @return null|string + */ + public function getMacrosCertificate() + { + return $this->macrosCertificate; + } + + /** + * Remove all macros, certificate from spreadsheet. + */ + public function discardMacros() + { + $this->hasMacros = false; + $this->macrosCode = null; + $this->macrosCertificate = null; + } + + /** + * set ribbon XML data. + * + * @param null|mixed $target + * @param null|mixed $xmlData + */ + public function setRibbonXMLData($target, $xmlData) + { + if ($target !== null && $xmlData !== null) { + $this->ribbonXMLData = ['target' => $target, 'data' => $xmlData]; + } else { + $this->ribbonXMLData = null; + } + } + + /** + * retrieve ribbon XML Data. + * + * return string|null|array + * + * @param string $what + * + * @return string + */ + public function getRibbonXMLData($what = 'all') //we need some constants here... + { + $returnData = null; + $what = strtolower($what); + switch ($what) { + case 'all': + $returnData = $this->ribbonXMLData; + + break; + case 'target': + case 'data': + if (is_array($this->ribbonXMLData) && isset($this->ribbonXMLData[$what])) { + $returnData = $this->ribbonXMLData[$what]; + } + + break; + } + + return $returnData; + } + + /** + * store binaries ribbon objects (pictures). + * + * @param null|mixed $BinObjectsNames + * @param null|mixed $BinObjectsData + */ + public function setRibbonBinObjects($BinObjectsNames, $BinObjectsData) + { + if ($BinObjectsNames !== null && $BinObjectsData !== null) { + $this->ribbonBinObjects = ['names' => $BinObjectsNames, 'data' => $BinObjectsData]; + } else { + $this->ribbonBinObjects = null; + } + } + + /** + * List of unparsed loaded data for export to same format with better compatibility. + * It has to be minimized when the library start to support currently unparsed data. + * + * @internal + * + * @return array + */ + public function getUnparsedLoadedData() + { + return $this->unparsedLoadedData; + } + + /** + * List of unparsed loaded data for export to same format with better compatibility. + * It has to be minimized when the library start to support currently unparsed data. + * + * @internal + * + * @param array $unparsedLoadedData + */ + public function setUnparsedLoadedData(array $unparsedLoadedData) + { + $this->unparsedLoadedData = $unparsedLoadedData; + } + + /** + * return the extension of a filename. Internal use for a array_map callback (php<5.3 don't like lambda function). + * + * @param mixed $path + * + * @return string + */ + private function getExtensionOnly($path) + { + return pathinfo($path, PATHINFO_EXTENSION); + } + + /** + * retrieve Binaries Ribbon Objects. + * + * @param string $what + * + * @return null|array + */ + public function getRibbonBinObjects($what = 'all') + { + $ReturnData = null; + $what = strtolower($what); + switch ($what) { + case 'all': + return $this->ribbonBinObjects; + + break; + case 'names': + case 'data': + if (is_array($this->ribbonBinObjects) && isset($this->ribbonBinObjects[$what])) { + $ReturnData = $this->ribbonBinObjects[$what]; + } + + break; + case 'types': + if (is_array($this->ribbonBinObjects) && + isset($this->ribbonBinObjects['data']) && is_array($this->ribbonBinObjects['data'])) { + $tmpTypes = array_keys($this->ribbonBinObjects['data']); + $ReturnData = array_unique(array_map([$this, 'getExtensionOnly'], $tmpTypes)); + } else { + $ReturnData = []; // the caller want an array... not null if empty + } + + break; + } + + return $ReturnData; + } + + /** + * This workbook have a custom UI ? + * + * @return bool + */ + public function hasRibbon() + { + return $this->ribbonXMLData !== null; + } + + /** + * This workbook have additionnal object for the ribbon ? + * + * @return bool + */ + public function hasRibbonBinObjects() + { + return $this->ribbonBinObjects !== null; + } + + /** + * Check if a sheet with a specified code name already exists. + * + * @param string $pSheetCodeName Name of the worksheet to check + * + * @return bool + */ + public function sheetCodeNameExists($pSheetCodeName) + { + return $this->getSheetByCodeName($pSheetCodeName) !== null; + } + + /** + * Get sheet by code name. Warning : sheet don't have always a code name ! + * + * @param string $pName Sheet name + * + * @return Worksheet + */ + public function getSheetByCodeName($pName) + { + $worksheetCount = count($this->workSheetCollection); + for ($i = 0; $i < $worksheetCount; ++$i) { + if ($this->workSheetCollection[$i]->getCodeName() == $pName) { + return $this->workSheetCollection[$i]; + } + } + + return null; + } + + /** + * Create a new PhpSpreadsheet with one Worksheet. + */ + public function __construct() + { + $this->uniqueID = uniqid('', true); + $this->calculationEngine = new Calculation($this); + + // Initialise worksheet collection and add one worksheet + $this->workSheetCollection = []; + $this->workSheetCollection[] = new Worksheet($this); + $this->activeSheetIndex = 0; + + // Create document properties + $this->properties = new Document\Properties(); + + // Create document security + $this->security = new Document\Security(); + + // Set named ranges + $this->namedRanges = []; + + // Create the cellXf supervisor + $this->cellXfSupervisor = new Style(true); + $this->cellXfSupervisor->bindParent($this); + + // Create the default style + $this->addCellXf(new Style()); + $this->addCellStyleXf(new Style()); + } + + /** + * Code to execute when this worksheet is unset(). + */ + public function __destruct() + { + $this->calculationEngine = null; + $this->disconnectWorksheets(); + } + + /** + * Disconnect all worksheets from this PhpSpreadsheet workbook object, + * typically so that the PhpSpreadsheet object can be unset. + */ + public function disconnectWorksheets() + { + $worksheet = null; + foreach ($this->workSheetCollection as $k => &$worksheet) { + $worksheet->disconnectCells(); + $this->workSheetCollection[$k] = null; + } + unset($worksheet); + $this->workSheetCollection = []; + } + + /** + * Return the calculation engine for this worksheet. + * + * @return Calculation + */ + public function getCalculationEngine() + { + return $this->calculationEngine; + } + + /** + * Get properties. + * + * @return Document\Properties + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Set properties. + * + * @param Document\Properties $pValue + */ + public function setProperties(Document\Properties $pValue) + { + $this->properties = $pValue; + } + + /** + * Get security. + * + * @return Document\Security + */ + public function getSecurity() + { + return $this->security; + } + + /** + * Set security. + * + * @param Document\Security $pValue + */ + public function setSecurity(Document\Security $pValue) + { + $this->security = $pValue; + } + + /** + * Get active sheet. + * + * @throws Exception + * + * @return Worksheet + */ + public function getActiveSheet() + { + return $this->getSheet($this->activeSheetIndex); + } + + /** + * Create sheet and add it to this workbook. + * + * @param null|int $sheetIndex Index where sheet should go (0,1,..., or null for last) + * + * @throws Exception + * + * @return Worksheet + */ + public function createSheet($sheetIndex = null) + { + $newSheet = new Worksheet($this); + $this->addSheet($newSheet, $sheetIndex); + + return $newSheet; + } + + /** + * Check if a sheet with a specified name already exists. + * + * @param string $pSheetName Name of the worksheet to check + * + * @return bool + */ + public function sheetNameExists($pSheetName) + { + return $this->getSheetByName($pSheetName) !== null; + } + + /** + * Add sheet. + * + * @param Worksheet $pSheet + * @param null|int $iSheetIndex Index where sheet should go (0,1,..., or null for last) + * + * @throws Exception + * + * @return Worksheet + */ + public function addSheet(Worksheet $pSheet, $iSheetIndex = null) + { + if ($this->sheetNameExists($pSheet->getTitle())) { + throw new Exception( + "Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first." + ); + } + + if ($iSheetIndex === null) { + if ($this->activeSheetIndex < 0) { + $this->activeSheetIndex = 0; + } + $this->workSheetCollection[] = $pSheet; + } else { + // Insert the sheet at the requested index + array_splice( + $this->workSheetCollection, + $iSheetIndex, + 0, + [$pSheet] + ); + + // Adjust active sheet index if necessary + if ($this->activeSheetIndex >= $iSheetIndex) { + ++$this->activeSheetIndex; + } + } + + if ($pSheet->getParent() === null) { + $pSheet->rebindParent($this); + } + + return $pSheet; + } + + /** + * Remove sheet by index. + * + * @param int $pIndex Active sheet index + * + * @throws Exception + */ + public function removeSheetByIndex($pIndex) + { + $numSheets = count($this->workSheetCollection); + if ($pIndex > $numSheets - 1) { + throw new Exception( + "You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." + ); + } + array_splice($this->workSheetCollection, $pIndex, 1); + + // Adjust active sheet index if necessary + if (($this->activeSheetIndex >= $pIndex) && + ($pIndex > count($this->workSheetCollection) - 1)) { + --$this->activeSheetIndex; + } + } + + /** + * Get sheet by index. + * + * @param int $pIndex Sheet index + * + * @throws Exception + * + * @return Worksheet + */ + public function getSheet($pIndex) + { + if (!isset($this->workSheetCollection[$pIndex])) { + $numSheets = $this->getSheetCount(); + + throw new Exception( + "Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}." + ); + } + + return $this->workSheetCollection[$pIndex]; + } + + /** + * Get all sheets. + * + * @return Worksheet[] + */ + public function getAllSheets() + { + return $this->workSheetCollection; + } + + /** + * Get sheet by name. + * + * @param string $pName Sheet name + * + * @return null|Worksheet + */ + public function getSheetByName($pName) + { + $worksheetCount = count($this->workSheetCollection); + for ($i = 0; $i < $worksheetCount; ++$i) { + if ($this->workSheetCollection[$i]->getTitle() === trim($pName, "'")) { + return $this->workSheetCollection[$i]; + } + } + + return null; + } + + /** + * Get index for sheet. + * + * @param Worksheet $pSheet + * + * @throws Exception + * + * @return int index + */ + public function getIndex(Worksheet $pSheet) + { + foreach ($this->workSheetCollection as $key => $value) { + if ($value->getHashCode() == $pSheet->getHashCode()) { + return $key; + } + } + + throw new Exception('Sheet does not exist.'); + } + + /** + * Set index for sheet by sheet name. + * + * @param string $sheetName Sheet name to modify index for + * @param int $newIndex New index for the sheet + * + * @throws Exception + * + * @return int New sheet index + */ + public function setIndexByName($sheetName, $newIndex) + { + $oldIndex = $this->getIndex($this->getSheetByName($sheetName)); + $pSheet = array_splice( + $this->workSheetCollection, + $oldIndex, + 1 + ); + array_splice( + $this->workSheetCollection, + $newIndex, + 0, + $pSheet + ); + + return $newIndex; + } + + /** + * Get sheet count. + * + * @return int + */ + public function getSheetCount() + { + return count($this->workSheetCollection); + } + + /** + * Get active sheet index. + * + * @return int Active sheet index + */ + public function getActiveSheetIndex() + { + return $this->activeSheetIndex; + } + + /** + * Set active sheet index. + * + * @param int $pIndex Active sheet index + * + * @throws Exception + * + * @return Worksheet + */ + public function setActiveSheetIndex($pIndex) + { + $numSheets = count($this->workSheetCollection); + + if ($pIndex > $numSheets - 1) { + throw new Exception( + "You tried to set a sheet active by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}." + ); + } + $this->activeSheetIndex = $pIndex; + + return $this->getActiveSheet(); + } + + /** + * Set active sheet index by name. + * + * @param string $pValue Sheet title + * + * @throws Exception + * + * @return Worksheet + */ + public function setActiveSheetIndexByName($pValue) + { + if (($worksheet = $this->getSheetByName($pValue)) instanceof Worksheet) { + $this->setActiveSheetIndex($this->getIndex($worksheet)); + + return $worksheet; + } + + throw new Exception('Workbook does not contain sheet:' . $pValue); + } + + /** + * Get sheet names. + * + * @return string[] + */ + public function getSheetNames() + { + $returnValue = []; + $worksheetCount = $this->getSheetCount(); + for ($i = 0; $i < $worksheetCount; ++$i) { + $returnValue[] = $this->getSheet($i)->getTitle(); + } + + return $returnValue; + } + + /** + * Add external sheet. + * + * @param Worksheet $pSheet External sheet to add + * @param null|int $iSheetIndex Index where sheet should go (0,1,..., or null for last) + * + * @throws Exception + * + * @return Worksheet + */ + public function addExternalSheet(Worksheet $pSheet, $iSheetIndex = null) + { + if ($this->sheetNameExists($pSheet->getTitle())) { + throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); + } + + // count how many cellXfs there are in this workbook currently, we will need this below + $countCellXfs = count($this->cellXfCollection); + + // copy all the shared cellXfs from the external workbook and append them to the current + foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) { + $this->addCellXf(clone $cellXf); + } + + // move sheet to this workbook + $pSheet->rebindParent($this); + + // update the cellXfs + foreach ($pSheet->getCoordinates(false) as $coordinate) { + $cell = $pSheet->getCell($coordinate); + $cell->setXfIndex($cell->getXfIndex() + $countCellXfs); + } + + return $this->addSheet($pSheet, $iSheetIndex); + } + + /** + * Get named ranges. + * + * @return NamedRange[] + */ + public function getNamedRanges() + { + return $this->namedRanges; + } + + /** + * Add named range. + * + * @param NamedRange $namedRange + * + * @return bool + */ + public function addNamedRange(NamedRange $namedRange) + { + if ($namedRange->getScope() == null) { + // global scope + $this->namedRanges[$namedRange->getName()] = $namedRange; + } else { + // local scope + $this->namedRanges[$namedRange->getScope()->getTitle() . '!' . $namedRange->getName()] = $namedRange; + } + + return true; + } + + /** + * Get named range. + * + * @param string $namedRange + * @param null|Worksheet $pSheet Scope. Use null for global scope + * + * @return null|NamedRange + */ + public function getNamedRange($namedRange, Worksheet $pSheet = null) + { + $returnValue = null; + + if ($namedRange != '' && ($namedRange !== null)) { + // first look for global defined name + if (isset($this->namedRanges[$namedRange])) { + $returnValue = $this->namedRanges[$namedRange]; + } + + // then look for local defined name (has priority over global defined name if both names exist) + if (($pSheet !== null) && isset($this->namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { + $returnValue = $this->namedRanges[$pSheet->getTitle() . '!' . $namedRange]; + } + } + + return $returnValue; + } + + /** + * Remove named range. + * + * @param string $namedRange + * @param null|Worksheet $pSheet scope: use null for global scope + * + * @return $this + */ + public function removeNamedRange($namedRange, Worksheet $pSheet = null) + { + if ($pSheet === null) { + if (isset($this->namedRanges[$namedRange])) { + unset($this->namedRanges[$namedRange]); + } + } else { + if (isset($this->namedRanges[$pSheet->getTitle() . '!' . $namedRange])) { + unset($this->namedRanges[$pSheet->getTitle() . '!' . $namedRange]); + } + } + + return $this; + } + + /** + * Get worksheet iterator. + * + * @return Iterator + */ + public function getWorksheetIterator() + { + return new Iterator($this); + } + + /** + * Copy workbook (!= clone!). + * + * @return Spreadsheet + */ + public function copy() + { + $copied = clone $this; + + $worksheetCount = count($this->workSheetCollection); + for ($i = 0; $i < $worksheetCount; ++$i) { + $this->workSheetCollection[$i] = $this->workSheetCollection[$i]->copy(); + $this->workSheetCollection[$i]->rebindParent($this); + } + + return $copied; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + foreach ($this as $key => $val) { + if (is_object($val) || (is_array($val))) { + $this->{$key} = unserialize(serialize($val)); + } + } + } + + /** + * Get the workbook collection of cellXfs. + * + * @return Style[] + */ + public function getCellXfCollection() + { + return $this->cellXfCollection; + } + + /** + * Get cellXf by index. + * + * @param int $pIndex + * + * @return Style + */ + public function getCellXfByIndex($pIndex) + { + return $this->cellXfCollection[$pIndex]; + } + + /** + * Get cellXf by hash code. + * + * @param string $pValue + * + * @return false|Style + */ + public function getCellXfByHashCode($pValue) + { + foreach ($this->cellXfCollection as $cellXf) { + if ($cellXf->getHashCode() == $pValue) { + return $cellXf; + } + } + + return false; + } + + /** + * Check if style exists in style collection. + * + * @param Style $pCellStyle + * + * @return bool + */ + public function cellXfExists($pCellStyle) + { + return in_array($pCellStyle, $this->cellXfCollection, true); + } + + /** + * Get default style. + * + * @throws Exception + * + * @return Style + */ + public function getDefaultStyle() + { + if (isset($this->cellXfCollection[0])) { + return $this->cellXfCollection[0]; + } + + throw new Exception('No default style found for this workbook'); + } + + /** + * Add a cellXf to the workbook. + * + * @param Style $style + */ + public function addCellXf(Style $style) + { + $this->cellXfCollection[] = $style; + $style->setIndex(count($this->cellXfCollection) - 1); + } + + /** + * Remove cellXf by index. It is ensured that all cells get their xf index updated. + * + * @param int $pIndex Index to cellXf + * + * @throws Exception + */ + public function removeCellXfByIndex($pIndex) + { + if ($pIndex > count($this->cellXfCollection) - 1) { + throw new Exception('CellXf index is out of bounds.'); + } + + // first remove the cellXf + array_splice($this->cellXfCollection, $pIndex, 1); + + // then update cellXf indexes for cells + foreach ($this->workSheetCollection as $worksheet) { + foreach ($worksheet->getCoordinates(false) as $coordinate) { + $cell = $worksheet->getCell($coordinate); + $xfIndex = $cell->getXfIndex(); + if ($xfIndex > $pIndex) { + // decrease xf index by 1 + $cell->setXfIndex($xfIndex - 1); + } elseif ($xfIndex == $pIndex) { + // set to default xf index 0 + $cell->setXfIndex(0); + } + } + } + } + + /** + * Get the cellXf supervisor. + * + * @return Style + */ + public function getCellXfSupervisor() + { + return $this->cellXfSupervisor; + } + + /** + * Get the workbook collection of cellStyleXfs. + * + * @return Style[] + */ + public function getCellStyleXfCollection() + { + return $this->cellStyleXfCollection; + } + + /** + * Get cellStyleXf by index. + * + * @param int $pIndex Index to cellXf + * + * @return Style + */ + public function getCellStyleXfByIndex($pIndex) + { + return $this->cellStyleXfCollection[$pIndex]; + } + + /** + * Get cellStyleXf by hash code. + * + * @param string $pValue + * + * @return false|Style + */ + public function getCellStyleXfByHashCode($pValue) + { + foreach ($this->cellStyleXfCollection as $cellStyleXf) { + if ($cellStyleXf->getHashCode() == $pValue) { + return $cellStyleXf; + } + } + + return false; + } + + /** + * Add a cellStyleXf to the workbook. + * + * @param Style $pStyle + */ + public function addCellStyleXf(Style $pStyle) + { + $this->cellStyleXfCollection[] = $pStyle; + $pStyle->setIndex(count($this->cellStyleXfCollection) - 1); + } + + /** + * Remove cellStyleXf by index. + * + * @param int $pIndex Index to cellXf + * + * @throws Exception + */ + public function removeCellStyleXfByIndex($pIndex) + { + if ($pIndex > count($this->cellStyleXfCollection) - 1) { + throw new Exception('CellStyleXf index is out of bounds.'); + } + array_splice($this->cellStyleXfCollection, $pIndex, 1); + } + + /** + * Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells + * and columns in the workbook. + */ + public function garbageCollect() + { + // how many references are there to each cellXf ? + $countReferencesCellXf = []; + foreach ($this->cellXfCollection as $index => $cellXf) { + $countReferencesCellXf[$index] = 0; + } + + foreach ($this->getWorksheetIterator() as $sheet) { + // from cells + foreach ($sheet->getCoordinates(false) as $coordinate) { + $cell = $sheet->getCell($coordinate); + ++$countReferencesCellXf[$cell->getXfIndex()]; + } + + // from row dimensions + foreach ($sheet->getRowDimensions() as $rowDimension) { + if ($rowDimension->getXfIndex() !== null) { + ++$countReferencesCellXf[$rowDimension->getXfIndex()]; + } + } + + // from column dimensions + foreach ($sheet->getColumnDimensions() as $columnDimension) { + ++$countReferencesCellXf[$columnDimension->getXfIndex()]; + } + } + + // remove cellXfs without references and create mapping so we can update xfIndex + // for all cells and columns + $countNeededCellXfs = 0; + foreach ($this->cellXfCollection as $index => $cellXf) { + if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf + ++$countNeededCellXfs; + } else { + unset($this->cellXfCollection[$index]); + } + $map[$index] = $countNeededCellXfs - 1; + } + $this->cellXfCollection = array_values($this->cellXfCollection); + + // update the index for all cellXfs + foreach ($this->cellXfCollection as $i => $cellXf) { + $cellXf->setIndex($i); + } + + // make sure there is always at least one cellXf (there should be) + if (empty($this->cellXfCollection)) { + $this->cellXfCollection[] = new Style(); + } + + // update the xfIndex for all cells, row dimensions, column dimensions + foreach ($this->getWorksheetIterator() as $sheet) { + // for all cells + foreach ($sheet->getCoordinates(false) as $coordinate) { + $cell = $sheet->getCell($coordinate); + $cell->setXfIndex($map[$cell->getXfIndex()]); + } + + // for all row dimensions + foreach ($sheet->getRowDimensions() as $rowDimension) { + if ($rowDimension->getXfIndex() !== null) { + $rowDimension->setXfIndex($map[$rowDimension->getXfIndex()]); + } + } + + // for all column dimensions + foreach ($sheet->getColumnDimensions() as $columnDimension) { + $columnDimension->setXfIndex($map[$columnDimension->getXfIndex()]); + } + + // also do garbage collection for all the sheets + $sheet->garbageCollect(); + } + } + + /** + * Return the unique ID value assigned to this spreadsheet workbook. + * + * @return string + */ + public function getID() + { + return $this->uniqueID; + } + + /** + * Get the visibility of the horizonal scroll bar in the application. + * + * @return bool True if horizonal scroll bar is visible + */ + public function getShowHorizontalScroll() + { + return $this->showHorizontalScroll; + } + + /** + * Set the visibility of the horizonal scroll bar in the application. + * + * @param bool $showHorizontalScroll True if horizonal scroll bar is visible + */ + public function setShowHorizontalScroll($showHorizontalScroll) + { + $this->showHorizontalScroll = (bool) $showHorizontalScroll; + } + + /** + * Get the visibility of the vertical scroll bar in the application. + * + * @return bool True if vertical scroll bar is visible + */ + public function getShowVerticalScroll() + { + return $this->showVerticalScroll; + } + + /** + * Set the visibility of the vertical scroll bar in the application. + * + * @param bool $showVerticalScroll True if vertical scroll bar is visible + */ + public function setShowVerticalScroll($showVerticalScroll) + { + $this->showVerticalScroll = (bool) $showVerticalScroll; + } + + /** + * Get the visibility of the sheet tabs in the application. + * + * @return bool True if the sheet tabs are visible + */ + public function getShowSheetTabs() + { + return $this->showSheetTabs; + } + + /** + * Set the visibility of the sheet tabs in the application. + * + * @param bool $showSheetTabs True if sheet tabs are visible + */ + public function setShowSheetTabs($showSheetTabs) + { + $this->showSheetTabs = (bool) $showSheetTabs; + } + + /** + * Return whether the workbook window is minimized. + * + * @return bool true if workbook window is minimized + */ + public function getMinimized() + { + return $this->minimized; + } + + /** + * Set whether the workbook window is minimized. + * + * @param bool $minimized true if workbook window is minimized + */ + public function setMinimized($minimized) + { + $this->minimized = (bool) $minimized; + } + + /** + * Return whether to group dates when presenting the user with + * filtering optiomd in the user interface. + * + * @return bool true if workbook window is minimized + */ + public function getAutoFilterDateGrouping() + { + return $this->autoFilterDateGrouping; + } + + /** + * Set whether to group dates when presenting the user with + * filtering optiomd in the user interface. + * + * @param bool $autoFilterDateGrouping true if workbook window is minimized + */ + public function setAutoFilterDateGrouping($autoFilterDateGrouping) + { + $this->autoFilterDateGrouping = (bool) $autoFilterDateGrouping; + } + + /** + * Return the first sheet in the book view. + * + * @return int First sheet in book view + */ + public function getFirstSheetIndex() + { + return $this->firstSheetIndex; + } + + /** + * Set the first sheet in the book view. + * + * @param int $firstSheetIndex First sheet in book view + * + * @throws Exception if the given value is invalid + */ + public function setFirstSheetIndex($firstSheetIndex) + { + if ($firstSheetIndex >= 0) { + $this->firstSheetIndex = (int) $firstSheetIndex; + } else { + throw new Exception('First sheet index must be a positive integer.'); + } + } + + /** + * Return the visibility status of the workbook. + * + * This may be one of the following three values: + * - visibile + * + * @return string Visible status + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Set the visibility status of the workbook. + * + * Valid values are: + * - 'visible' (self::VISIBILITY_VISIBLE): + * Workbook window is visible + * - 'hidden' (self::VISIBILITY_HIDDEN): + * Workbook window is hidden, but can be shown by the user + * via the user interface + * - 'veryHidden' (self::VISIBILITY_VERY_HIDDEN): + * Workbook window is hidden and cannot be shown in the + * user interface. + * + * @param string $visibility visibility status of the workbook + * + * @throws Exception if the given value is invalid + */ + public function setVisibility($visibility) + { + if ($visibility === null) { + $visibility = self::VISIBILITY_VISIBLE; + } + + if (in_array($visibility, self::$workbookViewVisibilityValues)) { + $this->visibility = $visibility; + } else { + throw new Exception('Invalid visibility value.'); + } + } + + /** + * Get the ratio between the workbook tabs bar and the horizontal scroll bar. + * TabRatio is assumed to be out of 1000 of the horizontal window width. + * + * @return int Ratio between the workbook tabs bar and the horizontal scroll bar + */ + public function getTabRatio() + { + return $this->tabRatio; + } + + /** + * Set the ratio between the workbook tabs bar and the horizontal scroll bar + * TabRatio is assumed to be out of 1000 of the horizontal window width. + * + * @param int $tabRatio Ratio between the tabs bar and the horizontal scroll bar + * + * @throws Exception if the given value is invalid + */ + public function setTabRatio($tabRatio) + { + if ($tabRatio >= 0 || $tabRatio <= 1000) { + $this->tabRatio = (int) $tabRatio; + } else { + throw new Exception('Tab ratio must be between 0 and 1000.'); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php new file mode 100644 index 0000000..5eb7c2b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Alignment.php @@ -0,0 +1,466 @@ +horizontal = null; + $this->vertical = null; + $this->textRotation = null; + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return Alignment + */ + public function getSharedComponent() + { + return $this->parent->getSharedComponent()->getAlignment(); + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return ['alignment' => $array]; + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( + * [ + * 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, + * 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, + * 'textRotation' => 0, + * 'wrapText' => TRUE + * ] + * ); + * + * + * @param array $pStyles Array containing style information + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function applyFromArray(array $pStyles) + { + if ($this->isSupervisor) { + $this->getActiveSheet()->getStyle($this->getSelectedCells()) + ->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (isset($pStyles['horizontal'])) { + $this->setHorizontal($pStyles['horizontal']); + } + if (isset($pStyles['vertical'])) { + $this->setVertical($pStyles['vertical']); + } + if (isset($pStyles['textRotation'])) { + $this->setTextRotation($pStyles['textRotation']); + } + if (isset($pStyles['wrapText'])) { + $this->setWrapText($pStyles['wrapText']); + } + if (isset($pStyles['shrinkToFit'])) { + $this->setShrinkToFit($pStyles['shrinkToFit']); + } + if (isset($pStyles['indent'])) { + $this->setIndent($pStyles['indent']); + } + if (isset($pStyles['readOrder'])) { + $this->setReadOrder($pStyles['readOrder']); + } + } + + return $this; + } + + /** + * Get Horizontal. + * + * @return string + */ + public function getHorizontal() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHorizontal(); + } + + return $this->horizontal; + } + + /** + * Set Horizontal. + * + * @param string $pValue see self::HORIZONTAL_* + * + * @return $this + */ + public function setHorizontal($pValue) + { + if ($pValue == '') { + $pValue = self::HORIZONTAL_GENERAL; + } + + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['horizontal' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->horizontal = $pValue; + } + + return $this; + } + + /** + * Get Vertical. + * + * @return string + */ + public function getVertical() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getVertical(); + } + + return $this->vertical; + } + + /** + * Set Vertical. + * + * @param string $pValue see self::VERTICAL_* + * + * @return $this + */ + public function setVertical($pValue) + { + if ($pValue == '') { + $pValue = self::VERTICAL_BOTTOM; + } + + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['vertical' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->vertical = $pValue; + } + + return $this; + } + + /** + * Get TextRotation. + * + * @return int + */ + public function getTextRotation() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getTextRotation(); + } + + return $this->textRotation; + } + + /** + * Set TextRotation. + * + * @param int $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setTextRotation($pValue) + { + // Excel2007 value 255 => PhpSpreadsheet value -165 + if ($pValue == 255) { + $pValue = -165; + } + + // Set rotation + if (($pValue >= -90 && $pValue <= 90) || $pValue == -165) { + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['textRotation' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->textRotation = $pValue; + } + } else { + throw new PhpSpreadsheetException('Text rotation should be a value between -90 and 90.'); + } + + return $this; + } + + /** + * Get Wrap Text. + * + * @return bool + */ + public function getWrapText() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getWrapText(); + } + + return $this->wrapText; + } + + /** + * Set Wrap Text. + * + * @param bool $pValue + * + * @return $this + */ + public function setWrapText($pValue) + { + if ($pValue == '') { + $pValue = false; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['wrapText' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->wrapText = $pValue; + } + + return $this; + } + + /** + * Get Shrink to fit. + * + * @return bool + */ + public function getShrinkToFit() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getShrinkToFit(); + } + + return $this->shrinkToFit; + } + + /** + * Set Shrink to fit. + * + * @param bool $pValue + * + * @return $this + */ + public function setShrinkToFit($pValue) + { + if ($pValue == '') { + $pValue = false; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['shrinkToFit' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->shrinkToFit = $pValue; + } + + return $this; + } + + /** + * Get indent. + * + * @return int + */ + public function getIndent() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getIndent(); + } + + return $this->indent; + } + + /** + * Set indent. + * + * @param int $pValue + * + * @return $this + */ + public function setIndent($pValue) + { + if ($pValue > 0) { + if ($this->getHorizontal() != self::HORIZONTAL_GENERAL && + $this->getHorizontal() != self::HORIZONTAL_LEFT && + $this->getHorizontal() != self::HORIZONTAL_RIGHT) { + $pValue = 0; // indent not supported + } + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['indent' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->indent = $pValue; + } + + return $this; + } + + /** + * Get read order. + * + * @return int + */ + public function getReadOrder() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getReadOrder(); + } + + return $this->readOrder; + } + + /** + * Set read order. + * + * @param int $pValue + * + * @return $this + */ + public function setReadOrder($pValue) + { + if ($pValue < 0 || $pValue > 2) { + $pValue = 0; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['readOrder' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->readOrder = $pValue; + } + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + + return md5( + $this->horizontal . + $this->vertical . + $this->textRotation . + ($this->wrapText ? 't' : 'f') . + ($this->shrinkToFit ? 't' : 'f') . + $this->indent . + $this->readOrder . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php new file mode 100644 index 0000000..5fa0cae --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Border.php @@ -0,0 +1,239 @@ +color = new Color(Color::COLOR_BLACK, $isSupervisor); + + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->color->bindParent($this, 'color'); + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @throws PhpSpreadsheetException + * + * @return Border + */ + public function getSharedComponent() + { + switch ($this->parentPropertyName) { + case 'allBorders': + case 'horizontal': + case 'inside': + case 'outline': + case 'vertical': + throw new PhpSpreadsheetException('Cannot get shared component for a pseudo-border.'); + + break; + case 'bottom': + return $this->parent->getSharedComponent()->getBottom(); + case 'diagonal': + return $this->parent->getSharedComponent()->getDiagonal(); + case 'left': + return $this->parent->getSharedComponent()->getLeft(); + case 'right': + return $this->parent->getSharedComponent()->getRight(); + case 'top': + return $this->parent->getSharedComponent()->getTop(); + } + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return $this->parent->getStyleArray([$this->parentPropertyName => $array]); + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( + * [ + * 'borderStyle' => Border::BORDER_DASHDOT, + * 'color' => [ + * 'rgb' => '808080' + * ] + * ] + * ); + * + * + * @param array $pStyles Array containing style information + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function applyFromArray(array $pStyles) + { + if ($this->isSupervisor) { + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (isset($pStyles['borderStyle'])) { + $this->setBorderStyle($pStyles['borderStyle']); + } + if (isset($pStyles['color'])) { + $this->getColor()->applyFromArray($pStyles['color']); + } + } + + return $this; + } + + /** + * Get Border style. + * + * @return string + */ + public function getBorderStyle() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getBorderStyle(); + } + + return $this->borderStyle; + } + + /** + * Set Border style. + * + * @param bool|string $pValue + * When passing a boolean, FALSE equates Border::BORDER_NONE + * and TRUE to Border::BORDER_MEDIUM + * + * @return $this + */ + public function setBorderStyle($pValue) + { + if (empty($pValue)) { + $pValue = self::BORDER_NONE; + } elseif (is_bool($pValue) && $pValue) { + $pValue = self::BORDER_MEDIUM; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['borderStyle' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->borderStyle = $pValue; + } + + return $this; + } + + /** + * Get Border Color. + * + * @return Color + */ + public function getColor() + { + return $this->color; + } + + /** + * Set Border Color. + * + * @param Color $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setColor(Color $pValue) + { + // make sure parameter is a real color and not a supervisor + $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; + + if ($this->isSupervisor) { + $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->color = $color; + } + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + + return md5( + $this->borderStyle . + $this->color->getHashCode() . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php new file mode 100644 index 0000000..8f005a9 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Borders.php @@ -0,0 +1,423 @@ +left = new Border($isSupervisor, $isConditional); + $this->right = new Border($isSupervisor, $isConditional); + $this->top = new Border($isSupervisor, $isConditional); + $this->bottom = new Border($isSupervisor, $isConditional); + $this->diagonal = new Border($isSupervisor, $isConditional); + $this->diagonalDirection = self::DIAGONAL_NONE; + + // Specially for supervisor + if ($isSupervisor) { + // Initialize pseudo-borders + $this->allBorders = new Border(true); + $this->outline = new Border(true); + $this->inside = new Border(true); + $this->vertical = new Border(true); + $this->horizontal = new Border(true); + + // bind parent if we are a supervisor + $this->left->bindParent($this, 'left'); + $this->right->bindParent($this, 'right'); + $this->top->bindParent($this, 'top'); + $this->bottom->bindParent($this, 'bottom'); + $this->diagonal->bindParent($this, 'diagonal'); + $this->allBorders->bindParent($this, 'allBorders'); + $this->outline->bindParent($this, 'outline'); + $this->inside->bindParent($this, 'inside'); + $this->vertical->bindParent($this, 'vertical'); + $this->horizontal->bindParent($this, 'horizontal'); + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return Borders + */ + public function getSharedComponent() + { + return $this->parent->getSharedComponent()->getBorders(); + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return ['borders' => $array]; + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( + * [ + * 'bottom' => [ + * 'borderStyle' => Border::BORDER_DASHDOT, + * 'color' => [ + * 'rgb' => '808080' + * ] + * ], + * 'top' => [ + * 'borderStyle' => Border::BORDER_DASHDOT, + * 'color' => [ + * 'rgb' => '808080' + * ] + * ] + * ] + * ); + * + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray( + * [ + * 'allBorders' => [ + * 'borderStyle' => Border::BORDER_DASHDOT, + * 'color' => [ + * 'rgb' => '808080' + * ] + * ] + * ] + * ); + * + * + * @param array $pStyles Array containing style information + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function applyFromArray(array $pStyles) + { + if ($this->isSupervisor) { + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (isset($pStyles['left'])) { + $this->getLeft()->applyFromArray($pStyles['left']); + } + if (isset($pStyles['right'])) { + $this->getRight()->applyFromArray($pStyles['right']); + } + if (isset($pStyles['top'])) { + $this->getTop()->applyFromArray($pStyles['top']); + } + if (isset($pStyles['bottom'])) { + $this->getBottom()->applyFromArray($pStyles['bottom']); + } + if (isset($pStyles['diagonal'])) { + $this->getDiagonal()->applyFromArray($pStyles['diagonal']); + } + if (isset($pStyles['diagonalDirection'])) { + $this->setDiagonalDirection($pStyles['diagonalDirection']); + } + if (isset($pStyles['allBorders'])) { + $this->getLeft()->applyFromArray($pStyles['allBorders']); + $this->getRight()->applyFromArray($pStyles['allBorders']); + $this->getTop()->applyFromArray($pStyles['allBorders']); + $this->getBottom()->applyFromArray($pStyles['allBorders']); + } + } + + return $this; + } + + /** + * Get Left. + * + * @return Border + */ + public function getLeft() + { + return $this->left; + } + + /** + * Get Right. + * + * @return Border + */ + public function getRight() + { + return $this->right; + } + + /** + * Get Top. + * + * @return Border + */ + public function getTop() + { + return $this->top; + } + + /** + * Get Bottom. + * + * @return Border + */ + public function getBottom() + { + return $this->bottom; + } + + /** + * Get Diagonal. + * + * @return Border + */ + public function getDiagonal() + { + return $this->diagonal; + } + + /** + * Get AllBorders (pseudo-border). Only applies to supervisor. + * + * @throws PhpSpreadsheetException + * + * @return Border + */ + public function getAllBorders() + { + if (!$this->isSupervisor) { + throw new PhpSpreadsheetException('Can only get pseudo-border for supervisor.'); + } + + return $this->allBorders; + } + + /** + * Get Outline (pseudo-border). Only applies to supervisor. + * + * @throws PhpSpreadsheetException + * + * @return Border + */ + public function getOutline() + { + if (!$this->isSupervisor) { + throw new PhpSpreadsheetException('Can only get pseudo-border for supervisor.'); + } + + return $this->outline; + } + + /** + * Get Inside (pseudo-border). Only applies to supervisor. + * + * @throws PhpSpreadsheetException + * + * @return Border + */ + public function getInside() + { + if (!$this->isSupervisor) { + throw new PhpSpreadsheetException('Can only get pseudo-border for supervisor.'); + } + + return $this->inside; + } + + /** + * Get Vertical (pseudo-border). Only applies to supervisor. + * + * @throws PhpSpreadsheetException + * + * @return Border + */ + public function getVertical() + { + if (!$this->isSupervisor) { + throw new PhpSpreadsheetException('Can only get pseudo-border for supervisor.'); + } + + return $this->vertical; + } + + /** + * Get Horizontal (pseudo-border). Only applies to supervisor. + * + * @throws PhpSpreadsheetException + * + * @return Border + */ + public function getHorizontal() + { + if (!$this->isSupervisor) { + throw new PhpSpreadsheetException('Can only get pseudo-border for supervisor.'); + } + + return $this->horizontal; + } + + /** + * Get DiagonalDirection. + * + * @return int + */ + public function getDiagonalDirection() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getDiagonalDirection(); + } + + return $this->diagonalDirection; + } + + /** + * Set DiagonalDirection. + * + * @param int $pValue see self::DIAGONAL_* + * + * @return $this + */ + public function setDiagonalDirection($pValue) + { + if ($pValue == '') { + $pValue = self::DIAGONAL_NONE; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['diagonalDirection' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->diagonalDirection = $pValue; + } + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHashcode(); + } + + return md5( + $this->getLeft()->getHashCode() . + $this->getRight()->getHashCode() . + $this->getTop()->getHashCode() . + $this->getBottom()->getHashCode() . + $this->getDiagonal()->getHashCode() . + $this->getDiagonalDirection() . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php new file mode 100644 index 0000000..ab22cbe --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Color.php @@ -0,0 +1,411 @@ +argb = $pARGB; + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return Color + */ + public function getSharedComponent() + { + switch ($this->parentPropertyName) { + case 'endColor': + return $this->parent->getSharedComponent()->getEndColor(); + case 'color': + return $this->parent->getSharedComponent()->getColor(); + case 'startColor': + return $this->parent->getSharedComponent()->getStartColor(); + } + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return $this->parent->getStyleArray([$this->parentPropertyName => $array]); + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray(['rgb' => '808080']); + * + * + * @param array $pStyles Array containing style information + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function applyFromArray(array $pStyles) + { + if ($this->isSupervisor) { + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (isset($pStyles['rgb'])) { + $this->setRGB($pStyles['rgb']); + } + if (isset($pStyles['argb'])) { + $this->setARGB($pStyles['argb']); + } + } + + return $this; + } + + /** + * Get ARGB. + * + * @return string + */ + public function getARGB() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getARGB(); + } + + return $this->argb; + } + + /** + * Set ARGB. + * + * @param string $pValue see self::COLOR_* + * + * @return $this + */ + public function setARGB($pValue) + { + if ($pValue == '') { + $pValue = self::COLOR_BLACK; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['argb' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->argb = $pValue; + } + + return $this; + } + + /** + * Get RGB. + * + * @return string + */ + public function getRGB() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getRGB(); + } + + return substr($this->argb, 2); + } + + /** + * Set RGB. + * + * @param string $pValue RGB value + * + * @return $this + */ + public function setRGB($pValue) + { + if ($pValue == '') { + $pValue = '000000'; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['argb' => 'FF' . $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->argb = 'FF' . $pValue; + } + + return $this; + } + + /** + * Get a specified colour component of an RGB value. + * + * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE + * @param int $offset Position within the RGB value to extract + * @param bool $hex Flag indicating whether the component should be returned as a hex or a + * decimal value + * + * @return string The extracted colour component + */ + private static function getColourComponent($RGB, $offset, $hex = true) + { + $colour = substr($RGB, $offset, 2); + + return ($hex) ? $colour : hexdec($colour); + } + + /** + * Get the red colour component of an RGB value. + * + * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE + * @param bool $hex Flag indicating whether the component should be returned as a hex or a + * decimal value + * + * @return string The red colour component + */ + public static function getRed($RGB, $hex = true) + { + return self::getColourComponent($RGB, strlen($RGB) - 6, $hex); + } + + /** + * Get the green colour component of an RGB value. + * + * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE + * @param bool $hex Flag indicating whether the component should be returned as a hex or a + * decimal value + * + * @return string The green colour component + */ + public static function getGreen($RGB, $hex = true) + { + return self::getColourComponent($RGB, strlen($RGB) - 4, $hex); + } + + /** + * Get the blue colour component of an RGB value. + * + * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE + * @param bool $hex Flag indicating whether the component should be returned as a hex or a + * decimal value + * + * @return string The blue colour component + */ + public static function getBlue($RGB, $hex = true) + { + return self::getColourComponent($RGB, strlen($RGB) - 2, $hex); + } + + /** + * Adjust the brightness of a color. + * + * @param string $hex The colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE) + * @param float $adjustPercentage The percentage by which to adjust the colour as a float from -1 to 1 + * + * @return string The adjusted colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE) + */ + public static function changeBrightness($hex, $adjustPercentage) + { + $rgba = (strlen($hex) === 8); + + $red = self::getRed($hex, false); + $green = self::getGreen($hex, false); + $blue = self::getBlue($hex, false); + if ($adjustPercentage > 0) { + $red += (255 - $red) * $adjustPercentage; + $green += (255 - $green) * $adjustPercentage; + $blue += (255 - $blue) * $adjustPercentage; + } else { + $red += $red * $adjustPercentage; + $green += $green * $adjustPercentage; + $blue += $blue * $adjustPercentage; + } + + if ($red < 0) { + $red = 0; + } elseif ($red > 255) { + $red = 255; + } + if ($green < 0) { + $green = 0; + } elseif ($green > 255) { + $green = 255; + } + if ($blue < 0) { + $blue = 0; + } elseif ($blue > 255) { + $blue = 255; + } + + $rgb = strtoupper( + str_pad(dechex((int) $red), 2, '0', 0) . + str_pad(dechex((int) $green), 2, '0', 0) . + str_pad(dechex((int) $blue), 2, '0', 0) + ); + + return (($rgba) ? 'FF' : '') . $rgb; + } + + /** + * Get indexed color. + * + * @param int $pIndex Index entry point into the colour array + * @param bool $background Flag to indicate whether default background or foreground colour + * should be returned if the indexed colour doesn't exist + * + * @return self + */ + public static function indexedColor($pIndex, $background = false) + { + // Clean parameter + $pIndex = (int) $pIndex; + + // Indexed colors + if (self::$indexedColors === null) { + self::$indexedColors = [ + 1 => 'FF000000', // System Colour #1 - Black + 2 => 'FFFFFFFF', // System Colour #2 - White + 3 => 'FFFF0000', // System Colour #3 - Red + 4 => 'FF00FF00', // System Colour #4 - Green + 5 => 'FF0000FF', // System Colour #5 - Blue + 6 => 'FFFFFF00', // System Colour #6 - Yellow + 7 => 'FFFF00FF', // System Colour #7- Magenta + 8 => 'FF00FFFF', // System Colour #8- Cyan + 9 => 'FF800000', // Standard Colour #9 + 10 => 'FF008000', // Standard Colour #10 + 11 => 'FF000080', // Standard Colour #11 + 12 => 'FF808000', // Standard Colour #12 + 13 => 'FF800080', // Standard Colour #13 + 14 => 'FF008080', // Standard Colour #14 + 15 => 'FFC0C0C0', // Standard Colour #15 + 16 => 'FF808080', // Standard Colour #16 + 17 => 'FF9999FF', // Chart Fill Colour #17 + 18 => 'FF993366', // Chart Fill Colour #18 + 19 => 'FFFFFFCC', // Chart Fill Colour #19 + 20 => 'FFCCFFFF', // Chart Fill Colour #20 + 21 => 'FF660066', // Chart Fill Colour #21 + 22 => 'FFFF8080', // Chart Fill Colour #22 + 23 => 'FF0066CC', // Chart Fill Colour #23 + 24 => 'FFCCCCFF', // Chart Fill Colour #24 + 25 => 'FF000080', // Chart Line Colour #25 + 26 => 'FFFF00FF', // Chart Line Colour #26 + 27 => 'FFFFFF00', // Chart Line Colour #27 + 28 => 'FF00FFFF', // Chart Line Colour #28 + 29 => 'FF800080', // Chart Line Colour #29 + 30 => 'FF800000', // Chart Line Colour #30 + 31 => 'FF008080', // Chart Line Colour #31 + 32 => 'FF0000FF', // Chart Line Colour #32 + 33 => 'FF00CCFF', // Standard Colour #33 + 34 => 'FFCCFFFF', // Standard Colour #34 + 35 => 'FFCCFFCC', // Standard Colour #35 + 36 => 'FFFFFF99', // Standard Colour #36 + 37 => 'FF99CCFF', // Standard Colour #37 + 38 => 'FFFF99CC', // Standard Colour #38 + 39 => 'FFCC99FF', // Standard Colour #39 + 40 => 'FFFFCC99', // Standard Colour #40 + 41 => 'FF3366FF', // Standard Colour #41 + 42 => 'FF33CCCC', // Standard Colour #42 + 43 => 'FF99CC00', // Standard Colour #43 + 44 => 'FFFFCC00', // Standard Colour #44 + 45 => 'FFFF9900', // Standard Colour #45 + 46 => 'FFFF6600', // Standard Colour #46 + 47 => 'FF666699', // Standard Colour #47 + 48 => 'FF969696', // Standard Colour #48 + 49 => 'FF003366', // Standard Colour #49 + 50 => 'FF339966', // Standard Colour #50 + 51 => 'FF003300', // Standard Colour #51 + 52 => 'FF333300', // Standard Colour #52 + 53 => 'FF993300', // Standard Colour #53 + 54 => 'FF993366', // Standard Colour #54 + 55 => 'FF333399', // Standard Colour #55 + 56 => 'FF333333', // Standard Colour #56 + ]; + } + + if (isset(self::$indexedColors[$pIndex])) { + return new self(self::$indexedColors[$pIndex]); + } + + if ($background) { + return new self(self::COLOR_WHITE); + } + + return new self(self::COLOR_BLACK); + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + + return md5( + $this->argb . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php new file mode 100644 index 0000000..ec8c858 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Conditional.php @@ -0,0 +1,273 @@ +style = new Style(false, true); + } + + /** + * Get Condition type. + * + * @return string + */ + public function getConditionType() + { + return $this->conditionType; + } + + /** + * Set Condition type. + * + * @param string $pValue Condition type, see self::CONDITION_* + * + * @return $this + */ + public function setConditionType($pValue) + { + $this->conditionType = $pValue; + + return $this; + } + + /** + * Get Operator type. + * + * @return string + */ + public function getOperatorType() + { + return $this->operatorType; + } + + /** + * Set Operator type. + * + * @param string $pValue Conditional operator type, see self::OPERATOR_* + * + * @return $this + */ + public function setOperatorType($pValue) + { + $this->operatorType = $pValue; + + return $this; + } + + /** + * Get text. + * + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Set text. + * + * @param string $value + * + * @return $this + */ + public function setText($value) + { + $this->text = $value; + + return $this; + } + + /** + * Get StopIfTrue. + * + * @return bool + */ + public function getStopIfTrue() + { + return $this->stopIfTrue; + } + + /** + * Set StopIfTrue. + * + * @param bool $value + * + * @return $this + */ + public function setStopIfTrue($value) + { + $this->stopIfTrue = $value; + + return $this; + } + + /** + * Get Conditions. + * + * @return string[] + */ + public function getConditions() + { + return $this->condition; + } + + /** + * Set Conditions. + * + * @param string[] $pValue Condition + * + * @return $this + */ + public function setConditions($pValue) + { + if (!is_array($pValue)) { + $pValue = [$pValue]; + } + $this->condition = $pValue; + + return $this; + } + + /** + * Add Condition. + * + * @param string $pValue Condition + * + * @return $this + */ + public function addCondition($pValue) + { + $this->condition[] = $pValue; + + return $this; + } + + /** + * Get Style. + * + * @return Style + */ + public function getStyle() + { + return $this->style; + } + + /** + * Set Style. + * + * @param Style $pValue + * + * @return $this + */ + public function setStyle(Style $pValue = null) + { + $this->style = $pValue; + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->conditionType . + $this->operatorType . + implode(';', $this->condition) . + $this->style->getHashCode() . + __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Fill.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Fill.php new file mode 100644 index 0000000..1d6bace --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Fill.php @@ -0,0 +1,326 @@ +fillType = null; + } + $this->startColor = new Color(Color::COLOR_WHITE, $isSupervisor, $isConditional); + $this->endColor = new Color(Color::COLOR_BLACK, $isSupervisor, $isConditional); + + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->startColor->bindParent($this, 'startColor'); + $this->endColor->bindParent($this, 'endColor'); + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return Fill + */ + public function getSharedComponent() + { + return $this->parent->getSharedComponent()->getFill(); + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return ['fill' => $array]; + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray( + * [ + * 'fillType' => Fill::FILL_GRADIENT_LINEAR, + * 'rotation' => 0, + * 'startColor' => [ + * 'rgb' => '000000' + * ], + * 'endColor' => [ + * 'argb' => 'FFFFFFFF' + * ] + * ] + * ); + * + * + * @param array $pStyles Array containing style information + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function applyFromArray(array $pStyles) + { + if ($this->isSupervisor) { + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (isset($pStyles['fillType'])) { + $this->setFillType($pStyles['fillType']); + } + if (isset($pStyles['rotation'])) { + $this->setRotation($pStyles['rotation']); + } + if (isset($pStyles['startColor'])) { + $this->getStartColor()->applyFromArray($pStyles['startColor']); + } + if (isset($pStyles['endColor'])) { + $this->getEndColor()->applyFromArray($pStyles['endColor']); + } + if (isset($pStyles['color'])) { + $this->getStartColor()->applyFromArray($pStyles['color']); + $this->getEndColor()->applyFromArray($pStyles['color']); + } + } + + return $this; + } + + /** + * Get Fill Type. + * + * @return string + */ + public function getFillType() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getFillType(); + } + + return $this->fillType; + } + + /** + * Set Fill Type. + * + * @param string $pValue Fill type, see self::FILL_* + * + * @return $this + */ + public function setFillType($pValue) + { + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['fillType' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->fillType = $pValue; + } + + return $this; + } + + /** + * Get Rotation. + * + * @return float + */ + public function getRotation() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getRotation(); + } + + return $this->rotation; + } + + /** + * Set Rotation. + * + * @param float $pValue + * + * @return $this + */ + public function setRotation($pValue) + { + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['rotation' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->rotation = $pValue; + } + + return $this; + } + + /** + * Get Start Color. + * + * @return Color + */ + public function getStartColor() + { + return $this->startColor; + } + + /** + * Set Start Color. + * + * @param Color $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setStartColor(Color $pValue) + { + // make sure parameter is a real color and not a supervisor + $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; + + if ($this->isSupervisor) { + $styleArray = $this->getStartColor()->getStyleArray(['argb' => $color->getARGB()]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->startColor = $color; + } + + return $this; + } + + /** + * Get End Color. + * + * @return Color + */ + public function getEndColor() + { + return $this->endColor; + } + + /** + * Set End Color. + * + * @param Color $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setEndColor(Color $pValue) + { + // make sure parameter is a real color and not a supervisor + $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; + + if ($this->isSupervisor) { + $styleArray = $this->getEndColor()->getStyleArray(['argb' => $color->getARGB()]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->endColor = $color; + } + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + // Note that we don't care about colours for fill type NONE, but could have duplicate NONEs with + // different hashes if we don't explicitly prevent this + return md5( + $this->getFillType() . + $this->getRotation() . + ($this->getFillType() !== self::FILL_NONE ? $this->getStartColor()->getHashCode() : '') . + ($this->getFillType() !== self::FILL_NONE ? $this->getEndColor()->getHashCode() : '') . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php new file mode 100644 index 0000000..0341cad --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Font.php @@ -0,0 +1,556 @@ +name = null; + $this->size = null; + $this->bold = null; + $this->italic = null; + $this->superscript = null; + $this->subscript = null; + $this->underline = null; + $this->strikethrough = null; + $this->color = new Color(Color::COLOR_BLACK, $isSupervisor, $isConditional); + } else { + $this->color = new Color(Color::COLOR_BLACK, $isSupervisor); + } + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->color->bindParent($this, 'color'); + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return Font + */ + public function getSharedComponent() + { + return $this->parent->getSharedComponent()->getFont(); + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return ['font' => $array]; + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( + * [ + * 'name' => 'Arial', + * 'bold' => TRUE, + * 'italic' => FALSE, + * 'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE, + * 'strikethrough' => FALSE, + * 'color' => [ + * 'rgb' => '808080' + * ] + * ] + * ); + * + * + * @param array $pStyles Array containing style information + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function applyFromArray(array $pStyles) + { + if ($this->isSupervisor) { + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (isset($pStyles['name'])) { + $this->setName($pStyles['name']); + } + if (isset($pStyles['bold'])) { + $this->setBold($pStyles['bold']); + } + if (isset($pStyles['italic'])) { + $this->setItalic($pStyles['italic']); + } + if (isset($pStyles['superscript'])) { + $this->setSuperscript($pStyles['superscript']); + } + if (isset($pStyles['subscript'])) { + $this->setSubscript($pStyles['subscript']); + } + if (isset($pStyles['underline'])) { + $this->setUnderline($pStyles['underline']); + } + if (isset($pStyles['strikethrough'])) { + $this->setStrikethrough($pStyles['strikethrough']); + } + if (isset($pStyles['color'])) { + $this->getColor()->applyFromArray($pStyles['color']); + } + if (isset($pStyles['size'])) { + $this->setSize($pStyles['size']); + } + } + + return $this; + } + + /** + * Get Name. + * + * @return string + */ + public function getName() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getName(); + } + + return $this->name; + } + + /** + * Set Name. + * + * @param string $pValue + * + * @return $this + */ + public function setName($pValue) + { + if ($pValue == '') { + $pValue = 'Calibri'; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['name' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->name = $pValue; + } + + return $this; + } + + /** + * Get Size. + * + * @return float + */ + public function getSize() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getSize(); + } + + return $this->size; + } + + /** + * Set Size. + * + * @param float $pValue + * + * @return $this + */ + public function setSize($pValue) + { + if ($pValue == '') { + $pValue = 10; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['size' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->size = $pValue; + } + + return $this; + } + + /** + * Get Bold. + * + * @return bool + */ + public function getBold() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getBold(); + } + + return $this->bold; + } + + /** + * Set Bold. + * + * @param bool $pValue + * + * @return $this + */ + public function setBold($pValue) + { + if ($pValue == '') { + $pValue = false; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['bold' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->bold = $pValue; + } + + return $this; + } + + /** + * Get Italic. + * + * @return bool + */ + public function getItalic() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getItalic(); + } + + return $this->italic; + } + + /** + * Set Italic. + * + * @param bool $pValue + * + * @return $this + */ + public function setItalic($pValue) + { + if ($pValue == '') { + $pValue = false; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['italic' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->italic = $pValue; + } + + return $this; + } + + /** + * Get Superscript. + * + * @return bool + */ + public function getSuperscript() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getSuperscript(); + } + + return $this->superscript; + } + + /** + * Set Superscript. + * + * @param bool $pValue + * + * @return $this + */ + public function setSuperscript($pValue) + { + if ($pValue == '') { + $pValue = false; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['superscript' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->superscript = $pValue; + $this->subscript = !$pValue; + } + + return $this; + } + + /** + * Get Subscript. + * + * @return bool + */ + public function getSubscript() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getSubscript(); + } + + return $this->subscript; + } + + /** + * Set Subscript. + * + * @param bool $pValue + * + * @return $this + */ + public function setSubscript($pValue) + { + if ($pValue == '') { + $pValue = false; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['subscript' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->subscript = $pValue; + $this->superscript = !$pValue; + } + + return $this; + } + + /** + * Get Underline. + * + * @return string + */ + public function getUnderline() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getUnderline(); + } + + return $this->underline; + } + + /** + * Set Underline. + * + * @param bool|string $pValue \PhpOffice\PhpSpreadsheet\Style\Font underline type + * If a boolean is passed, then TRUE equates to UNDERLINE_SINGLE, + * false equates to UNDERLINE_NONE + * + * @return $this + */ + public function setUnderline($pValue) + { + if (is_bool($pValue)) { + $pValue = ($pValue) ? self::UNDERLINE_SINGLE : self::UNDERLINE_NONE; + } elseif ($pValue == '') { + $pValue = self::UNDERLINE_NONE; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['underline' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->underline = $pValue; + } + + return $this; + } + + /** + * Get Strikethrough. + * + * @return bool + */ + public function getStrikethrough() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getStrikethrough(); + } + + return $this->strikethrough; + } + + /** + * Set Strikethrough. + * + * @param bool $pValue + * + * @return $this + */ + public function setStrikethrough($pValue) + { + if ($pValue == '') { + $pValue = false; + } + + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['strikethrough' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->strikethrough = $pValue; + } + + return $this; + } + + /** + * Get Color. + * + * @return Color + */ + public function getColor() + { + return $this->color; + } + + /** + * Set Color. + * + * @param Color $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setColor(Color $pValue) + { + // make sure parameter is a real color and not a supervisor + $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue; + + if ($this->isSupervisor) { + $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->color = $color; + } + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + + return md5( + $this->name . + $this->size . + ($this->bold ? 't' : 'f') . + ($this->italic ? 't' : 'f') . + ($this->superscript ? 't' : 'f') . + ($this->subscript ? 't' : 'f') . + $this->underline . + ($this->strikethrough ? 't' : 'f') . + $this->color->getHashCode() . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php new file mode 100644 index 0000000..df4ca76 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/NumberFormat.php @@ -0,0 +1,820 @@ +formatCode = null; + $this->builtInFormatCode = false; + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return NumberFormat + */ + public function getSharedComponent() + { + return $this->parent->getSharedComponent()->getNumberFormat(); + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return ['numberFormat' => $array]; + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray( + * [ + * 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE + * ] + * ); + * + * + * @param array $pStyles Array containing style information + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function applyFromArray(array $pStyles) + { + if ($this->isSupervisor) { + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (isset($pStyles['formatCode'])) { + $this->setFormatCode($pStyles['formatCode']); + } + } + + return $this; + } + + /** + * Get Format Code. + * + * @return string + */ + public function getFormatCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getFormatCode(); + } + if ($this->builtInFormatCode !== false) { + return self::builtInFormatCode($this->builtInFormatCode); + } + + return $this->formatCode; + } + + /** + * Set Format Code. + * + * @param string $pValue see self::FORMAT_* + * + * @return $this + */ + public function setFormatCode($pValue) + { + if ($pValue == '') { + $pValue = self::FORMAT_GENERAL; + } + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['formatCode' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->formatCode = $pValue; + $this->builtInFormatCode = self::builtInFormatCodeIndex($pValue); + } + + return $this; + } + + /** + * Get Built-In Format Code. + * + * @return int + */ + public function getBuiltInFormatCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getBuiltInFormatCode(); + } + + return $this->builtInFormatCode; + } + + /** + * Set Built-In Format Code. + * + * @param int $pValue + * + * @return $this + */ + public function setBuiltInFormatCode($pValue) + { + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['formatCode' => self::builtInFormatCode($pValue)]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->builtInFormatCode = $pValue; + $this->formatCode = self::builtInFormatCode($pValue); + } + + return $this; + } + + /** + * Fill built-in format codes. + */ + private static function fillBuiltInFormatCodes() + { + // [MS-OI29500: Microsoft Office Implementation Information for ISO/IEC-29500 Standard Compliance] + // 18.8.30. numFmt (Number Format) + // + // The ECMA standard defines built-in format IDs + // 14: "mm-dd-yy" + // 22: "m/d/yy h:mm" + // 37: "#,##0 ;(#,##0)" + // 38: "#,##0 ;[Red](#,##0)" + // 39: "#,##0.00;(#,##0.00)" + // 40: "#,##0.00;[Red](#,##0.00)" + // 47: "mmss.0" + // KOR fmt 55: "yyyy-mm-dd" + // Excel defines built-in format IDs + // 14: "m/d/yyyy" + // 22: "m/d/yyyy h:mm" + // 37: "#,##0_);(#,##0)" + // 38: "#,##0_);[Red](#,##0)" + // 39: "#,##0.00_);(#,##0.00)" + // 40: "#,##0.00_);[Red](#,##0.00)" + // 47: "mm:ss.0" + // KOR fmt 55: "yyyy/mm/dd" + + // Built-in format codes + if (self::$builtInFormats === null) { + self::$builtInFormats = []; + + // General + self::$builtInFormats[0] = self::FORMAT_GENERAL; + self::$builtInFormats[1] = '0'; + self::$builtInFormats[2] = '0.00'; + self::$builtInFormats[3] = '#,##0'; + self::$builtInFormats[4] = '#,##0.00'; + + self::$builtInFormats[9] = '0%'; + self::$builtInFormats[10] = '0.00%'; + self::$builtInFormats[11] = '0.00E+00'; + self::$builtInFormats[12] = '# ?/?'; + self::$builtInFormats[13] = '# ??/??'; + self::$builtInFormats[14] = 'm/d/yyyy'; // Despite ECMA 'mm-dd-yy'; + self::$builtInFormats[15] = 'd-mmm-yy'; + self::$builtInFormats[16] = 'd-mmm'; + self::$builtInFormats[17] = 'mmm-yy'; + self::$builtInFormats[18] = 'h:mm AM/PM'; + self::$builtInFormats[19] = 'h:mm:ss AM/PM'; + self::$builtInFormats[20] = 'h:mm'; + self::$builtInFormats[21] = 'h:mm:ss'; + self::$builtInFormats[22] = 'm/d/yyyy h:mm'; // Despite ECMA 'm/d/yy h:mm'; + + self::$builtInFormats[37] = '#,##0_);(#,##0)'; // Despite ECMA '#,##0 ;(#,##0)'; + self::$builtInFormats[38] = '#,##0_);[Red](#,##0)'; // Despite ECMA '#,##0 ;[Red](#,##0)'; + self::$builtInFormats[39] = '#,##0.00_);(#,##0.00)'; // Despite ECMA '#,##0.00;(#,##0.00)'; + self::$builtInFormats[40] = '#,##0.00_);[Red](#,##0.00)'; // Despite ECMA '#,##0.00;[Red](#,##0.00)'; + + self::$builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'; + self::$builtInFormats[45] = 'mm:ss'; + self::$builtInFormats[46] = '[h]:mm:ss'; + self::$builtInFormats[47] = 'mm:ss.0'; // Despite ECMA 'mmss.0'; + self::$builtInFormats[48] = '##0.0E+0'; + self::$builtInFormats[49] = '@'; + + // CHT + self::$builtInFormats[27] = '[$-404]e/m/d'; + self::$builtInFormats[30] = 'm/d/yy'; + self::$builtInFormats[36] = '[$-404]e/m/d'; + self::$builtInFormats[50] = '[$-404]e/m/d'; + self::$builtInFormats[57] = '[$-404]e/m/d'; + + // THA + self::$builtInFormats[59] = 't0'; + self::$builtInFormats[60] = 't0.00'; + self::$builtInFormats[61] = 't#,##0'; + self::$builtInFormats[62] = 't#,##0.00'; + self::$builtInFormats[67] = 't0%'; + self::$builtInFormats[68] = 't0.00%'; + self::$builtInFormats[69] = 't# ?/?'; + self::$builtInFormats[70] = 't# ??/??'; + + // JPN + self::$builtInFormats[28] = '[$-411]ggge"年"m"月"d"日"'; + self::$builtInFormats[29] = '[$-411]ggge"年"m"月"d"日"'; + self::$builtInFormats[31] = 'yyyy"年"m"月"d"日"'; + self::$builtInFormats[32] = 'h"時"mm"分"'; + self::$builtInFormats[33] = 'h"時"mm"分"ss"秒"'; + self::$builtInFormats[34] = 'yyyy"年"m"月"'; + self::$builtInFormats[35] = 'm"月"d"日"'; + self::$builtInFormats[51] = '[$-411]ggge"年"m"月"d"日"'; + self::$builtInFormats[52] = 'yyyy"年"m"月"'; + self::$builtInFormats[53] = 'm"月"d"日"'; + self::$builtInFormats[54] = '[$-411]ggge"年"m"月"d"日"'; + self::$builtInFormats[55] = 'yyyy"年"m"月"'; + self::$builtInFormats[56] = 'm"月"d"日"'; + self::$builtInFormats[58] = '[$-411]ggge"年"m"月"d"日"'; + + // Flip array (for faster lookups) + self::$flippedBuiltInFormats = array_flip(self::$builtInFormats); + } + } + + /** + * Get built-in format code. + * + * @param int $pIndex + * + * @return string + */ + public static function builtInFormatCode($pIndex) + { + // Clean parameter + $pIndex = (int) $pIndex; + + // Ensure built-in format codes are available + self::fillBuiltInFormatCodes(); + + // Lookup format code + if (isset(self::$builtInFormats[$pIndex])) { + return self::$builtInFormats[$pIndex]; + } + + return ''; + } + + /** + * Get built-in format code index. + * + * @param string $formatCode + * + * @return bool|int + */ + public static function builtInFormatCodeIndex($formatCode) + { + // Ensure built-in format codes are available + self::fillBuiltInFormatCodes(); + + // Lookup format code + if (array_key_exists($formatCode, self::$flippedBuiltInFormats)) { + return self::$flippedBuiltInFormats[$formatCode]; + } + + return false; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + + return md5( + $this->formatCode . + $this->builtInFormatCode . + __CLASS__ + ); + } + + /** + * Search/replace values to convert Excel date/time format masks to PHP format masks. + * + * @var array + */ + private static $dateFormatReplacements = [ + // first remove escapes related to non-format characters + '\\' => '', + // 12-hour suffix + 'am/pm' => 'A', + // 4-digit year + 'e' => 'Y', + 'yyyy' => 'Y', + // 2-digit year + 'yy' => 'y', + // first letter of month - no php equivalent + 'mmmmm' => 'M', + // full month name + 'mmmm' => 'F', + // short month name + 'mmm' => 'M', + // mm is minutes if time, but can also be month w/leading zero + // so we try to identify times be the inclusion of a : separator in the mask + // It isn't perfect, but the best way I know how + ':mm' => ':i', + 'mm:' => 'i:', + // month leading zero + 'mm' => 'm', + // month no leading zero + 'm' => 'n', + // full day of week name + 'dddd' => 'l', + // short day of week name + 'ddd' => 'D', + // days leading zero + 'dd' => 'd', + // days no leading zero + 'd' => 'j', + // seconds + 'ss' => 's', + // fractional seconds - no php equivalent + '.s' => '', + ]; + + /** + * Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock). + * + * @var array + */ + private static $dateFormatReplacements24 = [ + 'hh' => 'H', + 'h' => 'G', + ]; + + /** + * Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock). + * + * @var array + */ + private static $dateFormatReplacements12 = [ + 'hh' => 'h', + 'h' => 'g', + ]; + + private static function setLowercaseCallback($matches) + { + return mb_strtolower($matches[0]); + } + + private static function escapeQuotesCallback($matches) + { + return '\\' . implode('\\', str_split($matches[1])); + } + + private static function formatAsDate(&$value, &$format) + { + // strip off first part containing e.g. [$-F800] or [$USD-409] + // general syntax: [$-] + // language info is in hexadecimal + // strip off chinese part like [DBNum1][$-804] + $format = preg_replace('/^(\[[0-9A-Za-z]*\])*(\[\$[A-Z]*-[0-9A-F]*\])/i', '', $format); + + // OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case; + // but we don't want to change any quoted strings + $format = preg_replace_callback('/(?:^|")([^"]*)(?:$|")/', ['self', 'setLowercaseCallback'], $format); + + // Only process the non-quoted blocks for date format characters + $blocks = explode('"', $format); + foreach ($blocks as $key => &$block) { + if ($key % 2 == 0) { + $block = strtr($block, self::$dateFormatReplacements); + if (!strpos($block, 'A')) { + // 24-hour time format + // when [h]:mm format, the [h] should replace to the hours of the value * 24 + if (false !== strpos($block, '[h]')) { + $hours = (int) ($value * 24); + $block = str_replace('[h]', $hours, $block); + + continue; + } + $block = strtr($block, self::$dateFormatReplacements24); + } else { + // 12-hour time format + $block = strtr($block, self::$dateFormatReplacements12); + } + } + } + $format = implode('"', $blocks); + + // escape any quoted characters so that DateTime format() will render them correctly + $format = preg_replace_callback('/"(.*)"/U', ['self', 'escapeQuotesCallback'], $format); + + $dateObj = Date::excelToDateTimeObject($value); + $value = $dateObj->format($format); + } + + private static function formatAsPercentage(&$value, &$format) + { + if ($format === self::FORMAT_PERCENTAGE) { + $value = round((100 * $value), 0) . '%'; + } else { + if (preg_match('/\.[#0]+/', $format, $m)) { + $s = substr($m[0], 0, 1) . (strlen($m[0]) - 1); + $format = str_replace($m[0], $s, $format); + } + if (preg_match('/^[#0]+/', $format, $m)) { + $format = str_replace($m[0], strlen($m[0]), $format); + } + $format = '%' . str_replace('%', 'f%%', $format); + + $value = sprintf($format, 100 * $value); + } + } + + private static function formatAsFraction(&$value, &$format) + { + $sign = ($value < 0) ? '-' : ''; + + $integerPart = floor(abs($value)); + $decimalPart = trim(fmod(abs($value), 1), '0.'); + $decimalLength = strlen($decimalPart); + $decimalDivisor = pow(10, $decimalLength); + + $GCD = MathTrig::GCD($decimalPart, $decimalDivisor); + + $adjustedDecimalPart = $decimalPart / $GCD; + $adjustedDecimalDivisor = $decimalDivisor / $GCD; + + if ((strpos($format, '0') !== false) || (strpos($format, '#') !== false) || (substr($format, 0, 3) == '? ?')) { + if ($integerPart == 0) { + $integerPart = ''; + } + $value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor"; + } else { + $adjustedDecimalPart += $integerPart * $adjustedDecimalDivisor; + $value = "$sign$adjustedDecimalPart/$adjustedDecimalDivisor"; + } + } + + private static function mergeComplexNumberFormatMasks($numbers, $masks) + { + $decimalCount = strlen($numbers[1]); + $postDecimalMasks = []; + + do { + $tempMask = array_pop($masks); + $postDecimalMasks[] = $tempMask; + $decimalCount -= strlen($tempMask); + } while ($decimalCount > 0); + + return [ + implode('.', $masks), + implode('.', array_reverse($postDecimalMasks)), + ]; + } + + private static function processComplexNumberFormatMask($number, $mask) + { + $result = $number; + $maskingBlockCount = preg_match_all('/0+/', $mask, $maskingBlocks, PREG_OFFSET_CAPTURE); + + if ($maskingBlockCount > 1) { + $maskingBlocks = array_reverse($maskingBlocks[0]); + + foreach ($maskingBlocks as $block) { + $divisor = 1 . $block[0]; + $size = strlen($block[0]); + $offset = $block[1]; + + $blockValue = sprintf( + '%0' . $size . 'd', + fmod($number, $divisor) + ); + $number = floor($number / $divisor); + $mask = substr_replace($mask, $blockValue, $offset, $size); + } + if ($number > 0) { + $mask = substr_replace($mask, $number, $offset, 0); + } + $result = $mask; + } + + return $result; + } + + private static function complexNumberFormatMask($number, $mask, $splitOnPoint = true) + { + $sign = ($number < 0.0); + $number = abs($number); + + if ($splitOnPoint && strpos($mask, '.') !== false && strpos($number, '.') !== false) { + $numbers = explode('.', $number); + $masks = explode('.', $mask); + if (count($masks) > 2) { + $masks = self::mergeComplexNumberFormatMasks($numbers, $masks); + } + $result1 = self::complexNumberFormatMask($numbers[0], $masks[0], false); + $result2 = strrev(self::complexNumberFormatMask(strrev($numbers[1]), strrev($masks[1]), false)); + + return (($sign) ? '-' : '') . $result1 . '.' . $result2; + } + + $result = self::processComplexNumberFormatMask($number, $mask); + + return (($sign) ? '-' : '') . $result; + } + + private static function formatStraightNumericValue($value, $format, array $matches, $useThousands, $number_regex) + { + $left = $matches[1]; + $dec = $matches[2]; + $right = $matches[3]; + + // minimun width of formatted number (including dot) + $minWidth = strlen($left) + strlen($dec) + strlen($right); + if ($useThousands) { + $value = number_format( + $value, + strlen($right), + StringHelper::getDecimalSeparator(), + StringHelper::getThousandsSeparator() + ); + $value = preg_replace($number_regex, $value, $format); + } else { + if (preg_match('/[0#]E[+-]0/i', $format)) { + // Scientific format + $value = sprintf('%5.2E', $value); + } elseif (preg_match('/0([^\d\.]+)0/', $format) || substr_count($format, '.') > 1) { + if ($value == (int) $value && substr_count($format, '.') === 1) { + $value *= 10 ** strlen(explode('.', $format)[1]); + } + $value = self::complexNumberFormatMask($value, $format); + } else { + $sprintf_pattern = "%0$minWidth." . strlen($right) . 'f'; + $value = sprintf($sprintf_pattern, $value); + $value = preg_replace($number_regex, $value, $format); + } + } + + return $value; + } + + private static function formatAsNumber($value, $format) + { + if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) { + return 'EUR ' . sprintf('%1.2f', $value); + } + + // Some non-number strings are quoted, so we'll get rid of the quotes, likewise any positional * symbols + $format = str_replace(['"', '*'], '', $format); + + // Find out if we need thousands separator + // This is indicated by a comma enclosed by a digit placeholder: + // #,# or 0,0 + $useThousands = preg_match('/(#,#|0,0)/', $format); + if ($useThousands) { + $format = preg_replace('/0,0/', '00', $format); + $format = preg_replace('/#,#/', '##', $format); + } + + // Scale thousands, millions,... + // This is indicated by a number of commas after a digit placeholder: + // #, or 0.0,, + $scale = 1; // same as no scale + $matches = []; + if (preg_match('/(#|0)(,+)/', $format, $matches)) { + $scale = pow(1000, strlen($matches[2])); + + // strip the commas + $format = preg_replace('/0,+/', '0', $format); + $format = preg_replace('/#,+/', '#', $format); + } + + if (preg_match('/#?.*\?\/\?/', $format, $m)) { + if ($value != (int) $value) { + self::formatAsFraction($value, $format); + } + } else { + // Handle the number itself + + // scale number + $value = $value / $scale; + // Strip # + $format = preg_replace('/\\#/', '0', $format); + // Remove locale code [$-###] + $format = preg_replace('/\[\$\-.*\]/', '', $format); + + $n = '/\\[[^\\]]+\\]/'; + $m = preg_replace($n, '', $format); + $number_regex = '/(0+)(\\.?)(0*)/'; + if (preg_match($number_regex, $m, $matches)) { + $value = self::formatStraightNumericValue($value, $format, $matches, $useThousands, $number_regex); + } + } + + if (preg_match('/\[\$(.*)\]/u', $format, $m)) { + // Currency or Accounting + $currencyCode = $m[1]; + [$currencyCode] = explode('-', $currencyCode); + if ($currencyCode == '') { + $currencyCode = StringHelper::getCurrencyCode(); + } + $value = preg_replace('/\[\$([^\]]*)\]/u', $currencyCode, $value); + } + + return $value; + } + + /** + * Convert a value in a pre-defined format to a PHP string. + * + * @param mixed $value Value to format + * @param string $format Format code, see = self::FORMAT_* + * @param array $callBack Callback function for additional formatting of string + * + * @return string Formatted string + */ + public static function toFormattedString($value, $format, $callBack = null) + { + // For now we do not treat strings although section 4 of a format code affects strings + if (!is_numeric($value)) { + return $value; + } + + // For 'General' format code, we just pass the value although this is not entirely the way Excel does it, + // it seems to round numbers to a total of 10 digits. + if (($format === self::FORMAT_GENERAL) || ($format === self::FORMAT_TEXT)) { + return $value; + } + + // Convert any other escaped characters to quoted strings, e.g. (\T to "T") + $format = preg_replace('/(\\\(((.)(?!((AM\/PM)|(A\/P))))|([^ ])))(?=(?:[^"]|"[^"]*")*$)/u', '"${2}"', $format); + + // Get the sections, there can be up to four sections, separated with a semi-colon (but only if not a quoted literal) + $sections = preg_split('/(;)(?=(?:[^"]|"[^"]*")*$)/u', $format); + + // Extract the relevant section depending on whether number is positive, negative, or zero? + // Text not supported yet. + // Here is how the sections apply to various values in Excel: + // 1 section: [POSITIVE/NEGATIVE/ZERO/TEXT] + // 2 sections: [POSITIVE/ZERO/TEXT] [NEGATIVE] + // 3 sections: [POSITIVE/TEXT] [NEGATIVE] [ZERO] + // 4 sections: [POSITIVE] [NEGATIVE] [ZERO] [TEXT] + switch (count($sections)) { + case 1: + $format = $sections[0]; + + break; + case 2: + $format = ($value >= 0) ? $sections[0] : $sections[1]; + $value = abs($value); // Use the absolute value + break; + case 3: + $format = ($value > 0) ? + $sections[0] : (($value < 0) ? + $sections[1] : $sections[2]); + $value = abs($value); // Use the absolute value + break; + case 4: + $format = ($value > 0) ? + $sections[0] : (($value < 0) ? + $sections[1] : $sections[2]); + $value = abs($value); // Use the absolute value + break; + default: + // something is wrong, just use first section + $format = $sections[0]; + + break; + } + + // In Excel formats, "_" is used to add spacing, + // The following character indicates the size of the spacing, which we can't do in HTML, so we just use a standard space + $format = preg_replace('/_./', ' ', $format); + + // Save format with color information for later use below + $formatColor = $format; + // Strip colour information + $color_regex = '/\[(' . implode('|', Color::NAMED_COLORS) . ')\]/'; + $format = preg_replace($color_regex, '', $format); + // Let's begin inspecting the format and converting the value to a formatted string + + // Check for date/time characters (not inside quotes) + if (preg_match('/(\[\$[A-Z]*-[0-9A-F]*\])*[hmsdy](?=(?:[^"]|"[^"]*")*$)/miu', $format, $matches)) { + // datetime format + self::formatAsDate($value, $format); + } else { + if (substr($format, 0, 1) === '"' && substr($format, -1, 1) === '"') { + $value = substr($format, 1, -1); + } elseif (preg_match('/%$/', $format)) { + // % number format + self::formatAsPercentage($value, $format); + } else { + $value = self::formatAsNumber($value, $format); + } + } + + // Additional formatting provided by callback function + if ($callBack !== null) { + [$writerInstance, $function] = $callBack; + $value = $writerInstance->$function($value, $formatColor); + } + + return $value; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php new file mode 100644 index 0000000..8112bc6 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php @@ -0,0 +1,190 @@ +locked = self::PROTECTION_INHERIT; + $this->hidden = self::PROTECTION_INHERIT; + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return Protection + */ + public function getSharedComponent() + { + return $this->parent->getSharedComponent()->getProtection(); + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return ['protection' => $array]; + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray( + * [ + * 'locked' => TRUE, + * 'hidden' => FALSE + * ] + * ); + * + * + * @param array $pStyles Array containing style information + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function applyFromArray(array $pStyles) + { + if ($this->isSupervisor) { + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); + } else { + if (isset($pStyles['locked'])) { + $this->setLocked($pStyles['locked']); + } + if (isset($pStyles['hidden'])) { + $this->setHidden($pStyles['hidden']); + } + } + + return $this; + } + + /** + * Get locked. + * + * @return string + */ + public function getLocked() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getLocked(); + } + + return $this->locked; + } + + /** + * Set locked. + * + * @param string $pValue see self::PROTECTION_* + * + * @return $this + */ + public function setLocked($pValue) + { + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['locked' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->locked = $pValue; + } + + return $this; + } + + /** + * Get hidden. + * + * @return string + */ + public function getHidden() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHidden(); + } + + return $this->hidden; + } + + /** + * Set hidden. + * + * @param string $pValue see self::PROTECTION_* + * + * @return $this + */ + public function setHidden($pValue) + { + if ($this->isSupervisor) { + $styleArray = $this->getStyleArray(['hidden' => $pValue]); + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->hidden = $pValue; + } + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getHashCode(); + } + + return md5( + $this->locked . + $this->hidden . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php new file mode 100644 index 0000000..a37d99b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Style.php @@ -0,0 +1,641 @@ +conditionalStyles = []; + $this->font = new Font($isSupervisor, $isConditional); + $this->fill = new Fill($isSupervisor, $isConditional); + $this->borders = new Borders($isSupervisor, $isConditional); + $this->alignment = new Alignment($isSupervisor, $isConditional); + $this->numberFormat = new NumberFormat($isSupervisor, $isConditional); + $this->protection = new Protection($isSupervisor, $isConditional); + + // bind parent if we are a supervisor + if ($isSupervisor) { + $this->font->bindParent($this); + $this->fill->bindParent($this); + $this->borders->bindParent($this); + $this->alignment->bindParent($this); + $this->numberFormat->bindParent($this); + $this->protection->bindParent($this); + } + } + + /** + * Get the shared style component for the currently active cell in currently active sheet. + * Only used for style supervisor. + * + * @return Style + */ + public function getSharedComponent() + { + $activeSheet = $this->getActiveSheet(); + $selectedCell = $this->getActiveCell(); // e.g. 'A1' + + if ($activeSheet->cellExists($selectedCell)) { + $xfIndex = $activeSheet->getCell($selectedCell)->getXfIndex(); + } else { + $xfIndex = 0; + } + + return $this->parent->getCellXfByIndex($xfIndex); + } + + /** + * Get parent. Only used for style supervisor. + * + * @return Spreadsheet + */ + public function getParent() + { + return $this->parent; + } + + /** + * Build style array from subcomponents. + * + * @param array $array + * + * @return array + */ + public function getStyleArray($array) + { + return ['quotePrefix' => $array]; + } + + /** + * Apply styles from array. + * + * + * $spreadsheet->getActiveSheet()->getStyle('B2')->applyFromArray( + * [ + * 'font' => [ + * 'name' => 'Arial', + * 'bold' => true, + * 'italic' => false, + * 'underline' => Font::UNDERLINE_DOUBLE, + * 'strikethrough' => false, + * 'color' => [ + * 'rgb' => '808080' + * ] + * ], + * 'borders' => [ + * 'bottom' => [ + * 'borderStyle' => Border::BORDER_DASHDOT, + * 'color' => [ + * 'rgb' => '808080' + * ] + * ], + * 'top' => [ + * 'borderStyle' => Border::BORDER_DASHDOT, + * 'color' => [ + * 'rgb' => '808080' + * ] + * ] + * ], + * 'alignment' => [ + * 'horizontal' => Alignment::HORIZONTAL_CENTER, + * 'vertical' => Alignment::VERTICAL_CENTER, + * 'wrapText' => true, + * ], + * 'quotePrefix' => true + * ] + * ); + * + * + * @param array $pStyles Array containing style information + * @param bool $pAdvanced advanced mode for setting borders + * + * @return $this + */ + public function applyFromArray(array $pStyles, $pAdvanced = true) + { + if ($this->isSupervisor) { + $pRange = $this->getSelectedCells(); + + // Uppercase coordinate + $pRange = strtoupper($pRange); + + // Is it a cell range or a single cell? + if (strpos($pRange, ':') === false) { + $rangeA = $pRange; + $rangeB = $pRange; + } else { + [$rangeA, $rangeB] = explode(':', $pRange); + } + + // Calculate range outer borders + $rangeStart = Coordinate::coordinateFromString($rangeA); + $rangeEnd = Coordinate::coordinateFromString($rangeB); + + // Translate column into index + $rangeStart[0] = Coordinate::columnIndexFromString($rangeStart[0]); + $rangeEnd[0] = Coordinate::columnIndexFromString($rangeEnd[0]); + + // Make sure we can loop upwards on rows and columns + if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { + $tmp = $rangeStart; + $rangeStart = $rangeEnd; + $rangeEnd = $tmp; + } + + // ADVANCED MODE: + if ($pAdvanced && isset($pStyles['borders'])) { + // 'allBorders' is a shorthand property for 'outline' and 'inside' and + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['allBorders'])) { + foreach (['outline', 'inside'] as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['allBorders']; + } + } + unset($pStyles['borders']['allBorders']); // not needed any more + } + // 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left' + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['outline'])) { + foreach (['top', 'right', 'bottom', 'left'] as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['outline']; + } + } + unset($pStyles['borders']['outline']); // not needed any more + } + // 'inside' is a shorthand property for 'vertical' and 'horizontal' + // it applies to components that have not been set explicitly + if (isset($pStyles['borders']['inside'])) { + foreach (['vertical', 'horizontal'] as $component) { + if (!isset($pStyles['borders'][$component])) { + $pStyles['borders'][$component] = $pStyles['borders']['inside']; + } + } + unset($pStyles['borders']['inside']); // not needed any more + } + // width and height characteristics of selection, 1, 2, or 3 (for 3 or more) + $xMax = min($rangeEnd[0] - $rangeStart[0] + 1, 3); + $yMax = min($rangeEnd[1] - $rangeStart[1] + 1, 3); + + // loop through up to 3 x 3 = 9 regions + for ($x = 1; $x <= $xMax; ++$x) { + // start column index for region + $colStart = ($x == 3) ? + Coordinate::stringFromColumnIndex($rangeEnd[0]) + : Coordinate::stringFromColumnIndex($rangeStart[0] + $x - 1); + // end column index for region + $colEnd = ($x == 1) ? + Coordinate::stringFromColumnIndex($rangeStart[0]) + : Coordinate::stringFromColumnIndex($rangeEnd[0] - $xMax + $x); + + for ($y = 1; $y <= $yMax; ++$y) { + // which edges are touching the region + $edges = []; + if ($x == 1) { + // are we at left edge + $edges[] = 'left'; + } + if ($x == $xMax) { + // are we at right edge + $edges[] = 'right'; + } + if ($y == 1) { + // are we at top edge? + $edges[] = 'top'; + } + if ($y == $yMax) { + // are we at bottom edge? + $edges[] = 'bottom'; + } + + // start row index for region + $rowStart = ($y == 3) ? + $rangeEnd[1] : $rangeStart[1] + $y - 1; + + // end row index for region + $rowEnd = ($y == 1) ? + $rangeStart[1] : $rangeEnd[1] - $yMax + $y; + + // build range for region + $range = $colStart . $rowStart . ':' . $colEnd . $rowEnd; + + // retrieve relevant style array for region + $regionStyles = $pStyles; + unset($regionStyles['borders']['inside']); + + // what are the inner edges of the region when looking at the selection + $innerEdges = array_diff(['top', 'right', 'bottom', 'left'], $edges); + + // inner edges that are not touching the region should take the 'inside' border properties if they have been set + foreach ($innerEdges as $innerEdge) { + switch ($innerEdge) { + case 'top': + case 'bottom': + // should pick up 'horizontal' border property if set + if (isset($pStyles['borders']['horizontal'])) { + $regionStyles['borders'][$innerEdge] = $pStyles['borders']['horizontal']; + } else { + unset($regionStyles['borders'][$innerEdge]); + } + + break; + case 'left': + case 'right': + // should pick up 'vertical' border property if set + if (isset($pStyles['borders']['vertical'])) { + $regionStyles['borders'][$innerEdge] = $pStyles['borders']['vertical']; + } else { + unset($regionStyles['borders'][$innerEdge]); + } + + break; + } + } + + // apply region style to region by calling applyFromArray() in simple mode + $this->getActiveSheet()->getStyle($range)->applyFromArray($regionStyles, false); + } + } + + // restore initial cell selection range + $this->getActiveSheet()->getStyle($pRange); + + return $this; + } + + // SIMPLE MODE: + // Selection type, inspect + if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) { + $selectionType = 'COLUMN'; + } elseif (preg_match('/^A\d+:XFD\d+$/', $pRange)) { + $selectionType = 'ROW'; + } else { + $selectionType = 'CELL'; + } + + // First loop through columns, rows, or cells to find out which styles are affected by this operation + switch ($selectionType) { + case 'COLUMN': + $oldXfIndexes = []; + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + $oldXfIndexes[$this->getActiveSheet()->getColumnDimensionByColumn($col)->getXfIndex()] = true; + } + + break; + case 'ROW': + $oldXfIndexes = []; + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + if ($this->getActiveSheet()->getRowDimension($row)->getXfIndex() == null) { + $oldXfIndexes[0] = true; // row without explicit style should be formatted based on default style + } else { + $oldXfIndexes[$this->getActiveSheet()->getRowDimension($row)->getXfIndex()] = true; + } + } + + break; + case 'CELL': + $oldXfIndexes = []; + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $oldXfIndexes[$this->getActiveSheet()->getCellByColumnAndRow($col, $row)->getXfIndex()] = true; + } + } + + break; + } + + // clone each of the affected styles, apply the style array, and add the new styles to the workbook + $workbook = $this->getActiveSheet()->getParent(); + foreach ($oldXfIndexes as $oldXfIndex => $dummy) { + $style = $workbook->getCellXfByIndex($oldXfIndex); + $newStyle = clone $style; + $newStyle->applyFromArray($pStyles); + + if ($existingStyle = $workbook->getCellXfByHashCode($newStyle->getHashCode())) { + // there is already such cell Xf in our collection + $newXfIndexes[$oldXfIndex] = $existingStyle->getIndex(); + } else { + // we don't have such a cell Xf, need to add + $workbook->addCellXf($newStyle); + $newXfIndexes[$oldXfIndex] = $newStyle->getIndex(); + } + } + + // Loop through columns, rows, or cells again and update the XF index + switch ($selectionType) { + case 'COLUMN': + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + $columnDimension = $this->getActiveSheet()->getColumnDimensionByColumn($col); + $oldXfIndex = $columnDimension->getXfIndex(); + $columnDimension->setXfIndex($newXfIndexes[$oldXfIndex]); + } + + break; + case 'ROW': + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $rowDimension = $this->getActiveSheet()->getRowDimension($row); + $oldXfIndex = $rowDimension->getXfIndex() === null ? + 0 : $rowDimension->getXfIndex(); // row without explicit style should be formatted based on default style + $rowDimension->setXfIndex($newXfIndexes[$oldXfIndex]); + } + + break; + case 'CELL': + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $cell = $this->getActiveSheet()->getCellByColumnAndRow($col, $row); + $oldXfIndex = $cell->getXfIndex(); + $cell->setXfIndex($newXfIndexes[$oldXfIndex]); + } + } + + break; + } + } else { + // not a supervisor, just apply the style array directly on style object + if (isset($pStyles['fill'])) { + $this->getFill()->applyFromArray($pStyles['fill']); + } + if (isset($pStyles['font'])) { + $this->getFont()->applyFromArray($pStyles['font']); + } + if (isset($pStyles['borders'])) { + $this->getBorders()->applyFromArray($pStyles['borders']); + } + if (isset($pStyles['alignment'])) { + $this->getAlignment()->applyFromArray($pStyles['alignment']); + } + if (isset($pStyles['numberFormat'])) { + $this->getNumberFormat()->applyFromArray($pStyles['numberFormat']); + } + if (isset($pStyles['protection'])) { + $this->getProtection()->applyFromArray($pStyles['protection']); + } + if (isset($pStyles['quotePrefix'])) { + $this->quotePrefix = $pStyles['quotePrefix']; + } + } + + return $this; + } + + /** + * Get Fill. + * + * @return Fill + */ + public function getFill() + { + return $this->fill; + } + + /** + * Get Font. + * + * @return Font + */ + public function getFont() + { + return $this->font; + } + + /** + * Set font. + * + * @param Font $font + * + * @return $this + */ + public function setFont(Font $font) + { + $this->font = $font; + + return $this; + } + + /** + * Get Borders. + * + * @return Borders + */ + public function getBorders() + { + return $this->borders; + } + + /** + * Get Alignment. + * + * @return Alignment + */ + public function getAlignment() + { + return $this->alignment; + } + + /** + * Get Number Format. + * + * @return NumberFormat + */ + public function getNumberFormat() + { + return $this->numberFormat; + } + + /** + * Get Conditional Styles. Only used on supervisor. + * + * @return Conditional[] + */ + public function getConditionalStyles() + { + return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell()); + } + + /** + * Set Conditional Styles. Only used on supervisor. + * + * @param Conditional[] $pValue Array of conditional styles + * + * @return $this + */ + public function setConditionalStyles(array $pValue) + { + $this->getActiveSheet()->setConditionalStyles($this->getSelectedCells(), $pValue); + + return $this; + } + + /** + * Get Protection. + * + * @return Protection + */ + public function getProtection() + { + return $this->protection; + } + + /** + * Get quote prefix. + * + * @return bool + */ + public function getQuotePrefix() + { + if ($this->isSupervisor) { + return $this->getSharedComponent()->getQuotePrefix(); + } + + return $this->quotePrefix; + } + + /** + * Set quote prefix. + * + * @param bool $pValue + * + * @return $this + */ + public function setQuotePrefix($pValue) + { + if ($pValue == '') { + $pValue = false; + } + if ($this->isSupervisor) { + $styleArray = ['quotePrefix' => $pValue]; + $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); + } else { + $this->quotePrefix = (bool) $pValue; + } + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + $hashConditionals = ''; + foreach ($this->conditionalStyles as $conditional) { + $hashConditionals .= $conditional->getHashCode(); + } + + return md5( + $this->fill->getHashCode() . + $this->font->getHashCode() . + $this->borders->getHashCode() . + $this->alignment->getHashCode() . + $this->numberFormat->getHashCode() . + $hashConditionals . + $this->protection->getHashCode() . + ($this->quotePrefix ? 't' : 'f') . + __CLASS__ + ); + } + + /** + * Get own index in style collection. + * + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * Set own index in style collection. + * + * @param int $pValue + */ + public function setIndex($pValue) + { + $this->index = $pValue; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php new file mode 100644 index 0000000..1a70097 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Supervisor.php @@ -0,0 +1,117 @@ +isSupervisor = $isSupervisor; + } + + /** + * Bind parent. Only used for supervisor. + * + * @param Spreadsheet|Style $parent + * @param null|string $parentPropertyName + * + * @return $this + */ + public function bindParent($parent, $parentPropertyName = null) + { + $this->parent = $parent; + $this->parentPropertyName = $parentPropertyName; + + return $this; + } + + /** + * Is this a supervisor or a cell style component? + * + * @return bool + */ + public function getIsSupervisor() + { + return $this->isSupervisor; + } + + /** + * Get the currently active sheet. Only used for supervisor. + * + * @return Worksheet + */ + public function getActiveSheet() + { + return $this->parent->getActiveSheet(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor. + * + * @return string E.g. 'A1' + */ + public function getSelectedCells() + { + return $this->getActiveSheet()->getSelectedCells(); + } + + /** + * Get the currently active cell coordinate in currently active sheet. + * Only used for supervisor. + * + * @return string E.g. 'A1' + */ + public function getActiveCell() + { + return $this->getActiveSheet()->getActiveCell(); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ((is_object($value)) && ($key != 'parent')) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php new file mode 100644 index 0000000..dcbc4da --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -0,0 +1,873 @@ +range = $pRange; + $this->workSheet = $pSheet; + } + + /** + * Get AutoFilter Parent Worksheet. + * + * @return Worksheet + */ + public function getParent() + { + return $this->workSheet; + } + + /** + * Set AutoFilter Parent Worksheet. + * + * @param Worksheet $pSheet + * + * @return $this + */ + public function setParent(Worksheet $pSheet = null) + { + $this->workSheet = $pSheet; + + return $this; + } + + /** + * Get AutoFilter Range. + * + * @return string + */ + public function getRange() + { + return $this->range; + } + + /** + * Set AutoFilter Range. + * + * @param string $pRange Cell range (i.e. A1:E10) + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setRange($pRange) + { + // extract coordinate + [$worksheet, $pRange] = Worksheet::extractSheetTitle($pRange, true); + + if (strpos($pRange, ':') !== false) { + $this->range = $pRange; + } elseif (empty($pRange)) { + $this->range = ''; + } else { + throw new PhpSpreadsheetException('Autofilter must be set on a range of cells.'); + } + + if (empty($pRange)) { + // Discard all column rules + $this->columns = []; + } else { + // Discard any column rules that are no longer valid within this range + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range); + foreach ($this->columns as $key => $value) { + $colIndex = Coordinate::columnIndexFromString($key); + if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) { + unset($this->columns[$key]); + } + } + } + + return $this; + } + + /** + * Get all AutoFilter Columns. + * + * @return AutoFilter\Column[] + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Validate that the specified column is in the AutoFilter range. + * + * @param string $column Column name (e.g. A) + * + * @throws PhpSpreadsheetException + * + * @return int The column offset within the autofilter range + */ + public function testColumnInRange($column) + { + if (empty($this->range)) { + throw new PhpSpreadsheetException('No autofilter range is defined.'); + } + + $columnIndex = Coordinate::columnIndexFromString($column); + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range); + if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) { + throw new PhpSpreadsheetException('Column is outside of current autofilter range.'); + } + + return $columnIndex - $rangeStart[0]; + } + + /** + * Get a specified AutoFilter Column Offset within the defined AutoFilter range. + * + * @param string $pColumn Column name (e.g. A) + * + * @throws PhpSpreadsheetException + * + * @return int The offset of the specified column within the autofilter range + */ + public function getColumnOffset($pColumn) + { + return $this->testColumnInRange($pColumn); + } + + /** + * Get a specified AutoFilter Column. + * + * @param string $pColumn Column name (e.g. A) + * + * @throws PhpSpreadsheetException + * + * @return AutoFilter\Column + */ + public function getColumn($pColumn) + { + $this->testColumnInRange($pColumn); + + if (!isset($this->columns[$pColumn])) { + $this->columns[$pColumn] = new AutoFilter\Column($pColumn, $this); + } + + return $this->columns[$pColumn]; + } + + /** + * Get a specified AutoFilter Column by it's offset. + * + * @param int $pColumnOffset Column offset within range (starting from 0) + * + * @throws PhpSpreadsheetException + * + * @return AutoFilter\Column + */ + public function getColumnByOffset($pColumnOffset) + { + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range); + $pColumn = Coordinate::stringFromColumnIndex($rangeStart[0] + $pColumnOffset); + + return $this->getColumn($pColumn); + } + + /** + * Set AutoFilter. + * + * @param AutoFilter\Column|string $pColumn + * A simple string containing a Column ID like 'A' is permitted + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setColumn($pColumn) + { + if ((is_string($pColumn)) && (!empty($pColumn))) { + $column = $pColumn; + } elseif (is_object($pColumn) && ($pColumn instanceof AutoFilter\Column)) { + $column = $pColumn->getColumnIndex(); + } else { + throw new PhpSpreadsheetException('Column is not within the autofilter range.'); + } + $this->testColumnInRange($column); + + if (is_string($pColumn)) { + $this->columns[$pColumn] = new AutoFilter\Column($pColumn, $this); + } elseif (is_object($pColumn) && ($pColumn instanceof AutoFilter\Column)) { + $pColumn->setParent($this); + $this->columns[$column] = $pColumn; + } + ksort($this->columns); + + return $this; + } + + /** + * Clear a specified AutoFilter Column. + * + * @param string $pColumn Column name (e.g. A) + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function clearColumn($pColumn) + { + $this->testColumnInRange($pColumn); + + if (isset($this->columns[$pColumn])) { + unset($this->columns[$pColumn]); + } + + return $this; + } + + /** + * Shift an AutoFilter Column Rule to a different column. + * + * Note: This method bypasses validation of the destination column to ensure it is within this AutoFilter range. + * Nor does it verify whether any column rule already exists at $toColumn, but will simply override any existing value. + * Use with caution. + * + * @param string $fromColumn Column name (e.g. A) + * @param string $toColumn Column name (e.g. B) + * + * @return $this + */ + public function shiftColumn($fromColumn, $toColumn) + { + $fromColumn = strtoupper($fromColumn); + $toColumn = strtoupper($toColumn); + + if (($fromColumn !== null) && (isset($this->columns[$fromColumn])) && ($toColumn !== null)) { + $this->columns[$fromColumn]->setParent(); + $this->columns[$fromColumn]->setColumnIndex($toColumn); + $this->columns[$toColumn] = $this->columns[$fromColumn]; + $this->columns[$toColumn]->setParent($this); + unset($this->columns[$fromColumn]); + + ksort($this->columns); + } + + return $this; + } + + /** + * Test if cell value is in the defined set of values. + * + * @param mixed $cellValue + * @param mixed[] $dataSet + * + * @return bool + */ + private static function filterTestInSimpleDataSet($cellValue, $dataSet) + { + $dataSetValues = $dataSet['filterValues']; + $blanks = $dataSet['blanks']; + if (($cellValue == '') || ($cellValue === null)) { + return $blanks; + } + + return in_array($cellValue, $dataSetValues); + } + + /** + * Test if cell value is in the defined set of Excel date values. + * + * @param mixed $cellValue + * @param mixed[] $dataSet + * + * @return bool + */ + private static function filterTestInDateGroupSet($cellValue, $dataSet) + { + $dateSet = $dataSet['filterValues']; + $blanks = $dataSet['blanks']; + if (($cellValue == '') || ($cellValue === null)) { + return $blanks; + } + + if (is_numeric($cellValue)) { + $dateValue = Date::excelToTimestamp($cellValue); + if ($cellValue < 1) { + // Just the time part + $dtVal = date('His', $dateValue); + $dateSet = $dateSet['time']; + } elseif ($cellValue == floor($cellValue)) { + // Just the date part + $dtVal = date('Ymd', $dateValue); + $dateSet = $dateSet['date']; + } else { + // date and time parts + $dtVal = date('YmdHis', $dateValue); + $dateSet = $dateSet['dateTime']; + } + foreach ($dateSet as $dateValue) { + // Use of substr to extract value at the appropriate group level + if (substr($dtVal, 0, strlen($dateValue)) == $dateValue) { + return true; + } + } + } + + return false; + } + + /** + * Test if cell value is within a set of values defined by a ruleset. + * + * @param mixed $cellValue + * @param mixed[] $ruleSet + * + * @return bool + */ + private static function filterTestInCustomDataSet($cellValue, $ruleSet) + { + $dataSet = $ruleSet['filterRules']; + $join = $ruleSet['join']; + $customRuleForBlanks = $ruleSet['customRuleForBlanks'] ?? false; + + if (!$customRuleForBlanks) { + // Blank cells are always ignored, so return a FALSE + if (($cellValue == '') || ($cellValue === null)) { + return false; + } + } + $returnVal = ($join == AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND); + foreach ($dataSet as $rule) { + $retVal = false; + + if (is_numeric($rule['value'])) { + // Numeric values are tested using the appropriate operator + switch ($rule['operator']) { + case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL: + $retVal = ($cellValue == $rule['value']); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL: + $retVal = ($cellValue != $rule['value']); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN: + $retVal = ($cellValue > $rule['value']); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL: + $retVal = ($cellValue >= $rule['value']); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN: + $retVal = ($cellValue < $rule['value']); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL: + $retVal = ($cellValue <= $rule['value']); + + break; + } + } elseif ($rule['value'] == '') { + switch ($rule['operator']) { + case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL: + $retVal = (($cellValue == '') || ($cellValue === null)); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL: + $retVal = (($cellValue != '') && ($cellValue !== null)); + + break; + default: + $retVal = true; + + break; + } + } else { + // String values are always tested for equality, factoring in for wildcards (hence a regexp test) + $retVal = preg_match('/^' . $rule['value'] . '$/i', $cellValue); + } + // If there are multiple conditions, then we need to test both using the appropriate join operator + switch ($join) { + case AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR: + $returnVal = $returnVal || $retVal; + // Break as soon as we have a TRUE match for OR joins, + // to avoid unnecessary additional code execution + if ($returnVal) { + return $returnVal; + } + + break; + case AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND: + $returnVal = $returnVal && $retVal; + + break; + } + } + + return $returnVal; + } + + /** + * Test if cell date value is matches a set of values defined by a set of months. + * + * @param mixed $cellValue + * @param mixed[] $monthSet + * + * @return bool + */ + private static function filterTestInPeriodDateSet($cellValue, $monthSet) + { + // Blank cells are always ignored, so return a FALSE + if (($cellValue == '') || ($cellValue === null)) { + return false; + } + + if (is_numeric($cellValue)) { + $dateValue = date('m', Date::excelToTimestamp($cellValue)); + if (in_array($dateValue, $monthSet)) { + return true; + } + } + + return false; + } + + /** + * Search/Replace arrays to convert Excel wildcard syntax to a regexp syntax for preg_matching. + * + * @var array + */ + private static $fromReplace = ['\*', '\?', '~~', '~.*', '~.?']; + + private static $toReplace = ['.*', '.', '~', '\*', '\?']; + + /** + * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation. + * + * @param string $dynamicRuleType + * @param AutoFilter\Column $filterColumn + * + * @return mixed[] + */ + private function dynamicFilterDateRange($dynamicRuleType, &$filterColumn) + { + $rDateType = Functions::getReturnDateType(); + Functions::setReturnDateType(Functions::RETURNDATE_PHP_NUMERIC); + $val = $maxVal = null; + + $ruleValues = []; + $baseDate = DateTime::DATENOW(); + // Calculate start/end dates for the required date range based on current date + switch ($dynamicRuleType) { + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK: + $baseDate = strtotime('-7 days', $baseDate); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK: + $baseDate = strtotime('-7 days', $baseDate); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH: + $baseDate = strtotime('-1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH: + $baseDate = strtotime('+1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER: + $baseDate = strtotime('-3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER: + $baseDate = strtotime('+3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR: + $baseDate = strtotime('-1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR: + $baseDate = strtotime('+1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); + + break; + } + + switch ($dynamicRuleType) { + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW: + $maxVal = (int) Date::PHPtoExcel(strtotime('+1 day', $baseDate)); + $val = (int) Date::PHPToExcel($baseDate); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE: + $maxVal = (int) Date::PHPtoExcel(strtotime('+1 day', $baseDate)); + $val = (int) Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR: + $maxVal = (int) Date::PHPToExcel(gmmktime(0, 0, 0, 31, 12, date('Y', $baseDate))); + ++$maxVal; + $val = (int) Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER: + $thisMonth = date('m', $baseDate); + $thisQuarter = floor(--$thisMonth / 3); + $maxVal = (int) Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), (1 + $thisQuarter) * 3, date('Y', $baseDate))); + ++$maxVal; + $val = (int) Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1 + $thisQuarter * 3, date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH: + $maxVal = (int) Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), date('m', $baseDate), date('Y', $baseDate))); + ++$maxVal; + $val = (int) Date::PHPToExcel(gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate))); + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK: + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK: + $dayOfWeek = date('w', $baseDate); + $val = (int) Date::PHPToExcel($baseDate) - $dayOfWeek; + $maxVal = $val + 7; + + break; + } + + switch ($dynamicRuleType) { + // Adjust Today dates for Yesterday and Tomorrow + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY: + --$maxVal; + --$val; + + break; + case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW: + ++$maxVal; + ++$val; + + break; + } + + // Set the filter column rule attributes ready for writing + $filterColumn->setAttributes(['val' => $val, 'maxVal' => $maxVal]); + + // Set the rules for identifying rows for hide/show + $ruleValues[] = ['operator' => AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val]; + $ruleValues[] = ['operator' => AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal]; + Functions::setReturnDateType($rDateType); + + return ['method' => 'filterTestInCustomDataSet', 'arguments' => ['filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND]]; + } + + private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) + { + $range = $columnID . $startRow . ':' . $columnID . $endRow; + $dataValues = Functions::flattenArray($this->workSheet->rangeToArray($range, null, true, false)); + + $dataValues = array_filter($dataValues); + if ($ruleType == AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) { + rsort($dataValues); + } else { + sort($dataValues); + } + + return array_pop(array_slice($dataValues, 0, $ruleValue)); + } + + /** + * Apply the AutoFilter rules to the AutoFilter Range. + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function showHideRows() + { + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($this->range); + + // The heading row should always be visible + $this->workSheet->getRowDimension($rangeStart[1])->setVisible(true); + + $columnFilterTests = []; + foreach ($this->columns as $columnID => $filterColumn) { + $rules = $filterColumn->getRules(); + switch ($filterColumn->getFilterType()) { + case AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER: + $ruleType = null; + $ruleValues = []; + // Build a list of the filter value selections + foreach ($rules as $rule) { + $ruleType = $rule->getRuleType(); + $ruleValues[] = $rule->getValue(); + } + // Test if we want to include blanks in our filter criteria + $blanks = false; + $ruleDataSet = array_filter($ruleValues); + if (count($ruleValues) != count($ruleDataSet)) { + $blanks = true; + } + if ($ruleType == AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_FILTER) { + // Filter on absolute values + $columnFilterTests[$columnID] = [ + 'method' => 'filterTestInSimpleDataSet', + 'arguments' => ['filterValues' => $ruleDataSet, 'blanks' => $blanks], + ]; + } else { + // Filter on date group values + $arguments = [ + 'date' => [], + 'time' => [], + 'dateTime' => [], + ]; + foreach ($ruleDataSet as $ruleValue) { + $date = $time = ''; + if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) && + ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== '')) { + $date .= sprintf('%04d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]); + } + if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) && + ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != '')) { + $date .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]); + } + if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) && + ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== '')) { + $date .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]); + } + if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) && + ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== '')) { + $time .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]); + } + if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) && + ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== '')) { + $time .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]); + } + if ((isset($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) && + ($ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== '')) { + $time .= sprintf('%02d', $ruleValue[AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]); + } + $dateTime = $date . $time; + $arguments['date'][] = $date; + $arguments['time'][] = $time; + $arguments['dateTime'][] = $dateTime; + } + // Remove empty elements + $arguments['date'] = array_filter($arguments['date']); + $arguments['time'] = array_filter($arguments['time']); + $arguments['dateTime'] = array_filter($arguments['dateTime']); + $columnFilterTests[$columnID] = [ + 'method' => 'filterTestInDateGroupSet', + 'arguments' => ['filterValues' => $arguments, 'blanks' => $blanks], + ]; + } + + break; + case AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER: + $customRuleForBlanks = false; + $ruleValues = []; + // Build a list of the filter value selections + foreach ($rules as $rule) { + $ruleValue = $rule->getValue(); + if (!is_numeric($ruleValue)) { + // Convert to a regexp allowing for regexp reserved characters, wildcards and escaped wildcards + $ruleValue = preg_quote($ruleValue); + $ruleValue = str_replace(self::$fromReplace, self::$toReplace, $ruleValue); + if (trim($ruleValue) == '') { + $customRuleForBlanks = true; + $ruleValue = trim($ruleValue); + } + } + $ruleValues[] = ['operator' => $rule->getOperator(), 'value' => $ruleValue]; + } + $join = $filterColumn->getJoin(); + $columnFilterTests[$columnID] = [ + 'method' => 'filterTestInCustomDataSet', + 'arguments' => ['filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks], + ]; + + break; + case AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER: + $ruleValues = []; + foreach ($rules as $rule) { + // We should only ever have one Dynamic Filter Rule anyway + $dynamicRuleType = $rule->getGrouping(); + if (($dynamicRuleType == AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) || + ($dynamicRuleType == AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE)) { + // Number (Average) based + // Calculate the average + $averageFormula = '=AVERAGE(' . $columnID . ($rangeStart[1] + 1) . ':' . $columnID . $rangeEnd[1] . ')'; + $average = Calculation::getInstance()->calculateFormula($averageFormula, null, $this->workSheet->getCell('A1')); + // Set above/below rule based on greaterThan or LessTan + $operator = ($dynamicRuleType === AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) + ? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN + : AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; + $ruleValues[] = [ + 'operator' => $operator, + 'value' => $average, + ]; + $columnFilterTests[$columnID] = [ + 'method' => 'filterTestInCustomDataSet', + 'arguments' => ['filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR], + ]; + } else { + // Date based + if ($dynamicRuleType[0] == 'M' || $dynamicRuleType[0] == 'Q') { + $periodType = ''; + $period = 0; + // Month or Quarter + sscanf($dynamicRuleType, '%[A-Z]%d', $periodType, $period); + if ($periodType == 'M') { + $ruleValues = [$period]; + } else { + --$period; + $periodEnd = (1 + $period) * 3; + $periodStart = 1 + $period * 3; + $ruleValues = range($periodStart, $periodEnd); + } + $columnFilterTests[$columnID] = [ + 'method' => 'filterTestInPeriodDateSet', + 'arguments' => $ruleValues, + ]; + $filterColumn->setAttributes([]); + } else { + // Date Range + $columnFilterTests[$columnID] = $this->dynamicFilterDateRange($dynamicRuleType, $filterColumn); + + break; + } + } + } + + break; + case AutoFilter\Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER: + $ruleValues = []; + $dataRowCount = $rangeEnd[1] - $rangeStart[1]; + foreach ($rules as $rule) { + // We should only ever have one Dynamic Filter Rule anyway + $toptenRuleType = $rule->getGrouping(); + $ruleValue = $rule->getValue(); + $ruleOperator = $rule->getOperator(); + } + if ($ruleOperator === AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) { + $ruleValue = floor($ruleValue * ($dataRowCount / 100)); + } + if ($ruleValue < 1) { + $ruleValue = 1; + } + if ($ruleValue > 500) { + $ruleValue = 500; + } + + $maxVal = $this->calculateTopTenValue($columnID, $rangeStart[1] + 1, $rangeEnd[1], $toptenRuleType, $ruleValue); + + $operator = ($toptenRuleType == AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) + ? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL + : AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL; + $ruleValues[] = ['operator' => $operator, 'value' => $maxVal]; + $columnFilterTests[$columnID] = [ + 'method' => 'filterTestInCustomDataSet', + 'arguments' => ['filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR], + ]; + $filterColumn->setAttributes(['maxVal' => $maxVal]); + + break; + } + } + + // Execute the column tests for each row in the autoFilter range to determine show/hide, + for ($row = $rangeStart[1] + 1; $row <= $rangeEnd[1]; ++$row) { + $result = true; + foreach ($columnFilterTests as $columnID => $columnFilterTest) { + $cellValue = $this->workSheet->getCell($columnID . $row)->getCalculatedValue(); + // Execute the filter test + $result = $result && + call_user_func_array( + [self::class, $columnFilterTest['method']], + [$cellValue, $columnFilterTest['arguments']] + ); + // If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests + if (!$result) { + break; + } + } + // Set show/hide for the row based on the result of the autoFilter result + $this->workSheet->getRowDimension($row)->setVisible($result); + } + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + if ($key === 'workSheet') { + // Detach from worksheet + $this->{$key} = null; + } else { + $this->{$key} = clone $value; + } + } elseif ((is_array($value)) && ($key == 'columns')) { + // The columns array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter objects + $this->{$key} = []; + foreach ($value as $k => $v) { + $this->{$key}[$k] = clone $v; + // attach the new cloned Column to this new cloned Autofilter object + $this->{$key}[$k]->setParent($this); + } + } else { + $this->{$key} = $value; + } + } + } + + /** + * toString method replicates previous behavior by returning the range if object is + * referenced as a property of its parent. + */ + public function __toString() + { + return (string) $this->range; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php new file mode 100644 index 0000000..3ed7270 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column.php @@ -0,0 +1,388 @@ +columnIndex = $pColumn; + $this->parent = $pParent; + } + + /** + * Get AutoFilter column index as string eg: 'A'. + * + * @return string + */ + public function getColumnIndex() + { + return $this->columnIndex; + } + + /** + * Set AutoFilter column index as string eg: 'A'. + * + * @param string $pColumn Column (e.g. A) + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setColumnIndex($pColumn) + { + // Uppercase coordinate + $pColumn = strtoupper($pColumn); + if ($this->parent !== null) { + $this->parent->testColumnInRange($pColumn); + } + + $this->columnIndex = $pColumn; + + return $this; + } + + /** + * Get this Column's AutoFilter Parent. + * + * @return AutoFilter + */ + public function getParent() + { + return $this->parent; + } + + /** + * Set this Column's AutoFilter Parent. + * + * @param AutoFilter $pParent + * + * @return $this + */ + public function setParent(AutoFilter $pParent = null) + { + $this->parent = $pParent; + + return $this; + } + + /** + * Get AutoFilter Type. + * + * @return string + */ + public function getFilterType() + { + return $this->filterType; + } + + /** + * Set AutoFilter Type. + * + * @param string $pFilterType + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setFilterType($pFilterType) + { + if (!in_array($pFilterType, self::$filterTypes)) { + throw new PhpSpreadsheetException('Invalid filter type for column AutoFilter.'); + } + + $this->filterType = $pFilterType; + + return $this; + } + + /** + * Get AutoFilter Multiple Rules And/Or Join. + * + * @return string + */ + public function getJoin() + { + return $this->join; + } + + /** + * Set AutoFilter Multiple Rules And/Or. + * + * @param string $pJoin And/Or + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setJoin($pJoin) + { + // Lowercase And/Or + $pJoin = strtolower($pJoin); + if (!in_array($pJoin, self::$ruleJoins)) { + throw new PhpSpreadsheetException('Invalid rule connection for column AutoFilter.'); + } + + $this->join = $pJoin; + + return $this; + } + + /** + * Set AutoFilter Attributes. + * + * @param string[] $attributes + * + * @return $this + */ + public function setAttributes(array $attributes) + { + $this->attributes = $attributes; + + return $this; + } + + /** + * Set An AutoFilter Attribute. + * + * @param string $pName Attribute Name + * @param string $pValue Attribute Value + * + * @return $this + */ + public function setAttribute($pName, $pValue) + { + $this->attributes[$pName] = $pValue; + + return $this; + } + + /** + * Get AutoFilter Column Attributes. + * + * @return string[] + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Get specific AutoFilter Column Attribute. + * + * @param string $pName Attribute Name + * + * @return string + */ + public function getAttribute($pName) + { + if (isset($this->attributes[$pName])) { + return $this->attributes[$pName]; + } + + return null; + } + + /** + * Get all AutoFilter Column Rules. + * + * @return Column\Rule[] + */ + public function getRules() + { + return $this->ruleset; + } + + /** + * Get a specified AutoFilter Column Rule. + * + * @param int $pIndex Rule index in the ruleset array + * + * @return Column\Rule + */ + public function getRule($pIndex) + { + if (!isset($this->ruleset[$pIndex])) { + $this->ruleset[$pIndex] = new Column\Rule($this); + } + + return $this->ruleset[$pIndex]; + } + + /** + * Create a new AutoFilter Column Rule in the ruleset. + * + * @return Column\Rule + */ + public function createRule() + { + $this->ruleset[] = new Column\Rule($this); + + return end($this->ruleset); + } + + /** + * Add a new AutoFilter Column Rule to the ruleset. + * + * @param Column\Rule $pRule + * + * @return $this + */ + public function addRule(Column\Rule $pRule) + { + $pRule->setParent($this); + $this->ruleset[] = $pRule; + + return $this; + } + + /** + * Delete a specified AutoFilter Column Rule + * If the number of rules is reduced to 1, then we reset And/Or logic to Or. + * + * @param int $pIndex Rule index in the ruleset array + * + * @return $this + */ + public function deleteRule($pIndex) + { + if (isset($this->ruleset[$pIndex])) { + unset($this->ruleset[$pIndex]); + // If we've just deleted down to a single rule, then reset And/Or joining to Or + if (count($this->ruleset) <= 1) { + $this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR); + } + } + + return $this; + } + + /** + * Delete all AutoFilter Column Rules. + * + * @return $this + */ + public function clearRules() + { + $this->ruleset = []; + $this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR); + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ($key === 'parent') { + // Detach from autofilter parent + $this->parent = null; + } elseif ($key === 'ruleset') { + // The columns array of \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\AutoFilter objects + $this->ruleset = []; + foreach ($value as $k => $v) { + $cloned = clone $v; + $cloned->setParent($this); // attach the new cloned Rule to this new cloned Autofilter Cloned object + $this->ruleset[$k] = $cloned; + } + } elseif (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php new file mode 100644 index 0000000..09a2bac --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/AutoFilter/Column/Rule.php @@ -0,0 +1,455 @@ + + * + * + * + * + * + */ + const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal'; + const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual'; + const AUTOFILTER_COLUMN_RULE_GREATERTHAN = 'greaterThan'; + const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual'; + const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan'; + const AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL = 'lessThanOrEqual'; + + private static $operators = [ + self::AUTOFILTER_COLUMN_RULE_EQUAL, + self::AUTOFILTER_COLUMN_RULE_NOTEQUAL, + self::AUTOFILTER_COLUMN_RULE_GREATERTHAN, + self::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, + self::AUTOFILTER_COLUMN_RULE_LESSTHAN, + self::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, + ]; + + const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue'; + const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent'; + + private static $topTenValue = [ + self::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE, + self::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT, + ]; + + const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top'; + const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom'; + + private static $topTenType = [ + self::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP, + self::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM, + ]; + + // Rule Operators (Numeric, Boolean etc) +// const AUTOFILTER_COLUMN_RULE_BETWEEN = 'between'; // greaterThanOrEqual 1 && lessThanOrEqual 2 + // Rule Operators (Numeric Special) which are translated to standard numeric operators with calculated values +// const AUTOFILTER_COLUMN_RULE_TOPTEN = 'topTen'; // greaterThan calculated value +// const AUTOFILTER_COLUMN_RULE_TOPTENPERCENT = 'topTenPercent'; // greaterThan calculated value +// const AUTOFILTER_COLUMN_RULE_ABOVEAVERAGE = 'aboveAverage'; // Value is calculated as the average +// const AUTOFILTER_COLUMN_RULE_BELOWAVERAGE = 'belowAverage'; // Value is calculated as the average + // Rule Operators (String) which are set as wild-carded values +// const AUTOFILTER_COLUMN_RULE_BEGINSWITH = 'beginsWith'; // A* +// const AUTOFILTER_COLUMN_RULE_ENDSWITH = 'endsWith'; // *Z +// const AUTOFILTER_COLUMN_RULE_CONTAINS = 'contains'; // *B* +// const AUTOFILTER_COLUMN_RULE_DOESNTCONTAIN = 'notEqual'; // notEqual *B* + // Rule Operators (Date Special) which are translated to standard numeric operators with calculated values +// const AUTOFILTER_COLUMN_RULE_BEFORE = 'lessThan'; +// const AUTOFILTER_COLUMN_RULE_AFTER = 'greaterThan'; +// const AUTOFILTER_COLUMN_RULE_YESTERDAY = 'yesterday'; +// const AUTOFILTER_COLUMN_RULE_TODAY = 'today'; +// const AUTOFILTER_COLUMN_RULE_TOMORROW = 'tomorrow'; +// const AUTOFILTER_COLUMN_RULE_LASTWEEK = 'lastWeek'; +// const AUTOFILTER_COLUMN_RULE_THISWEEK = 'thisWeek'; +// const AUTOFILTER_COLUMN_RULE_NEXTWEEK = 'nextWeek'; +// const AUTOFILTER_COLUMN_RULE_LASTMONTH = 'lastMonth'; +// const AUTOFILTER_COLUMN_RULE_THISMONTH = 'thisMonth'; +// const AUTOFILTER_COLUMN_RULE_NEXTMONTH = 'nextMonth'; +// const AUTOFILTER_COLUMN_RULE_LASTQUARTER = 'lastQuarter'; +// const AUTOFILTER_COLUMN_RULE_THISQUARTER = 'thisQuarter'; +// const AUTOFILTER_COLUMN_RULE_NEXTQUARTER = 'nextQuarter'; +// const AUTOFILTER_COLUMN_RULE_LASTYEAR = 'lastYear'; +// const AUTOFILTER_COLUMN_RULE_THISYEAR = 'thisYear'; +// const AUTOFILTER_COLUMN_RULE_NEXTYEAR = 'nextYear'; +// const AUTOFILTER_COLUMN_RULE_YEARTODATE = 'yearToDate'; // +// const AUTOFILTER_COLUMN_RULE_ALLDATESINMONTH = 'allDatesInMonth'; // for Month/February +// const AUTOFILTER_COLUMN_RULE_ALLDATESINQUARTER = 'allDatesInQuarter'; // for Quarter 2 + + /** + * Autofilter Column. + * + * @var Column + */ + private $parent; + + /** + * Autofilter Rule Type. + * + * @var string + */ + private $ruleType = self::AUTOFILTER_RULETYPE_FILTER; + + /** + * Autofilter Rule Value. + * + * @var string + */ + private $value = ''; + + /** + * Autofilter Rule Operator. + * + * @var string + */ + private $operator = self::AUTOFILTER_COLUMN_RULE_EQUAL; + + /** + * DateTimeGrouping Group Value. + * + * @var string + */ + private $grouping = ''; + + /** + * Create a new Rule. + * + * @param Column $pParent + */ + public function __construct(Column $pParent = null) + { + $this->parent = $pParent; + } + + /** + * Get AutoFilter Rule Type. + * + * @return string + */ + public function getRuleType() + { + return $this->ruleType; + } + + /** + * Set AutoFilter Rule Type. + * + * @param string $pRuleType see self::AUTOFILTER_RULETYPE_* + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setRuleType($pRuleType) + { + if (!in_array($pRuleType, self::$ruleTypes)) { + throw new PhpSpreadsheetException('Invalid rule type for column AutoFilter Rule.'); + } + + $this->ruleType = $pRuleType; + + return $this; + } + + /** + * Get AutoFilter Rule Value. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Set AutoFilter Rule Value. + * + * @param string|string[] $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setValue($pValue) + { + if (is_array($pValue)) { + $grouping = -1; + foreach ($pValue as $key => $value) { + // Validate array entries + if (!in_array($key, self::$dateTimeGroups)) { + // Remove any invalid entries from the value array + unset($pValue[$key]); + } else { + // Work out what the dateTime grouping will be + $grouping = max($grouping, array_search($key, self::$dateTimeGroups)); + } + } + if (count($pValue) == 0) { + throw new PhpSpreadsheetException('Invalid rule value for column AutoFilter Rule.'); + } + // Set the dateTime grouping that we've anticipated + $this->setGrouping(self::$dateTimeGroups[$grouping]); + } + $this->value = $pValue; + + return $this; + } + + /** + * Get AutoFilter Rule Operator. + * + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Set AutoFilter Rule Operator. + * + * @param string $pOperator see self::AUTOFILTER_COLUMN_RULE_* + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setOperator($pOperator) + { + if (empty($pOperator)) { + $pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL; + } + if ((!in_array($pOperator, self::$operators)) && + (!in_array($pOperator, self::$topTenValue))) { + throw new PhpSpreadsheetException('Invalid operator for column AutoFilter Rule.'); + } + $this->operator = $pOperator; + + return $this; + } + + /** + * Get AutoFilter Rule Grouping. + * + * @return string + */ + public function getGrouping() + { + return $this->grouping; + } + + /** + * Set AutoFilter Rule Grouping. + * + * @param string $pGrouping + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setGrouping($pGrouping) + { + if (($pGrouping !== null) && + (!in_array($pGrouping, self::$dateTimeGroups)) && + (!in_array($pGrouping, self::$dynamicTypes)) && + (!in_array($pGrouping, self::$topTenType))) { + throw new PhpSpreadsheetException('Invalid rule type for column AutoFilter Rule.'); + } + $this->grouping = $pGrouping; + + return $this; + } + + /** + * Set AutoFilter Rule. + * + * @param string $pOperator see self::AUTOFILTER_COLUMN_RULE_* + * @param string|string[] $pValue + * @param string $pGrouping + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setRule($pOperator, $pValue, $pGrouping = null) + { + $this->setOperator($pOperator); + $this->setValue($pValue); + // Only set grouping if it's been passed in as a user-supplied argument, + // otherwise we're calculating it when we setValue() and don't want to overwrite that + // If the user supplies an argumnet for grouping, then on their own head be it + if ($pGrouping !== null) { + $this->setGrouping($pGrouping); + } + + return $this; + } + + /** + * Get this Rule's AutoFilter Column Parent. + * + * @return Column + */ + public function getParent() + { + return $this->parent; + } + + /** + * Set this Rule's AutoFilter Column Parent. + * + * @param Column $pParent + * + * @return $this + */ + public function setParent(Column $pParent = null) + { + $this->parent = $pParent; + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + if ($key == 'parent') { + // Detach from autofilter column parent + $this->$key = null; + } else { + $this->$key = clone $value; + } + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php new file mode 100644 index 0000000..7d24e44 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/BaseDrawing.php @@ -0,0 +1,537 @@ +name = ''; + $this->description = ''; + $this->worksheet = null; + $this->coordinates = 'A1'; + $this->offsetX = 0; + $this->offsetY = 0; + $this->width = 0; + $this->height = 0; + $this->resizeProportional = true; + $this->rotation = 0; + $this->shadow = new Drawing\Shadow(); + + // Set image index + ++self::$imageCounter; + $this->imageIndex = self::$imageCounter; + } + + /** + * Get image index. + * + * @return int + */ + public function getImageIndex() + { + return $this->imageIndex; + } + + /** + * Get Name. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set Name. + * + * @param string $pValue + * + * @return $this + */ + public function setName($pValue) + { + $this->name = $pValue; + + return $this; + } + + /** + * Get Description. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Set Description. + * + * @param string $description + * + * @return $this + */ + public function setDescription($description) + { + $this->description = $description; + + return $this; + } + + /** + * Get Worksheet. + * + * @return Worksheet + */ + public function getWorksheet() + { + return $this->worksheet; + } + + /** + * Set Worksheet. + * + * @param Worksheet $pValue + * @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet? + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setWorksheet(Worksheet $pValue = null, $pOverrideOld = false) + { + if ($this->worksheet === null) { + // Add drawing to \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet + $this->worksheet = $pValue; + $this->worksheet->getCell($this->coordinates); + $this->worksheet->getDrawingCollection()->append($this); + } else { + if ($pOverrideOld) { + // Remove drawing from old \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet + $iterator = $this->worksheet->getDrawingCollection()->getIterator(); + + while ($iterator->valid()) { + if ($iterator->current()->getHashCode() == $this->getHashCode()) { + $this->worksheet->getDrawingCollection()->offsetUnset($iterator->key()); + $this->worksheet = null; + + break; + } + } + + // Set new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet + $this->setWorksheet($pValue); + } else { + throw new PhpSpreadsheetException('A Worksheet has already been assigned. Drawings can only exist on one \\PhpOffice\\PhpSpreadsheet\\Worksheet.'); + } + } + + return $this; + } + + /** + * Get Coordinates. + * + * @return string + */ + public function getCoordinates() + { + return $this->coordinates; + } + + /** + * Set Coordinates. + * + * @param string $pValue eg: 'A1' + * + * @return $this + */ + public function setCoordinates($pValue) + { + $this->coordinates = $pValue; + + return $this; + } + + /** + * Get OffsetX. + * + * @return int + */ + public function getOffsetX() + { + return $this->offsetX; + } + + /** + * Set OffsetX. + * + * @param int $pValue + * + * @return $this + */ + public function setOffsetX($pValue) + { + $this->offsetX = $pValue; + + return $this; + } + + /** + * Get OffsetY. + * + * @return int + */ + public function getOffsetY() + { + return $this->offsetY; + } + + /** + * Set OffsetY. + * + * @param int $pValue + * + * @return $this + */ + public function setOffsetY($pValue) + { + $this->offsetY = $pValue; + + return $this; + } + + /** + * Get Width. + * + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Set Width. + * + * @param int $pValue + * + * @return $this + */ + public function setWidth($pValue) + { + // Resize proportional? + if ($this->resizeProportional && $pValue != 0) { + $ratio = $this->height / ($this->width != 0 ? $this->width : 1); + $this->height = round($ratio * $pValue); + } + + // Set width + $this->width = $pValue; + + return $this; + } + + /** + * Get Height. + * + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * Set Height. + * + * @param int $pValue + * + * @return $this + */ + public function setHeight($pValue) + { + // Resize proportional? + if ($this->resizeProportional && $pValue != 0) { + $ratio = $this->width / ($this->height != 0 ? $this->height : 1); + $this->width = round($ratio * $pValue); + } + + // Set height + $this->height = $pValue; + + return $this; + } + + /** + * Set width and height with proportional resize. + * + * Example: + * + * $objDrawing->setResizeProportional(true); + * $objDrawing->setWidthAndHeight(160,120); + * + * + * @author Vincent@luo MSN:kele_100@hotmail.com + * + * @param int $width + * @param int $height + * + * @return $this + */ + public function setWidthAndHeight($width, $height) + { + $xratio = $width / ($this->width != 0 ? $this->width : 1); + $yratio = $height / ($this->height != 0 ? $this->height : 1); + if ($this->resizeProportional && !($width == 0 || $height == 0)) { + if (($xratio * $this->height) < $height) { + $this->height = ceil($xratio * $this->height); + $this->width = $width; + } else { + $this->width = ceil($yratio * $this->width); + $this->height = $height; + } + } else { + $this->width = $width; + $this->height = $height; + } + + return $this; + } + + /** + * Get ResizeProportional. + * + * @return bool + */ + public function getResizeProportional() + { + return $this->resizeProportional; + } + + /** + * Set ResizeProportional. + * + * @param bool $pValue + * + * @return $this + */ + public function setResizeProportional($pValue) + { + $this->resizeProportional = $pValue; + + return $this; + } + + /** + * Get Rotation. + * + * @return int + */ + public function getRotation() + { + return $this->rotation; + } + + /** + * Set Rotation. + * + * @param int $pValue + * + * @return $this + */ + public function setRotation($pValue) + { + $this->rotation = $pValue; + + return $this; + } + + /** + * Get Shadow. + * + * @return Drawing\Shadow + */ + public function getShadow() + { + return $this->shadow; + } + + /** + * Set Shadow. + * + * @param Drawing\Shadow $pValue + * + * @return $this + */ + public function setShadow(Drawing\Shadow $pValue = null) + { + $this->shadow = $pValue; + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->name . + $this->description . + $this->worksheet->getHashCode() . + $this->coordinates . + $this->offsetX . + $this->offsetY . + $this->width . + $this->height . + $this->rotation . + $this->shadow->getHashCode() . + __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if ($key == 'worksheet') { + $this->worksheet = null; + } elseif (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } + + /** + * @param null|Hyperlink $pHyperlink + */ + public function setHyperlink(Hyperlink $pHyperlink = null) + { + $this->hyperlink = $pHyperlink; + } + + /** + * @return null|Hyperlink + */ + public function getHyperlink() + { + return $this->hyperlink; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/CellIterator.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/CellIterator.php new file mode 100644 index 0000000..d97e33f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/CellIterator.php @@ -0,0 +1,61 @@ +worksheet); + } + + /** + * Get loop only existing cells. + * + * @return bool + */ + public function getIterateOnlyExistingCells() + { + return $this->onlyExistingCells; + } + + /** + * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. + * + * @throws PhpSpreadsheetException + */ + abstract protected function adjustForExistingOnlyRange(); + + /** + * Set the iterator to loop only existing cells. + * + * @param bool $value + * + * @throws PhpSpreadsheetException + */ + public function setIterateOnlyExistingCells($value) + { + $this->onlyExistingCells = (bool) $value; + + $this->adjustForExistingOnlyRange(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Column.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Column.php new file mode 100644 index 0000000..098967f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Column.php @@ -0,0 +1,64 @@ +parent = $parent; + $this->columnIndex = $columnIndex; + } + + /** + * Destructor. + */ + public function __destruct() + { + unset($this->parent); + } + + /** + * Get column index as string eg: 'A'. + * + * @return string + */ + public function getColumnIndex() + { + return $this->columnIndex; + } + + /** + * Get cell iterator. + * + * @param int $startRow The row number at which to start iterating + * @param int $endRow Optionally, the row number at which to stop iterating + * + * @return ColumnCellIterator + */ + public function getCellIterator($startRow = 1, $endRow = null) + { + return new ColumnCellIterator($this->parent, $this->columnIndex, $startRow, $endRow); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php new file mode 100644 index 0000000..d75da89 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php @@ -0,0 +1,197 @@ +worksheet = $subject; + $this->columnIndex = Coordinate::columnIndexFromString($columnIndex); + $this->resetEnd($endRow); + $this->resetStart($startRow); + } + + /** + * (Re)Set the start row and the current row pointer. + * + * @param int $startRow The row number at which to start iterating + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function resetStart($startRow = 1) + { + $this->startRow = $startRow; + $this->adjustForExistingOnlyRange(); + $this->seek($startRow); + + return $this; + } + + /** + * (Re)Set the end row. + * + * @param int $endRow The row number at which to stop iterating + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function resetEnd($endRow = null) + { + $this->endRow = ($endRow) ? $endRow : $this->worksheet->getHighestRow(); + $this->adjustForExistingOnlyRange(); + + return $this; + } + + /** + * Set the row pointer to the selected row. + * + * @param int $row The row number to set the current pointer at + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function seek($row = 1) + { + if (($row < $this->startRow) || ($row > $this->endRow)) { + throw new PhpSpreadsheetException("Row $row is out of range ({$this->startRow} - {$this->endRow})"); + } elseif ($this->onlyExistingCells && !($this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $row))) { + throw new PhpSpreadsheetException('In "IterateOnlyExistingCells" mode and Cell does not exist'); + } + $this->currentRow = $row; + + return $this; + } + + /** + * Rewind the iterator to the starting row. + */ + public function rewind() + { + $this->currentRow = $this->startRow; + } + + /** + * Return the current cell in this worksheet column. + * + * @return null|\PhpOffice\PhpSpreadsheet\Cell\Cell + */ + public function current() + { + return $this->worksheet->getCellByColumnAndRow($this->columnIndex, $this->currentRow); + } + + /** + * Return the current iterator key. + * + * @return int + */ + public function key() + { + return $this->currentRow; + } + + /** + * Set the iterator to its next value. + */ + public function next() + { + do { + ++$this->currentRow; + } while (($this->onlyExistingCells) && + (!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->currentRow)) && + ($this->currentRow <= $this->endRow)); + } + + /** + * Set the iterator to its previous value. + */ + public function prev() + { + do { + --$this->currentRow; + } while (($this->onlyExistingCells) && + (!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->currentRow)) && + ($this->currentRow >= $this->startRow)); + } + + /** + * Indicate if more rows exist in the worksheet range of rows that we're iterating. + * + * @return bool + */ + public function valid() + { + return $this->currentRow <= $this->endRow && $this->currentRow >= $this->startRow; + } + + /** + * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. + * + * @throws PhpSpreadsheetException + */ + protected function adjustForExistingOnlyRange() + { + if ($this->onlyExistingCells) { + while ((!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->startRow)) && + ($this->startRow <= $this->endRow)) { + ++$this->startRow; + } + if ($this->startRow > $this->endRow) { + throw new PhpSpreadsheetException('No cells exist within the specified range'); + } + while ((!$this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $this->endRow)) && + ($this->endRow >= $this->startRow)) { + --$this->endRow; + } + if ($this->endRow < $this->startRow) { + throw new PhpSpreadsheetException('No cells exist within the specified range'); + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php new file mode 100644 index 0000000..4e87a34 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnDimension.php @@ -0,0 +1,115 @@ +columnIndex = $pIndex; + + // set dimension as unformatted by default + parent::__construct(0); + } + + /** + * Get column index as string eg: 'A'. + * + * @return string + */ + public function getColumnIndex() + { + return $this->columnIndex; + } + + /** + * Set column index as string eg: 'A'. + * + * @param string $pValue + * + * @return $this + */ + public function setColumnIndex($pValue) + { + $this->columnIndex = $pValue; + + return $this; + } + + /** + * Get Width. + * + * @return float + */ + public function getWidth() + { + return $this->width; + } + + /** + * Set Width. + * + * @param float $pValue + * + * @return $this + */ + public function setWidth($pValue) + { + $this->width = $pValue; + + return $this; + } + + /** + * Get Auto Size. + * + * @return bool + */ + public function getAutoSize() + { + return $this->autoSize; + } + + /** + * Set Auto Size. + * + * @param bool $pValue + * + * @return $this + */ + public function setAutoSize($pValue) + { + $this->autoSize = $pValue; + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnIterator.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnIterator.php new file mode 100644 index 0000000..c8913cc --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/ColumnIterator.php @@ -0,0 +1,175 @@ +worksheet = $worksheet; + $this->resetEnd($endColumn); + $this->resetStart($startColumn); + } + + /** + * Destructor. + */ + public function __destruct() + { + unset($this->worksheet); + } + + /** + * (Re)Set the start column and the current column pointer. + * + * @param string $startColumn The column address at which to start iterating + * + * @throws Exception + * + * @return $this + */ + public function resetStart($startColumn = 'A') + { + $startColumnIndex = Coordinate::columnIndexFromString($startColumn); + if ($startColumnIndex > Coordinate::columnIndexFromString($this->worksheet->getHighestColumn())) { + throw new Exception("Start column ({$startColumn}) is beyond highest column ({$this->worksheet->getHighestColumn()})"); + } + + $this->startColumnIndex = $startColumnIndex; + if ($this->endColumnIndex < $this->startColumnIndex) { + $this->endColumnIndex = $this->startColumnIndex; + } + $this->seek($startColumn); + + return $this; + } + + /** + * (Re)Set the end column. + * + * @param string $endColumn The column address at which to stop iterating + * + * @return $this + */ + public function resetEnd($endColumn = null) + { + $endColumn = $endColumn ? $endColumn : $this->worksheet->getHighestColumn(); + $this->endColumnIndex = Coordinate::columnIndexFromString($endColumn); + + return $this; + } + + /** + * Set the column pointer to the selected column. + * + * @param string $column The column address to set the current pointer at + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function seek($column = 'A') + { + $column = Coordinate::columnIndexFromString($column); + if (($column < $this->startColumnIndex) || ($column > $this->endColumnIndex)) { + throw new PhpSpreadsheetException("Column $column is out of range ({$this->startColumnIndex} - {$this->endColumnIndex})"); + } + $this->currentColumnIndex = $column; + + return $this; + } + + /** + * Rewind the iterator to the starting column. + */ + public function rewind() + { + $this->currentColumnIndex = $this->startColumnIndex; + } + + /** + * Return the current column in this worksheet. + * + * @return Column + */ + public function current() + { + return new Column($this->worksheet, Coordinate::stringFromColumnIndex($this->currentColumnIndex)); + } + + /** + * Return the current iterator key. + * + * @return string + */ + public function key() + { + return Coordinate::stringFromColumnIndex($this->currentColumnIndex); + } + + /** + * Set the iterator to its next value. + */ + public function next() + { + ++$this->currentColumnIndex; + } + + /** + * Set the iterator to its previous value. + */ + public function prev() + { + --$this->currentColumnIndex; + } + + /** + * Indicate if more columns exist in the worksheet range of columns that we're iterating. + * + * @return bool + */ + public function valid() + { + return $this->currentColumnIndex <= $this->endColumnIndex && $this->currentColumnIndex >= $this->startColumnIndex; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php new file mode 100644 index 0000000..ce40cf5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Dimension.php @@ -0,0 +1,165 @@ +xfIndex = $initialValue; + } + + /** + * Get Visible. + * + * @return bool + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set Visible. + * + * @param bool $pValue + * + * @return $this + */ + public function setVisible($pValue) + { + $this->visible = (bool) $pValue; + + return $this; + } + + /** + * Get Outline Level. + * + * @return int + */ + public function getOutlineLevel() + { + return $this->outlineLevel; + } + + /** + * Set Outline Level. + * Value must be between 0 and 7. + * + * @param int $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setOutlineLevel($pValue) + { + if ($pValue < 0 || $pValue > 7) { + throw new PhpSpreadsheetException('Outline level must range between 0 and 7.'); + } + + $this->outlineLevel = $pValue; + + return $this; + } + + /** + * Get Collapsed. + * + * @return bool + */ + public function getCollapsed() + { + return $this->collapsed; + } + + /** + * Set Collapsed. + * + * @param bool $pValue + * + * @return $this + */ + public function setCollapsed($pValue) + { + $this->collapsed = (bool) $pValue; + + return $this; + } + + /** + * Get index to cellXf. + * + * @return int + */ + public function getXfIndex() + { + return $this->xfIndex; + } + + /** + * Set index to cellXf. + * + * @param int $pValue + * + * @return $this + */ + public function setXfIndex($pValue) + { + $this->xfIndex = $pValue; + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php new file mode 100644 index 0000000..da492b4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing.php @@ -0,0 +1,116 @@ +path = ''; + + // Initialize parent + parent::__construct(); + } + + /** + * Get Filename. + * + * @return string + */ + public function getFilename() + { + return basename($this->path); + } + + /** + * Get indexed filename (using image index). + * + * @return string + */ + public function getIndexedFilename() + { + $fileName = $this->getFilename(); + $fileName = str_replace(' ', '_', $fileName); + + return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension(); + } + + /** + * Get Extension. + * + * @return string + */ + public function getExtension() + { + $exploded = explode('.', basename($this->path)); + + return $exploded[count($exploded) - 1]; + } + + /** + * Get Path. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * Set Path. + * + * @param string $pValue File path + * @param bool $pVerifyFile Verify file + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setPath($pValue, $pVerifyFile = true) + { + if ($pVerifyFile) { + if (file_exists($pValue)) { + $this->path = $pValue; + + if ($this->width == 0 && $this->height == 0) { + // Get width/height + [$this->width, $this->height] = getimagesize($pValue); + } + } else { + throw new PhpSpreadsheetException("File $pValue not found!"); + } + } else { + $this->path = $pValue; + } + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->path . + parent::getHashCode() . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php new file mode 100644 index 0000000..c7594da --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php @@ -0,0 +1,289 @@ +visible = false; + $this->blurRadius = 6; + $this->distance = 2; + $this->direction = 0; + $this->alignment = self::SHADOW_BOTTOM_RIGHT; + $this->color = new Color(Color::COLOR_BLACK); + $this->alpha = 50; + } + + /** + * Get Visible. + * + * @return bool + */ + public function getVisible() + { + return $this->visible; + } + + /** + * Set Visible. + * + * @param bool $pValue + * + * @return $this + */ + public function setVisible($pValue) + { + $this->visible = $pValue; + + return $this; + } + + /** + * Get Blur radius. + * + * @return int + */ + public function getBlurRadius() + { + return $this->blurRadius; + } + + /** + * Set Blur radius. + * + * @param int $pValue + * + * @return $this + */ + public function setBlurRadius($pValue) + { + $this->blurRadius = $pValue; + + return $this; + } + + /** + * Get Shadow distance. + * + * @return int + */ + public function getDistance() + { + return $this->distance; + } + + /** + * Set Shadow distance. + * + * @param int $pValue + * + * @return $this + */ + public function setDistance($pValue) + { + $this->distance = $pValue; + + return $this; + } + + /** + * Get Shadow direction (in degrees). + * + * @return int + */ + public function getDirection() + { + return $this->direction; + } + + /** + * Set Shadow direction (in degrees). + * + * @param int $pValue + * + * @return $this + */ + public function setDirection($pValue) + { + $this->direction = $pValue; + + return $this; + } + + /** + * Get Shadow alignment. + * + * @return int + */ + public function getAlignment() + { + return $this->alignment; + } + + /** + * Set Shadow alignment. + * + * @param int $pValue + * + * @return $this + */ + public function setAlignment($pValue) + { + $this->alignment = $pValue; + + return $this; + } + + /** + * Get Color. + * + * @return Color + */ + public function getColor() + { + return $this->color; + } + + /** + * Set Color. + * + * @param Color $pValue + * + * @return $this + */ + public function setColor(Color $pValue = null) + { + $this->color = $pValue; + + return $this; + } + + /** + * Get Alpha. + * + * @return int + */ + public function getAlpha() + { + return $this->alpha; + } + + /** + * Set Alpha. + * + * @param int $pValue + * + * @return $this + */ + public function setAlpha($pValue) + { + $this->alpha = $pValue; + + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + ($this->visible ? 't' : 'f') . + $this->blurRadius . + $this->distance . + $this->direction . + $this->alignment . + $this->color->getHashCode() . + $this->alpha . + __CLASS__ + ); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooter.php new file mode 100644 index 0000000..be19abb --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooter.php @@ -0,0 +1,491 @@ + + * Header/Footer Formatting Syntax taken from Office Open XML Part 4 - Markup Language Reference, page 1970:. + * + * There are a number of formatting codes that can be written inline with the actual header / footer text, which + * affect the formatting in the header or footer. + * + * Example: This example shows the text "Center Bold Header" on the first line (center section), and the date on + * the second line (center section). + * &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D + * + * General Rules: + * There is no required order in which these codes must appear. + * + * The first occurrence of the following codes turns the formatting ON, the second occurrence turns it OFF again: + * - strikethrough + * - superscript + * - subscript + * Superscript and subscript cannot both be ON at same time. Whichever comes first wins and the other is ignored, + * while the first is ON. + * &L - code for "left section" (there are three header / footer locations, "left", "center", and "right"). When + * two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the + * order of appearance, and placed into the left section. + * &P - code for "current page #" + * &N - code for "total pages" + * &font size - code for "text font size", where font size is a font size in points. + * &K - code for "text font color" + * RGB Color is specified as RRGGBB + * Theme Color is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade + * value, NN is the tint/shade value. + * &S - code for "text strikethrough" on / off + * &X - code for "text super script" on / off + * &Y - code for "text subscript" on / off + * &C - code for "center section". When two or more occurrences of this section marker exist, the contents + * from all markers are concatenated, in the order of appearance, and placed into the center section. + * + * &D - code for "date" + * &T - code for "time" + * &G - code for "picture as background" + * &U - code for "text single underline" + * &E - code for "double underline" + * &R - code for "right section". When two or more occurrences of this section marker exist, the contents + * from all markers are concatenated, in the order of appearance, and placed into the right section. + * &Z - code for "this workbook's file path" + * &F - code for "this workbook's file name" + * &A - code for "sheet tab name" + * &+ - code for add to page #. + * &- - code for subtract from page #. + * &"font name,font type" - code for "text font name" and "text font type", where font name and font type + * are strings specifying the name and type of the font, separated by a comma. When a hyphen appears in font + * name, it means "none specified". Both of font name and font type can be localized values. + * &"-,Bold" - code for "bold font style" + * &B - also means "bold font style". + * &"-,Regular" - code for "regular font style" + * &"-,Italic" - code for "italic font style" + * &I - also means "italic font style" + * &"-,Bold Italic" code for "bold italic font style" + * &O - code for "outline style" + * &H - code for "shadow style" + * + */ +class HeaderFooter +{ + // Header/footer image location + const IMAGE_HEADER_LEFT = 'LH'; + const IMAGE_HEADER_CENTER = 'CH'; + const IMAGE_HEADER_RIGHT = 'RH'; + const IMAGE_FOOTER_LEFT = 'LF'; + const IMAGE_FOOTER_CENTER = 'CF'; + const IMAGE_FOOTER_RIGHT = 'RF'; + + /** + * OddHeader. + * + * @var string + */ + private $oddHeader = ''; + + /** + * OddFooter. + * + * @var string + */ + private $oddFooter = ''; + + /** + * EvenHeader. + * + * @var string + */ + private $evenHeader = ''; + + /** + * EvenFooter. + * + * @var string + */ + private $evenFooter = ''; + + /** + * FirstHeader. + * + * @var string + */ + private $firstHeader = ''; + + /** + * FirstFooter. + * + * @var string + */ + private $firstFooter = ''; + + /** + * Different header for Odd/Even, defaults to false. + * + * @var bool + */ + private $differentOddEven = false; + + /** + * Different header for first page, defaults to false. + * + * @var bool + */ + private $differentFirst = false; + + /** + * Scale with document, defaults to true. + * + * @var bool + */ + private $scaleWithDocument = true; + + /** + * Align with margins, defaults to true. + * + * @var bool + */ + private $alignWithMargins = true; + + /** + * Header/footer images. + * + * @var HeaderFooterDrawing[] + */ + private $headerFooterImages = []; + + /** + * Create a new HeaderFooter. + */ + public function __construct() + { + } + + /** + * Get OddHeader. + * + * @return string + */ + public function getOddHeader() + { + return $this->oddHeader; + } + + /** + * Set OddHeader. + * + * @param string $pValue + * + * @return $this + */ + public function setOddHeader($pValue) + { + $this->oddHeader = $pValue; + + return $this; + } + + /** + * Get OddFooter. + * + * @return string + */ + public function getOddFooter() + { + return $this->oddFooter; + } + + /** + * Set OddFooter. + * + * @param string $pValue + * + * @return $this + */ + public function setOddFooter($pValue) + { + $this->oddFooter = $pValue; + + return $this; + } + + /** + * Get EvenHeader. + * + * @return string + */ + public function getEvenHeader() + { + return $this->evenHeader; + } + + /** + * Set EvenHeader. + * + * @param string $pValue + * + * @return $this + */ + public function setEvenHeader($pValue) + { + $this->evenHeader = $pValue; + + return $this; + } + + /** + * Get EvenFooter. + * + * @return string + */ + public function getEvenFooter() + { + return $this->evenFooter; + } + + /** + * Set EvenFooter. + * + * @param string $pValue + * + * @return $this + */ + public function setEvenFooter($pValue) + { + $this->evenFooter = $pValue; + + return $this; + } + + /** + * Get FirstHeader. + * + * @return string + */ + public function getFirstHeader() + { + return $this->firstHeader; + } + + /** + * Set FirstHeader. + * + * @param string $pValue + * + * @return $this + */ + public function setFirstHeader($pValue) + { + $this->firstHeader = $pValue; + + return $this; + } + + /** + * Get FirstFooter. + * + * @return string + */ + public function getFirstFooter() + { + return $this->firstFooter; + } + + /** + * Set FirstFooter. + * + * @param string $pValue + * + * @return $this + */ + public function setFirstFooter($pValue) + { + $this->firstFooter = $pValue; + + return $this; + } + + /** + * Get DifferentOddEven. + * + * @return bool + */ + public function getDifferentOddEven() + { + return $this->differentOddEven; + } + + /** + * Set DifferentOddEven. + * + * @param bool $pValue + * + * @return $this + */ + public function setDifferentOddEven($pValue) + { + $this->differentOddEven = $pValue; + + return $this; + } + + /** + * Get DifferentFirst. + * + * @return bool + */ + public function getDifferentFirst() + { + return $this->differentFirst; + } + + /** + * Set DifferentFirst. + * + * @param bool $pValue + * + * @return $this + */ + public function setDifferentFirst($pValue) + { + $this->differentFirst = $pValue; + + return $this; + } + + /** + * Get ScaleWithDocument. + * + * @return bool + */ + public function getScaleWithDocument() + { + return $this->scaleWithDocument; + } + + /** + * Set ScaleWithDocument. + * + * @param bool $pValue + * + * @return $this + */ + public function setScaleWithDocument($pValue) + { + $this->scaleWithDocument = $pValue; + + return $this; + } + + /** + * Get AlignWithMargins. + * + * @return bool + */ + public function getAlignWithMargins() + { + return $this->alignWithMargins; + } + + /** + * Set AlignWithMargins. + * + * @param bool $pValue + * + * @return $this + */ + public function setAlignWithMargins($pValue) + { + $this->alignWithMargins = $pValue; + + return $this; + } + + /** + * Add header/footer image. + * + * @param HeaderFooterDrawing $image + * @param string $location + * + * @return $this + */ + public function addImage(HeaderFooterDrawing $image, $location = self::IMAGE_HEADER_LEFT) + { + $this->headerFooterImages[$location] = $image; + + return $this; + } + + /** + * Remove header/footer image. + * + * @param string $location + * + * @return $this + */ + public function removeImage($location = self::IMAGE_HEADER_LEFT) + { + if (isset($this->headerFooterImages[$location])) { + unset($this->headerFooterImages[$location]); + } + + return $this; + } + + /** + * Set header/footer images. + * + * @param HeaderFooterDrawing[] $images + * + * @return $this + */ + public function setImages(array $images) + { + $this->headerFooterImages = $images; + + return $this; + } + + /** + * Get header/footer images. + * + * @return HeaderFooterDrawing[] + */ + public function getImages() + { + // Sort array + $images = []; + if (isset($this->headerFooterImages[self::IMAGE_HEADER_LEFT])) { + $images[self::IMAGE_HEADER_LEFT] = $this->headerFooterImages[self::IMAGE_HEADER_LEFT]; + } + if (isset($this->headerFooterImages[self::IMAGE_HEADER_CENTER])) { + $images[self::IMAGE_HEADER_CENTER] = $this->headerFooterImages[self::IMAGE_HEADER_CENTER]; + } + if (isset($this->headerFooterImages[self::IMAGE_HEADER_RIGHT])) { + $images[self::IMAGE_HEADER_RIGHT] = $this->headerFooterImages[self::IMAGE_HEADER_RIGHT]; + } + if (isset($this->headerFooterImages[self::IMAGE_FOOTER_LEFT])) { + $images[self::IMAGE_FOOTER_LEFT] = $this->headerFooterImages[self::IMAGE_FOOTER_LEFT]; + } + if (isset($this->headerFooterImages[self::IMAGE_FOOTER_CENTER])) { + $images[self::IMAGE_FOOTER_CENTER] = $this->headerFooterImages[self::IMAGE_FOOTER_CENTER]; + } + if (isset($this->headerFooterImages[self::IMAGE_FOOTER_RIGHT])) { + $images[self::IMAGE_FOOTER_RIGHT] = $this->headerFooterImages[self::IMAGE_FOOTER_RIGHT]; + } + $this->headerFooterImages = $images; + + return $this->headerFooterImages; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php new file mode 100644 index 0000000..b42c732 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/HeaderFooterDrawing.php @@ -0,0 +1,24 @@ +getPath() . + $this->name . + $this->offsetX . + $this->offsetY . + $this->width . + $this->height . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Iterator.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Iterator.php new file mode 100644 index 0000000..d8797a3 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Iterator.php @@ -0,0 +1,87 @@ +subject = $subject; + } + + /** + * Destructor. + */ + public function __destruct() + { + unset($this->subject); + } + + /** + * Rewind iterator. + */ + public function rewind() + { + $this->position = 0; + } + + /** + * Current Worksheet. + * + * @return Worksheet + */ + public function current() + { + return $this->subject->getSheet($this->position); + } + + /** + * Current key. + * + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * Next value. + */ + public function next() + { + ++$this->position; + } + + /** + * Are there more Worksheet instances available? + * + * @return bool + */ + public function valid() + { + return $this->position < $this->subject->getSheetCount() && $this->position >= 0; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php new file mode 100644 index 0000000..f093558 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/MemoryDrawing.php @@ -0,0 +1,169 @@ +imageResource = null; + $this->renderingFunction = self::RENDERING_DEFAULT; + $this->mimeType = self::MIMETYPE_DEFAULT; + $this->uniqueName = md5(rand(0, 9999) . time() . rand(0, 9999)); + + // Initialize parent + parent::__construct(); + } + + /** + * Get image resource. + * + * @return resource + */ + public function getImageResource() + { + return $this->imageResource; + } + + /** + * Set image resource. + * + * @param resource $value + * + * @return $this + */ + public function setImageResource($value) + { + $this->imageResource = $value; + + if ($this->imageResource !== null) { + // Get width/height + $this->width = imagesx($this->imageResource); + $this->height = imagesy($this->imageResource); + } + + return $this; + } + + /** + * Get rendering function. + * + * @return string + */ + public function getRenderingFunction() + { + return $this->renderingFunction; + } + + /** + * Set rendering function. + * + * @param string $value see self::RENDERING_* + * + * @return $this + */ + public function setRenderingFunction($value) + { + $this->renderingFunction = $value; + + return $this; + } + + /** + * Get mime type. + * + * @return string + */ + public function getMimeType() + { + return $this->mimeType; + } + + /** + * Set mime type. + * + * @param string $value see self::MIMETYPE_* + * + * @return $this + */ + public function setMimeType($value) + { + $this->mimeType = $value; + + return $this; + } + + /** + * Get indexed filename (using image index). + * + * @return string + */ + public function getIndexedFilename() + { + $extension = strtolower($this->getMimeType()); + $extension = explode('/', $extension); + $extension = $extension[1]; + + return $this->uniqueName . $this->getImageIndex() . '.' . $extension; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + return md5( + $this->renderingFunction . + $this->mimeType . + $this->uniqueName . + parent::getHashCode() . + __CLASS__ + ); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageMargins.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageMargins.php new file mode 100644 index 0000000..9ebfb64 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageMargins.php @@ -0,0 +1,214 @@ +left; + } + + /** + * Set Left. + * + * @param float $pValue + * + * @return $this + */ + public function setLeft($pValue) + { + $this->left = $pValue; + + return $this; + } + + /** + * Get Right. + * + * @return float + */ + public function getRight() + { + return $this->right; + } + + /** + * Set Right. + * + * @param float $pValue + * + * @return $this + */ + public function setRight($pValue) + { + $this->right = $pValue; + + return $this; + } + + /** + * Get Top. + * + * @return float + */ + public function getTop() + { + return $this->top; + } + + /** + * Set Top. + * + * @param float $pValue + * + * @return $this + */ + public function setTop($pValue) + { + $this->top = $pValue; + + return $this; + } + + /** + * Get Bottom. + * + * @return float + */ + public function getBottom() + { + return $this->bottom; + } + + /** + * Set Bottom. + * + * @param float $pValue + * + * @return $this + */ + public function setBottom($pValue) + { + $this->bottom = $pValue; + + return $this; + } + + /** + * Get Header. + * + * @return float + */ + public function getHeader() + { + return $this->header; + } + + /** + * Set Header. + * + * @param float $pValue + * + * @return $this + */ + public function setHeader($pValue) + { + $this->header = $pValue; + + return $this; + } + + /** + * Get Footer. + * + * @return float + */ + public function getFooter() + { + return $this->footer; + } + + /** + * Set Footer. + * + * @param float $pValue + * + * @return $this + */ + public function setFooter($pValue) + { + $this->footer = $pValue; + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php new file mode 100644 index 0000000..fa1810f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/PageSetup.php @@ -0,0 +1,851 @@ + + * Paper size taken from Office Open XML Part 4 - Markup Language Reference, page 1988:. + * + * 1 = Letter paper (8.5 in. by 11 in.) + * 2 = Letter small paper (8.5 in. by 11 in.) + * 3 = Tabloid paper (11 in. by 17 in.) + * 4 = Ledger paper (17 in. by 11 in.) + * 5 = Legal paper (8.5 in. by 14 in.) + * 6 = Statement paper (5.5 in. by 8.5 in.) + * 7 = Executive paper (7.25 in. by 10.5 in.) + * 8 = A3 paper (297 mm by 420 mm) + * 9 = A4 paper (210 mm by 297 mm) + * 10 = A4 small paper (210 mm by 297 mm) + * 11 = A5 paper (148 mm by 210 mm) + * 12 = B4 paper (250 mm by 353 mm) + * 13 = B5 paper (176 mm by 250 mm) + * 14 = Folio paper (8.5 in. by 13 in.) + * 15 = Quarto paper (215 mm by 275 mm) + * 16 = Standard paper (10 in. by 14 in.) + * 17 = Standard paper (11 in. by 17 in.) + * 18 = Note paper (8.5 in. by 11 in.) + * 19 = #9 envelope (3.875 in. by 8.875 in.) + * 20 = #10 envelope (4.125 in. by 9.5 in.) + * 21 = #11 envelope (4.5 in. by 10.375 in.) + * 22 = #12 envelope (4.75 in. by 11 in.) + * 23 = #14 envelope (5 in. by 11.5 in.) + * 24 = C paper (17 in. by 22 in.) + * 25 = D paper (22 in. by 34 in.) + * 26 = E paper (34 in. by 44 in.) + * 27 = DL envelope (110 mm by 220 mm) + * 28 = C5 envelope (162 mm by 229 mm) + * 29 = C3 envelope (324 mm by 458 mm) + * 30 = C4 envelope (229 mm by 324 mm) + * 31 = C6 envelope (114 mm by 162 mm) + * 32 = C65 envelope (114 mm by 229 mm) + * 33 = B4 envelope (250 mm by 353 mm) + * 34 = B5 envelope (176 mm by 250 mm) + * 35 = B6 envelope (176 mm by 125 mm) + * 36 = Italy envelope (110 mm by 230 mm) + * 37 = Monarch envelope (3.875 in. by 7.5 in.). + * 38 = 6 3/4 envelope (3.625 in. by 6.5 in.) + * 39 = US standard fanfold (14.875 in. by 11 in.) + * 40 = German standard fanfold (8.5 in. by 12 in.) + * 41 = German legal fanfold (8.5 in. by 13 in.) + * 42 = ISO B4 (250 mm by 353 mm) + * 43 = Japanese double postcard (200 mm by 148 mm) + * 44 = Standard paper (9 in. by 11 in.) + * 45 = Standard paper (10 in. by 11 in.) + * 46 = Standard paper (15 in. by 11 in.) + * 47 = Invite envelope (220 mm by 220 mm) + * 50 = Letter extra paper (9.275 in. by 12 in.) + * 51 = Legal extra paper (9.275 in. by 15 in.) + * 52 = Tabloid extra paper (11.69 in. by 18 in.) + * 53 = A4 extra paper (236 mm by 322 mm) + * 54 = Letter transverse paper (8.275 in. by 11 in.) + * 55 = A4 transverse paper (210 mm by 297 mm) + * 56 = Letter extra transverse paper (9.275 in. by 12 in.) + * 57 = SuperA/SuperA/A4 paper (227 mm by 356 mm) + * 58 = SuperB/SuperB/A3 paper (305 mm by 487 mm) + * 59 = Letter plus paper (8.5 in. by 12.69 in.) + * 60 = A4 plus paper (210 mm by 330 mm) + * 61 = A5 transverse paper (148 mm by 210 mm) + * 62 = JIS B5 transverse paper (182 mm by 257 mm) + * 63 = A3 extra paper (322 mm by 445 mm) + * 64 = A5 extra paper (174 mm by 235 mm) + * 65 = ISO B5 extra paper (201 mm by 276 mm) + * 66 = A2 paper (420 mm by 594 mm) + * 67 = A3 transverse paper (297 mm by 420 mm) + * 68 = A3 extra transverse paper (322 mm by 445 mm) + * + * + * @category PhpSpreadsheet + * + * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) + */ +class PageSetup +{ + // Paper size + const PAPERSIZE_LETTER = 1; + const PAPERSIZE_LETTER_SMALL = 2; + const PAPERSIZE_TABLOID = 3; + const PAPERSIZE_LEDGER = 4; + const PAPERSIZE_LEGAL = 5; + const PAPERSIZE_STATEMENT = 6; + const PAPERSIZE_EXECUTIVE = 7; + const PAPERSIZE_A3 = 8; + const PAPERSIZE_A4 = 9; + const PAPERSIZE_A4_SMALL = 10; + const PAPERSIZE_A5 = 11; + const PAPERSIZE_B4 = 12; + const PAPERSIZE_B5 = 13; + const PAPERSIZE_FOLIO = 14; + const PAPERSIZE_QUARTO = 15; + const PAPERSIZE_STANDARD_1 = 16; + const PAPERSIZE_STANDARD_2 = 17; + const PAPERSIZE_NOTE = 18; + const PAPERSIZE_NO9_ENVELOPE = 19; + const PAPERSIZE_NO10_ENVELOPE = 20; + const PAPERSIZE_NO11_ENVELOPE = 21; + const PAPERSIZE_NO12_ENVELOPE = 22; + const PAPERSIZE_NO14_ENVELOPE = 23; + const PAPERSIZE_C = 24; + const PAPERSIZE_D = 25; + const PAPERSIZE_E = 26; + const PAPERSIZE_DL_ENVELOPE = 27; + const PAPERSIZE_C5_ENVELOPE = 28; + const PAPERSIZE_C3_ENVELOPE = 29; + const PAPERSIZE_C4_ENVELOPE = 30; + const PAPERSIZE_C6_ENVELOPE = 31; + const PAPERSIZE_C65_ENVELOPE = 32; + const PAPERSIZE_B4_ENVELOPE = 33; + const PAPERSIZE_B5_ENVELOPE = 34; + const PAPERSIZE_B6_ENVELOPE = 35; + const PAPERSIZE_ITALY_ENVELOPE = 36; + const PAPERSIZE_MONARCH_ENVELOPE = 37; + const PAPERSIZE_6_3_4_ENVELOPE = 38; + const PAPERSIZE_US_STANDARD_FANFOLD = 39; + const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40; + const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41; + const PAPERSIZE_ISO_B4 = 42; + const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43; + const PAPERSIZE_STANDARD_PAPER_1 = 44; + const PAPERSIZE_STANDARD_PAPER_2 = 45; + const PAPERSIZE_STANDARD_PAPER_3 = 46; + const PAPERSIZE_INVITE_ENVELOPE = 47; + const PAPERSIZE_LETTER_EXTRA_PAPER = 48; + const PAPERSIZE_LEGAL_EXTRA_PAPER = 49; + const PAPERSIZE_TABLOID_EXTRA_PAPER = 50; + const PAPERSIZE_A4_EXTRA_PAPER = 51; + const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52; + const PAPERSIZE_A4_TRANSVERSE_PAPER = 53; + const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54; + const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55; + const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56; + const PAPERSIZE_LETTER_PLUS_PAPER = 57; + const PAPERSIZE_A4_PLUS_PAPER = 58; + const PAPERSIZE_A5_TRANSVERSE_PAPER = 59; + const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60; + const PAPERSIZE_A3_EXTRA_PAPER = 61; + const PAPERSIZE_A5_EXTRA_PAPER = 62; + const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63; + const PAPERSIZE_A2_PAPER = 64; + const PAPERSIZE_A3_TRANSVERSE_PAPER = 65; + const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66; + + // Page orientation + const ORIENTATION_DEFAULT = 'default'; + const ORIENTATION_LANDSCAPE = 'landscape'; + const ORIENTATION_PORTRAIT = 'portrait'; + + // Print Range Set Method + const SETPRINTRANGE_OVERWRITE = 'O'; + const SETPRINTRANGE_INSERT = 'I'; + + /** + * Paper size. + * + * @var int + */ + private $paperSize = self::PAPERSIZE_LETTER; + + /** + * Orientation. + * + * @var string + */ + private $orientation = self::ORIENTATION_DEFAULT; + + /** + * Scale (Print Scale). + * + * Print scaling. Valid values range from 10 to 400 + * This setting is overridden when fitToWidth and/or fitToHeight are in use + * + * @var int? + */ + private $scale = 100; + + /** + * Fit To Page + * Whether scale or fitToWith / fitToHeight applies. + * + * @var bool + */ + private $fitToPage = false; + + /** + * Fit To Height + * Number of vertical pages to fit on. + * + * @var int? + */ + private $fitToHeight = 1; + + /** + * Fit To Width + * Number of horizontal pages to fit on. + * + * @var int? + */ + private $fitToWidth = 1; + + /** + * Columns to repeat at left. + * + * @var array Containing start column and end column, empty array if option unset + */ + private $columnsToRepeatAtLeft = ['', '']; + + /** + * Rows to repeat at top. + * + * @var array Containing start row number and end row number, empty array if option unset + */ + private $rowsToRepeatAtTop = [0, 0]; + + /** + * Center page horizontally. + * + * @var bool + */ + private $horizontalCentered = false; + + /** + * Center page vertically. + * + * @var bool + */ + private $verticalCentered = false; + + /** + * Print area. + * + * @var string + */ + private $printArea; + + /** + * First page number. + * + * @var int + */ + private $firstPageNumber; + + /** + * Create a new PageSetup. + */ + public function __construct() + { + } + + /** + * Get Paper Size. + * + * @return int + */ + public function getPaperSize() + { + return $this->paperSize; + } + + /** + * Set Paper Size. + * + * @param int $pValue see self::PAPERSIZE_* + * + * @return $this + */ + public function setPaperSize($pValue) + { + $this->paperSize = $pValue; + + return $this; + } + + /** + * Get Orientation. + * + * @return string + */ + public function getOrientation() + { + return $this->orientation; + } + + /** + * Set Orientation. + * + * @param string $pValue see self::ORIENTATION_* + * + * @return $this + */ + public function setOrientation($pValue) + { + $this->orientation = $pValue; + + return $this; + } + + /** + * Get Scale. + * + * @return int? + */ + public function getScale() + { + return $this->scale; + } + + /** + * Set Scale. + * Print scaling. Valid values range from 10 to 400 + * This setting is overridden when fitToWidth and/or fitToHeight are in use. + * + * @param null|int $pValue + * @param bool $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setScale($pValue, $pUpdate = true) + { + // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, + // but it is apparently still able to handle any scale >= 0, where 0 results in 100 + if (($pValue >= 0) || $pValue === null) { + $this->scale = $pValue; + if ($pUpdate) { + $this->fitToPage = false; + } + } else { + throw new PhpSpreadsheetException('Scale must not be negative'); + } + + return $this; + } + + /** + * Get Fit To Page. + * + * @return bool + */ + public function getFitToPage() + { + return $this->fitToPage; + } + + /** + * Set Fit To Page. + * + * @param bool $pValue + * + * @return $this + */ + public function setFitToPage($pValue) + { + $this->fitToPage = $pValue; + + return $this; + } + + /** + * Get Fit To Height. + * + * @return int? + */ + public function getFitToHeight() + { + return $this->fitToHeight; + } + + /** + * Set Fit To Height. + * + * @param null|int $pValue + * @param bool $pUpdate Update fitToPage so it applies rather than scaling + * + * @return $this + */ + public function setFitToHeight($pValue, $pUpdate = true) + { + $this->fitToHeight = $pValue; + if ($pUpdate) { + $this->fitToPage = true; + } + + return $this; + } + + /** + * Get Fit To Width. + * + * @return int? + */ + public function getFitToWidth() + { + return $this->fitToWidth; + } + + /** + * Set Fit To Width. + * + * @param null|int $pValue + * @param bool $pUpdate Update fitToPage so it applies rather than scaling + * + * @return $this + */ + public function setFitToWidth($pValue, $pUpdate = true) + { + $this->fitToWidth = $pValue; + if ($pUpdate) { + $this->fitToPage = true; + } + + return $this; + } + + /** + * Is Columns to repeat at left set? + * + * @return bool + */ + public function isColumnsToRepeatAtLeftSet() + { + if (is_array($this->columnsToRepeatAtLeft)) { + if ($this->columnsToRepeatAtLeft[0] != '' && $this->columnsToRepeatAtLeft[1] != '') { + return true; + } + } + + return false; + } + + /** + * Get Columns to repeat at left. + * + * @return array Containing start column and end column, empty array if option unset + */ + public function getColumnsToRepeatAtLeft() + { + return $this->columnsToRepeatAtLeft; + } + + /** + * Set Columns to repeat at left. + * + * @param array $pValue Containing start column and end column, empty array if option unset + * + * @return $this + */ + public function setColumnsToRepeatAtLeft(array $pValue) + { + $this->columnsToRepeatAtLeft = $pValue; + + return $this; + } + + /** + * Set Columns to repeat at left by start and end. + * + * @param string $pStart eg: 'A' + * @param string $pEnd eg: 'B' + * + * @return $this + */ + public function setColumnsToRepeatAtLeftByStartAndEnd($pStart, $pEnd) + { + $this->columnsToRepeatAtLeft = [$pStart, $pEnd]; + + return $this; + } + + /** + * Is Rows to repeat at top set? + * + * @return bool + */ + public function isRowsToRepeatAtTopSet() + { + if (is_array($this->rowsToRepeatAtTop)) { + if ($this->rowsToRepeatAtTop[0] != 0 && $this->rowsToRepeatAtTop[1] != 0) { + return true; + } + } + + return false; + } + + /** + * Get Rows to repeat at top. + * + * @return array Containing start column and end column, empty array if option unset + */ + public function getRowsToRepeatAtTop() + { + return $this->rowsToRepeatAtTop; + } + + /** + * Set Rows to repeat at top. + * + * @param array $pValue Containing start column and end column, empty array if option unset + * + * @return $this + */ + public function setRowsToRepeatAtTop(array $pValue) + { + $this->rowsToRepeatAtTop = $pValue; + + return $this; + } + + /** + * Set Rows to repeat at top by start and end. + * + * @param int $pStart eg: 1 + * @param int $pEnd eg: 1 + * + * @return $this + */ + public function setRowsToRepeatAtTopByStartAndEnd($pStart, $pEnd) + { + $this->rowsToRepeatAtTop = [$pStart, $pEnd]; + + return $this; + } + + /** + * Get center page horizontally. + * + * @return bool + */ + public function getHorizontalCentered() + { + return $this->horizontalCentered; + } + + /** + * Set center page horizontally. + * + * @param bool $value + * + * @return $this + */ + public function setHorizontalCentered($value) + { + $this->horizontalCentered = $value; + + return $this; + } + + /** + * Get center page vertically. + * + * @return bool + */ + public function getVerticalCentered() + { + return $this->verticalCentered; + } + + /** + * Set center page vertically. + * + * @param bool $value + * + * @return $this + */ + public function setVerticalCentered($value) + { + $this->verticalCentered = $value; + + return $this; + } + + /** + * Get print area. + * + * @param int $index Identifier for a specific print area range if several ranges have been set + * Default behaviour, or a index value of 0, will return all ranges as a comma-separated string + * Otherwise, the specific range identified by the value of $index will be returned + * Print areas are numbered from 1 + * + * @throws PhpSpreadsheetException + * + * @return string + */ + public function getPrintArea($index = 0) + { + if ($index == 0) { + return $this->printArea; + } + $printAreas = explode(',', $this->printArea); + if (isset($printAreas[$index - 1])) { + return $printAreas[$index - 1]; + } + + throw new PhpSpreadsheetException('Requested Print Area does not exist'); + } + + /** + * Is print area set? + * + * @param int $index Identifier for a specific print area range if several ranges have been set + * Default behaviour, or an index value of 0, will identify whether any print range is set + * Otherwise, existence of the range identified by the value of $index will be returned + * Print areas are numbered from 1 + * + * @return bool + */ + public function isPrintAreaSet($index = 0) + { + if ($index == 0) { + return $this->printArea !== null; + } + $printAreas = explode(',', $this->printArea); + + return isset($printAreas[$index - 1]); + } + + /** + * Clear a print area. + * + * @param int $index Identifier for a specific print area range if several ranges have been set + * Default behaviour, or an index value of 0, will clear all print ranges that are set + * Otherwise, the range identified by the value of $index will be removed from the series + * Print areas are numbered from 1 + * + * @return $this + */ + public function clearPrintArea($index = 0) + { + if ($index == 0) { + $this->printArea = null; + } else { + $printAreas = explode(',', $this->printArea); + if (isset($printAreas[$index - 1])) { + unset($printAreas[$index - 1]); + $this->printArea = implode(',', $printAreas); + } + } + + return $this; + } + + /** + * Set print area. e.g. 'A1:D10' or 'A1:D10,G5:M20'. + * + * @param string $value + * @param int $index Identifier for a specific print area range allowing several ranges to be set + * When the method is "O"verwrite, then a positive integer index will overwrite that indexed + * entry in the print areas list; a negative index value will identify which entry to + * overwrite working bacward through the print area to the list, with the last entry as -1. + * Specifying an index value of 0, will overwrite all existing print ranges. + * When the method is "I"nsert, then a positive index will insert after that indexed entry in + * the print areas list, while a negative index will insert before the indexed entry. + * Specifying an index value of 0, will always append the new print range at the end of the + * list. + * Print areas are numbered from 1 + * @param string $method Determines the method used when setting multiple print areas + * Default behaviour, or the "O" method, overwrites existing print area + * The "I" method, inserts the new print area before any specified index, or at the end of the list + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) + { + if (strpos($value, '!') !== false) { + throw new PhpSpreadsheetException('Cell coordinate must not specify a worksheet.'); + } elseif (strpos($value, ':') === false) { + throw new PhpSpreadsheetException('Cell coordinate must be a range of cells.'); + } elseif (strpos($value, '$') !== false) { + throw new PhpSpreadsheetException('Cell coordinate must not be absolute.'); + } + $value = strtoupper($value); + + if ($method == self::SETPRINTRANGE_OVERWRITE) { + if ($index == 0) { + $this->printArea = $value; + } else { + $printAreas = explode(',', $this->printArea); + if ($index < 0) { + $index = count($printAreas) - abs($index) + 1; + } + if (($index <= 0) || ($index > count($printAreas))) { + throw new PhpSpreadsheetException('Invalid index for setting print range.'); + } + $printAreas[$index - 1] = $value; + $this->printArea = implode(',', $printAreas); + } + } elseif ($method == self::SETPRINTRANGE_INSERT) { + if ($index == 0) { + $this->printArea .= ($this->printArea == '') ? $value : ',' . $value; + } else { + $printAreas = explode(',', $this->printArea); + if ($index < 0) { + $index = abs($index) - 1; + } + if ($index > count($printAreas)) { + throw new PhpSpreadsheetException('Invalid index for setting print range.'); + } + $printAreas = array_merge(array_slice($printAreas, 0, $index), [$value], array_slice($printAreas, $index)); + $this->printArea = implode(',', $printAreas); + } + } else { + throw new PhpSpreadsheetException('Invalid method for setting print range.'); + } + + return $this; + } + + /** + * Add a new print area (e.g. 'A1:D10' or 'A1:D10,G5:M20') to the list of print areas. + * + * @param string $value + * @param int $index Identifier for a specific print area range allowing several ranges to be set + * A positive index will insert after that indexed entry in the print areas list, while a + * negative index will insert before the indexed entry. + * Specifying an index value of 0, will always append the new print range at the end of the + * list. + * Print areas are numbered from 1 + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function addPrintArea($value, $index = -1) + { + return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT); + } + + /** + * Set print area. + * + * @param int $column1 Column 1 + * @param int $row1 Row 1 + * @param int $column2 Column 2 + * @param int $row2 Row 2 + * @param int $index Identifier for a specific print area range allowing several ranges to be set + * When the method is "O"verwrite, then a positive integer index will overwrite that indexed + * entry in the print areas list; a negative index value will identify which entry to + * overwrite working backward through the print area to the list, with the last entry as -1. + * Specifying an index value of 0, will overwrite all existing print ranges. + * When the method is "I"nsert, then a positive index will insert after that indexed entry in + * the print areas list, while a negative index will insert before the indexed entry. + * Specifying an index value of 0, will always append the new print range at the end of the + * list. + * Print areas are numbered from 1 + * @param string $method Determines the method used when setting multiple print areas + * Default behaviour, or the "O" method, overwrites existing print area + * The "I" method, inserts the new print area before any specified index, or at the end of the list + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) + { + return $this->setPrintArea( + Coordinate::stringFromColumnIndex($column1) . $row1 . ':' . Coordinate::stringFromColumnIndex($column2) . $row2, + $index, + $method + ); + } + + /** + * Add a new print area to the list of print areas. + * + * @param int $column1 Start Column for the print area + * @param int $row1 Start Row for the print area + * @param int $column2 End Column for the print area + * @param int $row2 End Row for the print area + * @param int $index Identifier for a specific print area range allowing several ranges to be set + * A positive index will insert after that indexed entry in the print areas list, while a + * negative index will insert before the indexed entry. + * Specifying an index value of 0, will always append the new print range at the end of the + * list. + * Print areas are numbered from 1 + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1) + { + return $this->setPrintArea( + Coordinate::stringFromColumnIndex($column1) . $row1 . ':' . Coordinate::stringFromColumnIndex($column2) . $row2, + $index, + self::SETPRINTRANGE_INSERT + ); + } + + /** + * Get first page number. + * + * @return int + */ + public function getFirstPageNumber() + { + return $this->firstPageNumber; + } + + /** + * Set first page number. + * + * @param int $value + * + * @return $this + */ + public function setFirstPageNumber($value) + { + $this->firstPageNumber = $value; + + return $this; + } + + /** + * Reset first page number. + * + * @return $this + */ + public function resetFirstPageNumber() + { + return $this->setFirstPageNumber(null); + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Protection.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Protection.php new file mode 100644 index 0000000..2fd3e91 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Protection.php @@ -0,0 +1,586 @@ +sheet || + $this->objects || + $this->scenarios || + $this->formatCells || + $this->formatColumns || + $this->formatRows || + $this->insertColumns || + $this->insertRows || + $this->insertHyperlinks || + $this->deleteColumns || + $this->deleteRows || + $this->selectLockedCells || + $this->sort || + $this->autoFilter || + $this->pivotTables || + $this->selectUnlockedCells; + } + + /** + * Get Sheet. + * + * @return bool + */ + public function getSheet() + { + return $this->sheet; + } + + /** + * Set Sheet. + * + * @param bool $pValue + * + * @return $this + */ + public function setSheet($pValue) + { + $this->sheet = $pValue; + + return $this; + } + + /** + * Get Objects. + * + * @return bool + */ + public function getObjects() + { + return $this->objects; + } + + /** + * Set Objects. + * + * @param bool $pValue + * + * @return $this + */ + public function setObjects($pValue) + { + $this->objects = $pValue; + + return $this; + } + + /** + * Get Scenarios. + * + * @return bool + */ + public function getScenarios() + { + return $this->scenarios; + } + + /** + * Set Scenarios. + * + * @param bool $pValue + * + * @return $this + */ + public function setScenarios($pValue) + { + $this->scenarios = $pValue; + + return $this; + } + + /** + * Get FormatCells. + * + * @return bool + */ + public function getFormatCells() + { + return $this->formatCells; + } + + /** + * Set FormatCells. + * + * @param bool $pValue + * + * @return $this + */ + public function setFormatCells($pValue) + { + $this->formatCells = $pValue; + + return $this; + } + + /** + * Get FormatColumns. + * + * @return bool + */ + public function getFormatColumns() + { + return $this->formatColumns; + } + + /** + * Set FormatColumns. + * + * @param bool $pValue + * + * @return $this + */ + public function setFormatColumns($pValue) + { + $this->formatColumns = $pValue; + + return $this; + } + + /** + * Get FormatRows. + * + * @return bool + */ + public function getFormatRows() + { + return $this->formatRows; + } + + /** + * Set FormatRows. + * + * @param bool $pValue + * + * @return $this + */ + public function setFormatRows($pValue) + { + $this->formatRows = $pValue; + + return $this; + } + + /** + * Get InsertColumns. + * + * @return bool + */ + public function getInsertColumns() + { + return $this->insertColumns; + } + + /** + * Set InsertColumns. + * + * @param bool $pValue + * + * @return $this + */ + public function setInsertColumns($pValue) + { + $this->insertColumns = $pValue; + + return $this; + } + + /** + * Get InsertRows. + * + * @return bool + */ + public function getInsertRows() + { + return $this->insertRows; + } + + /** + * Set InsertRows. + * + * @param bool $pValue + * + * @return $this + */ + public function setInsertRows($pValue) + { + $this->insertRows = $pValue; + + return $this; + } + + /** + * Get InsertHyperlinks. + * + * @return bool + */ + public function getInsertHyperlinks() + { + return $this->insertHyperlinks; + } + + /** + * Set InsertHyperlinks. + * + * @param bool $pValue + * + * @return $this + */ + public function setInsertHyperlinks($pValue) + { + $this->insertHyperlinks = $pValue; + + return $this; + } + + /** + * Get DeleteColumns. + * + * @return bool + */ + public function getDeleteColumns() + { + return $this->deleteColumns; + } + + /** + * Set DeleteColumns. + * + * @param bool $pValue + * + * @return $this + */ + public function setDeleteColumns($pValue) + { + $this->deleteColumns = $pValue; + + return $this; + } + + /** + * Get DeleteRows. + * + * @return bool + */ + public function getDeleteRows() + { + return $this->deleteRows; + } + + /** + * Set DeleteRows. + * + * @param bool $pValue + * + * @return $this + */ + public function setDeleteRows($pValue) + { + $this->deleteRows = $pValue; + + return $this; + } + + /** + * Get SelectLockedCells. + * + * @return bool + */ + public function getSelectLockedCells() + { + return $this->selectLockedCells; + } + + /** + * Set SelectLockedCells. + * + * @param bool $pValue + * + * @return $this + */ + public function setSelectLockedCells($pValue) + { + $this->selectLockedCells = $pValue; + + return $this; + } + + /** + * Get Sort. + * + * @return bool + */ + public function getSort() + { + return $this->sort; + } + + /** + * Set Sort. + * + * @param bool $pValue + * + * @return $this + */ + public function setSort($pValue) + { + $this->sort = $pValue; + + return $this; + } + + /** + * Get AutoFilter. + * + * @return bool + */ + public function getAutoFilter() + { + return $this->autoFilter; + } + + /** + * Set AutoFilter. + * + * @param bool $pValue + * + * @return $this + */ + public function setAutoFilter($pValue) + { + $this->autoFilter = $pValue; + + return $this; + } + + /** + * Get PivotTables. + * + * @return bool + */ + public function getPivotTables() + { + return $this->pivotTables; + } + + /** + * Set PivotTables. + * + * @param bool $pValue + * + * @return $this + */ + public function setPivotTables($pValue) + { + $this->pivotTables = $pValue; + + return $this; + } + + /** + * Get SelectUnlockedCells. + * + * @return bool + */ + public function getSelectUnlockedCells() + { + return $this->selectUnlockedCells; + } + + /** + * Set SelectUnlockedCells. + * + * @param bool $pValue + * + * @return $this + */ + public function setSelectUnlockedCells($pValue) + { + $this->selectUnlockedCells = $pValue; + + return $this; + } + + /** + * Get Password (hashed). + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Set Password. + * + * @param string $pValue + * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * + * @return $this + */ + public function setPassword($pValue, $pAlreadyHashed = false) + { + if (!$pAlreadyHashed) { + $pValue = PasswordHasher::hashPassword($pValue); + } + $this->password = $pValue; + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php new file mode 100644 index 0000000..2a379d2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Row.php @@ -0,0 +1,74 @@ +worksheet = $worksheet; + $this->rowIndex = $rowIndex; + } + + /** + * Destructor. + */ + public function __destruct() + { + unset($this->worksheet); + } + + /** + * Get row index. + * + * @return int + */ + public function getRowIndex() + { + return $this->rowIndex; + } + + /** + * Get cell iterator. + * + * @param string $startColumn The column address at which to start iterating + * @param string $endColumn Optionally, the column address at which to stop iterating + * + * @return RowCellIterator + */ + public function getCellIterator($startColumn = 'A', $endColumn = null) + { + return new RowCellIterator($this->worksheet, $this->rowIndex, $startColumn, $endColumn); + } + + /** + * Returns bound worksheet. + * + * @return Worksheet + */ + public function getWorksheet() + { + return $this->worksheet; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowCellIterator.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowCellIterator.php new file mode 100644 index 0000000..9746d64 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowCellIterator.php @@ -0,0 +1,205 @@ +worksheet = $worksheet; + $this->rowIndex = $rowIndex; + $this->resetEnd($endColumn); + $this->resetStart($startColumn); + } + + /** + * (Re)Set the start column and the current column pointer. + * + * @param string $startColumn The column address at which to start iterating + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function resetStart($startColumn = 'A') + { + $this->startColumnIndex = Coordinate::columnIndexFromString($startColumn); + $this->adjustForExistingOnlyRange(); + $this->seek(Coordinate::stringFromColumnIndex($this->startColumnIndex)); + + return $this; + } + + /** + * (Re)Set the end column. + * + * @param string $endColumn The column address at which to stop iterating + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function resetEnd($endColumn = null) + { + $endColumn = $endColumn ? $endColumn : $this->worksheet->getHighestColumn(); + $this->endColumnIndex = Coordinate::columnIndexFromString($endColumn); + $this->adjustForExistingOnlyRange(); + + return $this; + } + + /** + * Set the column pointer to the selected column. + * + * @param string $column The column address to set the current pointer at + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function seek($column = 'A') + { + $column = Coordinate::columnIndexFromString($column); + if (($column < $this->startColumnIndex) || ($column > $this->endColumnIndex)) { + throw new PhpSpreadsheetException("Column $column is out of range ({$this->startColumnIndex} - {$this->endColumnIndex})"); + } elseif ($this->onlyExistingCells && !($this->worksheet->cellExistsByColumnAndRow($column, $this->rowIndex))) { + throw new PhpSpreadsheetException('In "IterateOnlyExistingCells" mode and Cell does not exist'); + } + $this->currentColumnIndex = $column; + + return $this; + } + + /** + * Rewind the iterator to the starting column. + */ + public function rewind() + { + $this->currentColumnIndex = $this->startColumnIndex; + } + + /** + * Return the current cell in this worksheet row. + * + * @return \PhpOffice\PhpSpreadsheet\Cell\Cell + */ + public function current() + { + return $this->worksheet->getCellByColumnAndRow($this->currentColumnIndex, $this->rowIndex); + } + + /** + * Return the current iterator key. + * + * @return string + */ + public function key() + { + return Coordinate::stringFromColumnIndex($this->currentColumnIndex); + } + + /** + * Set the iterator to its next value. + */ + public function next() + { + do { + ++$this->currentColumnIndex; + } while (($this->onlyExistingCells) && (!$this->worksheet->cellExistsByColumnAndRow($this->currentColumnIndex, $this->rowIndex)) && ($this->currentColumnIndex <= $this->endColumnIndex)); + } + + /** + * Set the iterator to its previous value. + * + * @throws PhpSpreadsheetException + */ + public function prev() + { + do { + --$this->currentColumnIndex; + } while (($this->onlyExistingCells) && (!$this->worksheet->cellExistsByColumnAndRow($this->currentColumnIndex, $this->rowIndex)) && ($this->currentColumnIndex >= $this->startColumnIndex)); + } + + /** + * Indicate if more columns exist in the worksheet range of columns that we're iterating. + * + * @return bool + */ + public function valid() + { + return $this->currentColumnIndex <= $this->endColumnIndex && $this->currentColumnIndex >= $this->startColumnIndex; + } + + /** + * Return the current iterator position. + * + * @return int + */ + public function getCurrentColumnIndex() + { + return $this->currentColumnIndex; + } + + /** + * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary. + * + * @throws PhpSpreadsheetException + */ + protected function adjustForExistingOnlyRange() + { + if ($this->onlyExistingCells) { + while ((!$this->worksheet->cellExistsByColumnAndRow($this->startColumnIndex, $this->rowIndex)) && ($this->startColumnIndex <= $this->endColumnIndex)) { + ++$this->startColumnIndex; + } + if ($this->startColumnIndex > $this->endColumnIndex) { + throw new PhpSpreadsheetException('No cells exist within the specified range'); + } + while ((!$this->worksheet->cellExistsByColumnAndRow($this->endColumnIndex, $this->rowIndex)) && ($this->endColumnIndex >= $this->startColumnIndex)) { + --$this->endColumnIndex; + } + if ($this->endColumnIndex < $this->startColumnIndex) { + throw new PhpSpreadsheetException('No cells exist within the specified range'); + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php new file mode 100644 index 0000000..c4a87bd --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php @@ -0,0 +1,115 @@ +rowIndex = $pIndex; + + // set dimension as unformatted by default + parent::__construct(null); + } + + /** + * Get Row Index. + * + * @return int + */ + public function getRowIndex() + { + return $this->rowIndex; + } + + /** + * Set Row Index. + * + * @param int $pValue + * + * @return $this + */ + public function setRowIndex($pValue) + { + $this->rowIndex = $pValue; + + return $this; + } + + /** + * Get Row Height. + * + * @return float + */ + public function getRowHeight() + { + return $this->height; + } + + /** + * Set Row Height. + * + * @param float $pValue + * + * @return $this + */ + public function setRowHeight($pValue) + { + $this->height = $pValue; + + return $this; + } + + /** + * Get ZeroHeight. + * + * @return bool + */ + public function getZeroHeight() + { + return $this->zeroHeight; + } + + /** + * Set ZeroHeight. + * + * @param bool $pValue + * + * @return $this + */ + public function setZeroHeight($pValue) + { + $this->zeroHeight = $pValue; + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowIterator.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowIterator.php new file mode 100644 index 0000000..3b9d0e2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowIterator.php @@ -0,0 +1,170 @@ +subject = $subject; + $this->resetEnd($endRow); + $this->resetStart($startRow); + } + + /** + * Destructor. + */ + public function __destruct() + { + unset($this->subject); + } + + /** + * (Re)Set the start row and the current row pointer. + * + * @param int $startRow The row number at which to start iterating + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function resetStart($startRow = 1) + { + if ($startRow > $this->subject->getHighestRow()) { + throw new PhpSpreadsheetException("Start row ({$startRow}) is beyond highest row ({$this->subject->getHighestRow()})"); + } + + $this->startRow = $startRow; + if ($this->endRow < $this->startRow) { + $this->endRow = $this->startRow; + } + $this->seek($startRow); + + return $this; + } + + /** + * (Re)Set the end row. + * + * @param int $endRow The row number at which to stop iterating + * + * @return $this + */ + public function resetEnd($endRow = null) + { + $this->endRow = ($endRow) ? $endRow : $this->subject->getHighestRow(); + + return $this; + } + + /** + * Set the row pointer to the selected row. + * + * @param int $row The row number to set the current pointer at + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function seek($row = 1) + { + if (($row < $this->startRow) || ($row > $this->endRow)) { + throw new PhpSpreadsheetException("Row $row is out of range ({$this->startRow} - {$this->endRow})"); + } + $this->position = $row; + + return $this; + } + + /** + * Rewind the iterator to the starting row. + */ + public function rewind() + { + $this->position = $this->startRow; + } + + /** + * Return the current row in this worksheet. + * + * @return Row + */ + public function current() + { + return new Row($this->subject, $this->position); + } + + /** + * Return the current iterator key. + * + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * Set the iterator to its next value. + */ + public function next() + { + ++$this->position; + } + + /** + * Set the iterator to its previous value. + */ + public function prev() + { + --$this->position; + } + + /** + * Indicate if more rows exist in the worksheet range of rows that we're iterating. + * + * @return bool + */ + public function valid() + { + return $this->position <= $this->endRow && $this->position >= $this->startRow; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/SheetView.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/SheetView.php new file mode 100644 index 0000000..fa85bd2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/SheetView.php @@ -0,0 +1,199 @@ +zoomScale; + } + + /** + * Set ZoomScale. + * Valid values range from 10 to 400. + * + * @param int $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setZoomScale($pValue) + { + // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface, + // but it is apparently still able to handle any scale >= 1 + if (($pValue >= 1) || $pValue === null) { + $this->zoomScale = $pValue; + } else { + throw new PhpSpreadsheetException('Scale must be greater than or equal to 1.'); + } + + return $this; + } + + /** + * Get ZoomScaleNormal. + * + * @return int + */ + public function getZoomScaleNormal() + { + return $this->zoomScaleNormal; + } + + /** + * Set ZoomScale. + * Valid values range from 10 to 400. + * + * @param int $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setZoomScaleNormal($pValue) + { + if (($pValue >= 1) || $pValue === null) { + $this->zoomScaleNormal = $pValue; + } else { + throw new PhpSpreadsheetException('Scale must be greater than or equal to 1.'); + } + + return $this; + } + + /** + * Set ShowZeroes setting. + * + * @param bool $pValue + */ + public function setShowZeros($pValue) + { + $this->showZeros = $pValue; + } + + /** + * @return bool + */ + public function getShowZeros() + { + return $this->showZeros; + } + + /** + * Get View. + * + * @return string + */ + public function getView() + { + return $this->sheetviewType; + } + + /** + * Set View. + * + * Valid values are + * 'normal' self::SHEETVIEW_NORMAL + * 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT + * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW + * + * @param string $pValue + * + * @throws PhpSpreadsheetException + * + * @return $this + */ + public function setView($pValue) + { + // MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' via the user interface + if ($pValue === null) { + $pValue = self::SHEETVIEW_NORMAL; + } + if (in_array($pValue, self::$sheetViewTypes)) { + $this->sheetviewType = $pValue; + } else { + throw new PhpSpreadsheetException('Invalid sheetview layout type.'); + } + + return $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + $vars = get_object_vars($this); + foreach ($vars as $key => $value) { + if (is_object($value)) { + $this->$key = clone $value; + } else { + $this->$key = $value; + } + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php new file mode 100644 index 0000000..f3a5b4d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -0,0 +1,3079 @@ +parent = $parent; + $this->setTitle($pTitle, false); + // setTitle can change $pTitle + $this->setCodeName($this->getTitle()); + $this->setSheetState(self::SHEETSTATE_VISIBLE); + + $this->cellCollection = CellsFactory::getInstance($this); + // Set page setup + $this->pageSetup = new PageSetup(); + // Set page margins + $this->pageMargins = new PageMargins(); + // Set page header/footer + $this->headerFooter = new HeaderFooter(); + // Set sheet view + $this->sheetView = new SheetView(); + // Drawing collection + $this->drawingCollection = new \ArrayObject(); + // Chart collection + $this->chartCollection = new \ArrayObject(); + // Protection + $this->protection = new Protection(); + // Default row dimension + $this->defaultRowDimension = new RowDimension(null); + // Default column dimension + $this->defaultColumnDimension = new ColumnDimension(null); + $this->autoFilter = new AutoFilter(null, $this); + } + + /** + * Disconnect all cells from this Worksheet object, + * typically so that the worksheet object can be unset. + */ + public function disconnectCells() + { + if ($this->cellCollection !== null) { + $this->cellCollection->unsetWorksheetCells(); + $this->cellCollection = null; + } + // detach ourself from the workbook, so that it can then delete this worksheet successfully + $this->parent = null; + } + + /** + * Code to execute when this worksheet is unset(). + */ + public function __destruct() + { + Calculation::getInstance($this->parent)->clearCalculationCacheForWorksheet($this->title); + + $this->disconnectCells(); + } + + /** + * Return the cell collection. + * + * @return Cells + */ + public function getCellCollection() + { + return $this->cellCollection; + } + + /** + * Get array of invalid characters for sheet title. + * + * @return array + */ + public static function getInvalidCharacters() + { + return self::$invalidCharacters; + } + + /** + * Check sheet code name for valid Excel syntax. + * + * @param string $pValue The string to check + * + * @throws Exception + * + * @return string The valid string + */ + private static function checkSheetCodeName($pValue) + { + $CharCount = Shared\StringHelper::countCharacters($pValue); + if ($CharCount == 0) { + throw new Exception('Sheet code name cannot be empty.'); + } + // Some of the printable ASCII characters are invalid: * : / \ ? [ ] and first and last characters cannot be a "'" + if ((str_replace(self::$invalidCharacters, '', $pValue) !== $pValue) || + (Shared\StringHelper::substring($pValue, -1, 1) == '\'') || + (Shared\StringHelper::substring($pValue, 0, 1) == '\'')) { + throw new Exception('Invalid character found in sheet code name'); + } + + // Enforce maximum characters allowed for sheet title + if ($CharCount > self::SHEET_TITLE_MAXIMUM_LENGTH) { + throw new Exception('Maximum ' . self::SHEET_TITLE_MAXIMUM_LENGTH . ' characters allowed in sheet code name.'); + } + + return $pValue; + } + + /** + * Check sheet title for valid Excel syntax. + * + * @param string $pValue The string to check + * + * @throws Exception + * + * @return string The valid string + */ + private static function checkSheetTitle($pValue) + { + // Some of the printable ASCII characters are invalid: * : / \ ? [ ] + if (str_replace(self::$invalidCharacters, '', $pValue) !== $pValue) { + throw new Exception('Invalid character found in sheet title'); + } + + // Enforce maximum characters allowed for sheet title + if (Shared\StringHelper::countCharacters($pValue) > self::SHEET_TITLE_MAXIMUM_LENGTH) { + throw new Exception('Maximum ' . self::SHEET_TITLE_MAXIMUM_LENGTH . ' characters allowed in sheet title.'); + } + + return $pValue; + } + + /** + * Get a sorted list of all cell coordinates currently held in the collection by row and column. + * + * @param bool $sorted Also sort the cell collection? + * + * @return string[] + */ + public function getCoordinates($sorted = true) + { + if ($this->cellCollection == null) { + return []; + } + + if ($sorted) { + return $this->cellCollection->getSortedCoordinates(); + } + + return $this->cellCollection->getCoordinates(); + } + + /** + * Get collection of row dimensions. + * + * @return RowDimension[] + */ + public function getRowDimensions() + { + return $this->rowDimensions; + } + + /** + * Get default row dimension. + * + * @return RowDimension + */ + public function getDefaultRowDimension() + { + return $this->defaultRowDimension; + } + + /** + * Get collection of column dimensions. + * + * @return ColumnDimension[] + */ + public function getColumnDimensions() + { + return $this->columnDimensions; + } + + /** + * Get default column dimension. + * + * @return ColumnDimension + */ + public function getDefaultColumnDimension() + { + return $this->defaultColumnDimension; + } + + /** + * Get collection of drawings. + * + * @return BaseDrawing[] + */ + public function getDrawingCollection() + { + return $this->drawingCollection; + } + + /** + * Get collection of charts. + * + * @return Chart[] + */ + public function getChartCollection() + { + return $this->chartCollection; + } + + /** + * Add chart. + * + * @param Chart $pChart + * @param null|int $iChartIndex Index where chart should go (0,1,..., or null for last) + * + * @return Chart + */ + public function addChart(Chart $pChart, $iChartIndex = null) + { + $pChart->setWorksheet($this); + if ($iChartIndex === null) { + $this->chartCollection[] = $pChart; + } else { + // Insert the chart at the requested index + array_splice($this->chartCollection, $iChartIndex, 0, [$pChart]); + } + + return $pChart; + } + + /** + * Return the count of charts on this worksheet. + * + * @return int The number of charts + */ + public function getChartCount() + { + return count($this->chartCollection); + } + + /** + * Get a chart by its index position. + * + * @param string $index Chart index position + * + * @return Chart|false + */ + public function getChartByIndex($index) + { + $chartCount = count($this->chartCollection); + if ($chartCount == 0) { + return false; + } + if ($index === null) { + $index = --$chartCount; + } + if (!isset($this->chartCollection[$index])) { + return false; + } + + return $this->chartCollection[$index]; + } + + /** + * Return an array of the names of charts on this worksheet. + * + * @return string[] The names of charts + */ + public function getChartNames() + { + $chartNames = []; + foreach ($this->chartCollection as $chart) { + $chartNames[] = $chart->getName(); + } + + return $chartNames; + } + + /** + * Get a chart by name. + * + * @param string $chartName Chart name + * + * @return Chart|false + */ + public function getChartByName($chartName) + { + $chartCount = count($this->chartCollection); + if ($chartCount == 0) { + return false; + } + foreach ($this->chartCollection as $index => $chart) { + if ($chart->getName() == $chartName) { + return $this->chartCollection[$index]; + } + } + + return false; + } + + /** + * Refresh column dimensions. + * + * @return $this + */ + public function refreshColumnDimensions() + { + $currentColumnDimensions = $this->getColumnDimensions(); + $newColumnDimensions = []; + + foreach ($currentColumnDimensions as $objColumnDimension) { + $newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension; + } + + $this->columnDimensions = $newColumnDimensions; + + return $this; + } + + /** + * Refresh row dimensions. + * + * @return $this + */ + public function refreshRowDimensions() + { + $currentRowDimensions = $this->getRowDimensions(); + $newRowDimensions = []; + + foreach ($currentRowDimensions as $objRowDimension) { + $newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension; + } + + $this->rowDimensions = $newRowDimensions; + + return $this; + } + + /** + * Calculate worksheet dimension. + * + * @return string String containing the dimension of this worksheet + */ + public function calculateWorksheetDimension() + { + // Return + return 'A1:' . $this->getHighestColumn() . $this->getHighestRow(); + } + + /** + * Calculate worksheet data dimension. + * + * @return string String containing the dimension of this worksheet that actually contain data + */ + public function calculateWorksheetDataDimension() + { + // Return + return 'A1:' . $this->getHighestDataColumn() . $this->getHighestDataRow(); + } + + /** + * Calculate widths for auto-size columns. + * + * @return $this + */ + public function calculateColumnWidths() + { + // initialize $autoSizes array + $autoSizes = []; + foreach ($this->getColumnDimensions() as $colDimension) { + if ($colDimension->getAutoSize()) { + $autoSizes[$colDimension->getColumnIndex()] = -1; + } + } + + // There is only something to do if there are some auto-size columns + if (!empty($autoSizes)) { + // build list of cells references that participate in a merge + $isMergeCell = []; + foreach ($this->getMergeCells() as $cells) { + foreach (Coordinate::extractAllCellReferencesInRange($cells) as $cellReference) { + $isMergeCell[$cellReference] = true; + } + } + + // loop through all cells in the worksheet + foreach ($this->getCoordinates(false) as $coordinate) { + $cell = $this->getCell($coordinate, false); + if ($cell !== null && isset($autoSizes[$this->cellCollection->getCurrentColumn()])) { + //Determine if cell is in merge range + $isMerged = isset($isMergeCell[$this->cellCollection->getCurrentCoordinate()]); + + //By default merged cells should be ignored + $isMergedButProceed = false; + + //The only exception is if it's a merge range value cell of a 'vertical' randge (1 column wide) + if ($isMerged && $cell->isMergeRangeValueCell()) { + $range = $cell->getMergeRange(); + $rangeBoundaries = Coordinate::rangeDimension($range); + if ($rangeBoundaries[0] == 1) { + $isMergedButProceed = true; + } + } + + // Determine width if cell does not participate in a merge or does and is a value cell of 1-column wide range + if (!$isMerged || $isMergedButProceed) { + // Calculated value + // To formatted string + $cellValue = NumberFormat::toFormattedString( + $cell->getCalculatedValue(), + $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode() + ); + + $autoSizes[$this->cellCollection->getCurrentColumn()] = max( + (float) $autoSizes[$this->cellCollection->getCurrentColumn()], + (float) Shared\Font::calculateColumnWidth( + $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(), + $cellValue, + $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(), + $this->getParent()->getDefaultStyle()->getFont() + ) + ); + } + } + } + + // adjust column widths + foreach ($autoSizes as $columnIndex => $width) { + if ($width == -1) { + $width = $this->getDefaultColumnDimension()->getWidth(); + } + $this->getColumnDimension($columnIndex)->setWidth($width); + } + } + + return $this; + } + + /** + * Get parent. + * + * @return Spreadsheet + */ + public function getParent() + { + return $this->parent; + } + + /** + * Re-bind parent. + * + * @param Spreadsheet $parent + * + * @return $this + */ + public function rebindParent(Spreadsheet $parent) + { + if ($this->parent !== null) { + $namedRanges = $this->parent->getNamedRanges(); + foreach ($namedRanges as $namedRange) { + $parent->addNamedRange($namedRange); + } + + $this->parent->removeSheetByIndex( + $this->parent->getIndex($this) + ); + } + $this->parent = $parent; + + return $this; + } + + /** + * Get title. + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set title. + * + * @param string $pValue String containing the dimension of this worksheet + * @param bool $updateFormulaCellReferences Flag indicating whether cell references in formulae should + * be updated to reflect the new sheet name. + * This should be left as the default true, unless you are + * certain that no formula cells on any worksheet contain + * references to this worksheet + * @param bool $validate False to skip validation of new title. WARNING: This should only be set + * at parse time (by Readers), where titles can be assumed to be valid. + * + * @return $this + */ + public function setTitle($pValue, $updateFormulaCellReferences = true, $validate = true) + { + // Is this a 'rename' or not? + if ($this->getTitle() == $pValue) { + return $this; + } + + // Old title + $oldTitle = $this->getTitle(); + + if ($validate) { + // Syntax check + self::checkSheetTitle($pValue); + + if ($this->parent) { + // Is there already such sheet name? + if ($this->parent->sheetNameExists($pValue)) { + // Use name, but append with lowest possible integer + + if (Shared\StringHelper::countCharacters($pValue) > 29) { + $pValue = Shared\StringHelper::substring($pValue, 0, 29); + } + $i = 1; + while ($this->parent->sheetNameExists($pValue . ' ' . $i)) { + ++$i; + if ($i == 10) { + if (Shared\StringHelper::countCharacters($pValue) > 28) { + $pValue = Shared\StringHelper::substring($pValue, 0, 28); + } + } elseif ($i == 100) { + if (Shared\StringHelper::countCharacters($pValue) > 27) { + $pValue = Shared\StringHelper::substring($pValue, 0, 27); + } + } + } + + $pValue .= " $i"; + } + } + } + + // Set title + $this->title = $pValue; + $this->dirty = true; + + if ($this->parent && $this->parent->getCalculationEngine()) { + // New title + $newTitle = $this->getTitle(); + $this->parent->getCalculationEngine() + ->renameCalculationCacheForWorksheet($oldTitle, $newTitle); + if ($updateFormulaCellReferences) { + ReferenceHelper::getInstance()->updateNamedFormulas($this->parent, $oldTitle, $newTitle); + } + } + + return $this; + } + + /** + * Get sheet state. + * + * @return string Sheet state (visible, hidden, veryHidden) + */ + public function getSheetState() + { + return $this->sheetState; + } + + /** + * Set sheet state. + * + * @param string $value Sheet state (visible, hidden, veryHidden) + * + * @return $this + */ + public function setSheetState($value) + { + $this->sheetState = $value; + + return $this; + } + + /** + * Get page setup. + * + * @return PageSetup + */ + public function getPageSetup() + { + return $this->pageSetup; + } + + /** + * Set page setup. + * + * @param PageSetup $pValue + * + * @return $this + */ + public function setPageSetup(PageSetup $pValue) + { + $this->pageSetup = $pValue; + + return $this; + } + + /** + * Get page margins. + * + * @return PageMargins + */ + public function getPageMargins() + { + return $this->pageMargins; + } + + /** + * Set page margins. + * + * @param PageMargins $pValue + * + * @return $this + */ + public function setPageMargins(PageMargins $pValue) + { + $this->pageMargins = $pValue; + + return $this; + } + + /** + * Get page header/footer. + * + * @return HeaderFooter + */ + public function getHeaderFooter() + { + return $this->headerFooter; + } + + /** + * Set page header/footer. + * + * @param HeaderFooter $pValue + * + * @return $this + */ + public function setHeaderFooter(HeaderFooter $pValue) + { + $this->headerFooter = $pValue; + + return $this; + } + + /** + * Get sheet view. + * + * @return SheetView + */ + public function getSheetView() + { + return $this->sheetView; + } + + /** + * Set sheet view. + * + * @param SheetView $pValue + * + * @return $this + */ + public function setSheetView(SheetView $pValue) + { + $this->sheetView = $pValue; + + return $this; + } + + /** + * Get Protection. + * + * @return Protection + */ + public function getProtection() + { + return $this->protection; + } + + /** + * Set Protection. + * + * @param Protection $pValue + * + * @return $this + */ + public function setProtection(Protection $pValue) + { + $this->protection = $pValue; + $this->dirty = true; + + return $this; + } + + /** + * Get highest worksheet column. + * + * @param string $row Return the data highest column for the specified row, + * or the highest column of any row if no row number is passed + * + * @return string Highest column name + */ + public function getHighestColumn($row = null) + { + if ($row == null) { + return $this->cachedHighestColumn; + } + + return $this->getHighestDataColumn($row); + } + + /** + * Get highest worksheet column that contains data. + * + * @param string $row Return the highest data column for the specified row, + * or the highest data column of any row if no row number is passed + * + * @return string Highest column name that contains data + */ + public function getHighestDataColumn($row = null) + { + return $this->cellCollection->getHighestColumn($row); + } + + /** + * Get highest worksheet row. + * + * @param string $column Return the highest data row for the specified column, + * or the highest row of any column if no column letter is passed + * + * @return int Highest row number + */ + public function getHighestRow($column = null) + { + if ($column == null) { + return $this->cachedHighestRow; + } + + return $this->getHighestDataRow($column); + } + + /** + * Get highest worksheet row that contains data. + * + * @param string $column Return the highest data row for the specified column, + * or the highest data row of any column if no column letter is passed + * + * @return int Highest row number that contains data + */ + public function getHighestDataRow($column = null) + { + return $this->cellCollection->getHighestRow($column); + } + + /** + * Get highest worksheet column and highest row that have cell records. + * + * @return array Highest column name and highest row number + */ + public function getHighestRowAndColumn() + { + return $this->cellCollection->getHighestRowAndColumn(); + } + + /** + * Set a cell value. + * + * @param string $pCoordinate Coordinate of the cell, eg: 'A1' + * @param mixed $pValue Value of the cell + * + * @return $this + */ + public function setCellValue($pCoordinate, $pValue) + { + $this->getCell($pCoordinate)->setValue($pValue); + + return $this; + } + + /** + * Set a cell value by using numeric cell coordinates. + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * @param mixed $value Value of the cell + * + * @return $this + */ + public function setCellValueByColumnAndRow($columnIndex, $row, $value) + { + $this->getCellByColumnAndRow($columnIndex, $row)->setValue($value); + + return $this; + } + + /** + * Set a cell value. + * + * @param string $pCoordinate Coordinate of the cell, eg: 'A1' + * @param mixed $pValue Value of the cell + * @param string $pDataType Explicit data type, see DataType::TYPE_* + * + * @return $this + */ + public function setCellValueExplicit($pCoordinate, $pValue, $pDataType) + { + // Set value + $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType); + + return $this; + } + + /** + * Set a cell value by using numeric cell coordinates. + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * @param mixed $value Value of the cell + * @param string $dataType Explicit data type, see DataType::TYPE_* + * + * @return $this + */ + public function setCellValueExplicitByColumnAndRow($columnIndex, $row, $value, $dataType) + { + $this->getCellByColumnAndRow($columnIndex, $row)->setValueExplicit($value, $dataType); + + return $this; + } + + /** + * Get cell at a specific coordinate. + * + * @param string $pCoordinate Coordinate of the cell, eg: 'A1' + * @param bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't + * already exist, or a null should be returned instead + * + * @throws Exception + * + * @return null|Cell Cell that was found/created or null + */ + public function getCell($pCoordinate, $createIfNotExists = true) + { + // Uppercase coordinate + $pCoordinateUpper = strtoupper($pCoordinate); + + // Check cell collection + if ($this->cellCollection->has($pCoordinateUpper)) { + return $this->cellCollection->get($pCoordinateUpper); + } + + // Worksheet reference? + if (strpos($pCoordinate, '!') !== false) { + $worksheetReference = self::extractSheetTitle($pCoordinate, true); + + return $this->parent->getSheetByName($worksheetReference[0])->getCell(strtoupper($worksheetReference[1]), $createIfNotExists); + } + + // Named range? + if ((!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $pCoordinate, $matches)) && + (preg_match('/^' . Calculation::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $pCoordinate, $matches))) { + $namedRange = NamedRange::resolveRange($pCoordinate, $this); + if ($namedRange !== null) { + $pCoordinate = $namedRange->getRange(); + + return $namedRange->getWorksheet()->getCell($pCoordinate, $createIfNotExists); + } + } + + if (Coordinate::coordinateIsRange($pCoordinate)) { + throw new Exception('Cell coordinate can not be a range of cells.'); + } elseif (strpos($pCoordinate, '$') !== false) { + throw new Exception('Cell coordinate must not be absolute.'); + } + + // Create new cell object, if required + return $createIfNotExists ? $this->createNewCell($pCoordinateUpper) : null; + } + + /** + * Get cell at a specific coordinate by using numeric cell coordinates. + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * @param bool $createIfNotExists Flag indicating whether a new cell should be created if it doesn't + * already exist, or a null should be returned instead + * + * @return null|Cell Cell that was found/created or null + */ + public function getCellByColumnAndRow($columnIndex, $row, $createIfNotExists = true) + { + $columnLetter = Coordinate::stringFromColumnIndex($columnIndex); + $coordinate = $columnLetter . $row; + + if ($this->cellCollection->has($coordinate)) { + return $this->cellCollection->get($coordinate); + } + + // Create new cell object, if required + return $createIfNotExists ? $this->createNewCell($coordinate) : null; + } + + /** + * Create a new cell at the specified coordinate. + * + * @param string $pCoordinate Coordinate of the cell + * + * @return Cell Cell that was created + */ + private function createNewCell($pCoordinate) + { + $cell = new Cell(null, DataType::TYPE_NULL, $this); + $this->cellCollection->add($pCoordinate, $cell); + $this->cellCollectionIsSorted = false; + + // Coordinates + $aCoordinates = Coordinate::coordinateFromString($pCoordinate); + if (Coordinate::columnIndexFromString($this->cachedHighestColumn) < Coordinate::columnIndexFromString($aCoordinates[0])) { + $this->cachedHighestColumn = $aCoordinates[0]; + } + if ($aCoordinates[1] > $this->cachedHighestRow) { + $this->cachedHighestRow = $aCoordinates[1]; + } + + // Cell needs appropriate xfIndex from dimensions records + // but don't create dimension records if they don't already exist + $rowDimension = $this->getRowDimension($aCoordinates[1], false); + $columnDimension = $this->getColumnDimension($aCoordinates[0], false); + + if ($rowDimension !== null && $rowDimension->getXfIndex() > 0) { + // then there is a row dimension with explicit style, assign it to the cell + $cell->setXfIndex($rowDimension->getXfIndex()); + } elseif ($columnDimension !== null && $columnDimension->getXfIndex() > 0) { + // then there is a column dimension, assign it to the cell + $cell->setXfIndex($columnDimension->getXfIndex()); + } + + return $cell; + } + + /** + * Does the cell at a specific coordinate exist? + * + * @param string $pCoordinate Coordinate of the cell eg: 'A1' + * + * @throws Exception + * + * @return bool + */ + public function cellExists($pCoordinate) + { + // Worksheet reference? + if (strpos($pCoordinate, '!') !== false) { + $worksheetReference = self::extractSheetTitle($pCoordinate, true); + + return $this->parent->getSheetByName($worksheetReference[0])->cellExists(strtoupper($worksheetReference[1])); + } + + // Named range? + if ((!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $pCoordinate, $matches)) && + (preg_match('/^' . Calculation::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $pCoordinate, $matches))) { + $namedRange = NamedRange::resolveRange($pCoordinate, $this); + if ($namedRange !== null) { + $pCoordinate = $namedRange->getRange(); + if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) { + if (!$namedRange->getLocalOnly()) { + return $namedRange->getWorksheet()->cellExists($pCoordinate); + } + + throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle()); + } + } else { + return false; + } + } + + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + if (Coordinate::coordinateIsRange($pCoordinate)) { + throw new Exception('Cell coordinate can not be a range of cells.'); + } elseif (strpos($pCoordinate, '$') !== false) { + throw new Exception('Cell coordinate must not be absolute.'); + } + + // Cell exists? + return $this->cellCollection->has($pCoordinate); + } + + /** + * Cell at a specific coordinate by using numeric cell coordinates exists? + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * + * @return bool + */ + public function cellExistsByColumnAndRow($columnIndex, $row) + { + return $this->cellExists(Coordinate::stringFromColumnIndex($columnIndex) . $row); + } + + /** + * Get row dimension at a specific row. + * + * @param int $pRow Numeric index of the row + * @param bool $create + * + * @return RowDimension + */ + public function getRowDimension($pRow, $create = true) + { + // Found + $found = null; + + // Get row dimension + if (!isset($this->rowDimensions[$pRow])) { + if (!$create) { + return null; + } + $this->rowDimensions[$pRow] = new RowDimension($pRow); + + $this->cachedHighestRow = max($this->cachedHighestRow, $pRow); + } + + return $this->rowDimensions[$pRow]; + } + + /** + * Get column dimension at a specific column. + * + * @param string $pColumn String index of the column eg: 'A' + * @param bool $create + * + * @return ColumnDimension + */ + public function getColumnDimension($pColumn, $create = true) + { + // Uppercase coordinate + $pColumn = strtoupper($pColumn); + + // Fetch dimensions + if (!isset($this->columnDimensions[$pColumn])) { + if (!$create) { + return null; + } + $this->columnDimensions[$pColumn] = new ColumnDimension($pColumn); + + if (Coordinate::columnIndexFromString($this->cachedHighestColumn) < Coordinate::columnIndexFromString($pColumn)) { + $this->cachedHighestColumn = $pColumn; + } + } + + return $this->columnDimensions[$pColumn]; + } + + /** + * Get column dimension at a specific column by using numeric cell coordinates. + * + * @param int $columnIndex Numeric column coordinate of the cell + * + * @return ColumnDimension + */ + public function getColumnDimensionByColumn($columnIndex) + { + return $this->getColumnDimension(Coordinate::stringFromColumnIndex($columnIndex)); + } + + /** + * Get styles. + * + * @return Style[] + */ + public function getStyles() + { + return $this->styles; + } + + /** + * Get style for cell. + * + * @param string $pCellCoordinate Cell coordinate (or range) to get style for, eg: 'A1' + * + * @throws Exception + * + * @return Style + */ + public function getStyle($pCellCoordinate) + { + // set this sheet as active + $this->parent->setActiveSheetIndex($this->parent->getIndex($this)); + + // set cell coordinate as active + $this->setSelectedCells($pCellCoordinate); + + return $this->parent->getCellXfSupervisor(); + } + + /** + * Get conditional styles for a cell. + * + * @param string $pCoordinate eg: 'A1' + * + * @return Conditional[] + */ + public function getConditionalStyles($pCoordinate) + { + $pCoordinate = strtoupper($pCoordinate); + if (!isset($this->conditionalStylesCollection[$pCoordinate])) { + $this->conditionalStylesCollection[$pCoordinate] = []; + } + + return $this->conditionalStylesCollection[$pCoordinate]; + } + + /** + * Do conditional styles exist for this cell? + * + * @param string $pCoordinate eg: 'A1' + * + * @return bool + */ + public function conditionalStylesExists($pCoordinate) + { + return isset($this->conditionalStylesCollection[strtoupper($pCoordinate)]); + } + + /** + * Removes conditional styles for a cell. + * + * @param string $pCoordinate eg: 'A1' + * + * @return $this + */ + public function removeConditionalStyles($pCoordinate) + { + unset($this->conditionalStylesCollection[strtoupper($pCoordinate)]); + + return $this; + } + + /** + * Get collection of conditional styles. + * + * @return array + */ + public function getConditionalStylesCollection() + { + return $this->conditionalStylesCollection; + } + + /** + * Set conditional styles. + * + * @param string $pCoordinate eg: 'A1' + * @param $pValue Conditional[] + * + * @return $this + */ + public function setConditionalStyles($pCoordinate, $pValue) + { + $this->conditionalStylesCollection[strtoupper($pCoordinate)] = $pValue; + + return $this; + } + + /** + * Get style for cell by using numeric cell coordinates. + * + * @param int $columnIndex1 Numeric column coordinate of the cell + * @param int $row1 Numeric row coordinate of the cell + * @param null|int $columnIndex2 Numeric column coordinate of the range cell + * @param null|int $row2 Numeric row coordinate of the range cell + * + * @return Style + */ + public function getStyleByColumnAndRow($columnIndex1, $row1, $columnIndex2 = null, $row2 = null) + { + if ($columnIndex2 !== null && $row2 !== null) { + $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + + return $this->getStyle($cellRange); + } + + return $this->getStyle(Coordinate::stringFromColumnIndex($columnIndex1) . $row1); + } + + /** + * Duplicate cell style to a range of cells. + * + * Please note that this will overwrite existing cell styles for cells in range! + * + * @param Style $pCellStyle Cell style to duplicate + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * + * @throws Exception + * + * @return $this + */ + public function duplicateStyle(Style $pCellStyle, $pRange) + { + // Add the style to the workbook if necessary + $workbook = $this->parent; + if ($existingStyle = $this->parent->getCellXfByHashCode($pCellStyle->getHashCode())) { + // there is already such cell Xf in our collection + $xfIndex = $existingStyle->getIndex(); + } else { + // we don't have such a cell Xf, need to add + $workbook->addCellXf($pCellStyle); + $xfIndex = $pCellStyle->getIndex(); + } + + // Calculate range outer borders + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($pRange . ':' . $pRange); + + // Make sure we can loop upwards on rows and columns + if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { + $tmp = $rangeStart; + $rangeStart = $rangeEnd; + $rangeEnd = $tmp; + } + + // Loop through cells and apply styles + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $this->getCell(Coordinate::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex); + } + } + + return $this; + } + + /** + * Duplicate conditional style to a range of cells. + * + * Please note that this will overwrite existing cell styles for cells in range! + * + * @param Conditional[] $pCellStyle Cell style to duplicate + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * + * @throws Exception + * + * @return $this + */ + public function duplicateConditionalStyle(array $pCellStyle, $pRange = '') + { + foreach ($pCellStyle as $cellStyle) { + if (!($cellStyle instanceof Conditional)) { + throw new Exception('Style is not a conditional style'); + } + } + + // Calculate range outer borders + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($pRange . ':' . $pRange); + + // Make sure we can loop upwards on rows and columns + if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) { + $tmp = $rangeStart; + $rangeStart = $rangeEnd; + $rangeEnd = $tmp; + } + + // Loop through cells and apply styles + for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) { + for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) { + $this->setConditionalStyles(Coordinate::stringFromColumnIndex($col) . $row, $pCellStyle); + } + } + + return $this; + } + + /** + * Set break on a cell. + * + * @param string $pCoordinate Cell coordinate (e.g. A1) + * @param int $pBreak Break type (type of Worksheet::BREAK_*) + * + * @throws Exception + * + * @return $this + */ + public function setBreak($pCoordinate, $pBreak) + { + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + if ($pCoordinate != '') { + if ($pBreak == self::BREAK_NONE) { + if (isset($this->breaks[$pCoordinate])) { + unset($this->breaks[$pCoordinate]); + } + } else { + $this->breaks[$pCoordinate] = $pBreak; + } + } else { + throw new Exception('No cell coordinate specified.'); + } + + return $this; + } + + /** + * Set break on a cell by using numeric cell coordinates. + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * @param int $break Break type (type of Worksheet::BREAK_*) + * + * @return $this + */ + public function setBreakByColumnAndRow($columnIndex, $row, $break) + { + return $this->setBreak(Coordinate::stringFromColumnIndex($columnIndex) . $row, $break); + } + + /** + * Get breaks. + * + * @return array[] + */ + public function getBreaks() + { + return $this->breaks; + } + + /** + * Set merge on a cell range. + * + * @param string $pRange Cell range (e.g. A1:E1) + * + * @throws Exception + * + * @return $this + */ + public function mergeCells($pRange) + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (strpos($pRange, ':') !== false) { + $this->mergeCells[$pRange] = $pRange; + + // make sure cells are created + + // get the cells in the range + $aReferences = Coordinate::extractAllCellReferencesInRange($pRange); + + // create upper left cell if it does not already exist + $upperLeft = $aReferences[0]; + if (!$this->cellExists($upperLeft)) { + $this->getCell($upperLeft)->setValueExplicit(null, DataType::TYPE_NULL); + } + + // Blank out the rest of the cells in the range (if they exist) + $count = count($aReferences); + for ($i = 1; $i < $count; ++$i) { + if ($this->cellExists($aReferences[$i])) { + $this->getCell($aReferences[$i])->setValueExplicit(null, DataType::TYPE_NULL); + } + } + } else { + throw new Exception('Merge must be set on a range of cells.'); + } + + return $this; + } + + /** + * Set merge on a cell range by using numeric cell coordinates. + * + * @param int $columnIndex1 Numeric column coordinate of the first cell + * @param int $row1 Numeric row coordinate of the first cell + * @param int $columnIndex2 Numeric column coordinate of the last cell + * @param int $row2 Numeric row coordinate of the last cell + * + * @throws Exception + * + * @return $this + */ + public function mergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2) + { + $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + + return $this->mergeCells($cellRange); + } + + /** + * Remove merge on a cell range. + * + * @param string $pRange Cell range (e.g. A1:E1) + * + * @throws Exception + * + * @return $this + */ + public function unmergeCells($pRange) + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (strpos($pRange, ':') !== false) { + if (isset($this->mergeCells[$pRange])) { + unset($this->mergeCells[$pRange]); + } else { + throw new Exception('Cell range ' . $pRange . ' not known as merged.'); + } + } else { + throw new Exception('Merge can only be removed from a range of cells.'); + } + + return $this; + } + + /** + * Remove merge on a cell range by using numeric cell coordinates. + * + * @param int $columnIndex1 Numeric column coordinate of the first cell + * @param int $row1 Numeric row coordinate of the first cell + * @param int $columnIndex2 Numeric column coordinate of the last cell + * @param int $row2 Numeric row coordinate of the last cell + * + * @throws Exception + * + * @return $this + */ + public function unmergeCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2) + { + $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + + return $this->unmergeCells($cellRange); + } + + /** + * Get merge cells array. + * + * @return array[] + */ + public function getMergeCells() + { + return $this->mergeCells; + } + + /** + * Set merge cells array for the entire sheet. Use instead mergeCells() to merge + * a single cell range. + * + * @param array $pValue + * + * @return $this + */ + public function setMergeCells(array $pValue) + { + $this->mergeCells = $pValue; + + return $this; + } + + /** + * Set protection on a cell range. + * + * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) + * @param string $pPassword Password to unlock the protection + * @param bool $pAlreadyHashed If the password has already been hashed, set this to true + * + * @return $this + */ + public function protectCells($pRange, $pPassword, $pAlreadyHashed = false) + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (!$pAlreadyHashed) { + $pPassword = Shared\PasswordHasher::hashPassword($pPassword); + } + $this->protectedCells[$pRange] = $pPassword; + + return $this; + } + + /** + * Set protection on a cell range by using numeric cell coordinates. + * + * @param int $columnIndex1 Numeric column coordinate of the first cell + * @param int $row1 Numeric row coordinate of the first cell + * @param int $columnIndex2 Numeric column coordinate of the last cell + * @param int $row2 Numeric row coordinate of the last cell + * @param string $password Password to unlock the protection + * @param bool $alreadyHashed If the password has already been hashed, set this to true + * + * @return $this + */ + public function protectCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2, $password, $alreadyHashed = false) + { + $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + + return $this->protectCells($cellRange, $password, $alreadyHashed); + } + + /** + * Remove protection on a cell range. + * + * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1) + * + * @throws Exception + * + * @return $this + */ + public function unprotectCells($pRange) + { + // Uppercase coordinate + $pRange = strtoupper($pRange); + + if (isset($this->protectedCells[$pRange])) { + unset($this->protectedCells[$pRange]); + } else { + throw new Exception('Cell range ' . $pRange . ' not known as protected.'); + } + + return $this; + } + + /** + * Remove protection on a cell range by using numeric cell coordinates. + * + * @param int $columnIndex1 Numeric column coordinate of the first cell + * @param int $row1 Numeric row coordinate of the first cell + * @param int $columnIndex2 Numeric column coordinate of the last cell + * @param int $row2 Numeric row coordinate of the last cell + * + * @throws Exception + * + * @return $this + */ + public function unprotectCellsByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2) + { + $cellRange = Coordinate::stringFromColumnIndex($columnIndex1) . $row1 . ':' . Coordinate::stringFromColumnIndex($columnIndex2) . $row2; + + return $this->unprotectCells($cellRange); + } + + /** + * Get protected cells. + * + * @return array[] + */ + public function getProtectedCells() + { + return $this->protectedCells; + } + + /** + * Get Autofilter. + * + * @return AutoFilter + */ + public function getAutoFilter() + { + return $this->autoFilter; + } + + /** + * Set AutoFilter. + * + * @param AutoFilter|string $pValue + * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility + * + * @throws Exception + * + * @return $this + */ + public function setAutoFilter($pValue) + { + if (is_string($pValue)) { + $this->autoFilter->setRange($pValue); + } elseif (is_object($pValue) && ($pValue instanceof AutoFilter)) { + $this->autoFilter = $pValue; + } + + return $this; + } + + /** + * Set Autofilter Range by using numeric cell coordinates. + * + * @param int $columnIndex1 Numeric column coordinate of the first cell + * @param int $row1 Numeric row coordinate of the first cell + * @param int $columnIndex2 Numeric column coordinate of the second cell + * @param int $row2 Numeric row coordinate of the second cell + * + * @throws Exception + * + * @return $this + */ + public function setAutoFilterByColumnAndRow($columnIndex1, $row1, $columnIndex2, $row2) + { + return $this->setAutoFilter( + Coordinate::stringFromColumnIndex($columnIndex1) . $row1 + . ':' . + Coordinate::stringFromColumnIndex($columnIndex2) . $row2 + ); + } + + /** + * Remove autofilter. + * + * @return $this + */ + public function removeAutoFilter() + { + $this->autoFilter->setRange(null); + + return $this; + } + + /** + * Get Freeze Pane. + * + * @return string + */ + public function getFreezePane() + { + return $this->freezePane; + } + + /** + * Freeze Pane. + * + * Examples: + * + * - A2 will freeze the rows above cell A2 (i.e row 1) + * - B1 will freeze the columns to the left of cell B1 (i.e column A) + * - B2 will freeze the rows above and to the left of cell B2 (i.e row 1 and column A) + * + * @param null|string $cell Position of the split + * @param null|string $topLeftCell default position of the right bottom pane + * + * @throws Exception + * + * @return $this + */ + public function freezePane($cell, $topLeftCell = null) + { + if (is_string($cell) && Coordinate::coordinateIsRange($cell)) { + throw new Exception('Freeze pane can not be set on a range of cells.'); + } + + if ($cell !== null && $topLeftCell === null) { + $coordinate = Coordinate::coordinateFromString($cell); + $topLeftCell = $coordinate[0] . $coordinate[1]; + } + + $this->freezePane = $cell; + $this->topLeftCell = $topLeftCell; + + return $this; + } + + /** + * Freeze Pane by using numeric cell coordinates. + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * + * @return $this + */ + public function freezePaneByColumnAndRow($columnIndex, $row) + { + return $this->freezePane(Coordinate::stringFromColumnIndex($columnIndex) . $row); + } + + /** + * Unfreeze Pane. + * + * @return $this + */ + public function unfreezePane() + { + return $this->freezePane(null); + } + + /** + * Get the default position of the right bottom pane. + * + * @return int + */ + public function getTopLeftCell() + { + return $this->topLeftCell; + } + + /** + * Insert a new row, updating all possible related data. + * + * @param int $pBefore Insert before this one + * @param int $pNumRows Number of rows to insert + * + * @throws Exception + * + * @return $this + */ + public function insertNewRowBefore($pBefore, $pNumRows = 1) + { + if ($pBefore >= 1) { + $objReferenceHelper = ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this); + } else { + throw new Exception('Rows can only be inserted before at least row 1.'); + } + + return $this; + } + + /** + * Insert a new column, updating all possible related data. + * + * @param string $pBefore Insert before this one, eg: 'A' + * @param int $pNumCols Number of columns to insert + * + * @throws Exception + * + * @return $this + */ + public function insertNewColumnBefore($pBefore, $pNumCols = 1) + { + if (!is_numeric($pBefore)) { + $objReferenceHelper = ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this); + } else { + throw new Exception('Column references should not be numeric.'); + } + + return $this; + } + + /** + * Insert a new column, updating all possible related data. + * + * @param int $beforeColumnIndex Insert before this one (numeric column coordinate of the cell) + * @param int $pNumCols Number of columns to insert + * + * @throws Exception + * + * @return $this + */ + public function insertNewColumnBeforeByIndex($beforeColumnIndex, $pNumCols = 1) + { + if ($beforeColumnIndex >= 1) { + return $this->insertNewColumnBefore(Coordinate::stringFromColumnIndex($beforeColumnIndex), $pNumCols); + } + + throw new Exception('Columns can only be inserted before at least column A (1).'); + } + + /** + * Delete a row, updating all possible related data. + * + * @param int $pRow Remove starting with this one + * @param int $pNumRows Number of rows to remove + * + * @throws Exception + * + * @return $this + */ + public function removeRow($pRow, $pNumRows = 1) + { + if ($pRow >= 1) { + for ($r = 0; $r < $pNumRows; ++$r) { + $this->getCellCollection()->removeRow($pRow + $r); + } + + $highestRow = $this->getHighestDataRow(); + $objReferenceHelper = ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this); + for ($r = 0; $r < $pNumRows; ++$r) { + $this->getCellCollection()->removeRow($highestRow); + --$highestRow; + } + } else { + throw new Exception('Rows to be deleted should at least start from row 1.'); + } + + return $this; + } + + /** + * Remove a column, updating all possible related data. + * + * @param string $pColumn Remove starting with this one, eg: 'A' + * @param int $pNumCols Number of columns to remove + * + * @throws Exception + * + * @return $this + */ + public function removeColumn($pColumn, $pNumCols = 1) + { + if (is_numeric($pColumn)) { + throw new Exception('Column references should not be numeric.'); + } + + $highestColumn = $this->getHighestDataColumn(); + $highestColumnIndex = Coordinate::columnIndexFromString($highestColumn); + $pColumnIndex = Coordinate::columnIndexFromString($pColumn); + + if ($pColumnIndex > $highestColumnIndex) { + return $this; + } + + $pColumn = Coordinate::stringFromColumnIndex($pColumnIndex + $pNumCols); + $objReferenceHelper = ReferenceHelper::getInstance(); + $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this); + + $maxPossibleColumnsToBeRemoved = $highestColumnIndex - $pColumnIndex + 1; + + for ($c = 0, $n = min($maxPossibleColumnsToBeRemoved, $pNumCols); $c < $n; ++$c) { + $this->getCellCollection()->removeColumn($highestColumn); + $highestColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($highestColumn) - 1); + } + + $this->garbageCollect(); + + return $this; + } + + /** + * Remove a column, updating all possible related data. + * + * @param int $columnIndex Remove starting with this one (numeric column coordinate of the cell) + * @param int $numColumns Number of columns to remove + * + * @throws Exception + * + * @return $this + */ + public function removeColumnByIndex($columnIndex, $numColumns = 1) + { + if ($columnIndex >= 1) { + return $this->removeColumn(Coordinate::stringFromColumnIndex($columnIndex), $numColumns); + } + + throw new Exception('Columns to be deleted should at least start from column A (1)'); + } + + /** + * Show gridlines? + * + * @return bool + */ + public function getShowGridlines() + { + return $this->showGridlines; + } + + /** + * Set show gridlines. + * + * @param bool $pValue Show gridlines (true/false) + * + * @return $this + */ + public function setShowGridlines($pValue) + { + $this->showGridlines = $pValue; + + return $this; + } + + /** + * Print gridlines? + * + * @return bool + */ + public function getPrintGridlines() + { + return $this->printGridlines; + } + + /** + * Set print gridlines. + * + * @param bool $pValue Print gridlines (true/false) + * + * @return $this + */ + public function setPrintGridlines($pValue) + { + $this->printGridlines = $pValue; + + return $this; + } + + /** + * Show row and column headers? + * + * @return bool + */ + public function getShowRowColHeaders() + { + return $this->showRowColHeaders; + } + + /** + * Set show row and column headers. + * + * @param bool $pValue Show row and column headers (true/false) + * + * @return $this + */ + public function setShowRowColHeaders($pValue) + { + $this->showRowColHeaders = $pValue; + + return $this; + } + + /** + * Show summary below? (Row/Column outlining). + * + * @return bool + */ + public function getShowSummaryBelow() + { + return $this->showSummaryBelow; + } + + /** + * Set show summary below. + * + * @param bool $pValue Show summary below (true/false) + * + * @return $this + */ + public function setShowSummaryBelow($pValue) + { + $this->showSummaryBelow = $pValue; + + return $this; + } + + /** + * Show summary right? (Row/Column outlining). + * + * @return bool + */ + public function getShowSummaryRight() + { + return $this->showSummaryRight; + } + + /** + * Set show summary right. + * + * @param bool $pValue Show summary right (true/false) + * + * @return $this + */ + public function setShowSummaryRight($pValue) + { + $this->showSummaryRight = $pValue; + + return $this; + } + + /** + * Get comments. + * + * @return Comment[] + */ + public function getComments() + { + return $this->comments; + } + + /** + * Set comments array for the entire sheet. + * + * @param Comment[] $pValue + * + * @return $this + */ + public function setComments(array $pValue) + { + $this->comments = $pValue; + + return $this; + } + + /** + * Get comment for cell. + * + * @param string $pCellCoordinate Cell coordinate to get comment for, eg: 'A1' + * + * @throws Exception + * + * @return Comment + */ + public function getComment($pCellCoordinate) + { + // Uppercase coordinate + $pCellCoordinate = strtoupper($pCellCoordinate); + + if (Coordinate::coordinateIsRange($pCellCoordinate)) { + throw new Exception('Cell coordinate string can not be a range of cells.'); + } elseif (strpos($pCellCoordinate, '$') !== false) { + throw new Exception('Cell coordinate string must not be absolute.'); + } elseif ($pCellCoordinate == '') { + throw new Exception('Cell coordinate can not be zero-length string.'); + } + + // Check if we already have a comment for this cell. + if (isset($this->comments[$pCellCoordinate])) { + return $this->comments[$pCellCoordinate]; + } + + // If not, create a new comment. + $newComment = new Comment(); + $this->comments[$pCellCoordinate] = $newComment; + + return $newComment; + } + + /** + * Get comment for cell by using numeric cell coordinates. + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * + * @return Comment + */ + public function getCommentByColumnAndRow($columnIndex, $row) + { + return $this->getComment(Coordinate::stringFromColumnIndex($columnIndex) . $row); + } + + /** + * Get active cell. + * + * @return string Example: 'A1' + */ + public function getActiveCell() + { + return $this->activeCell; + } + + /** + * Get selected cells. + * + * @return string + */ + public function getSelectedCells() + { + return $this->selectedCells; + } + + /** + * Selected cell. + * + * @param string $pCoordinate Cell (i.e. A1) + * + * @return $this + */ + public function setSelectedCell($pCoordinate) + { + return $this->setSelectedCells($pCoordinate); + } + + /** + * Select a range of cells. + * + * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6' + * + * @return $this + */ + public function setSelectedCells($pCoordinate) + { + // Uppercase coordinate + $pCoordinate = strtoupper($pCoordinate); + + // Convert 'A' to 'A:A' + $pCoordinate = preg_replace('/^([A-Z]+)$/', '${1}:${1}', $pCoordinate); + + // Convert '1' to '1:1' + $pCoordinate = preg_replace('/^(\d+)$/', '${1}:${1}', $pCoordinate); + + // Convert 'A:C' to 'A1:C1048576' + $pCoordinate = preg_replace('/^([A-Z]+):([A-Z]+)$/', '${1}1:${2}1048576', $pCoordinate); + + // Convert '1:3' to 'A1:XFD3' + $pCoordinate = preg_replace('/^(\d+):(\d+)$/', 'A${1}:XFD${2}', $pCoordinate); + + if (Coordinate::coordinateIsRange($pCoordinate)) { + [$first] = Coordinate::splitRange($pCoordinate); + $this->activeCell = $first[0]; + } else { + $this->activeCell = $pCoordinate; + } + $this->selectedCells = $pCoordinate; + + return $this; + } + + /** + * Selected cell by using numeric cell coordinates. + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * + * @throws Exception + * + * @return $this + */ + public function setSelectedCellByColumnAndRow($columnIndex, $row) + { + return $this->setSelectedCells(Coordinate::stringFromColumnIndex($columnIndex) . $row); + } + + /** + * Get right-to-left. + * + * @return bool + */ + public function getRightToLeft() + { + return $this->rightToLeft; + } + + /** + * Set right-to-left. + * + * @param bool $value Right-to-left true/false + * + * @return $this + */ + public function setRightToLeft($value) + { + $this->rightToLeft = $value; + + return $this; + } + + /** + * Fill worksheet from values in array. + * + * @param array $source Source array + * @param mixed $nullValue Value in source array that stands for blank cell + * @param string $startCell Insert array starting from this cell address as the top left coordinate + * @param bool $strictNullComparison Apply strict comparison when testing for null values in the array + * + * @throws Exception + * + * @return $this + */ + public function fromArray(array $source, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) + { + // Convert a 1-D array to 2-D (for ease of looping) + if (!is_array(end($source))) { + $source = [$source]; + } + + // start coordinate + [$startColumn, $startRow] = Coordinate::coordinateFromString($startCell); + + // Loop through $source + foreach ($source as $rowData) { + $currentColumn = $startColumn; + foreach ($rowData as $cellValue) { + if ($strictNullComparison) { + if ($cellValue !== $nullValue) { + // Set cell value + $this->getCell($currentColumn . $startRow)->setValue($cellValue); + } + } else { + if ($cellValue != $nullValue) { + // Set cell value + $this->getCell($currentColumn . $startRow)->setValue($cellValue); + } + } + ++$currentColumn; + } + ++$startRow; + } + + return $this; + } + + /** + * Create array from a range of cells. + * + * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1") + * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist + * @param bool $calculateFormulas Should formulas be calculated? + * @param bool $formatData Should formatting be applied to cell values? + * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero + * True - Return rows and columns indexed by their actual row and column IDs + * + * @return array + */ + public function rangeToArray($pRange, $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) + { + // Returnvalue + $returnValue = []; + // Identify the range that we need to extract from the worksheet + [$rangeStart, $rangeEnd] = Coordinate::rangeBoundaries($pRange); + $minCol = Coordinate::stringFromColumnIndex($rangeStart[0]); + $minRow = $rangeStart[1]; + $maxCol = Coordinate::stringFromColumnIndex($rangeEnd[0]); + $maxRow = $rangeEnd[1]; + + ++$maxCol; + // Loop through rows + $r = -1; + for ($row = $minRow; $row <= $maxRow; ++$row) { + $rRef = $returnCellRef ? $row : ++$r; + $c = -1; + // Loop through columns in the current row + for ($col = $minCol; $col != $maxCol; ++$col) { + $cRef = $returnCellRef ? $col : ++$c; + // Using getCell() will create a new cell if it doesn't already exist. We don't want that to happen + // so we test and retrieve directly against cellCollection + if ($this->cellCollection->has($col . $row)) { + // Cell exists + $cell = $this->cellCollection->get($col . $row); + if ($cell->getValue() !== null) { + if ($cell->getValue() instanceof RichText) { + $returnValue[$rRef][$cRef] = $cell->getValue()->getPlainText(); + } else { + if ($calculateFormulas) { + $returnValue[$rRef][$cRef] = $cell->getCalculatedValue(); + } else { + $returnValue[$rRef][$cRef] = $cell->getValue(); + } + } + + if ($formatData) { + $style = $this->parent->getCellXfByIndex($cell->getXfIndex()); + $returnValue[$rRef][$cRef] = NumberFormat::toFormattedString( + $returnValue[$rRef][$cRef], + ($style && $style->getNumberFormat()) ? $style->getNumberFormat()->getFormatCode() : NumberFormat::FORMAT_GENERAL + ); + } + } else { + // Cell holds a NULL + $returnValue[$rRef][$cRef] = $nullValue; + } + } else { + // Cell doesn't exist + $returnValue[$rRef][$cRef] = $nullValue; + } + } + } + + // Return + return $returnValue; + } + + /** + * Create array from a range of cells. + * + * @param string $pNamedRange Name of the Named Range + * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist + * @param bool $calculateFormulas Should formulas be calculated? + * @param bool $formatData Should formatting be applied to cell values? + * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero + * True - Return rows and columns indexed by their actual row and column IDs + * + * @throws Exception + * + * @return array + */ + public function namedRangeToArray($pNamedRange, $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) + { + $namedRange = NamedRange::resolveRange($pNamedRange, $this); + if ($namedRange !== null) { + $pWorkSheet = $namedRange->getWorksheet(); + $pCellRange = $namedRange->getRange(); + + return $pWorkSheet->rangeToArray($pCellRange, $nullValue, $calculateFormulas, $formatData, $returnCellRef); + } + + throw new Exception('Named Range ' . $pNamedRange . ' does not exist.'); + } + + /** + * Create array from worksheet. + * + * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist + * @param bool $calculateFormulas Should formulas be calculated? + * @param bool $formatData Should formatting be applied to cell values? + * @param bool $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero + * True - Return rows and columns indexed by their actual row and column IDs + * + * @return array + */ + public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) + { + // Garbage collect... + $this->garbageCollect(); + + // Identify the range that we need to extract from the worksheet + $maxCol = $this->getHighestColumn(); + $maxRow = $this->getHighestRow(); + + // Return + return $this->rangeToArray('A1:' . $maxCol . $maxRow, $nullValue, $calculateFormulas, $formatData, $returnCellRef); + } + + /** + * Get row iterator. + * + * @param int $startRow The row number at which to start iterating + * @param int $endRow The row number at which to stop iterating + * + * @return RowIterator + */ + public function getRowIterator($startRow = 1, $endRow = null) + { + return new RowIterator($this, $startRow, $endRow); + } + + /** + * Get column iterator. + * + * @param string $startColumn The column address at which to start iterating + * @param string $endColumn The column address at which to stop iterating + * + * @return ColumnIterator + */ + public function getColumnIterator($startColumn = 'A', $endColumn = null) + { + return new ColumnIterator($this, $startColumn, $endColumn); + } + + /** + * Run PhpSpreadsheet garbage collector. + * + * @return $this + */ + public function garbageCollect() + { + // Flush cache + $this->cellCollection->get('A1'); + + // Lookup highest column and highest row if cells are cleaned + $colRow = $this->cellCollection->getHighestRowAndColumn(); + $highestRow = $colRow['row']; + $highestColumn = Coordinate::columnIndexFromString($colRow['column']); + + // Loop through column dimensions + foreach ($this->columnDimensions as $dimension) { + $highestColumn = max($highestColumn, Coordinate::columnIndexFromString($dimension->getColumnIndex())); + } + + // Loop through row dimensions + foreach ($this->rowDimensions as $dimension) { + $highestRow = max($highestRow, $dimension->getRowIndex()); + } + + // Cache values + if ($highestColumn < 1) { + $this->cachedHighestColumn = 'A'; + } else { + $this->cachedHighestColumn = Coordinate::stringFromColumnIndex($highestColumn); + } + $this->cachedHighestRow = $highestRow; + + // Return + return $this; + } + + /** + * Get hash code. + * + * @return string Hash code + */ + public function getHashCode() + { + if ($this->dirty) { + $this->hash = md5($this->title . $this->autoFilter . ($this->protection->isProtectionEnabled() ? 't' : 'f') . __CLASS__); + $this->dirty = false; + } + + return $this->hash; + } + + /** + * Extract worksheet title from range. + * + * Example: extractSheetTitle("testSheet!A1") ==> 'A1' + * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> ['testSheet 1', 'A1']; + * + * @param string $pRange Range to extract title from + * @param bool $returnRange Return range? (see example) + * + * @return mixed + */ + public static function extractSheetTitle($pRange, $returnRange = false) + { + // Sheet title included? + if (($sep = strrpos($pRange, '!')) === false) { + return $returnRange ? ['', $pRange] : ''; + } + + if ($returnRange) { + return [substr($pRange, 0, $sep), substr($pRange, $sep + 1)]; + } + + return substr($pRange, $sep + 1); + } + + /** + * Get hyperlink. + * + * @param string $pCellCoordinate Cell coordinate to get hyperlink for, eg: 'A1' + * + * @return Hyperlink + */ + public function getHyperlink($pCellCoordinate) + { + // return hyperlink if we already have one + if (isset($this->hyperlinkCollection[$pCellCoordinate])) { + return $this->hyperlinkCollection[$pCellCoordinate]; + } + + // else create hyperlink + $this->hyperlinkCollection[$pCellCoordinate] = new Hyperlink(); + + return $this->hyperlinkCollection[$pCellCoordinate]; + } + + /** + * Set hyperlink. + * + * @param string $pCellCoordinate Cell coordinate to insert hyperlink, eg: 'A1' + * @param null|Hyperlink $pHyperlink + * + * @return $this + */ + public function setHyperlink($pCellCoordinate, Hyperlink $pHyperlink = null) + { + if ($pHyperlink === null) { + unset($this->hyperlinkCollection[$pCellCoordinate]); + } else { + $this->hyperlinkCollection[$pCellCoordinate] = $pHyperlink; + } + + return $this; + } + + /** + * Hyperlink at a specific coordinate exists? + * + * @param string $pCoordinate eg: 'A1' + * + * @return bool + */ + public function hyperlinkExists($pCoordinate) + { + return isset($this->hyperlinkCollection[$pCoordinate]); + } + + /** + * Get collection of hyperlinks. + * + * @return Hyperlink[] + */ + public function getHyperlinkCollection() + { + return $this->hyperlinkCollection; + } + + /** + * Get data validation. + * + * @param string $pCellCoordinate Cell coordinate to get data validation for, eg: 'A1' + * + * @return DataValidation + */ + public function getDataValidation($pCellCoordinate) + { + // return data validation if we already have one + if (isset($this->dataValidationCollection[$pCellCoordinate])) { + return $this->dataValidationCollection[$pCellCoordinate]; + } + + // else create data validation + $this->dataValidationCollection[$pCellCoordinate] = new DataValidation(); + + return $this->dataValidationCollection[$pCellCoordinate]; + } + + /** + * Set data validation. + * + * @param string $pCellCoordinate Cell coordinate to insert data validation, eg: 'A1' + * @param null|DataValidation $pDataValidation + * + * @return $this + */ + public function setDataValidation($pCellCoordinate, DataValidation $pDataValidation = null) + { + if ($pDataValidation === null) { + unset($this->dataValidationCollection[$pCellCoordinate]); + } else { + $this->dataValidationCollection[$pCellCoordinate] = $pDataValidation; + } + + return $this; + } + + /** + * Data validation at a specific coordinate exists? + * + * @param string $pCoordinate eg: 'A1' + * + * @return bool + */ + public function dataValidationExists($pCoordinate) + { + return isset($this->dataValidationCollection[$pCoordinate]); + } + + /** + * Get collection of data validations. + * + * @return DataValidation[] + */ + public function getDataValidationCollection() + { + return $this->dataValidationCollection; + } + + /** + * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet. + * + * @param string $range + * + * @return string Adjusted range value + */ + public function shrinkRangeToFit($range) + { + $maxCol = $this->getHighestColumn(); + $maxRow = $this->getHighestRow(); + $maxCol = Coordinate::columnIndexFromString($maxCol); + + $rangeBlocks = explode(' ', $range); + foreach ($rangeBlocks as &$rangeSet) { + $rangeBoundaries = Coordinate::getRangeBoundaries($rangeSet); + + if (Coordinate::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) { + $rangeBoundaries[0][0] = Coordinate::stringFromColumnIndex($maxCol); + } + if ($rangeBoundaries[0][1] > $maxRow) { + $rangeBoundaries[0][1] = $maxRow; + } + if (Coordinate::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) { + $rangeBoundaries[1][0] = Coordinate::stringFromColumnIndex($maxCol); + } + if ($rangeBoundaries[1][1] > $maxRow) { + $rangeBoundaries[1][1] = $maxRow; + } + $rangeSet = $rangeBoundaries[0][0] . $rangeBoundaries[0][1] . ':' . $rangeBoundaries[1][0] . $rangeBoundaries[1][1]; + } + unset($rangeSet); + + return implode(' ', $rangeBlocks); + } + + /** + * Get tab color. + * + * @return Color + */ + public function getTabColor() + { + if ($this->tabColor === null) { + $this->tabColor = new Color(); + } + + return $this->tabColor; + } + + /** + * Reset tab color. + * + * @return $this + */ + public function resetTabColor() + { + $this->tabColor = null; + unset($this->tabColor); + + return $this; + } + + /** + * Tab color set? + * + * @return bool + */ + public function isTabColorSet() + { + return $this->tabColor !== null; + } + + /** + * Copy worksheet (!= clone!). + * + * @return static + */ + public function copy() + { + return clone $this; + } + + /** + * Implement PHP __clone to create a deep clone, not just a shallow copy. + */ + public function __clone() + { + foreach ($this as $key => $val) { + if ($key == 'parent') { + continue; + } + + if (is_object($val) || (is_array($val))) { + if ($key == 'cellCollection') { + $newCollection = $this->cellCollection->cloneCellCollection($this); + $this->cellCollection = $newCollection; + } elseif ($key == 'drawingCollection') { + $currentCollection = $this->drawingCollection; + $this->drawingCollection = new ArrayObject(); + foreach ($currentCollection as $item) { + if (is_object($item)) { + $newDrawing = clone $item; + $newDrawing->setWorksheet($this); + } + } + } elseif (($key == 'autoFilter') && ($this->autoFilter instanceof AutoFilter)) { + $newAutoFilter = clone $this->autoFilter; + $this->autoFilter = $newAutoFilter; + $this->autoFilter->setParent($this); + } else { + $this->{$key} = unserialize(serialize($val)); + } + } + } + } + + /** + * Define the code name of the sheet. + * + * @param string $pValue Same rule as Title minus space not allowed (but, like Excel, change + * silently space to underscore) + * @param bool $validate False to skip validation of new title. WARNING: This should only be set + * at parse time (by Readers), where titles can be assumed to be valid. + * + * @throws Exception + * + * @return $this + */ + public function setCodeName($pValue, $validate = true) + { + // Is this a 'rename' or not? + if ($this->getCodeName() == $pValue) { + return $this; + } + + if ($validate) { + $pValue = str_replace(' ', '_', $pValue); //Excel does this automatically without flinching, we are doing the same + + // Syntax check + // throw an exception if not valid + self::checkSheetCodeName($pValue); + + // We use the same code that setTitle to find a valid codeName else not using a space (Excel don't like) but a '_' + + if ($this->getParent()) { + // Is there already such sheet name? + if ($this->getParent()->sheetCodeNameExists($pValue)) { + // Use name, but append with lowest possible integer + + if (Shared\StringHelper::countCharacters($pValue) > 29) { + $pValue = Shared\StringHelper::substring($pValue, 0, 29); + } + $i = 1; + while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) { + ++$i; + if ($i == 10) { + if (Shared\StringHelper::countCharacters($pValue) > 28) { + $pValue = Shared\StringHelper::substring($pValue, 0, 28); + } + } elseif ($i == 100) { + if (Shared\StringHelper::countCharacters($pValue) > 27) { + $pValue = Shared\StringHelper::substring($pValue, 0, 27); + } + } + } + + $pValue .= '_' . $i; // ok, we have a valid name + } + } + } + + $this->codeName = $pValue; + + return $this; + } + + /** + * Return the code name of the sheet. + * + * @return null|string + */ + public function getCodeName() + { + return $this->codeName; + } + + /** + * Sheet has a code name ? + * + * @return bool + */ + public function hasCodeName() + { + return $this->codeName !== null; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php new file mode 100644 index 0000000..f13150d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/BaseWriter.php @@ -0,0 +1,86 @@ +includeCharts; + } + + public function setIncludeCharts($pValue) + { + $this->includeCharts = (bool) $pValue; + + return $this; + } + + public function getPreCalculateFormulas() + { + return $this->preCalculateFormulas; + } + + public function setPreCalculateFormulas($pValue) + { + $this->preCalculateFormulas = (bool) $pValue; + + return $this; + } + + public function getUseDiskCaching() + { + return $this->useDiskCaching; + } + + public function setUseDiskCaching($pValue, $pDirectory = null) + { + $this->useDiskCaching = $pValue; + + if ($pDirectory !== null) { + if (is_dir($pDirectory)) { + $this->diskCachingDirectory = $pDirectory; + } else { + throw new Exception("Directory does not exist: $pDirectory"); + } + } + + return $this; + } + + public function getDiskCachingDirectory() + { + return $this->diskCachingDirectory; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Csv.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Csv.php new file mode 100644 index 0000000..1166bd2 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Csv.php @@ -0,0 +1,342 @@ +spreadsheet = $spreadsheet; + } + + /** + * Save PhpSpreadsheet to file. + * + * @param string $pFilename + * + * @throws Exception + */ + public function save($pFilename) + { + // Fetch sheet + $sheet = $this->spreadsheet->getSheet($this->sheetIndex); + + $saveDebugLog = Calculation::getInstance($this->spreadsheet)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog(false); + $saveArrayReturnType = Calculation::getArrayReturnType(); + Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE); + + // Open file + $fileHandle = fopen($pFilename, 'wb+'); + if ($fileHandle === false) { + throw new Exception("Could not open file $pFilename for writing."); + } + + if ($this->excelCompatibility) { + $this->setUseBOM(true); // Enforce UTF-8 BOM Header + $this->setIncludeSeparatorLine(true); // Set separator line + $this->setEnclosure('"'); // Set enclosure to " + $this->setDelimiter(';'); // Set delimiter to a semi-colon + $this->setLineEnding("\r\n"); + } + if ($this->useBOM) { + // Write the UTF-8 BOM code if required + fwrite($fileHandle, "\xEF\xBB\xBF"); + } + if ($this->includeSeparatorLine) { + // Write the separator line if required + fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->lineEnding); + } + + // Identify the range that we need to extract from the worksheet + $maxCol = $sheet->getHighestDataColumn(); + $maxRow = $sheet->getHighestDataRow(); + + // Write rows to file + for ($row = 1; $row <= $maxRow; ++$row) { + // Convert the row to an array... + $cellsArray = $sheet->rangeToArray('A' . $row . ':' . $maxCol . $row, '', $this->preCalculateFormulas); + // ... and write to the file + $this->writeLine($fileHandle, $cellsArray[0]); + } + + // Close file + fclose($fileHandle); + + Calculation::setArrayReturnType($saveArrayReturnType); + Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); + } + + /** + * Get delimiter. + * + * @return string + */ + public function getDelimiter() + { + return $this->delimiter; + } + + /** + * Set delimiter. + * + * @param string $pValue Delimiter, defaults to ',' + * + * @return $this + */ + public function setDelimiter($pValue) + { + $this->delimiter = $pValue; + + return $this; + } + + /** + * Get enclosure. + * + * @return string + */ + public function getEnclosure() + { + return $this->enclosure; + } + + /** + * Set enclosure. + * + * @param string $pValue Enclosure, defaults to " + * + * @return $this + */ + public function setEnclosure($pValue) + { + if ($pValue == '') { + $pValue = null; + } + $this->enclosure = $pValue; + + return $this; + } + + /** + * Get line ending. + * + * @return string + */ + public function getLineEnding() + { + return $this->lineEnding; + } + + /** + * Set line ending. + * + * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) + * + * @return $this + */ + public function setLineEnding($pValue) + { + $this->lineEnding = $pValue; + + return $this; + } + + /** + * Get whether BOM should be used. + * + * @return bool + */ + public function getUseBOM() + { + return $this->useBOM; + } + + /** + * Set whether BOM should be used. + * + * @param bool $pValue Use UTF-8 byte-order mark? Defaults to false + * + * @return $this + */ + public function setUseBOM($pValue) + { + $this->useBOM = $pValue; + + return $this; + } + + /** + * Get whether a separator line should be included. + * + * @return bool + */ + public function getIncludeSeparatorLine() + { + return $this->includeSeparatorLine; + } + + /** + * Set whether a separator line should be included as the first line of the file. + * + * @param bool $pValue Use separator line? Defaults to false + * + * @return $this + */ + public function setIncludeSeparatorLine($pValue) + { + $this->includeSeparatorLine = $pValue; + + return $this; + } + + /** + * Get whether the file should be saved with full Excel Compatibility. + * + * @return bool + */ + public function getExcelCompatibility() + { + return $this->excelCompatibility; + } + + /** + * Set whether the file should be saved with full Excel Compatibility. + * + * @param bool $pValue Set the file to be written as a fully Excel compatible csv file + * Note that this overrides other settings such as useBOM, enclosure and delimiter + * + * @return $this + */ + public function setExcelCompatibility($pValue) + { + $this->excelCompatibility = $pValue; + + return $this; + } + + /** + * Get sheet index. + * + * @return int + */ + public function getSheetIndex() + { + return $this->sheetIndex; + } + + /** + * Set sheet index. + * + * @param int $pValue Sheet index + * + * @return $this + */ + public function setSheetIndex($pValue) + { + $this->sheetIndex = $pValue; + + return $this; + } + + /** + * Write line to CSV file. + * + * @param resource $pFileHandle PHP filehandle + * @param array $pValues Array containing values in a row + */ + private function writeLine($pFileHandle, array $pValues) + { + // No leading delimiter + $writeDelimiter = false; + + // Build the line + $line = ''; + + foreach ($pValues as $element) { + // Escape enclosures + $element = str_replace($this->enclosure, $this->enclosure . $this->enclosure, $element); + + // Add delimiter + if ($writeDelimiter) { + $line .= $this->delimiter; + } else { + $writeDelimiter = true; + } + + // Add enclosed string + $line .= $this->enclosure . $element . $this->enclosure; + } + + // Add line ending + $line .= $this->lineEnding; + + // Write to file + fwrite($pFileHandle, $line); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Exception.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Exception.php new file mode 100644 index 0000000..92e6f5f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Exception.php @@ -0,0 +1,9 @@ +spreadsheet = $spreadsheet; + $this->defaultFont = $this->spreadsheet->getDefaultStyle()->getFont(); + } + + /** + * Save Spreadsheet to file. + * + * @param string $pFilename + * + * @throws WriterException + */ + public function save($pFilename) + { + // garbage collect + $this->spreadsheet->garbageCollect(); + + $saveDebugLog = Calculation::getInstance($this->spreadsheet)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog(false); + $saveArrayReturnType = Calculation::getArrayReturnType(); + Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE); + + // Build CSS + $this->buildCSS(!$this->useInlineCss); + + // Open file + $fileHandle = fopen($pFilename, 'wb+'); + if ($fileHandle === false) { + throw new WriterException("Could not open file $pFilename for writing."); + } + + // Write headers + fwrite($fileHandle, $this->generateHTMLHeader(!$this->useInlineCss)); + + // Write navigation (tabs) + if ((!$this->isPdf) && ($this->generateSheetNavigationBlock)) { + fwrite($fileHandle, $this->generateNavigation()); + } + + // Write data + fwrite($fileHandle, $this->generateSheetData()); + + // Write footer + fwrite($fileHandle, $this->generateHTMLFooter()); + + // Close file + fclose($fileHandle); + + Calculation::setArrayReturnType($saveArrayReturnType); + Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); + } + + /** + * Map VAlign. + * + * @param string $vAlign Vertical alignment + * + * @return string + */ + private function mapVAlign($vAlign) + { + switch ($vAlign) { + case Alignment::VERTICAL_BOTTOM: + return 'bottom'; + case Alignment::VERTICAL_TOP: + return 'top'; + case Alignment::VERTICAL_CENTER: + case Alignment::VERTICAL_JUSTIFY: + return 'middle'; + default: + return 'baseline'; + } + } + + /** + * Map HAlign. + * + * @param string $hAlign Horizontal alignment + * + * @return false|string + */ + private function mapHAlign($hAlign) + { + switch ($hAlign) { + case Alignment::HORIZONTAL_GENERAL: + return false; + case Alignment::HORIZONTAL_LEFT: + return 'left'; + case Alignment::HORIZONTAL_RIGHT: + return 'right'; + case Alignment::HORIZONTAL_CENTER: + case Alignment::HORIZONTAL_CENTER_CONTINUOUS: + return 'center'; + case Alignment::HORIZONTAL_JUSTIFY: + return 'justify'; + default: + return false; + } + } + + /** + * Map border style. + * + * @param int $borderStyle Sheet index + * + * @return string + */ + private function mapBorderStyle($borderStyle) + { + switch ($borderStyle) { + case Border::BORDER_NONE: + return 'none'; + case Border::BORDER_DASHDOT: + return '1px dashed'; + case Border::BORDER_DASHDOTDOT: + return '1px dotted'; + case Border::BORDER_DASHED: + return '1px dashed'; + case Border::BORDER_DOTTED: + return '1px dotted'; + case Border::BORDER_DOUBLE: + return '3px double'; + case Border::BORDER_HAIR: + return '1px solid'; + case Border::BORDER_MEDIUM: + return '2px solid'; + case Border::BORDER_MEDIUMDASHDOT: + return '2px dashed'; + case Border::BORDER_MEDIUMDASHDOTDOT: + return '2px dotted'; + case Border::BORDER_MEDIUMDASHED: + return '2px dashed'; + case Border::BORDER_SLANTDASHDOT: + return '2px dashed'; + case Border::BORDER_THICK: + return '3px solid'; + case Border::BORDER_THIN: + return '1px solid'; + default: + // map others to thin + return '1px solid'; + } + } + + /** + * Get sheet index. + * + * @return int + */ + public function getSheetIndex() + { + return $this->sheetIndex; + } + + /** + * Set sheet index. + * + * @param int $pValue Sheet index + * + * @return $this + */ + public function setSheetIndex($pValue) + { + $this->sheetIndex = $pValue; + + return $this; + } + + /** + * Get sheet index. + * + * @return bool + */ + public function getGenerateSheetNavigationBlock() + { + return $this->generateSheetNavigationBlock; + } + + /** + * Set sheet index. + * + * @param bool $pValue Flag indicating whether the sheet navigation block should be generated or not + * + * @return $this + */ + public function setGenerateSheetNavigationBlock($pValue) + { + $this->generateSheetNavigationBlock = (bool) $pValue; + + return $this; + } + + /** + * Write all sheets (resets sheetIndex to NULL). + * + * @return $this + */ + public function writeAllSheets() + { + $this->sheetIndex = null; + + return $this; + } + + /** + * Generate HTML header. + * + * @param bool $pIncludeStyles Include styles? + * + * @throws WriterException + * + * @return string + */ + public function generateHTMLHeader($pIncludeStyles = false) + { + // Construct HTML + $properties = $this->spreadsheet->getProperties(); + $html = '' . PHP_EOL; + $html .= '' . PHP_EOL; + $html .= ' ' . PHP_EOL; + $html .= ' ' . PHP_EOL; + $html .= ' ' . PHP_EOL; + if ($properties->getTitle() > '') { + $html .= ' ' . htmlspecialchars($properties->getTitle()) . '' . PHP_EOL; + } + if ($properties->getCreator() > '') { + $html .= ' ' . PHP_EOL; + } + if ($properties->getTitle() > '') { + $html .= ' ' . PHP_EOL; + } + if ($properties->getDescription() > '') { + $html .= ' ' . PHP_EOL; + } + if ($properties->getSubject() > '') { + $html .= ' ' . PHP_EOL; + } + if ($properties->getKeywords() > '') { + $html .= ' ' . PHP_EOL; + } + if ($properties->getCategory() > '') { + $html .= ' ' . PHP_EOL; + } + if ($properties->getCompany() > '') { + $html .= ' ' . PHP_EOL; + } + if ($properties->getManager() > '') { + $html .= ' ' . PHP_EOL; + } + + if ($pIncludeStyles) { + $html .= $this->generateStyles(true); + } + + $html .= ' ' . PHP_EOL; + $html .= '' . PHP_EOL; + $html .= ' ' . PHP_EOL; + + return $html; + } + + /** + * Generate sheet data. + * + * @throws WriterException + * + * @return string + */ + public function generateSheetData() + { + // Ensure that Spans have been calculated? + if ($this->sheetIndex !== null || !$this->spansAreCalculated) { + $this->calculateSpans(); + } + + // Fetch sheets + $sheets = []; + if ($this->sheetIndex === null) { + $sheets = $this->spreadsheet->getAllSheets(); + } else { + $sheets[] = $this->spreadsheet->getSheet($this->sheetIndex); + } + + // Construct HTML + $html = ''; + + // Loop all sheets + $sheetId = 0; + foreach ($sheets as $sheet) { + // Write table header + $html .= $this->generateTableHeader($sheet); + + // Get worksheet dimension + $dimension = explode(':', $sheet->calculateWorksheetDimension()); + $dimension[0] = Coordinate::coordinateFromString($dimension[0]); + $dimension[0][0] = Coordinate::columnIndexFromString($dimension[0][0]); + $dimension[1] = Coordinate::coordinateFromString($dimension[1]); + $dimension[1][0] = Coordinate::columnIndexFromString($dimension[1][0]); + + // row min,max + $rowMin = $dimension[0][1]; + $rowMax = $dimension[1][1]; + + // calculate start of , + $tbodyStart = $rowMin; + $theadStart = $theadEnd = 0; // default: no no + if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) { + $rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop(); + + // we can only support repeating rows that start at top row + if ($rowsToRepeatAtTop[0] == 1) { + $theadStart = $rowsToRepeatAtTop[0]; + $theadEnd = $rowsToRepeatAtTop[1]; + $tbodyStart = $rowsToRepeatAtTop[1] + 1; + } + } + + // Loop through cells + $row = $rowMin - 1; + while ($row++ < $rowMax) { + // ? + if ($row == $theadStart) { + $html .= ' ' . PHP_EOL; + $cellType = 'th'; + } + + // ? + if ($row == $tbodyStart) { + $html .= ' ' . PHP_EOL; + $cellType = 'td'; + } + + // Write row if there are HTML table cells in it + if (!isset($this->isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row])) { + // Start a new rowData + $rowData = []; + // Loop through columns + $column = $dimension[0][0]; + while ($column <= $dimension[1][0]) { + // Cell exists? + if ($sheet->cellExistsByColumnAndRow($column, $row)) { + $rowData[$column] = Coordinate::stringFromColumnIndex($column) . $row; + } else { + $rowData[$column] = ''; + } + ++$column; + } + $html .= $this->generateRow($sheet, $rowData, $row - 1, $cellType); + } + + // ? + if ($row == $theadEnd) { + $html .= ' ' . PHP_EOL; + } + } + $html .= $this->extendRowsForChartsAndImages($sheet, $row); + + // Close table body. + $html .= ' ' . PHP_EOL; + + // Write table footer + $html .= $this->generateTableFooter(); + + // Writing PDF? + if ($this->isPdf) { + if ($this->sheetIndex === null && $sheetId + 1 < $this->spreadsheet->getSheetCount()) { + $html .= '

'; + } + } + + // Next sheet + ++$sheetId; + } + + return $html; + } + + /** + * Generate sheet tabs. + * + * @throws WriterException + * + * @return string + */ + public function generateNavigation() + { + // Fetch sheets + $sheets = []; + if ($this->sheetIndex === null) { + $sheets = $this->spreadsheet->getAllSheets(); + } else { + $sheets[] = $this->spreadsheet->getSheet($this->sheetIndex); + } + + // Construct HTML + $html = ''; + + // Only if there are more than 1 sheets + if (count($sheets) > 1) { + // Loop all sheets + $sheetId = 0; + + $html .= '' . PHP_EOL; + } + + return $html; + } + + private function extendRowsForChartsAndImages(Worksheet $pSheet, $row) + { + $rowMax = $row; + $colMax = 'A'; + if ($this->includeCharts) { + foreach ($pSheet->getChartCollection() as $chart) { + if ($chart instanceof Chart) { + $chartCoordinates = $chart->getTopLeftPosition(); + $chartTL = Coordinate::coordinateFromString($chartCoordinates['cell']); + $chartCol = Coordinate::columnIndexFromString($chartTL[0]); + if ($chartTL[1] > $rowMax) { + $rowMax = $chartTL[1]; + if ($chartCol > Coordinate::columnIndexFromString($colMax)) { + $colMax = $chartTL[0]; + } + } + } + } + } + + foreach ($pSheet->getDrawingCollection() as $drawing) { + if ($drawing instanceof Drawing) { + $imageTL = Coordinate::coordinateFromString($drawing->getCoordinates()); + $imageCol = Coordinate::columnIndexFromString($imageTL[0]); + if ($imageTL[1] > $rowMax) { + $rowMax = $imageTL[1]; + if ($imageCol > Coordinate::columnIndexFromString($colMax)) { + $colMax = $imageTL[0]; + } + } + } + } + + // Don't extend rows if not needed + if ($row === $rowMax) { + return ''; + } + + $html = ''; + ++$colMax; + + while ($row <= $rowMax) { + $html .= ''; + for ($col = 'A'; $col != $colMax; ++$col) { + $html .= ''; + $html .= $this->writeImageInCell($pSheet, $col . $row); + if ($this->includeCharts) { + $html .= $this->writeChartInCell($pSheet, $col . $row); + } + $html .= ''; + } + ++$row; + $html .= ''; + } + + return $html; + } + + /** + * Generate image tag in cell. + * + * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet + * @param string $coordinates Cell coordinates + * + * @return string + */ + private function writeImageInCell(Worksheet $pSheet, $coordinates) + { + // Construct HTML + $html = ''; + + // Write images + foreach ($pSheet->getDrawingCollection() as $drawing) { + if ($drawing instanceof Drawing) { + if ($drawing->getCoordinates() == $coordinates) { + $filename = $drawing->getPath(); + + // Strip off eventual '.' + if (substr($filename, 0, 1) == '.') { + $filename = substr($filename, 1); + } + + // Prepend images root + $filename = $this->getImagesRoot() . $filename; + + // Strip off eventual '.' + if (substr($filename, 0, 1) == '.' && substr($filename, 0, 2) != './') { + $filename = substr($filename, 1); + } + + // Convert UTF8 data to PCDATA + $filename = htmlspecialchars($filename); + + $html .= PHP_EOL; + if ((!$this->embedImages) || ($this->isPdf)) { + $imageData = $filename; + } else { + $imageDetails = getimagesize($filename); + if ($fp = fopen($filename, 'rb', 0)) { + $picture = ''; + while (!feof($fp)) { + $picture .= fread($fp, 1024); + } + fclose($fp); + // base64 encode the binary data, then break it + // into chunks according to RFC 2045 semantics + $base64 = chunk_split(base64_encode($picture)); + $imageData = 'data:' . $imageDetails['mime'] . ';base64,' . $base64; + } else { + $imageData = $filename; + } + } + + $html .= '
'; + $html .= ''; + $html .= '
'; + } + } elseif ($drawing instanceof MemoryDrawing) { + if ($drawing->getCoordinates() != $coordinates) { + continue; + } + ob_start(); // Let's start output buffering. + imagepng($drawing->getImageResource()); // This will normally output the image, but because of ob_start(), it won't. + $contents = ob_get_contents(); // Instead, output above is saved to $contents + ob_end_clean(); // End the output buffer. + + $dataUri = 'data:image/jpeg;base64,' . base64_encode($contents); + + // Because of the nature of tables, width is more important than height. + // max-width: 100% ensures that image doesnt overflow containing cell + // width: X sets width of supplied image. + // As a result, images bigger than cell will be contained and images smaller will not get stretched + $html .= ''; + } + } + + return $html; + } + + /** + * Generate chart tag in cell. + * + * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet + * @param string $coordinates Cell coordinates + * + * @return string + */ + private function writeChartInCell(Worksheet $pSheet, $coordinates) + { + // Construct HTML + $html = ''; + + // Write charts + foreach ($pSheet->getChartCollection() as $chart) { + if ($chart instanceof Chart) { + $chartCoordinates = $chart->getTopLeftPosition(); + if ($chartCoordinates['cell'] == $coordinates) { + $chartFileName = File::sysGetTempDir() . '/' . uniqid('', true) . '.png'; + if (!$chart->render($chartFileName)) { + return; + } + + $html .= PHP_EOL; + $imageDetails = getimagesize($chartFileName); + if ($fp = fopen($chartFileName, 'rb', 0)) { + $picture = fread($fp, filesize($chartFileName)); + fclose($fp); + // base64 encode the binary data, then break it + // into chunks according to RFC 2045 semantics + $base64 = chunk_split(base64_encode($picture)); + $imageData = 'data:' . $imageDetails['mime'] . ';base64,' . $base64; + + $html .= '
'; + $html .= '' . PHP_EOL; + $html .= '
'; + + unlink($chartFileName); + } + } + } + } + + // Return + return $html; + } + + /** + * Generate CSS styles. + * + * @param bool $generateSurroundingHTML Generate surrounding HTML tags? (<style> and </style>) + * + * @throws WriterException + * + * @return string + */ + public function generateStyles($generateSurroundingHTML = true) + { + // Build CSS + $css = $this->buildCSS($generateSurroundingHTML); + + // Construct HTML + $html = ''; + + // Start styles + if ($generateSurroundingHTML) { + $html .= ' ' . PHP_EOL; + } + + // Return + return $html; + } + + /** + * Build CSS styles. + * + * @param bool $generateSurroundingHTML Generate surrounding HTML style? (html { }) + * + * @throws WriterException + * + * @return array + */ + public function buildCSS($generateSurroundingHTML = true) + { + // Cached? + if ($this->cssStyles !== null) { + return $this->cssStyles; + } + + // Ensure that spans have been calculated + if (!$this->spansAreCalculated) { + $this->calculateSpans(); + } + + // Construct CSS + $css = []; + + // Start styles + if ($generateSurroundingHTML) { + // html { } + $css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif'; + $css['html']['font-size'] = '11pt'; + $css['html']['background-color'] = 'white'; + } + + // CSS for comments as found in LibreOffice + $css['a.comment-indicator:hover + div.comment'] = [ + 'background' => '#ffd', + 'position' => 'absolute', + 'display' => 'block', + 'border' => '1px solid black', + 'padding' => '0.5em', + ]; + + $css['a.comment-indicator'] = [ + 'background' => 'red', + 'display' => 'inline-block', + 'border' => '1px solid black', + 'width' => '0.5em', + 'height' => '0.5em', + ]; + + $css['div.comment']['display'] = 'none'; + + // table { } + $css['table']['border-collapse'] = 'collapse'; + if (!$this->isPdf) { + $css['table']['page-break-after'] = 'always'; + } + + // .gridlines td { } + $css['.gridlines td']['border'] = '1px dotted black'; + $css['.gridlines th']['border'] = '1px dotted black'; + + // .b {} + $css['.b']['text-align'] = 'center'; // BOOL + + // .e {} + $css['.e']['text-align'] = 'center'; // ERROR + + // .f {} + $css['.f']['text-align'] = 'right'; // FORMULA + + // .inlineStr {} + $css['.inlineStr']['text-align'] = 'left'; // INLINE + + // .n {} + $css['.n']['text-align'] = 'right'; // NUMERIC + + // .s {} + $css['.s']['text-align'] = 'left'; // STRING + + // Calculate cell style hashes + foreach ($this->spreadsheet->getCellXfCollection() as $index => $style) { + $css['td.style' . $index] = $this->createCSSStyle($style); + $css['th.style' . $index] = $this->createCSSStyle($style); + } + + // Fetch sheets + $sheets = []; + if ($this->sheetIndex === null) { + $sheets = $this->spreadsheet->getAllSheets(); + } else { + $sheets[] = $this->spreadsheet->getSheet($this->sheetIndex); + } + + // Build styles per sheet + foreach ($sheets as $sheet) { + // Calculate hash code + $sheetIndex = $sheet->getParent()->getIndex($sheet); + + // Build styles + // Calculate column widths + $sheet->calculateColumnWidths(); + + // col elements, initialize + $highestColumnIndex = Coordinate::columnIndexFromString($sheet->getHighestColumn()) - 1; + $column = -1; + while ($column++ < $highestColumnIndex) { + $this->columnWidths[$sheetIndex][$column] = 42; // approximation + $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = '42pt'; + } + + // col elements, loop through columnDimensions and set width + foreach ($sheet->getColumnDimensions() as $columnDimension) { + if (($width = SharedDrawing::cellDimensionToPixels($columnDimension->getWidth(), $this->defaultFont)) >= 0) { + $width = SharedDrawing::pixelsToPoints($width); + $column = Coordinate::columnIndexFromString($columnDimension->getColumnIndex()) - 1; + $this->columnWidths[$sheetIndex][$column] = $width; + $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt'; + + if ($columnDimension->getVisible() === false) { + $css['table.sheet' . $sheetIndex . ' .column' . $column]['visibility'] = 'collapse'; + $css['table.sheet' . $sheetIndex . ' .column' . $column]['display'] = 'none'; // target IE6+7 + } + } + } + + // Default row height + $rowDimension = $sheet->getDefaultRowDimension(); + + // table.sheetN tr { } + $css['table.sheet' . $sheetIndex . ' tr'] = []; + + if ($rowDimension->getRowHeight() == -1) { + $pt_height = SharedFont::getDefaultRowHeightByFont($this->spreadsheet->getDefaultStyle()->getFont()); + } else { + $pt_height = $rowDimension->getRowHeight(); + } + $css['table.sheet' . $sheetIndex . ' tr']['height'] = $pt_height . 'pt'; + if ($rowDimension->getVisible() === false) { + $css['table.sheet' . $sheetIndex . ' tr']['display'] = 'none'; + $css['table.sheet' . $sheetIndex . ' tr']['visibility'] = 'hidden'; + } + + // Calculate row heights + foreach ($sheet->getRowDimensions() as $rowDimension) { + $row = $rowDimension->getRowIndex() - 1; + + // table.sheetN tr.rowYYYYYY { } + $css['table.sheet' . $sheetIndex . ' tr.row' . $row] = []; + + if ($rowDimension->getRowHeight() == -1) { + $pt_height = SharedFont::getDefaultRowHeightByFont($this->spreadsheet->getDefaultStyle()->getFont()); + } else { + $pt_height = $rowDimension->getRowHeight(); + } + $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['height'] = $pt_height . 'pt'; + if ($rowDimension->getVisible() === false) { + $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['display'] = 'none'; + $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['visibility'] = 'hidden'; + } + } + } + + // Cache + if ($this->cssStyles === null) { + $this->cssStyles = $css; + } + + // Return + return $css; + } + + /** + * Create CSS style. + * + * @param Style $pStyle + * + * @return array + */ + private function createCSSStyle(Style $pStyle) + { + // Create CSS + return array_merge( + $this->createCSSStyleAlignment($pStyle->getAlignment()), + $this->createCSSStyleBorders($pStyle->getBorders()), + $this->createCSSStyleFont($pStyle->getFont()), + $this->createCSSStyleFill($pStyle->getFill()) + ); + } + + /** + * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Alignment). + * + * @param Alignment $pStyle \PhpOffice\PhpSpreadsheet\Style\Alignment + * + * @return array + */ + private function createCSSStyleAlignment(Alignment $pStyle) + { + // Construct CSS + $css = []; + + // Create CSS + $css['vertical-align'] = $this->mapVAlign($pStyle->getVertical()); + if ($textAlign = $this->mapHAlign($pStyle->getHorizontal())) { + $css['text-align'] = $textAlign; + if (in_array($textAlign, ['left', 'right'])) { + $css['padding-' . $textAlign] = (string) ((int) $pStyle->getIndent() * 9) . 'px'; + } + } + + return $css; + } + + /** + * Create CSS style (\PhpOffice\PhpSpreadsheet\Style\Font). + * + * @param Font $pStyle + * + * @return array + */ + private function createCSSStyleFont(Font $pStyle) + { + // Construct CSS + $css = []; + + // Create CSS + if ($pStyle->getBold()) { + $css['font-weight'] = 'bold'; + } + if ($pStyle->getUnderline() != Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) { + $css['text-decoration'] = 'underline line-through'; + } elseif ($pStyle->getUnderline() != Font::UNDERLINE_NONE) { + $css['text-decoration'] = 'underline'; + } elseif ($pStyle->getStrikethrough()) { + $css['text-decoration'] = 'line-through'; + } + if ($pStyle->getItalic()) { + $css['font-style'] = 'italic'; + } + + $css['color'] = '#' . $pStyle->getColor()->getRGB(); + $css['font-family'] = '\'' . $pStyle->getName() . '\''; + $css['font-size'] = $pStyle->getSize() . 'pt'; + + return $css; + } + + /** + * Create CSS style (Borders). + * + * @param Borders $pStyle Borders + * + * @return array + */ + private function createCSSStyleBorders(Borders $pStyle) + { + // Construct CSS + $css = []; + + // Create CSS + $css['border-bottom'] = $this->createCSSStyleBorder($pStyle->getBottom()); + $css['border-top'] = $this->createCSSStyleBorder($pStyle->getTop()); + $css['border-left'] = $this->createCSSStyleBorder($pStyle->getLeft()); + $css['border-right'] = $this->createCSSStyleBorder($pStyle->getRight()); + + return $css; + } + + /** + * Create CSS style (Border). + * + * @param Border $pStyle Border + * + * @return string + */ + private function createCSSStyleBorder(Border $pStyle) + { + // Create CSS - add !important to non-none border styles for merged cells + $borderStyle = $this->mapBorderStyle($pStyle->getBorderStyle()); + + return $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); + } + + /** + * Create CSS style (Fill). + * + * @param Fill $pStyle Fill + * + * @return array + */ + private function createCSSStyleFill(Fill $pStyle) + { + // Construct HTML + $css = []; + + // Create CSS + $value = $pStyle->getFillType() == Fill::FILL_NONE ? + 'white' : '#' . $pStyle->getStartColor()->getRGB(); + $css['background-color'] = $value; + + return $css; + } + + /** + * Generate HTML footer. + */ + public function generateHTMLFooter() + { + // Construct HTML + $html = ''; + $html .= ' ' . PHP_EOL; + $html .= '' . PHP_EOL; + + return $html; + } + + /** + * Generate table header. + * + * @param Worksheet $pSheet The worksheet for the table we are writing + * + * @return string + */ + private function generateTableHeader($pSheet) + { + $sheetIndex = $pSheet->getParent()->getIndex($pSheet); + + // Construct HTML + $html = ''; + if ($this->useEmbeddedCSS) { + $html .= $this->setMargins($pSheet); + } + + if (!$this->useInlineCss) { + $gridlines = $pSheet->getShowGridlines() ? ' gridlines' : ''; + $html .= ' ' . PHP_EOL; + } else { + $style = isset($this->cssStyles['table']) ? + $this->assembleCSS($this->cssStyles['table']) : ''; + + if ($this->isPdf && $pSheet->getShowGridlines()) { + $html .= '
' . PHP_EOL; + } else { + $html .= '
' . PHP_EOL; + } + } + + // Write elements + $highestColumnIndex = Coordinate::columnIndexFromString($pSheet->getHighestColumn()) - 1; + $i = -1; + while ($i++ < $highestColumnIndex) { + if (!$this->isPdf) { + if (!$this->useInlineCss) { + $html .= ' ' . PHP_EOL; + } else { + $style = isset($this->cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ? + $this->assembleCSS($this->cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : ''; + $html .= ' ' . PHP_EOL; + } + } + } + + return $html; + } + + /** + * Generate table footer. + */ + private function generateTableFooter() + { + return '
' . PHP_EOL; + } + + /** + * Generate row. + * + * @param Worksheet $pSheet \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet + * @param array $pValues Array containing cells in a row + * @param int $pRow Row number (0-based) + * @param string $cellType eg: 'td' + * + * @throws WriterException + * + * @return string + */ + private function generateRow(Worksheet $pSheet, array $pValues, $pRow, $cellType) + { + // Construct HTML + $html = ''; + + // Sheet index + $sheetIndex = $pSheet->getParent()->getIndex($pSheet); + + // Dompdf and breaks + if ($this->isPdf && count($pSheet->getBreaks()) > 0) { + $breaks = $pSheet->getBreaks(); + + // check if a break is needed before this row + if (isset($breaks['A' . $pRow])) { + // close table: + $html .= $this->generateTableFooter(); + + // insert page break + $html .= '
'; + + // open table again: + etc. + $html .= $this->generateTableHeader($pSheet); + } + } + + // Write row start + if (!$this->useInlineCss) { + $html .= ' ' . PHP_EOL; + } else { + $style = isset($this->cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) + ? $this->assembleCSS($this->cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) : ''; + + $html .= ' ' . PHP_EOL; + } + + // Write cells + $colNum = 0; + foreach ($pValues as $cellAddress) { + $cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : ''; + $coordinate = Coordinate::stringFromColumnIndex($colNum + 1) . ($pRow + 1); + if (!$this->useInlineCss) { + $cssClass = 'column' . $colNum; + } else { + $cssClass = []; + if ($cellType == 'th') { + if (isset($this->cssStyles['table.sheet' . $sheetIndex . ' th.column' . $colNum])) { + $this->cssStyles['table.sheet' . $sheetIndex . ' th.column' . $colNum]; + } + } else { + if (isset($this->cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum])) { + $this->cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum]; + } + } + } + $colSpan = 1; + $rowSpan = 1; + + // initialize + $cellData = ' '; + + // Cell + if ($cell instanceof Cell) { + $cellData = ''; + if ($cell->getParent() === null) { + $cell->attach($pSheet); + } + // Value + if ($cell->getValue() instanceof RichText) { + // Loop through rich text elements + $elements = $cell->getValue()->getRichTextElements(); + foreach ($elements as $element) { + // Rich text start? + if ($element instanceof Run) { + $cellData .= ''; + + if ($element->getFont()->getSuperscript()) { + $cellData .= ''; + } elseif ($element->getFont()->getSubscript()) { + $cellData .= ''; + } + } + + // Convert UTF8 data to PCDATA + $cellText = $element->getText(); + $cellData .= htmlspecialchars($cellText); + + if ($element instanceof Run) { + if ($element->getFont()->getSuperscript()) { + $cellData .= ''; + } elseif ($element->getFont()->getSubscript()) { + $cellData .= ''; + } + + $cellData .= ''; + } + } + } else { + if ($this->preCalculateFormulas) { + $cellData = NumberFormat::toFormattedString( + $cell->getCalculatedValue(), + $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(), + [$this, 'formatColor'] + ); + } else { + $cellData = NumberFormat::toFormattedString( + $cell->getValue(), + $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(), + [$this, 'formatColor'] + ); + } + $cellData = htmlspecialchars($cellData); + if ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSuperscript()) { + $cellData = '' . $cellData . ''; + } elseif ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSubscript()) { + $cellData = '' . $cellData . ''; + } + } + + // Converts the cell content so that spaces occuring at beginning of each new line are replaced by   + // Example: " Hello\n to the world" is converted to "  Hello\n to the world" + $cellData = preg_replace('/(?m)(?:^|\\G) /', ' ', $cellData); + + // convert newline "\n" to '
' + $cellData = nl2br($cellData); + + // Extend CSS class? + if (!$this->useInlineCss) { + $cssClass .= ' style' . $cell->getXfIndex(); + $cssClass .= ' ' . $cell->getDataType(); + } else { + if ($cellType == 'th') { + if (isset($this->cssStyles['th.style' . $cell->getXfIndex()])) { + $cssClass = array_merge($cssClass, $this->cssStyles['th.style' . $cell->getXfIndex()]); + } + } else { + if (isset($this->cssStyles['td.style' . $cell->getXfIndex()])) { + $cssClass = array_merge($cssClass, $this->cssStyles['td.style' . $cell->getXfIndex()]); + } + } + + // General horizontal alignment: Actual horizontal alignment depends on dataType + $sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex()); + if ($sharedStyle->getAlignment()->getHorizontal() == Alignment::HORIZONTAL_GENERAL + && isset($this->cssStyles['.' . $cell->getDataType()]['text-align']) + ) { + $cssClass['text-align'] = $this->cssStyles['.' . $cell->getDataType()]['text-align']; + } + } + } + + // Hyperlink? + if ($pSheet->hyperlinkExists($coordinate) && !$pSheet->getHyperlink($coordinate)->isInternal()) { + $cellData = '' . $cellData . ''; + } + + // Should the cell be written or is it swallowed by a rowspan or colspan? + $writeCell = !(isset($this->isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]) + && $this->isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]); + + // Colspan and Rowspan + $colspan = 1; + $rowspan = 1; + if (isset($this->isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum])) { + $spans = $this->isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]; + $rowSpan = $spans['rowspan']; + $colSpan = $spans['colspan']; + + // Also apply style from last cell in merge to fix borders - + // relies on !important for non-none border declarations in createCSSStyleBorder + $endCellCoord = Coordinate::stringFromColumnIndex($colNum + $colSpan) . ($pRow + $rowSpan); + if (!$this->useInlineCss) { + $cssClass .= ' style' . $pSheet->getCell($endCellCoord)->getXfIndex(); + } + } + + // Write + if ($writeCell) { + // Column start + $html .= ' <' . $cellType; + if (!$this->useInlineCss) { + $html .= ' class="' . $cssClass . '"'; + } else { + //** Necessary redundant code for the sake of \PhpOffice\PhpSpreadsheet\Writer\Pdf ** + // We must explicitly write the width of the + $width = 0; + $i = $colNum - 1; + $e = $colNum + $colSpan - 1; + while ($i++ < $e) { + if (isset($this->columnWidths[$sheetIndex][$i])) { + $width += $this->columnWidths[$sheetIndex][$i]; + } + } + $cssClass['width'] = $width . 'pt'; + + // We must also explicitly write the height of the + if (isset($this->cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) { + $height = $this->cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height']; + $cssClass['height'] = $height; + } + //** end of redundant code ** + + $html .= ' style="' . $this->assembleCSS($cssClass) . '"'; + } + if ($colSpan > 1) { + $html .= ' colspan="' . $colSpan . '"'; + } + if ($rowSpan > 1) { + $html .= ' rowspan="' . $rowSpan . '"'; + } + $html .= '>'; + + $html .= $this->writeComment($pSheet, $coordinate); + + // Image? + $html .= $this->writeImageInCell($pSheet, $coordinate); + + // Chart? + if ($this->includeCharts) { + $html .= $this->writeChartInCell($pSheet, $coordinate); + } + + // Cell data + $html .= $cellData; + + // Column end + $html .= '' . PHP_EOL; + } + + // Next column + ++$colNum; + } + + // Write row end + $html .= ' ' . PHP_EOL; + + // Return + return $html; + } + + /** + * Takes array where of CSS properties / values and converts to CSS string. + * + * @param array $pValue + * + * @return string + */ + private function assembleCSS(array $pValue = []) + { + $pairs = []; + foreach ($pValue as $property => $value) { + $pairs[] = $property . ':' . $value; + } + $string = implode('; ', $pairs); + + return $string; + } + + /** + * Get images root. + * + * @return string + */ + public function getImagesRoot() + { + return $this->imagesRoot; + } + + /** + * Set images root. + * + * @param string $pValue + * + * @return $this + */ + public function setImagesRoot($pValue) + { + $this->imagesRoot = $pValue; + + return $this; + } + + /** + * Get embed images. + * + * @return bool + */ + public function getEmbedImages() + { + return $this->embedImages; + } + + /** + * Set embed images. + * + * @param bool $pValue + * + * @return $this + */ + public function setEmbedImages($pValue) + { + $this->embedImages = $pValue; + + return $this; + } + + /** + * Get use inline CSS? + * + * @return bool + */ + public function getUseInlineCss() + { + return $this->useInlineCss; + } + + /** + * Set use inline CSS? + * + * @param bool $pValue + * + * @return $this + */ + public function setUseInlineCss($pValue) + { + $this->useInlineCss = $pValue; + + return $this; + } + + /** + * Get use embedded CSS? + * + * @return bool + */ + public function getUseEmbeddedCSS() + { + return $this->useEmbeddedCSS; + } + + /** + * Set use embedded CSS? + * + * @param bool $pValue + * + * @return $this + */ + public function setUseEmbeddedCSS($pValue) + { + $this->useEmbeddedCSS = $pValue; + + return $this; + } + + /** + * Add color to formatted string as inline style. + * + * @param string $pValue Plain formatted value without color + * @param string $pFormat Format code + * + * @return string + */ + public function formatColor($pValue, $pFormat) + { + // Color information, e.g. [Red] is always at the beginning + $color = null; // initialize + $matches = []; + + $color_regex = '/^\\[[a-zA-Z]+\\]/'; + if (preg_match($color_regex, $pFormat, $matches)) { + $color = str_replace(['[', ']'], '', $matches[0]); + $color = strtolower($color); + } + + // convert to PCDATA + $value = htmlspecialchars($pValue); + + // color span tag + if ($color !== null) { + $value = '' . $value . ''; + } + + return $value; + } + + /** + * Calculate information about HTML colspan and rowspan which is not always the same as Excel's. + */ + private function calculateSpans() + { + // Identify all cells that should be omitted in HTML due to cell merge. + // In HTML only the upper-left cell should be written and it should have + // appropriate rowspan / colspan attribute + $sheetIndexes = $this->sheetIndex !== null ? + [$this->sheetIndex] : range(0, $this->spreadsheet->getSheetCount() - 1); + + foreach ($sheetIndexes as $sheetIndex) { + $sheet = $this->spreadsheet->getSheet($sheetIndex); + + $candidateSpannedRow = []; + + // loop through all Excel merged cells + foreach ($sheet->getMergeCells() as $cells) { + [$cells] = Coordinate::splitRange($cells); + $first = $cells[0]; + $last = $cells[1]; + + [$fc, $fr] = Coordinate::coordinateFromString($first); + $fc = Coordinate::columnIndexFromString($fc) - 1; + + [$lc, $lr] = Coordinate::coordinateFromString($last); + $lc = Coordinate::columnIndexFromString($lc) - 1; + + // loop through the individual cells in the individual merge + $r = $fr - 1; + while ($r++ < $lr) { + // also, flag this row as a HTML row that is candidate to be omitted + $candidateSpannedRow[$r] = $r; + + $c = $fc - 1; + while ($c++ < $lc) { + if (!($c == $fc && $r == $fr)) { + // not the upper-left cell (should not be written in HTML) + $this->isSpannedCell[$sheetIndex][$r][$c] = [ + 'baseCell' => [$fr, $fc], + ]; + } else { + // upper-left is the base cell that should hold the colspan/rowspan attribute + $this->isBaseCell[$sheetIndex][$r][$c] = [ + 'xlrowspan' => $lr - $fr + 1, // Excel rowspan + 'rowspan' => $lr - $fr + 1, // HTML rowspan, value may change + 'xlcolspan' => $lc - $fc + 1, // Excel colspan + 'colspan' => $lc - $fc + 1, // HTML colspan, value may change + ]; + } + } + } + } + + // Identify which rows should be omitted in HTML. These are the rows where all the cells + // participate in a merge and the where base cells are somewhere above. + $countColumns = Coordinate::columnIndexFromString($sheet->getHighestColumn()); + foreach ($candidateSpannedRow as $rowIndex) { + if (isset($this->isSpannedCell[$sheetIndex][$rowIndex])) { + if (count($this->isSpannedCell[$sheetIndex][$rowIndex]) == $countColumns) { + $this->isSpannedRow[$sheetIndex][$rowIndex] = $rowIndex; + } + } + } + + // For each of the omitted rows we found above, the affected rowspans should be subtracted by 1 + if (isset($this->isSpannedRow[$sheetIndex])) { + foreach ($this->isSpannedRow[$sheetIndex] as $rowIndex) { + $adjustedBaseCells = []; + $c = -1; + $e = $countColumns - 1; + while ($c++ < $e) { + $baseCell = $this->isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell']; + + if (!in_array($baseCell, $adjustedBaseCells)) { + // subtract rowspan by 1 + --$this->isBaseCell[$sheetIndex][$baseCell[0]][$baseCell[1]]['rowspan']; + $adjustedBaseCells[] = $baseCell; + } + } + } + } + + // TODO: Same for columns + } + + // We have calculated the spans + $this->spansAreCalculated = true; + } + + private function setMargins(Worksheet $pSheet) + { + $htmlPage = '@page { '; + $htmlBody = 'body { '; + + $left = StringHelper::formatNumber($pSheet->getPageMargins()->getLeft()) . 'in; '; + $htmlPage .= 'margin-left: ' . $left; + $htmlBody .= 'margin-left: ' . $left; + $right = StringHelper::formatNumber($pSheet->getPageMargins()->getRight()) . 'in; '; + $htmlPage .= 'margin-right: ' . $right; + $htmlBody .= 'margin-right: ' . $right; + $top = StringHelper::formatNumber($pSheet->getPageMargins()->getTop()) . 'in; '; + $htmlPage .= 'margin-top: ' . $top; + $htmlBody .= 'margin-top: ' . $top; + $bottom = StringHelper::formatNumber($pSheet->getPageMargins()->getBottom()) . 'in; '; + $htmlPage .= 'margin-bottom: ' . $bottom; + $htmlBody .= 'margin-bottom: ' . $bottom; + + $htmlPage .= "}\n"; + $htmlBody .= "}\n"; + + return "\n"; + } + + /** + * Write a comment in the same format as LibreOffice. + * + * @see https://github.com/LibreOffice/core/blob/9fc9bf3240f8c62ad7859947ab8a033ac1fe93fa/sc/source/filter/html/htmlexp.cxx#L1073-L1092 + * + * @param Worksheet $pSheet + * @param string $coordinate + * + * @return string + */ + private function writeComment(Worksheet $pSheet, $coordinate) + { + $result = ''; + if (!$this->isPdf && isset($pSheet->getComments()[$coordinate])) { + $result .= ''; + $result .= '
' . nl2br($pSheet->getComment($coordinate)->getText()->getPlainText()) . '
'; + $result .= PHP_EOL; + } + + return $result; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/IWriter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/IWriter.php new file mode 100644 index 0000000..448b532 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/IWriter.php @@ -0,0 +1,93 @@ +setSpreadsheet($spreadsheet); + + $writerPartsArray = [ + 'content' => Content::class, + 'meta' => Meta::class, + 'meta_inf' => MetaInf::class, + 'mimetype' => Mimetype::class, + 'settings' => Settings::class, + 'styles' => Styles::class, + 'thumbnails' => Thumbnails::class, + ]; + + foreach ($writerPartsArray as $writer => $class) { + $this->writerParts[$writer] = new $class($this); + } + } + + /** + * Get writer part. + * + * @param string $pPartName Writer part name + * + * @return null|Ods\WriterPart + */ + public function getWriterPart($pPartName) + { + if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) { + return $this->writerParts[strtolower($pPartName)]; + } + + return null; + } + + /** + * Save PhpSpreadsheet to file. + * + * @param string $pFilename + * + * @throws WriterException + */ + public function save($pFilename) + { + if (!$this->spreadSheet) { + throw new WriterException('PhpSpreadsheet object unassigned.'); + } + + // garbage collect + $this->spreadSheet->garbageCollect(); + + // If $pFilename is php://output or php://stdout, make it a temporary file... + $originalFilename = $pFilename; + if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') { + $pFilename = @tempnam(File::sysGetTempDir(), 'phpxltmp'); + if ($pFilename == '') { + $pFilename = $originalFilename; + } + } + + $zip = $this->createZip($pFilename); + + $zip->addFromString('META-INF/manifest.xml', $this->getWriterPart('meta_inf')->writeManifest()); + $zip->addFromString('Thumbnails/thumbnail.png', $this->getWriterPart('thumbnails')->writeThumbnail()); + $zip->addFromString('content.xml', $this->getWriterPart('content')->write()); + $zip->addFromString('meta.xml', $this->getWriterPart('meta')->write()); + $zip->addFromString('mimetype', $this->getWriterPart('mimetype')->write()); + $zip->addFromString('settings.xml', $this->getWriterPart('settings')->write()); + $zip->addFromString('styles.xml', $this->getWriterPart('styles')->write()); + + // Close file + if ($zip->close() === false) { + throw new WriterException("Could not close zip file $pFilename."); + } + + // If a temporary file was used, copy it to the correct file stream + if ($originalFilename != $pFilename) { + if (copy($pFilename, $originalFilename) === false) { + throw new WriterException("Could not copy temporary zip file $pFilename to $originalFilename."); + } + @unlink($pFilename); + } + } + + /** + * Create zip object. + * + * @param string $pFilename + * + * @throws WriterException + * + * @return ZipArchive + */ + private function createZip($pFilename) + { + // Create new ZIP file and open it for writing + $zip = new ZipArchive(); + + if (file_exists($pFilename)) { + unlink($pFilename); + } + // Try opening the ZIP file + if ($zip->open($pFilename, ZipArchive::OVERWRITE) !== true) { + if ($zip->open($pFilename, ZipArchive::CREATE) !== true) { + throw new WriterException("Could not open $pFilename for writing."); + } + } + + return $zip; + } + + /** + * Get Spreadsheet object. + * + * @throws WriterException + * + * @return Spreadsheet + */ + public function getSpreadsheet() + { + if ($this->spreadSheet !== null) { + return $this->spreadSheet; + } + + throw new WriterException('No PhpSpreadsheet assigned.'); + } + + /** + * Set Spreadsheet object. + * + * @param Spreadsheet $spreadsheet PhpSpreadsheet object + * + * @return $this + */ + public function setSpreadsheet(Spreadsheet $spreadsheet) + { + $this->spreadSheet = $spreadsheet; + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php new file mode 100644 index 0000000..2f543be --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Cell/Comment.php @@ -0,0 +1,33 @@ + + */ +class Comment +{ + public static function write(XMLWriter $objWriter, Cell $cell) + { + $comments = $cell->getWorksheet()->getComments(); + if (!isset($comments[$cell->getCoordinate()])) { + return; + } + $comment = $comments[$cell->getCoordinate()]; + + $objWriter->startElement('office:annotation'); + $objWriter->writeAttribute('svg:width', $comment->getWidth()); + $objWriter->writeAttribute('svg:height', $comment->getHeight()); + $objWriter->writeAttribute('svg:x', $comment->getMarginLeft()); + $objWriter->writeAttribute('svg:y', $comment->getMarginTop()); + $objWriter->writeElement('dc:creator', $comment->getAuthor()); + $objWriter->writeElement('text:p', $comment->getText()->getPlainText()); + $objWriter->endElement(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php new file mode 100644 index 0000000..dea5100 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php @@ -0,0 +1,395 @@ + + */ +class Content extends WriterPart +{ + const NUMBER_COLS_REPEATED_MAX = 1024; + const NUMBER_ROWS_REPEATED_MAX = 1048576; + const CELL_STYLE_PREFIX = 'ce'; + + /** + * Write content.xml to XML format. + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * + * @return string XML Output + */ + public function write() + { + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8'); + + // Content + $objWriter->startElement('office:document-content'); + $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); + $objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0'); + $objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); + $objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); + $objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'); + $objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'); + $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); + $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); + $objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); + $objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'); + $objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'); + $objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'); + $objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0'); + $objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0'); + $objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML'); + $objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'); + $objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0'); + $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); + $objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer'); + $objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc'); + $objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events'); + $objWriter->writeAttribute('xmlns:xforms', 'http://www.w3.org/2002/xforms'); + $objWriter->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema'); + $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report'); + $objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2'); + $objWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml'); + $objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#'); + $objWriter->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table'); + $objWriter->writeAttribute('xmlns:field', 'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0'); + $objWriter->writeAttribute('xmlns:formx', 'urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0'); + $objWriter->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/'); + $objWriter->writeAttribute('office:version', '1.2'); + + $objWriter->writeElement('office:scripts'); + $objWriter->writeElement('office:font-face-decls'); + + // Styles XF + $objWriter->startElement('office:automatic-styles'); + $this->writeXfStyles($objWriter, $this->getParentWriter()->getSpreadsheet()); + $objWriter->endElement(); + + $objWriter->startElement('office:body'); + $objWriter->startElement('office:spreadsheet'); + $objWriter->writeElement('table:calculation-settings'); + + $this->writeSheets($objWriter); + + $objWriter->writeElement('table:named-expressions'); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + + return $objWriter->getData(); + } + + /** + * Write sheets. + * + * @param XMLWriter $objWriter + */ + private function writeSheets(XMLWriter $objWriter) + { + $spreadsheet = $this->getParentWriter()->getSpreadsheet(); // @var $spreadsheet Spreadsheet + + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + $objWriter->startElement('table:table'); + $objWriter->writeAttribute('table:name', $spreadsheet->getSheet($i)->getTitle()); + $objWriter->writeElement('office:forms'); + $objWriter->startElement('table:table-column'); + $objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX); + $objWriter->endElement(); + $this->writeRows($objWriter, $spreadsheet->getSheet($i)); + $objWriter->endElement(); + } + } + + /** + * Write rows of the specified sheet. + * + * @param XMLWriter $objWriter + * @param Worksheet $sheet + */ + private function writeRows(XMLWriter $objWriter, Worksheet $sheet) + { + $numberRowsRepeated = self::NUMBER_ROWS_REPEATED_MAX; + $span_row = 0; + $rows = $sheet->getRowIterator(); + while ($rows->valid()) { + --$numberRowsRepeated; + $row = $rows->current(); + if ($row->getCellIterator()->valid()) { + if ($span_row) { + $objWriter->startElement('table:table-row'); + if ($span_row > 1) { + $objWriter->writeAttribute('table:number-rows-repeated', $span_row); + } + $objWriter->startElement('table:table-cell'); + $objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX); + $objWriter->endElement(); + $objWriter->endElement(); + $span_row = 0; + } + $objWriter->startElement('table:table-row'); + $this->writeCells($objWriter, $row); + $objWriter->endElement(); + } else { + ++$span_row; + } + $rows->next(); + } + } + + /** + * Write cells of the specified row. + * + * @param XMLWriter $objWriter + * @param Row $row + * + * @throws Exception + */ + private function writeCells(XMLWriter $objWriter, Row $row) + { + $numberColsRepeated = self::NUMBER_COLS_REPEATED_MAX; + $prevColumn = -1; + $cells = $row->getCellIterator(); + while ($cells->valid()) { + /** @var \PhpOffice\PhpSpreadsheet\Cell\Cell $cell */ + $cell = $cells->current(); + $column = Coordinate::columnIndexFromString($cell->getColumn()) - 1; + + $this->writeCellSpan($objWriter, $column, $prevColumn); + $objWriter->startElement('table:table-cell'); + $this->writeCellMerge($objWriter, $cell); + + // Style XF + $style = $cell->getXfIndex(); + if ($style !== null) { + $objWriter->writeAttribute('table:style-name', self::CELL_STYLE_PREFIX . $style); + } + + switch ($cell->getDataType()) { + case DataType::TYPE_BOOL: + $objWriter->writeAttribute('office:value-type', 'boolean'); + $objWriter->writeAttribute('office:value', $cell->getValue()); + $objWriter->writeElement('text:p', $cell->getValue()); + + break; + case DataType::TYPE_ERROR: + throw new Exception('Writing of error not implemented yet.'); + + break; + case DataType::TYPE_FORMULA: + $formulaValue = $cell->getValue(); + if ($this->getParentWriter()->getPreCalculateFormulas()) { + try { + $formulaValue = $cell->getCalculatedValue(); + } catch (Exception $e) { + // don't do anything + } + } + $objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue()); + if (is_numeric($formulaValue)) { + $objWriter->writeAttribute('office:value-type', 'float'); + } else { + $objWriter->writeAttribute('office:value-type', 'string'); + } + $objWriter->writeAttribute('office:value', $formulaValue); + $objWriter->writeElement('text:p', $formulaValue); + + break; + case DataType::TYPE_INLINE: + throw new Exception('Writing of inline not implemented yet.'); + + break; + case DataType::TYPE_NUMERIC: + $objWriter->writeAttribute('office:value-type', 'float'); + $objWriter->writeAttribute('office:value', $cell->getValue()); + $objWriter->writeElement('text:p', $cell->getValue()); + + break; + case DataType::TYPE_STRING: + $objWriter->writeAttribute('office:value-type', 'string'); + $objWriter->writeElement('text:p', $cell->getValue()); + + break; + } + Comment::write($objWriter, $cell); + $objWriter->endElement(); + $prevColumn = $column; + $cells->next(); + } + $numberColsRepeated = $numberColsRepeated - $prevColumn - 1; + if ($numberColsRepeated > 0) { + if ($numberColsRepeated > 1) { + $objWriter->startElement('table:table-cell'); + $objWriter->writeAttribute('table:number-columns-repeated', $numberColsRepeated); + $objWriter->endElement(); + } else { + $objWriter->writeElement('table:table-cell'); + } + } + } + + /** + * Write span. + * + * @param XMLWriter $objWriter + * @param int $curColumn + * @param int $prevColumn + */ + private function writeCellSpan(XMLWriter $objWriter, $curColumn, $prevColumn) + { + $diff = $curColumn - $prevColumn - 1; + if (1 === $diff) { + $objWriter->writeElement('table:table-cell'); + } elseif ($diff > 1) { + $objWriter->startElement('table:table-cell'); + $objWriter->writeAttribute('table:number-columns-repeated', $diff); + $objWriter->endElement(); + } + } + + /** + * Write XF cell styles. + * + * @param XMLWriter $writer + * @param Spreadsheet $spreadsheet + */ + private function writeXfStyles(XMLWriter $writer, Spreadsheet $spreadsheet) + { + foreach ($spreadsheet->getCellXfCollection() as $style) { + $writer->startElement('style:style'); + $writer->writeAttribute('style:name', self::CELL_STYLE_PREFIX . $style->getIndex()); + $writer->writeAttribute('style:family', 'table-cell'); + $writer->writeAttribute('style:parent-style-name', 'Default'); + + // style:text-properties + + // Font + $writer->startElement('style:text-properties'); + + $font = $style->getFont(); + + if ($font->getBold()) { + $writer->writeAttribute('fo:font-weight', 'bold'); + $writer->writeAttribute('style:font-weight-complex', 'bold'); + $writer->writeAttribute('style:font-weight-asian', 'bold'); + } + + if ($font->getItalic()) { + $writer->writeAttribute('fo:font-style', 'italic'); + } + + if ($color = $font->getColor()) { + $writer->writeAttribute('fo:color', sprintf('#%s', $color->getRGB())); + } + + if ($family = $font->getName()) { + $writer->writeAttribute('fo:font-family', $family); + } + + if ($size = $font->getSize()) { + $writer->writeAttribute('fo:font-size', sprintf('%.1Fpt', $size)); + } + + if ($font->getUnderline() && $font->getUnderline() != Font::UNDERLINE_NONE) { + $writer->writeAttribute('style:text-underline-style', 'solid'); + $writer->writeAttribute('style:text-underline-width', 'auto'); + $writer->writeAttribute('style:text-underline-color', 'font-color'); + + switch ($font->getUnderline()) { + case Font::UNDERLINE_DOUBLE: + $writer->writeAttribute('style:text-underline-type', 'double'); + + break; + case Font::UNDERLINE_SINGLE: + $writer->writeAttribute('style:text-underline-type', 'single'); + + break; + } + } + + $writer->endElement(); // Close style:text-properties + + // style:table-cell-properties + + $writer->startElement('style:table-cell-properties'); + $writer->writeAttribute('style:rotation-align', 'none'); + + // Fill + if ($fill = $style->getFill()) { + switch ($fill->getFillType()) { + case Fill::FILL_SOLID: + $writer->writeAttribute('fo:background-color', sprintf( + '#%s', + strtolower($fill->getStartColor()->getRGB()) + )); + + break; + case Fill::FILL_GRADIENT_LINEAR: + case Fill::FILL_GRADIENT_PATH: + /// TODO :: To be implemented + break; + case Fill::FILL_NONE: + default: + } + } + + $writer->endElement(); // Close style:table-cell-properties + + // End + + $writer->endElement(); // Close style:style + } + } + + /** + * Write attributes for merged cell. + * + * @param XMLWriter $objWriter + * @param Cell $cell + * + * @throws \PhpOffice\PhpSpreadsheet\Exception + */ + private function writeCellMerge(XMLWriter $objWriter, Cell $cell) + { + if (!$cell->isMergeRangeValueCell()) { + return; + } + + $mergeRange = Coordinate::splitRange($cell->getMergeRange()); + [$startCell, $endCell] = $mergeRange[0]; + $start = Coordinate::coordinateFromString($startCell); + $end = Coordinate::coordinateFromString($endCell); + $columnSpan = Coordinate::columnIndexFromString($end[0]) - Coordinate::columnIndexFromString($start[0]) + 1; + $rowSpan = $end[1] - $start[1] + 1; + + $objWriter->writeAttribute('table:number-columns-spanned', $columnSpan); + $objWriter->writeAttribute('table:number-rows-spanned', $rowSpan); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Meta.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Meta.php new file mode 100644 index 0000000..ffe5eff --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Meta.php @@ -0,0 +1,77 @@ +getParentWriter()->getSpreadsheet(); + } + + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8'); + + // Meta + $objWriter->startElement('office:document-meta'); + + $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); + $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); + $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); + $objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); + $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); + $objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#'); + $objWriter->writeAttribute('office:version', '1.2'); + + $objWriter->startElement('office:meta'); + + $objWriter->writeElement('meta:initial-creator', $spreadsheet->getProperties()->getCreator()); + $objWriter->writeElement('dc:creator', $spreadsheet->getProperties()->getCreator()); + $objWriter->writeElement('meta:creation-date', date(DATE_W3C, $spreadsheet->getProperties()->getCreated())); + $objWriter->writeElement('dc:date', date(DATE_W3C, $spreadsheet->getProperties()->getCreated())); + $objWriter->writeElement('dc:title', $spreadsheet->getProperties()->getTitle()); + $objWriter->writeElement('dc:description', $spreadsheet->getProperties()->getDescription()); + $objWriter->writeElement('dc:subject', $spreadsheet->getProperties()->getSubject()); + $keywords = explode(' ', $spreadsheet->getProperties()->getKeywords()); + foreach ($keywords as $keyword) { + $objWriter->writeElement('meta:keyword', $keyword); + } + + // + $objWriter->startElement('meta:user-defined'); + $objWriter->writeAttribute('meta:name', 'Company'); + $objWriter->writeRaw($spreadsheet->getProperties()->getCompany()); + $objWriter->endElement(); + + $objWriter->startElement('meta:user-defined'); + $objWriter->writeAttribute('meta:name', 'category'); + $objWriter->writeRaw($spreadsheet->getProperties()->getCategory()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + return $objWriter->getData(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/MetaInf.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/MetaInf.php new file mode 100644 index 0000000..1ec9d1e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/MetaInf.php @@ -0,0 +1,62 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8'); + + // Manifest + $objWriter->startElement('manifest:manifest'); + $objWriter->writeAttribute('xmlns:manifest', 'urn:oasis:names:tc:opendocument:xmlns:manifest:1.0'); + $objWriter->writeAttribute('manifest:version', '1.2'); + + $objWriter->startElement('manifest:file-entry'); + $objWriter->writeAttribute('manifest:full-path', '/'); + $objWriter->writeAttribute('manifest:version', '1.2'); + $objWriter->writeAttribute('manifest:media-type', 'application/vnd.oasis.opendocument.spreadsheet'); + $objWriter->endElement(); + $objWriter->startElement('manifest:file-entry'); + $objWriter->writeAttribute('manifest:full-path', 'meta.xml'); + $objWriter->writeAttribute('manifest:media-type', 'text/xml'); + $objWriter->endElement(); + $objWriter->startElement('manifest:file-entry'); + $objWriter->writeAttribute('manifest:full-path', 'settings.xml'); + $objWriter->writeAttribute('manifest:media-type', 'text/xml'); + $objWriter->endElement(); + $objWriter->startElement('manifest:file-entry'); + $objWriter->writeAttribute('manifest:full-path', 'content.xml'); + $objWriter->writeAttribute('manifest:media-type', 'text/xml'); + $objWriter->endElement(); + $objWriter->startElement('manifest:file-entry'); + $objWriter->writeAttribute('manifest:full-path', 'Thumbnails/thumbnail.png'); + $objWriter->writeAttribute('manifest:media-type', 'image/png'); + $objWriter->endElement(); + $objWriter->startElement('manifest:file-entry'); + $objWriter->writeAttribute('manifest:full-path', 'styles.xml'); + $objWriter->writeAttribute('manifest:media-type', 'text/xml'); + $objWriter->endElement(); + $objWriter->endElement(); + + return $objWriter->getData(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Mimetype.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Mimetype.php new file mode 100644 index 0000000..d0fed2b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Mimetype.php @@ -0,0 +1,20 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8'); + + // Settings + $objWriter->startElement('office:document-settings'); + $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); + $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); + $objWriter->writeAttribute('xmlns:config', 'urn:oasis:names:tc:opendocument:xmlns:config:1.0'); + $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); + $objWriter->writeAttribute('office:version', '1.2'); + + $objWriter->startElement('office:settings'); + $objWriter->startElement('config:config-item-set'); + $objWriter->writeAttribute('config:name', 'ooo:view-settings'); + $objWriter->startElement('config:config-item-map-indexed'); + $objWriter->writeAttribute('config:name', 'Views'); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->startElement('config:config-item-set'); + $objWriter->writeAttribute('config:name', 'ooo:configuration-settings'); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + + return $objWriter->getData(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Styles.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Styles.php new file mode 100644 index 0000000..eaf5cad --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Styles.php @@ -0,0 +1,70 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8'); + + // Content + $objWriter->startElement('office:document-styles'); + $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); + $objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0'); + $objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); + $objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); + $objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'); + $objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'); + $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); + $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); + $objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); + $objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'); + $objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'); + $objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'); + $objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0'); + $objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0'); + $objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML'); + $objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'); + $objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0'); + $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); + $objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer'); + $objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc'); + $objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events'); + $objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report'); + $objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2'); + $objWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml'); + $objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#'); + $objWriter->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table'); + $objWriter->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/'); + $objWriter->writeAttribute('office:version', '1.2'); + + $objWriter->writeElement('office:font-face-decls'); + $objWriter->writeElement('office:styles'); + $objWriter->writeElement('office:automatic-styles'); + $objWriter->writeElement('office:master-styles'); + $objWriter->endElement(); + + return $objWriter->getData(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php new file mode 100644 index 0000000..a29a14a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Thumbnails.php @@ -0,0 +1,20 @@ +parentWriter; + } + + /** + * Set parent Ods writer. + * + * @param Ods $writer + */ + public function __construct(Ods $writer) + { + $this->parentWriter = $writer; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php new file mode 100644 index 0000000..d918456 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf.php @@ -0,0 +1,283 @@ + 'LETTER', // (8.5 in. by 11 in.) + PageSetup::PAPERSIZE_LETTER_SMALL => 'LETTER', // (8.5 in. by 11 in.) + PageSetup::PAPERSIZE_TABLOID => [792.00, 1224.00], // (11 in. by 17 in.) + PageSetup::PAPERSIZE_LEDGER => [1224.00, 792.00], // (17 in. by 11 in.) + PageSetup::PAPERSIZE_LEGAL => 'LEGAL', // (8.5 in. by 14 in.) + PageSetup::PAPERSIZE_STATEMENT => [396.00, 612.00], // (5.5 in. by 8.5 in.) + PageSetup::PAPERSIZE_EXECUTIVE => 'EXECUTIVE', // (7.25 in. by 10.5 in.) + PageSetup::PAPERSIZE_A3 => 'A3', // (297 mm by 420 mm) + PageSetup::PAPERSIZE_A4 => 'A4', // (210 mm by 297 mm) + PageSetup::PAPERSIZE_A4_SMALL => 'A4', // (210 mm by 297 mm) + PageSetup::PAPERSIZE_A5 => 'A5', // (148 mm by 210 mm) + PageSetup::PAPERSIZE_B4 => 'B4', // (250 mm by 353 mm) + PageSetup::PAPERSIZE_B5 => 'B5', // (176 mm by 250 mm) + PageSetup::PAPERSIZE_FOLIO => 'FOLIO', // (8.5 in. by 13 in.) + PageSetup::PAPERSIZE_QUARTO => [609.45, 779.53], // (215 mm by 275 mm) + PageSetup::PAPERSIZE_STANDARD_1 => [720.00, 1008.00], // (10 in. by 14 in.) + PageSetup::PAPERSIZE_STANDARD_2 => [792.00, 1224.00], // (11 in. by 17 in.) + PageSetup::PAPERSIZE_NOTE => 'LETTER', // (8.5 in. by 11 in.) + PageSetup::PAPERSIZE_NO9_ENVELOPE => [279.00, 639.00], // (3.875 in. by 8.875 in.) + PageSetup::PAPERSIZE_NO10_ENVELOPE => [297.00, 684.00], // (4.125 in. by 9.5 in.) + PageSetup::PAPERSIZE_NO11_ENVELOPE => [324.00, 747.00], // (4.5 in. by 10.375 in.) + PageSetup::PAPERSIZE_NO12_ENVELOPE => [342.00, 792.00], // (4.75 in. by 11 in.) + PageSetup::PAPERSIZE_NO14_ENVELOPE => [360.00, 828.00], // (5 in. by 11.5 in.) + PageSetup::PAPERSIZE_C => [1224.00, 1584.00], // (17 in. by 22 in.) + PageSetup::PAPERSIZE_D => [1584.00, 2448.00], // (22 in. by 34 in.) + PageSetup::PAPERSIZE_E => [2448.00, 3168.00], // (34 in. by 44 in.) + PageSetup::PAPERSIZE_DL_ENVELOPE => [311.81, 623.62], // (110 mm by 220 mm) + PageSetup::PAPERSIZE_C5_ENVELOPE => 'C5', // (162 mm by 229 mm) + PageSetup::PAPERSIZE_C3_ENVELOPE => 'C3', // (324 mm by 458 mm) + PageSetup::PAPERSIZE_C4_ENVELOPE => 'C4', // (229 mm by 324 mm) + PageSetup::PAPERSIZE_C6_ENVELOPE => 'C6', // (114 mm by 162 mm) + PageSetup::PAPERSIZE_C65_ENVELOPE => [323.15, 649.13], // (114 mm by 229 mm) + PageSetup::PAPERSIZE_B4_ENVELOPE => 'B4', // (250 mm by 353 mm) + PageSetup::PAPERSIZE_B5_ENVELOPE => 'B5', // (176 mm by 250 mm) + PageSetup::PAPERSIZE_B6_ENVELOPE => [498.90, 354.33], // (176 mm by 125 mm) + PageSetup::PAPERSIZE_ITALY_ENVELOPE => [311.81, 651.97], // (110 mm by 230 mm) + PageSetup::PAPERSIZE_MONARCH_ENVELOPE => [279.00, 540.00], // (3.875 in. by 7.5 in.) + PageSetup::PAPERSIZE_6_3_4_ENVELOPE => [261.00, 468.00], // (3.625 in. by 6.5 in.) + PageSetup::PAPERSIZE_US_STANDARD_FANFOLD => [1071.00, 792.00], // (14.875 in. by 11 in.) + PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD => [612.00, 864.00], // (8.5 in. by 12 in.) + PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD => 'FOLIO', // (8.5 in. by 13 in.) + PageSetup::PAPERSIZE_ISO_B4 => 'B4', // (250 mm by 353 mm) + PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD => [566.93, 419.53], // (200 mm by 148 mm) + PageSetup::PAPERSIZE_STANDARD_PAPER_1 => [648.00, 792.00], // (9 in. by 11 in.) + PageSetup::PAPERSIZE_STANDARD_PAPER_2 => [720.00, 792.00], // (10 in. by 11 in.) + PageSetup::PAPERSIZE_STANDARD_PAPER_3 => [1080.00, 792.00], // (15 in. by 11 in.) + PageSetup::PAPERSIZE_INVITE_ENVELOPE => [623.62, 623.62], // (220 mm by 220 mm) + PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER => [667.80, 864.00], // (9.275 in. by 12 in.) + PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER => [667.80, 1080.00], // (9.275 in. by 15 in.) + PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER => [841.68, 1296.00], // (11.69 in. by 18 in.) + PageSetup::PAPERSIZE_A4_EXTRA_PAPER => [668.98, 912.76], // (236 mm by 322 mm) + PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER => [595.80, 792.00], // (8.275 in. by 11 in.) + PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER => 'A4', // (210 mm by 297 mm) + PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER => [667.80, 864.00], // (9.275 in. by 12 in.) + PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER => [643.46, 1009.13], // (227 mm by 356 mm) + PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER => [864.57, 1380.47], // (305 mm by 487 mm) + PageSetup::PAPERSIZE_LETTER_PLUS_PAPER => [612.00, 913.68], // (8.5 in. by 12.69 in.) + PageSetup::PAPERSIZE_A4_PLUS_PAPER => [595.28, 935.43], // (210 mm by 330 mm) + PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER => 'A5', // (148 mm by 210 mm) + PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER => [515.91, 728.50], // (182 mm by 257 mm) + PageSetup::PAPERSIZE_A3_EXTRA_PAPER => [912.76, 1261.42], // (322 mm by 445 mm) + PageSetup::PAPERSIZE_A5_EXTRA_PAPER => [493.23, 666.14], // (174 mm by 235 mm) + PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER => [569.76, 782.36], // (201 mm by 276 mm) + PageSetup::PAPERSIZE_A2_PAPER => 'A2', // (420 mm by 594 mm) + PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER => 'A3', // (297 mm by 420 mm) + PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER => [912.76, 1261.42], // (322 mm by 445 mm) + ]; + + /** + * Create a new PDF Writer instance. + * + * @param Spreadsheet $spreadsheet Spreadsheet object + */ + public function __construct(Spreadsheet $spreadsheet) + { + parent::__construct($spreadsheet); + $this->setUseInlineCss(true); + $this->tempDir = File::sysGetTempDir(); + } + + /** + * Get Font. + * + * @return string + */ + public function getFont() + { + return $this->font; + } + + /** + * Set font. Examples: + * 'arialunicid0-chinese-simplified' + * 'arialunicid0-chinese-traditional' + * 'arialunicid0-korean' + * 'arialunicid0-japanese'. + * + * @param string $fontName + * + * @return $this + */ + public function setFont($fontName) + { + $this->font = $fontName; + + return $this; + } + + /** + * Get Paper Size. + * + * @return int + */ + public function getPaperSize() + { + return $this->paperSize; + } + + /** + * Set Paper Size. + * + * @param string $pValue Paper size see PageSetup::PAPERSIZE_* + * + * @return self + */ + public function setPaperSize($pValue) + { + $this->paperSize = $pValue; + + return $this; + } + + /** + * Get Orientation. + * + * @return string + */ + public function getOrientation() + { + return $this->orientation; + } + + /** + * Set Orientation. + * + * @param string $pValue Page orientation see PageSetup::ORIENTATION_* + * + * @return self + */ + public function setOrientation($pValue) + { + $this->orientation = $pValue; + + return $this; + } + + /** + * Get temporary storage directory. + * + * @return string + */ + public function getTempDir() + { + return $this->tempDir; + } + + /** + * Set temporary storage directory. + * + * @param string $pValue Temporary storage directory + * + * @throws WriterException when directory does not exist + * + * @return self + */ + public function setTempDir($pValue) + { + if (is_dir($pValue)) { + $this->tempDir = $pValue; + } else { + throw new WriterException("Directory does not exist: $pValue"); + } + + return $this; + } + + /** + * Save Spreadsheet to PDF file, pre-save. + * + * @param string $pFilename Name of the file to save as + * + * @throws WriterException + * + * @return resource + */ + protected function prepareForSave($pFilename) + { + // garbage collect + $this->spreadsheet->garbageCollect(); + + $this->saveArrayReturnType = Calculation::getArrayReturnType(); + Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE); + + // Open file + $fileHandle = fopen($pFilename, 'w'); + if ($fileHandle === false) { + throw new WriterException("Could not open file $pFilename for writing."); + } + + // Set PDF + $this->isPdf = true; + // Build CSS + $this->buildCSS(true); + + return $fileHandle; + } + + /** + * Save PhpSpreadsheet to PDF file, post-save. + * + * @param resource $fileHandle + */ + protected function restoreStateAfterSave($fileHandle) + { + // Close file + fclose($fileHandle); + + Calculation::setArrayReturnType($this->saveArrayReturnType); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php new file mode 100644 index 0000000..3c3044d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Dompdf.php @@ -0,0 +1,78 @@ +getSheetIndex() === null) { + $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() + == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); + } else { + $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() + == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); + } + + $orientation = ($orientation == 'L') ? 'landscape' : 'portrait'; + + // Override Page Orientation + if ($this->getOrientation() !== null) { + $orientation = ($this->getOrientation() == PageSetup::ORIENTATION_DEFAULT) + ? PageSetup::ORIENTATION_PORTRAIT + : $this->getOrientation(); + } + // Override Paper Size + if ($this->getPaperSize() !== null) { + $printPaperSize = $this->getPaperSize(); + } + + if (isset(self::$paperSizes[$printPaperSize])) { + $paperSize = self::$paperSizes[$printPaperSize]; + } + + // Create PDF + $pdf = $this->createExternalWriterInstance(); + $pdf->setPaper(strtolower($paperSize), $orientation); + + $pdf->loadHtml( + $this->generateHTMLHeader(false) . + $this->generateSheetData() . + $this->generateHTMLFooter() + ); + $pdf->render(); + + // Write to file + fwrite($fileHandle, $pdf->output()); + + parent::restoreStateAfterSave($fileHandle); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php new file mode 100644 index 0000000..fd2664a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Mpdf.php @@ -0,0 +1,112 @@ +getSheetIndex()) { + $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() + == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); + } else { + $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() + == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); + } + $this->setOrientation($orientation); + + // Override Page Orientation + if (null !== $this->getOrientation()) { + $orientation = ($this->getOrientation() == PageSetup::ORIENTATION_DEFAULT) + ? PageSetup::ORIENTATION_PORTRAIT + : $this->getOrientation(); + } + $orientation = strtoupper($orientation); + + // Override Paper Size + if (null !== $this->getPaperSize()) { + $printPaperSize = $this->getPaperSize(); + } + + if (isset(self::$paperSizes[$printPaperSize])) { + $paperSize = self::$paperSizes[$printPaperSize]; + } + + // Create PDF + $config = ['tempDir' => $this->tempDir]; + $pdf = $this->createExternalWriterInstance($config); + $ortmp = $orientation; + $pdf->_setPageSize(strtoupper($paperSize), $ortmp); + $pdf->DefOrientation = $orientation; + $pdf->AddPageByArray([ + 'orientation' => $orientation, + 'margin-left' => $this->inchesToMm($this->spreadsheet->getActiveSheet()->getPageMargins()->getLeft()), + 'margin-right' => $this->inchesToMm($this->spreadsheet->getActiveSheet()->getPageMargins()->getRight()), + 'margin-top' => $this->inchesToMm($this->spreadsheet->getActiveSheet()->getPageMargins()->getTop()), + 'margin-bottom' => $this->inchesToMm($this->spreadsheet->getActiveSheet()->getPageMargins()->getBottom()), + ]); + + // Document info + $pdf->SetTitle($this->spreadsheet->getProperties()->getTitle()); + $pdf->SetAuthor($this->spreadsheet->getProperties()->getCreator()); + $pdf->SetSubject($this->spreadsheet->getProperties()->getSubject()); + $pdf->SetKeywords($this->spreadsheet->getProperties()->getKeywords()); + $pdf->SetCreator($this->spreadsheet->getProperties()->getCreator()); + + $pdf->WriteHTML($this->generateHTMLHeader(false)); + $html = $this->generateSheetData(); + foreach (\array_chunk(\explode(PHP_EOL, $html), 1000) as $lines) { + $pdf->WriteHTML(\implode(PHP_EOL, $lines)); + } + $pdf->WriteHTML($this->generateHTMLFooter()); + + // Write to file + fwrite($fileHandle, $pdf->Output('', 'S')); + + parent::restoreStateAfterSave($fileHandle); + } + + /** + * Convert inches to mm. + * + * @param float $inches + * + * @return float + */ + private function inchesToMm($inches) + { + return $inches * 25.4; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php new file mode 100644 index 0000000..8a97b8f --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php @@ -0,0 +1,98 @@ +getSheetIndex() === null) { + $orientation = ($this->spreadsheet->getSheet(0)->getPageSetup()->getOrientation() + == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->spreadsheet->getSheet(0)->getPageSetup()->getPaperSize(); + $printMargins = $this->spreadsheet->getSheet(0)->getPageMargins(); + } else { + $orientation = ($this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() + == PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P'; + $printPaperSize = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize(); + $printMargins = $this->spreadsheet->getSheet($this->getSheetIndex())->getPageMargins(); + } + + // Override Page Orientation + if ($this->getOrientation() !== null) { + $orientation = ($this->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) + ? 'L' + : 'P'; + } + // Override Paper Size + if ($this->getPaperSize() !== null) { + $printPaperSize = $this->getPaperSize(); + } + + if (isset(self::$paperSizes[$printPaperSize])) { + $paperSize = self::$paperSizes[$printPaperSize]; + } + + // Create PDF + $pdf = $this->createExternalWriterInstance($orientation, 'pt', $paperSize); + $pdf->setFontSubsetting(false); + // Set margins, converting inches to points (using 72 dpi) + $pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72); + $pdf->SetAutoPageBreak(true, $printMargins->getBottom() * 72); + + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + + $pdf->AddPage(); + + // Set the appropriate font + $pdf->SetFont($this->getFont()); + $pdf->writeHTML( + $this->generateHTMLHeader(false) . + $this->generateSheetData() . + $this->generateHTMLFooter() + ); + + // Document info + $pdf->SetTitle($this->spreadsheet->getProperties()->getTitle()); + $pdf->SetAuthor($this->spreadsheet->getProperties()->getCreator()); + $pdf->SetSubject($this->spreadsheet->getProperties()->getSubject()); + $pdf->SetKeywords($this->spreadsheet->getProperties()->getKeywords()); + $pdf->SetCreator($this->spreadsheet->getProperties()->getCreator()); + + // Write to file + fwrite($fileHandle, $pdf->output($pFilename, 'S')); + + parent::restoreStateAfterSave($fileHandle); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php new file mode 100644 index 0000000..6932eb1 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls.php @@ -0,0 +1,946 @@ +spreadsheet = $spreadsheet; + + $this->parser = new Xls\Parser(); + } + + /** + * Save Spreadsheet to file. + * + * @param string $pFilename + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + */ + public function save($pFilename) + { + // garbage collect + $this->spreadsheet->garbageCollect(); + + $saveDebugLog = Calculation::getInstance($this->spreadsheet)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog(false); + $saveDateReturnType = Functions::getReturnDateType(); + Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); + + // initialize colors array + $this->colors = []; + + // Initialise workbook writer + $this->writerWorkbook = new Xls\Workbook($this->spreadsheet, $this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser); + + // Initialise worksheet writers + $countSheets = $this->spreadsheet->getSheetCount(); + for ($i = 0; $i < $countSheets; ++$i) { + $this->writerWorksheets[$i] = new Xls\Worksheet($this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser, $this->preCalculateFormulas, $this->spreadsheet->getSheet($i)); + } + + // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook. + $this->buildWorksheetEschers(); + $this->buildWorkbookEscher(); + + // add 15 identical cell style Xfs + // for now, we use the first cellXf instead of cellStyleXf + $cellXfCollection = $this->spreadsheet->getCellXfCollection(); + for ($i = 0; $i < 15; ++$i) { + $this->writerWorkbook->addXfWriter($cellXfCollection[0], true); + } + + // add all the cell Xfs + foreach ($this->spreadsheet->getCellXfCollection() as $style) { + $this->writerWorkbook->addXfWriter($style, false); + } + + // add fonts from rich text eleemnts + for ($i = 0; $i < $countSheets; ++$i) { + foreach ($this->writerWorksheets[$i]->phpSheet->getCoordinates() as $coordinate) { + $cell = $this->writerWorksheets[$i]->phpSheet->getCell($coordinate); + $cVal = $cell->getValue(); + if ($cVal instanceof RichText) { + $elements = $cVal->getRichTextElements(); + foreach ($elements as $element) { + if ($element instanceof Run) { + $font = $element->getFont(); + $this->writerWorksheets[$i]->fontHashIndex[$font->getHashCode()] = $this->writerWorkbook->addFont($font); + } + } + } + } + } + + // initialize OLE file + $workbookStreamName = 'Workbook'; + $OLE = new File(OLE::ascToUcs($workbookStreamName)); + + // Write the worksheet streams before the global workbook stream, + // because the byte sizes of these are needed in the global workbook stream + $worksheetSizes = []; + for ($i = 0; $i < $countSheets; ++$i) { + $this->writerWorksheets[$i]->close(); + $worksheetSizes[] = $this->writerWorksheets[$i]->_datasize; + } + + // add binary data for global workbook stream + $OLE->append($this->writerWorkbook->writeWorkbook($worksheetSizes)); + + // add binary data for sheet streams + for ($i = 0; $i < $countSheets; ++$i) { + $OLE->append($this->writerWorksheets[$i]->getData()); + } + + $this->documentSummaryInformation = $this->writeDocumentSummaryInformation(); + // initialize OLE Document Summary Information + if (isset($this->documentSummaryInformation) && !empty($this->documentSummaryInformation)) { + $OLE_DocumentSummaryInformation = new File(OLE::ascToUcs(chr(5) . 'DocumentSummaryInformation')); + $OLE_DocumentSummaryInformation->append($this->documentSummaryInformation); + } + + $this->summaryInformation = $this->writeSummaryInformation(); + // initialize OLE Summary Information + if (isset($this->summaryInformation) && !empty($this->summaryInformation)) { + $OLE_SummaryInformation = new File(OLE::ascToUcs(chr(5) . 'SummaryInformation')); + $OLE_SummaryInformation->append($this->summaryInformation); + } + + // define OLE Parts + $arrRootData = [$OLE]; + // initialize OLE Properties file + if (isset($OLE_SummaryInformation)) { + $arrRootData[] = $OLE_SummaryInformation; + } + // initialize OLE Extended Properties file + if (isset($OLE_DocumentSummaryInformation)) { + $arrRootData[] = $OLE_DocumentSummaryInformation; + } + + $root = new Root(time(), time(), $arrRootData); + // save the OLE file + $root->save($pFilename); + + Functions::setReturnDateType($saveDateReturnType); + Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); + } + + /** + * Build the Worksheet Escher objects. + */ + private function buildWorksheetEschers() + { + // 1-based index to BstoreContainer + $blipIndex = 0; + $lastReducedSpId = 0; + $lastSpId = 0; + + foreach ($this->spreadsheet->getAllsheets() as $sheet) { + // sheet index + $sheetIndex = $sheet->getParent()->getIndex($sheet); + + $escher = null; + + // check if there are any shapes for this sheet + $filterRange = $sheet->getAutoFilter()->getRange(); + if (count($sheet->getDrawingCollection()) == 0 && empty($filterRange)) { + continue; + } + + // create intermediate Escher object + $escher = new Escher(); + + // dgContainer + $dgContainer = new DgContainer(); + + // set the drawing index (we use sheet index + 1) + $dgId = $sheet->getParent()->getIndex($sheet) + 1; + $dgContainer->setDgId($dgId); + $escher->setDgContainer($dgContainer); + + // spgrContainer + $spgrContainer = new SpgrContainer(); + $dgContainer->setSpgrContainer($spgrContainer); + + // add one shape which is the group shape + $spContainer = new SpContainer(); + $spContainer->setSpgr(true); + $spContainer->setSpType(0); + $spContainer->setSpId(($sheet->getParent()->getIndex($sheet) + 1) << 10); + $spgrContainer->addChild($spContainer); + + // add the shapes + + $countShapes[$sheetIndex] = 0; // count number of shapes (minus group shape), in sheet + + foreach ($sheet->getDrawingCollection() as $drawing) { + ++$blipIndex; + + ++$countShapes[$sheetIndex]; + + // add the shape + $spContainer = new SpContainer(); + + // set the shape type + $spContainer->setSpType(0x004B); + // set the shape flag + $spContainer->setSpFlag(0x02); + + // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index) + $reducedSpId = $countShapes[$sheetIndex]; + $spId = $reducedSpId | ($sheet->getParent()->getIndex($sheet) + 1) << 10; + $spContainer->setSpId($spId); + + // keep track of last reducedSpId + $lastReducedSpId = $reducedSpId; + + // keep track of last spId + $lastSpId = $spId; + + // set the BLIP index + $spContainer->setOPT(0x4104, $blipIndex); + + // set coordinates and offsets, client anchor + $coordinates = $drawing->getCoordinates(); + $offsetX = $drawing->getOffsetX(); + $offsetY = $drawing->getOffsetY(); + $width = $drawing->getWidth(); + $height = $drawing->getHeight(); + + $twoAnchor = \PhpOffice\PhpSpreadsheet\Shared\Xls::oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height); + + $spContainer->setStartCoordinates($twoAnchor['startCoordinates']); + $spContainer->setStartOffsetX($twoAnchor['startOffsetX']); + $spContainer->setStartOffsetY($twoAnchor['startOffsetY']); + $spContainer->setEndCoordinates($twoAnchor['endCoordinates']); + $spContainer->setEndOffsetX($twoAnchor['endOffsetX']); + $spContainer->setEndOffsetY($twoAnchor['endOffsetY']); + + $spgrContainer->addChild($spContainer); + } + + // AutoFilters + if (!empty($filterRange)) { + $rangeBounds = Coordinate::rangeBoundaries($filterRange); + $iNumColStart = $rangeBounds[0][0]; + $iNumColEnd = $rangeBounds[1][0]; + + $iInc = $iNumColStart; + while ($iInc <= $iNumColEnd) { + ++$countShapes[$sheetIndex]; + + // create an Drawing Object for the dropdown + $oDrawing = new BaseDrawing(); + // get the coordinates of drawing + $cDrawing = Coordinate::stringFromColumnIndex($iInc) . $rangeBounds[0][1]; + $oDrawing->setCoordinates($cDrawing); + $oDrawing->setWorksheet($sheet); + + // add the shape + $spContainer = new SpContainer(); + // set the shape type + $spContainer->setSpType(0x00C9); + // set the shape flag + $spContainer->setSpFlag(0x01); + + // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index) + $reducedSpId = $countShapes[$sheetIndex]; + $spId = $reducedSpId | ($sheet->getParent()->getIndex($sheet) + 1) << 10; + $spContainer->setSpId($spId); + + // keep track of last reducedSpId + $lastReducedSpId = $reducedSpId; + + // keep track of last spId + $lastSpId = $spId; + + $spContainer->setOPT(0x007F, 0x01040104); // Protection -> fLockAgainstGrouping + $spContainer->setOPT(0x00BF, 0x00080008); // Text -> fFitTextToShape + $spContainer->setOPT(0x01BF, 0x00010000); // Fill Style -> fNoFillHitTest + $spContainer->setOPT(0x01FF, 0x00080000); // Line Style -> fNoLineDrawDash + $spContainer->setOPT(0x03BF, 0x000A0000); // Group Shape -> fPrint + + // set coordinates and offsets, client anchor + $endCoordinates = Coordinate::stringFromColumnIndex($iInc); + $endCoordinates .= $rangeBounds[0][1] + 1; + + $spContainer->setStartCoordinates($cDrawing); + $spContainer->setStartOffsetX(0); + $spContainer->setStartOffsetY(0); + $spContainer->setEndCoordinates($endCoordinates); + $spContainer->setEndOffsetX(0); + $spContainer->setEndOffsetY(0); + + $spgrContainer->addChild($spContainer); + ++$iInc; + } + } + + // identifier clusters, used for workbook Escher object + $this->IDCLs[$dgId] = $lastReducedSpId; + + // set last shape index + $dgContainer->setLastSpId($lastSpId); + + // set the Escher object + $this->writerWorksheets[$sheetIndex]->setEscher($escher); + } + } + + /** + * Build the Escher object corresponding to the MSODRAWINGGROUP record. + */ + private function buildWorkbookEscher() + { + $escher = null; + + // any drawings in this workbook? + $found = false; + foreach ($this->spreadsheet->getAllSheets() as $sheet) { + if (count($sheet->getDrawingCollection()) > 0) { + $found = true; + + break; + } + } + + // nothing to do if there are no drawings + if (!$found) { + return; + } + + // if we reach here, then there are drawings in the workbook + $escher = new Escher(); + + // dggContainer + $dggContainer = new DggContainer(); + $escher->setDggContainer($dggContainer); + + // set IDCLs (identifier clusters) + $dggContainer->setIDCLs($this->IDCLs); + + // this loop is for determining maximum shape identifier of all drawing + $spIdMax = 0; + $totalCountShapes = 0; + $countDrawings = 0; + + foreach ($this->spreadsheet->getAllsheets() as $sheet) { + $sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet + + if (count($sheet->getDrawingCollection()) > 0) { + ++$countDrawings; + + foreach ($sheet->getDrawingCollection() as $drawing) { + ++$sheetCountShapes; + ++$totalCountShapes; + + $spId = $sheetCountShapes | ($this->spreadsheet->getIndex($sheet) + 1) << 10; + $spIdMax = max($spId, $spIdMax); + } + } + } + + $dggContainer->setSpIdMax($spIdMax + 1); + $dggContainer->setCDgSaved($countDrawings); + $dggContainer->setCSpSaved($totalCountShapes + $countDrawings); // total number of shapes incl. one group shapes per drawing + + // bstoreContainer + $bstoreContainer = new BstoreContainer(); + $dggContainer->setBstoreContainer($bstoreContainer); + + // the BSE's (all the images) + foreach ($this->spreadsheet->getAllsheets() as $sheet) { + foreach ($sheet->getDrawingCollection() as $drawing) { + if (!extension_loaded('gd')) { + throw new RuntimeException('Saving images in xls requires gd extension'); + } + if ($drawing instanceof Drawing) { + $filename = $drawing->getPath(); + + [$imagesx, $imagesy, $imageFormat] = getimagesize($filename); + + switch ($imageFormat) { + case 1: // GIF, not supported by BIFF8, we convert to PNG + $blipType = BSE::BLIPTYPE_PNG; + ob_start(); + imagepng(imagecreatefromgif($filename)); + $blipData = ob_get_contents(); + ob_end_clean(); + + break; + case 2: // JPEG + $blipType = BSE::BLIPTYPE_JPEG; + $blipData = file_get_contents($filename); + + break; + case 3: // PNG + $blipType = BSE::BLIPTYPE_PNG; + $blipData = file_get_contents($filename); + + break; + case 6: // Windows DIB (BMP), we convert to PNG + $blipType = BSE::BLIPTYPE_PNG; + ob_start(); + imagepng(SharedDrawing::imagecreatefrombmp($filename)); + $blipData = ob_get_contents(); + ob_end_clean(); + + break; + default: + continue 2; + } + + $blip = new Blip(); + $blip->setData($blipData); + + $BSE = new BSE(); + $BSE->setBlipType($blipType); + $BSE->setBlip($blip); + + $bstoreContainer->addBSE($BSE); + } elseif ($drawing instanceof MemoryDrawing) { + switch ($drawing->getRenderingFunction()) { + case MemoryDrawing::RENDERING_JPEG: + $blipType = BSE::BLIPTYPE_JPEG; + $renderingFunction = 'imagejpeg'; + + break; + case MemoryDrawing::RENDERING_GIF: + case MemoryDrawing::RENDERING_PNG: + case MemoryDrawing::RENDERING_DEFAULT: + $blipType = BSE::BLIPTYPE_PNG; + $renderingFunction = 'imagepng'; + + break; + } + + ob_start(); + call_user_func($renderingFunction, $drawing->getImageResource()); + $blipData = ob_get_contents(); + ob_end_clean(); + + $blip = new Blip(); + $blip->setData($blipData); + + $BSE = new BSE(); + $BSE->setBlipType($blipType); + $BSE->setBlip($blip); + + $bstoreContainer->addBSE($BSE); + } + } + } + + // Set the Escher object + $this->writerWorkbook->setEscher($escher); + } + + /** + * Build the OLE Part for DocumentSummary Information. + * + * @return string + */ + private function writeDocumentSummaryInformation() + { + // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) + $data = pack('v', 0xFFFE); + // offset: 2; size: 2; + $data .= pack('v', 0x0000); + // offset: 4; size: 2; OS version + $data .= pack('v', 0x0106); + // offset: 6; size: 2; OS indicator + $data .= pack('v', 0x0002); + // offset: 8; size: 16 + $data .= pack('VVVV', 0x00, 0x00, 0x00, 0x00); + // offset: 24; size: 4; section count + $data .= pack('V', 0x0001); + + // offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae + $data .= pack('vvvvvvvv', 0xD502, 0xD5CD, 0x2E9C, 0x101B, 0x9793, 0x0008, 0x2C2B, 0xAEF9); + // offset: 44; size: 4; offset of the start + $data .= pack('V', 0x30); + + // SECTION + $dataSection = []; + $dataSection_NumProps = 0; + $dataSection_Summary = ''; + $dataSection_Content = ''; + + // GKPIDDSI_CODEPAGE: CodePage + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x01], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer + 'data' => ['data' => 1252], + ]; + ++$dataSection_NumProps; + + // GKPIDDSI_CATEGORY : Category + if ($this->spreadsheet->getProperties()->getCategory()) { + $dataProp = $this->spreadsheet->getProperties()->getCategory(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x02], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + } + // GKPIDDSI_VERSION :Version of the application that wrote the property storage + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x17], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x03], + 'data' => ['pack' => 'V', 'data' => 0x000C0000], + ]; + ++$dataSection_NumProps; + // GKPIDDSI_SCALE : FALSE + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0B], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x0B], + 'data' => ['data' => false], + ]; + ++$dataSection_NumProps; + // GKPIDDSI_LINKSDIRTY : True if any of the values for the linked properties have changed outside of the application + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x10], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x0B], + 'data' => ['data' => false], + ]; + ++$dataSection_NumProps; + // GKPIDDSI_SHAREDOC : FALSE + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x13], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x0B], + 'data' => ['data' => false], + ]; + ++$dataSection_NumProps; + // GKPIDDSI_HYPERLINKSCHANGED : True if any of the values for the _PID_LINKS (hyperlink text) have changed outside of the application + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x16], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x0B], + 'data' => ['data' => false], + ]; + ++$dataSection_NumProps; + + // GKPIDDSI_DOCSPARTS + // MS-OSHARED p75 (2.3.3.2.2.1) + // Structure is VtVecUnalignedLpstrValue (2.3.3.1.9) + // cElements + $dataProp = pack('v', 0x0001); + $dataProp .= pack('v', 0x0000); + // array of UnalignedLpstr + // cch + $dataProp .= pack('v', 0x000A); + $dataProp .= pack('v', 0x0000); + // value + $dataProp .= 'Worksheet' . chr(0); + + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0D], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x101E], + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + + // GKPIDDSI_HEADINGPAIR + // VtVecHeadingPairValue + // cElements + $dataProp = pack('v', 0x0002); + $dataProp .= pack('v', 0x0000); + // Array of vtHeadingPair + // vtUnalignedString - headingString + // stringType + $dataProp .= pack('v', 0x001E); + // padding + $dataProp .= pack('v', 0x0000); + // UnalignedLpstr + // cch + $dataProp .= pack('v', 0x0013); + $dataProp .= pack('v', 0x0000); + // value + $dataProp .= 'Feuilles de calcul'; + // vtUnalignedString - headingParts + // wType : 0x0003 = 32 bit signed integer + $dataProp .= pack('v', 0x0300); + // padding + $dataProp .= pack('v', 0x0000); + // value + $dataProp .= pack('v', 0x0100); + $dataProp .= pack('v', 0x0000); + $dataProp .= pack('v', 0x0000); + $dataProp .= pack('v', 0x0000); + + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0C], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x100C], + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + + // 4 Section Length + // 4 Property count + // 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4)) + $dataSection_Content_Offset = 8 + $dataSection_NumProps * 8; + foreach ($dataSection as $dataProp) { + // Summary + $dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']); + // Offset + $dataSection_Summary .= pack($dataProp['offset']['pack'], $dataSection_Content_Offset); + // DataType + $dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']); + // Data + if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer + $dataSection_Content .= pack('V', $dataProp['data']['data']); + + $dataSection_Content_Offset += 4 + 4; + } elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer + $dataSection_Content .= pack('V', $dataProp['data']['data']); + + $dataSection_Content_Offset += 4 + 4; + } elseif ($dataProp['type']['data'] == 0x0B) { // Boolean + if ($dataProp['data']['data'] == false) { + $dataSection_Content .= pack('V', 0x0000); + } else { + $dataSection_Content .= pack('V', 0x0001); + } + $dataSection_Content_Offset += 4 + 4; + } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length + // Null-terminated string + $dataProp['data']['data'] .= chr(0); + $dataProp['data']['length'] += 1; + // Complete the string with null string for being a %4 + $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4)); + $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT); + + $dataSection_Content .= pack('V', $dataProp['data']['length']); + $dataSection_Content .= $dataProp['data']['data']; + + $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']); + } elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) + $dataSection_Content .= $dataProp['data']['data']; + + $dataSection_Content_Offset += 4 + 8; + } else { + // Data Type Not Used at the moment + $dataSection_Content .= $dataProp['data']['data']; + + $dataSection_Content_Offset += 4 + $dataProp['data']['length']; + } + } + // Now $dataSection_Content_Offset contains the size of the content + + // section header + // offset: $secOffset; size: 4; section length + // + x Size of the content (summary + content) + $data .= pack('V', $dataSection_Content_Offset); + // offset: $secOffset+4; size: 4; property count + $data .= pack('V', $dataSection_NumProps); + // Section Summary + $data .= $dataSection_Summary; + // Section Content + $data .= $dataSection_Content; + + return $data; + } + + /** + * Build the OLE Part for Summary Information. + * + * @return string + */ + private function writeSummaryInformation() + { + // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark) + $data = pack('v', 0xFFFE); + // offset: 2; size: 2; + $data .= pack('v', 0x0000); + // offset: 4; size: 2; OS version + $data .= pack('v', 0x0106); + // offset: 6; size: 2; OS indicator + $data .= pack('v', 0x0002); + // offset: 8; size: 16 + $data .= pack('VVVV', 0x00, 0x00, 0x00, 0x00); + // offset: 24; size: 4; section count + $data .= pack('V', 0x0001); + + // offset: 28; size: 16; first section's class id: e0 85 9f f2 f9 4f 68 10 ab 91 08 00 2b 27 b3 d9 + $data .= pack('vvvvvvvv', 0x85E0, 0xF29F, 0x4FF9, 0x1068, 0x91AB, 0x0008, 0x272B, 0xD9B3); + // offset: 44; size: 4; offset of the start + $data .= pack('V', 0x30); + + // SECTION + $dataSection = []; + $dataSection_NumProps = 0; + $dataSection_Summary = ''; + $dataSection_Content = ''; + + // CodePage : CP-1252 + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x01], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer + 'data' => ['data' => 1252], + ]; + ++$dataSection_NumProps; + + // Title + if ($this->spreadsheet->getProperties()->getTitle()) { + $dataProp = $this->spreadsheet->getProperties()->getTitle(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x02], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + } + // Subject + if ($this->spreadsheet->getProperties()->getSubject()) { + $dataProp = $this->spreadsheet->getProperties()->getSubject(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x03], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + } + // Author (Creator) + if ($this->spreadsheet->getProperties()->getCreator()) { + $dataProp = $this->spreadsheet->getProperties()->getCreator(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x04], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + } + // Keywords + if ($this->spreadsheet->getProperties()->getKeywords()) { + $dataProp = $this->spreadsheet->getProperties()->getKeywords(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x05], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + } + // Comments (Description) + if ($this->spreadsheet->getProperties()->getDescription()) { + $dataProp = $this->spreadsheet->getProperties()->getDescription(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x06], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + } + // Last Saved By (LastModifiedBy) + if ($this->spreadsheet->getProperties()->getLastModifiedBy()) { + $dataProp = $this->spreadsheet->getProperties()->getLastModifiedBy(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x08], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; + ++$dataSection_NumProps; + } + // Created Date/Time + if ($this->spreadsheet->getProperties()->getCreated()) { + $dataProp = $this->spreadsheet->getProperties()->getCreated(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0C], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) + 'data' => ['data' => OLE::localDateToOLE($dataProp)], + ]; + ++$dataSection_NumProps; + } + // Modified Date/Time + if ($this->spreadsheet->getProperties()->getModified()) { + $dataProp = $this->spreadsheet->getProperties()->getModified(); + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0D], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) + 'data' => ['data' => OLE::localDateToOLE($dataProp)], + ]; + ++$dataSection_NumProps; + } + // Security + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x13], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x03], // 4 byte signed integer + 'data' => ['data' => 0x00], + ]; + ++$dataSection_NumProps; + + // 4 Section Length + // 4 Property count + // 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4)) + $dataSection_Content_Offset = 8 + $dataSection_NumProps * 8; + foreach ($dataSection as $dataProp) { + // Summary + $dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']); + // Offset + $dataSection_Summary .= pack($dataProp['offset']['pack'], $dataSection_Content_Offset); + // DataType + $dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']); + // Data + if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer + $dataSection_Content .= pack('V', $dataProp['data']['data']); + + $dataSection_Content_Offset += 4 + 4; + } elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer + $dataSection_Content .= pack('V', $dataProp['data']['data']); + + $dataSection_Content_Offset += 4 + 4; + } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length + // Null-terminated string + $dataProp['data']['data'] .= chr(0); + $dataProp['data']['length'] += 1; + // Complete the string with null string for being a %4 + $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4) == 4 ? 0 : (4 - $dataProp['data']['length'] % 4)); + $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT); + + $dataSection_Content .= pack('V', $dataProp['data']['length']); + $dataSection_Content .= $dataProp['data']['data']; + + $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']); + } elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) + $dataSection_Content .= $dataProp['data']['data']; + + $dataSection_Content_Offset += 4 + 8; + } + // Data Type Not Used at the moment + } + // Now $dataSection_Content_Offset contains the size of the content + + // section header + // offset: $secOffset; size: 4; section length + // + x Size of the content (summary + content) + $data .= pack('V', $dataSection_Content_Offset); + // offset: $secOffset+4; size: 4; property count + $data .= pack('V', $dataSection_NumProps); + // Section Summary + $data .= $dataSection_Summary; + // Section Content + $data .= $dataSection_Content; + + return $data; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php new file mode 100644 index 0000000..3b2eb9a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/BIFFwriter.php @@ -0,0 +1,224 @@ + +// * +// * The majority of this is _NOT_ my code. I simply ported it from the +// * PERL Spreadsheet::WriteExcel module. +// * +// * The author of the Spreadsheet::WriteExcel module is John McNamara +// * +// * +// * I _DO_ maintain this code, and John McNamara has nothing to do with the +// * porting of this code to PHP. Any questions directly related to this +// * class library should be directed to me. +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ +class BIFFwriter +{ + /** + * The byte order of this architecture. 0 => little endian, 1 => big endian. + * + * @var int + */ + private static $byteOrder; + + /** + * The string containing the data of the BIFF stream. + * + * @var string + */ + public $_data; + + /** + * The size of the data in bytes. Should be the same as strlen($this->_data). + * + * @var int + */ + public $_datasize; + + /** + * The maximum length for a BIFF record (excluding record header and length field). See addContinue(). + * + * @var int + * + * @see addContinue() + */ + private $limit = 8224; + + /** + * Constructor. + */ + public function __construct() + { + $this->_data = ''; + $this->_datasize = 0; + } + + /** + * Determine the byte order and store it as class data to avoid + * recalculating it for each call to new(). + * + * @return int + */ + public static function getByteOrder() + { + if (!isset(self::$byteOrder)) { + // Check if "pack" gives the required IEEE 64bit float + $teststr = pack('d', 1.2345); + $number = pack('C8', 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F); + if ($number == $teststr) { + $byte_order = 0; // Little Endian + } elseif ($number == strrev($teststr)) { + $byte_order = 1; // Big Endian + } else { + // Give up. I'll fix this in a later version. + throw new WriterException('Required floating point format not supported on this platform.'); + } + self::$byteOrder = $byte_order; + } + + return self::$byteOrder; + } + + /** + * General storage function. + * + * @param string $data binary data to append + */ + protected function append($data) + { + if (strlen($data) - 4 > $this->limit) { + $data = $this->addContinue($data); + } + $this->_data .= $data; + $this->_datasize += strlen($data); + } + + /** + * General storage function like append, but returns string instead of modifying $this->_data. + * + * @param string $data binary data to write + * + * @return string + */ + public function writeData($data) + { + if (strlen($data) - 4 > $this->limit) { + $data = $this->addContinue($data); + } + $this->_datasize += strlen($data); + + return $data; + } + + /** + * Writes Excel BOF record to indicate the beginning of a stream or + * sub-stream in the BIFF file. + * + * @param int $type type of BIFF file to write: 0x0005 Workbook, + * 0x0010 Worksheet + */ + protected function storeBof($type) + { + $record = 0x0809; // Record identifier (BIFF5-BIFF8) + $length = 0x0010; + + // by inspection of real files, MS Office Excel 2007 writes the following + $unknown = pack('VV', 0x000100D1, 0x00000406); + + $build = 0x0DBB; // Excel 97 + $year = 0x07CC; // Excel 97 + + $version = 0x0600; // BIFF8 + + $header = pack('vv', $record, $length); + $data = pack('vvvv', $version, $type, $build, $year); + $this->append($header . $data . $unknown); + } + + /** + * Writes Excel EOF record to indicate the end of a BIFF stream. + */ + protected function storeEof() + { + $record = 0x000A; // Record identifier + $length = 0x0000; // Number of bytes to follow + + $header = pack('vv', $record, $length); + $this->append($header); + } + + /** + * Writes Excel EOF record to indicate the end of a BIFF stream. + */ + public function writeEof() + { + $record = 0x000A; // Record identifier + $length = 0x0000; // Number of bytes to follow + $header = pack('vv', $record, $length); + + return $this->writeData($header); + } + + /** + * Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In + * Excel 97 the limit is 8228 bytes. Records that are longer than these limits + * must be split up into CONTINUE blocks. + * + * This function takes a long BIFF record and inserts CONTINUE records as + * necessary. + * + * @param string $data The original binary data to be written + * + * @return string A very convenient string of continue blocks + */ + private function addContinue($data) + { + $limit = $this->limit; + $record = 0x003C; // Record identifier + + // The first 2080/8224 bytes remain intact. However, we have to change + // the length field of the record. + $tmp = substr($data, 0, 2) . pack('v', $limit) . substr($data, 4, $limit); + + $header = pack('vv', $record, $limit); // Headers for continue records + + // Retrieve chunks of 2080/8224 bytes +4 for the header. + $data_length = strlen($data); + for ($i = $limit + 4; $i < ($data_length - $limit); $i += $limit) { + $tmp .= $header; + $tmp .= substr($data, $i, $limit); + } + + // Retrieve the last chunk of data + $header = pack('vv', $record, strlen($data) - $i); + $tmp .= $header; + $tmp .= substr($data, $i); + + return $tmp; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Escher.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Escher.php new file mode 100644 index 0000000..1ee2e90 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Escher.php @@ -0,0 +1,510 @@ +object = $object; + } + + /** + * Process the object to be written. + * + * @return string + */ + public function close() + { + // initialize + $this->data = ''; + + switch (get_class($this->object)) { + case \PhpOffice\PhpSpreadsheet\Shared\Escher::class: + if ($dggContainer = $this->object->getDggContainer()) { + $writer = new self($dggContainer); + $this->data = $writer->close(); + } elseif ($dgContainer = $this->object->getDgContainer()) { + $writer = new self($dgContainer); + $this->data = $writer->close(); + $this->spOffsets = $writer->getSpOffsets(); + $this->spTypes = $writer->getSpTypes(); + } + + break; + case DggContainer::class: + // this is a container record + + // initialize + $innerData = ''; + + // write the dgg + $recVer = 0x0; + $recInstance = 0x0000; + $recType = 0xF006; + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + // dgg data + $dggData = + pack( + 'VVVV', + $this->object->getSpIdMax(), // maximum shape identifier increased by one + $this->object->getCDgSaved() + 1, // number of file identifier clusters increased by one + $this->object->getCSpSaved(), + $this->object->getCDgSaved() // count total number of drawings saved + ); + + // add file identifier clusters (one per drawing) + $IDCLs = $this->object->getIDCLs(); + + foreach ($IDCLs as $dgId => $maxReducedSpId) { + $dggData .= pack('VV', $dgId, $maxReducedSpId + 1); + } + + $header = pack('vvV', $recVerInstance, $recType, strlen($dggData)); + $innerData .= $header . $dggData; + + // write the bstoreContainer + if ($bstoreContainer = $this->object->getBstoreContainer()) { + $writer = new self($bstoreContainer); + $innerData .= $writer->close(); + } + + // write the record + $recVer = 0xF; + $recInstance = 0x0000; + $recType = 0xF000; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->data = $header . $innerData; + + break; + case BstoreContainer::class: + // this is a container record + + // initialize + $innerData = ''; + + // treat the inner data + if ($BSECollection = $this->object->getBSECollection()) { + foreach ($BSECollection as $BSE) { + $writer = new self($BSE); + $innerData .= $writer->close(); + } + } + + // write the record + $recVer = 0xF; + $recInstance = count($this->object->getBSECollection()); + $recType = 0xF001; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->data = $header . $innerData; + + break; + case BSE::class: + // this is a semi-container record + + // initialize + $innerData = ''; + + // here we treat the inner data + if ($blip = $this->object->getBlip()) { + $writer = new self($blip); + $innerData .= $writer->close(); + } + + // initialize + $data = ''; + + $btWin32 = $this->object->getBlipType(); + $btMacOS = $this->object->getBlipType(); + $data .= pack('CC', $btWin32, $btMacOS); + + $rgbUid = pack('VVVV', 0, 0, 0, 0); // todo + $data .= $rgbUid; + + $tag = 0; + $size = strlen($innerData); + $cRef = 1; + $foDelay = 0; //todo + $unused1 = 0x0; + $cbName = 0x0; + $unused2 = 0x0; + $unused3 = 0x0; + $data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3); + + $data .= $innerData; + + // write the record + $recVer = 0x2; + $recInstance = $this->object->getBlipType(); + $recType = 0xF007; + $length = strlen($data); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->data = $header; + + $this->data .= $data; + + break; + case Blip::class: + // this is an atom record + + // write the record + switch ($this->object->getParent()->getBlipType()) { + case BSE::BLIPTYPE_JPEG: + // initialize + $innerData = ''; + + $rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo + $innerData .= $rgbUid1; + + $tag = 0xFF; // todo + $innerData .= pack('C', $tag); + + $innerData .= $this->object->getData(); + + $recVer = 0x0; + $recInstance = 0x46A; + $recType = 0xF01D; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->data = $header; + + $this->data .= $innerData; + + break; + case BSE::BLIPTYPE_PNG: + // initialize + $innerData = ''; + + $rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo + $innerData .= $rgbUid1; + + $tag = 0xFF; // todo + $innerData .= pack('C', $tag); + + $innerData .= $this->object->getData(); + + $recVer = 0x0; + $recInstance = 0x6E0; + $recType = 0xF01E; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->data = $header; + + $this->data .= $innerData; + + break; + } + + break; + case DgContainer::class: + // this is a container record + + // initialize + $innerData = ''; + + // write the dg + $recVer = 0x0; + $recInstance = $this->object->getDgId(); + $recType = 0xF008; + $length = 8; + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + // number of shapes in this drawing (including group shape) + $countShapes = count($this->object->getSpgrContainer()->getChildren()); + $innerData .= $header . pack('VV', $countShapes, $this->object->getLastSpId()); + + // write the spgrContainer + if ($spgrContainer = $this->object->getSpgrContainer()) { + $writer = new self($spgrContainer); + $innerData .= $writer->close(); + + // get the shape offsets relative to the spgrContainer record + $spOffsets = $writer->getSpOffsets(); + $spTypes = $writer->getSpTypes(); + + // save the shape offsets relative to dgContainer + foreach ($spOffsets as &$spOffset) { + $spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes) + } + + $this->spOffsets = $spOffsets; + $this->spTypes = $spTypes; + } + + // write the record + $recVer = 0xF; + $recInstance = 0x0000; + $recType = 0xF002; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->data = $header . $innerData; + + break; + case SpgrContainer::class: + // this is a container record + + // initialize + $innerData = ''; + + // initialize spape offsets + $totalSize = 8; + $spOffsets = []; + $spTypes = []; + + // treat the inner data + foreach ($this->object->getChildren() as $spContainer) { + $writer = new self($spContainer); + $spData = $writer->close(); + $innerData .= $spData; + + // save the shape offsets (where new shape records begin) + $totalSize += strlen($spData); + $spOffsets[] = $totalSize; + + $spTypes = array_merge($spTypes, $writer->getSpTypes()); + } + + // write the record + $recVer = 0xF; + $recInstance = 0x0000; + $recType = 0xF003; + $length = strlen($innerData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->data = $header . $innerData; + $this->spOffsets = $spOffsets; + $this->spTypes = $spTypes; + + break; + case SpContainer::class: + // initialize + $data = ''; + + // build the data + + // write group shape record, if necessary? + if ($this->object->getSpgr()) { + $recVer = 0x1; + $recInstance = 0x0000; + $recType = 0xF009; + $length = 0x00000010; + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $data .= $header . pack('VVVV', 0, 0, 0, 0); + } + $this->spTypes[] = ($this->object->getSpType()); + + // write the shape record + $recVer = 0x2; + $recInstance = $this->object->getSpType(); // shape type + $recType = 0xF00A; + $length = 0x00000008; + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $data .= $header . pack('VV', $this->object->getSpId(), $this->object->getSpgr() ? 0x0005 : 0x0A00); + + // the options + if ($this->object->getOPTCollection()) { + $optData = ''; + + $recVer = 0x3; + $recInstance = count($this->object->getOPTCollection()); + $recType = 0xF00B; + foreach ($this->object->getOPTCollection() as $property => $value) { + $optData .= pack('vV', $property, $value); + } + $length = strlen($optData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + $data .= $header . $optData; + } + + // the client anchor + if ($this->object->getStartCoordinates()) { + $clientAnchorData = ''; + + $recVer = 0x0; + $recInstance = 0x0; + $recType = 0xF010; + + // start coordinates + [$column, $row] = Coordinate::coordinateFromString($this->object->getStartCoordinates()); + $c1 = Coordinate::columnIndexFromString($column) - 1; + $r1 = $row - 1; + + // start offsetX + $startOffsetX = $this->object->getStartOffsetX(); + + // start offsetY + $startOffsetY = $this->object->getStartOffsetY(); + + // end coordinates + [$column, $row] = Coordinate::coordinateFromString($this->object->getEndCoordinates()); + $c2 = Coordinate::columnIndexFromString($column) - 1; + $r2 = $row - 1; + + // end offsetX + $endOffsetX = $this->object->getEndOffsetX(); + + // end offsetY + $endOffsetY = $this->object->getEndOffsetY(); + + $clientAnchorData = pack('vvvvvvvvv', $this->object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY); + + $length = strlen($clientAnchorData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + $data .= $header . $clientAnchorData; + } + + // the client data, just empty for now + if (!$this->object->getSpgr()) { + $clientDataData = ''; + + $recVer = 0x0; + $recInstance = 0x0; + $recType = 0xF011; + + $length = strlen($clientDataData); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + $data .= $header . $clientDataData; + } + + // write the record + $recVer = 0xF; + $recInstance = 0x0000; + $recType = 0xF004; + $length = strlen($data); + + $recVerInstance = $recVer; + $recVerInstance |= $recInstance << 4; + + $header = pack('vvV', $recVerInstance, $recType, $length); + + $this->data = $header . $data; + + break; + } + + return $this->data; + } + + /** + * Gets the shape offsets. + * + * @return array + */ + public function getSpOffsets() + { + return $this->spOffsets; + } + + /** + * Gets the shape types. + * + * @return array + */ + public function getSpTypes() + { + return $this->spTypes; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Font.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Font.php new file mode 100644 index 0000000..df37dcb --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Font.php @@ -0,0 +1,149 @@ +colorIndex = 0x7FFF; + $this->font = $font; + } + + /** + * Set the color index. + * + * @param int $colorIndex + */ + public function setColorIndex($colorIndex) + { + $this->colorIndex = $colorIndex; + } + + /** + * Get font record data. + * + * @return string + */ + public function writeFont() + { + $font_outline = 0; + $font_shadow = 0; + + $icv = $this->colorIndex; // Index to color palette + if ($this->font->getSuperscript()) { + $sss = 1; + } elseif ($this->font->getSubscript()) { + $sss = 2; + } else { + $sss = 0; + } + $bFamily = 0; // Font family + $bCharSet = \PhpOffice\PhpSpreadsheet\Shared\Font::getCharsetFromFontName($this->font->getName()); // Character set + + $record = 0x31; // Record identifier + $reserved = 0x00; // Reserved + $grbit = 0x00; // Font attributes + if ($this->font->getItalic()) { + $grbit |= 0x02; + } + if ($this->font->getStrikethrough()) { + $grbit |= 0x08; + } + if ($font_outline) { + $grbit |= 0x10; + } + if ($font_shadow) { + $grbit |= 0x20; + } + + $data = pack( + 'vvvvvCCCC', + // Fontsize (in twips) + $this->font->getSize() * 20, + $grbit, + // Colour + $icv, + // Font weight + self::mapBold($this->font->getBold()), + // Superscript/Subscript + $sss, + self::mapUnderline($this->font->getUnderline()), + $bFamily, + $bCharSet, + $reserved + ); + $data .= StringHelper::UTF8toBIFF8UnicodeShort($this->font->getName()); + + $length = strlen($data); + $header = pack('vv', $record, $length); + + return $header . $data; + } + + /** + * Map to BIFF5-BIFF8 codes for bold. + * + * @param bool $bold + * + * @return int + */ + private static function mapBold($bold) + { + if ($bold) { + return 0x2BC; // 700 = Bold font weight + } + + return 0x190; // 400 = Normal font weight + } + + /** + * Map of BIFF2-BIFF8 codes for underline styles. + * + * @var array of int + */ + private static $mapUnderline = [ + \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_NONE => 0x00, + \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE => 0x01, + \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE => 0x02, + \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLEACCOUNTING => 0x21, + \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLEACCOUNTING => 0x22, + ]; + + /** + * Map underline. + * + * @param string $underline + * + * @return int + */ + private static function mapUnderline($underline) + { + if (isset(self::$mapUnderline[$underline])) { + return self::$mapUnderline[$underline]; + } + + return 0x00; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Parser.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Parser.php new file mode 100644 index 0000000..5982062 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -0,0 +1,1438 @@ +=,;#()"{} + const REGEX_SHEET_TITLE_UNQUOTED = '[^\*\:\/\\\\\?\[\]\+\-\% \\\'\^\&\<\>\=\,\;\#\(\)\"\{\}]+'; + + // Sheet title in quoted form (without surrounding quotes) + // Invalid sheet title characters cannot occur in the sheet title: + // *:/\?[] (usual invalid sheet title characters) + // Single quote is represented as a pair '' + const REGEX_SHEET_TITLE_QUOTED = '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+'; + + /** + * The index of the character we are currently looking at. + * + * @var int + */ + public $currentCharacter; + + /** + * The token we are working on. + * + * @var string + */ + public $currentToken; + + /** + * The formula to parse. + * + * @var string + */ + private $formula; + + /** + * The character ahead of the current char. + * + * @var string + */ + public $lookAhead; + + /** + * The parse tree to be generated. + * + * @var string + */ + private $parseTree; + + /** + * Array of external sheets. + * + * @var array + */ + private $externalSheets; + + /** + * Array of sheet references in the form of REF structures. + * + * @var array + */ + public $references; + + /** + * The Excel ptg indices. + * + * @var array + */ + private $ptg = [ + 'ptgExp' => 0x01, + 'ptgTbl' => 0x02, + 'ptgAdd' => 0x03, + 'ptgSub' => 0x04, + 'ptgMul' => 0x05, + 'ptgDiv' => 0x06, + 'ptgPower' => 0x07, + 'ptgConcat' => 0x08, + 'ptgLT' => 0x09, + 'ptgLE' => 0x0A, + 'ptgEQ' => 0x0B, + 'ptgGE' => 0x0C, + 'ptgGT' => 0x0D, + 'ptgNE' => 0x0E, + 'ptgIsect' => 0x0F, + 'ptgUnion' => 0x10, + 'ptgRange' => 0x11, + 'ptgUplus' => 0x12, + 'ptgUminus' => 0x13, + 'ptgPercent' => 0x14, + 'ptgParen' => 0x15, + 'ptgMissArg' => 0x16, + 'ptgStr' => 0x17, + 'ptgAttr' => 0x19, + 'ptgSheet' => 0x1A, + 'ptgEndSheet' => 0x1B, + 'ptgErr' => 0x1C, + 'ptgBool' => 0x1D, + 'ptgInt' => 0x1E, + 'ptgNum' => 0x1F, + 'ptgArray' => 0x20, + 'ptgFunc' => 0x21, + 'ptgFuncVar' => 0x22, + 'ptgName' => 0x23, + 'ptgRef' => 0x24, + 'ptgArea' => 0x25, + 'ptgMemArea' => 0x26, + 'ptgMemErr' => 0x27, + 'ptgMemNoMem' => 0x28, + 'ptgMemFunc' => 0x29, + 'ptgRefErr' => 0x2A, + 'ptgAreaErr' => 0x2B, + 'ptgRefN' => 0x2C, + 'ptgAreaN' => 0x2D, + 'ptgMemAreaN' => 0x2E, + 'ptgMemNoMemN' => 0x2F, + 'ptgNameX' => 0x39, + 'ptgRef3d' => 0x3A, + 'ptgArea3d' => 0x3B, + 'ptgRefErr3d' => 0x3C, + 'ptgAreaErr3d' => 0x3D, + 'ptgArrayV' => 0x40, + 'ptgFuncV' => 0x41, + 'ptgFuncVarV' => 0x42, + 'ptgNameV' => 0x43, + 'ptgRefV' => 0x44, + 'ptgAreaV' => 0x45, + 'ptgMemAreaV' => 0x46, + 'ptgMemErrV' => 0x47, + 'ptgMemNoMemV' => 0x48, + 'ptgMemFuncV' => 0x49, + 'ptgRefErrV' => 0x4A, + 'ptgAreaErrV' => 0x4B, + 'ptgRefNV' => 0x4C, + 'ptgAreaNV' => 0x4D, + 'ptgMemAreaNV' => 0x4E, + 'ptgMemNoMemNV' => 0x4F, + 'ptgFuncCEV' => 0x58, + 'ptgNameXV' => 0x59, + 'ptgRef3dV' => 0x5A, + 'ptgArea3dV' => 0x5B, + 'ptgRefErr3dV' => 0x5C, + 'ptgAreaErr3dV' => 0x5D, + 'ptgArrayA' => 0x60, + 'ptgFuncA' => 0x61, + 'ptgFuncVarA' => 0x62, + 'ptgNameA' => 0x63, + 'ptgRefA' => 0x64, + 'ptgAreaA' => 0x65, + 'ptgMemAreaA' => 0x66, + 'ptgMemErrA' => 0x67, + 'ptgMemNoMemA' => 0x68, + 'ptgMemFuncA' => 0x69, + 'ptgRefErrA' => 0x6A, + 'ptgAreaErrA' => 0x6B, + 'ptgRefNA' => 0x6C, + 'ptgAreaNA' => 0x6D, + 'ptgMemAreaNA' => 0x6E, + 'ptgMemNoMemNA' => 0x6F, + 'ptgFuncCEA' => 0x78, + 'ptgNameXA' => 0x79, + 'ptgRef3dA' => 0x7A, + 'ptgArea3dA' => 0x7B, + 'ptgRefErr3dA' => 0x7C, + 'ptgAreaErr3dA' => 0x7D, + ]; + + /** + * Thanks to Michael Meeks and Gnumeric for the initial arg values. + * + * The following hash was generated by "function_locale.pl" in the distro. + * Refer to function_locale.pl for non-English function names. + * + * The array elements are as follow: + * ptg: The Excel function ptg code. + * args: The number of arguments that the function takes: + * >=0 is a fixed number of arguments. + * -1 is a variable number of arguments. + * class: The reference, value or array class of the function args. + * vol: The function is volatile. + * + * @var array + */ + private $functions = [ + // function ptg args class vol + 'COUNT' => [0, -1, 0, 0], + 'IF' => [1, -1, 1, 0], + 'ISNA' => [2, 1, 1, 0], + 'ISERROR' => [3, 1, 1, 0], + 'SUM' => [4, -1, 0, 0], + 'AVERAGE' => [5, -1, 0, 0], + 'MIN' => [6, -1, 0, 0], + 'MAX' => [7, -1, 0, 0], + 'ROW' => [8, -1, 0, 0], + 'COLUMN' => [9, -1, 0, 0], + 'NA' => [10, 0, 0, 0], + 'NPV' => [11, -1, 1, 0], + 'STDEV' => [12, -1, 0, 0], + 'DOLLAR' => [13, -1, 1, 0], + 'FIXED' => [14, -1, 1, 0], + 'SIN' => [15, 1, 1, 0], + 'COS' => [16, 1, 1, 0], + 'TAN' => [17, 1, 1, 0], + 'ATAN' => [18, 1, 1, 0], + 'PI' => [19, 0, 1, 0], + 'SQRT' => [20, 1, 1, 0], + 'EXP' => [21, 1, 1, 0], + 'LN' => [22, 1, 1, 0], + 'LOG10' => [23, 1, 1, 0], + 'ABS' => [24, 1, 1, 0], + 'INT' => [25, 1, 1, 0], + 'SIGN' => [26, 1, 1, 0], + 'ROUND' => [27, 2, 1, 0], + 'LOOKUP' => [28, -1, 0, 0], + 'INDEX' => [29, -1, 0, 1], + 'REPT' => [30, 2, 1, 0], + 'MID' => [31, 3, 1, 0], + 'LEN' => [32, 1, 1, 0], + 'VALUE' => [33, 1, 1, 0], + 'TRUE' => [34, 0, 1, 0], + 'FALSE' => [35, 0, 1, 0], + 'AND' => [36, -1, 0, 0], + 'OR' => [37, -1, 0, 0], + 'NOT' => [38, 1, 1, 0], + 'MOD' => [39, 2, 1, 0], + 'DCOUNT' => [40, 3, 0, 0], + 'DSUM' => [41, 3, 0, 0], + 'DAVERAGE' => [42, 3, 0, 0], + 'DMIN' => [43, 3, 0, 0], + 'DMAX' => [44, 3, 0, 0], + 'DSTDEV' => [45, 3, 0, 0], + 'VAR' => [46, -1, 0, 0], + 'DVAR' => [47, 3, 0, 0], + 'TEXT' => [48, 2, 1, 0], + 'LINEST' => [49, -1, 0, 0], + 'TREND' => [50, -1, 0, 0], + 'LOGEST' => [51, -1, 0, 0], + 'GROWTH' => [52, -1, 0, 0], + 'PV' => [56, -1, 1, 0], + 'FV' => [57, -1, 1, 0], + 'NPER' => [58, -1, 1, 0], + 'PMT' => [59, -1, 1, 0], + 'RATE' => [60, -1, 1, 0], + 'MIRR' => [61, 3, 0, 0], + 'IRR' => [62, -1, 0, 0], + 'RAND' => [63, 0, 1, 1], + 'MATCH' => [64, -1, 0, 0], + 'DATE' => [65, 3, 1, 0], + 'TIME' => [66, 3, 1, 0], + 'DAY' => [67, 1, 1, 0], + 'MONTH' => [68, 1, 1, 0], + 'YEAR' => [69, 1, 1, 0], + 'WEEKDAY' => [70, -1, 1, 0], + 'HOUR' => [71, 1, 1, 0], + 'MINUTE' => [72, 1, 1, 0], + 'SECOND' => [73, 1, 1, 0], + 'NOW' => [74, 0, 1, 1], + 'AREAS' => [75, 1, 0, 1], + 'ROWS' => [76, 1, 0, 1], + 'COLUMNS' => [77, 1, 0, 1], + 'OFFSET' => [78, -1, 0, 1], + 'SEARCH' => [82, -1, 1, 0], + 'TRANSPOSE' => [83, 1, 1, 0], + 'TYPE' => [86, 1, 1, 0], + 'ATAN2' => [97, 2, 1, 0], + 'ASIN' => [98, 1, 1, 0], + 'ACOS' => [99, 1, 1, 0], + 'CHOOSE' => [100, -1, 1, 0], + 'HLOOKUP' => [101, -1, 0, 0], + 'VLOOKUP' => [102, -1, 0, 0], + 'ISREF' => [105, 1, 0, 0], + 'LOG' => [109, -1, 1, 0], + 'CHAR' => [111, 1, 1, 0], + 'LOWER' => [112, 1, 1, 0], + 'UPPER' => [113, 1, 1, 0], + 'PROPER' => [114, 1, 1, 0], + 'LEFT' => [115, -1, 1, 0], + 'RIGHT' => [116, -1, 1, 0], + 'EXACT' => [117, 2, 1, 0], + 'TRIM' => [118, 1, 1, 0], + 'REPLACE' => [119, 4, 1, 0], + 'SUBSTITUTE' => [120, -1, 1, 0], + 'CODE' => [121, 1, 1, 0], + 'FIND' => [124, -1, 1, 0], + 'CELL' => [125, -1, 0, 1], + 'ISERR' => [126, 1, 1, 0], + 'ISTEXT' => [127, 1, 1, 0], + 'ISNUMBER' => [128, 1, 1, 0], + 'ISBLANK' => [129, 1, 1, 0], + 'T' => [130, 1, 0, 0], + 'N' => [131, 1, 0, 0], + 'DATEVALUE' => [140, 1, 1, 0], + 'TIMEVALUE' => [141, 1, 1, 0], + 'SLN' => [142, 3, 1, 0], + 'SYD' => [143, 4, 1, 0], + 'DDB' => [144, -1, 1, 0], + 'INDIRECT' => [148, -1, 1, 1], + 'CALL' => [150, -1, 1, 0], + 'CLEAN' => [162, 1, 1, 0], + 'MDETERM' => [163, 1, 2, 0], + 'MINVERSE' => [164, 1, 2, 0], + 'MMULT' => [165, 2, 2, 0], + 'IPMT' => [167, -1, 1, 0], + 'PPMT' => [168, -1, 1, 0], + 'COUNTA' => [169, -1, 0, 0], + 'PRODUCT' => [183, -1, 0, 0], + 'FACT' => [184, 1, 1, 0], + 'DPRODUCT' => [189, 3, 0, 0], + 'ISNONTEXT' => [190, 1, 1, 0], + 'STDEVP' => [193, -1, 0, 0], + 'VARP' => [194, -1, 0, 0], + 'DSTDEVP' => [195, 3, 0, 0], + 'DVARP' => [196, 3, 0, 0], + 'TRUNC' => [197, -1, 1, 0], + 'ISLOGICAL' => [198, 1, 1, 0], + 'DCOUNTA' => [199, 3, 0, 0], + 'USDOLLAR' => [204, -1, 1, 0], + 'FINDB' => [205, -1, 1, 0], + 'SEARCHB' => [206, -1, 1, 0], + 'REPLACEB' => [207, 4, 1, 0], + 'LEFTB' => [208, -1, 1, 0], + 'RIGHTB' => [209, -1, 1, 0], + 'MIDB' => [210, 3, 1, 0], + 'LENB' => [211, 1, 1, 0], + 'ROUNDUP' => [212, 2, 1, 0], + 'ROUNDDOWN' => [213, 2, 1, 0], + 'ASC' => [214, 1, 1, 0], + 'DBCS' => [215, 1, 1, 0], + 'RANK' => [216, -1, 0, 0], + 'ADDRESS' => [219, -1, 1, 0], + 'DAYS360' => [220, -1, 1, 0], + 'TODAY' => [221, 0, 1, 1], + 'VDB' => [222, -1, 1, 0], + 'MEDIAN' => [227, -1, 0, 0], + 'SUMPRODUCT' => [228, -1, 2, 0], + 'SINH' => [229, 1, 1, 0], + 'COSH' => [230, 1, 1, 0], + 'TANH' => [231, 1, 1, 0], + 'ASINH' => [232, 1, 1, 0], + 'ACOSH' => [233, 1, 1, 0], + 'ATANH' => [234, 1, 1, 0], + 'DGET' => [235, 3, 0, 0], + 'INFO' => [244, 1, 1, 1], + 'DB' => [247, -1, 1, 0], + 'FREQUENCY' => [252, 2, 0, 0], + 'ERROR.TYPE' => [261, 1, 1, 0], + 'REGISTER.ID' => [267, -1, 1, 0], + 'AVEDEV' => [269, -1, 0, 0], + 'BETADIST' => [270, -1, 1, 0], + 'GAMMALN' => [271, 1, 1, 0], + 'BETAINV' => [272, -1, 1, 0], + 'BINOMDIST' => [273, 4, 1, 0], + 'CHIDIST' => [274, 2, 1, 0], + 'CHIINV' => [275, 2, 1, 0], + 'COMBIN' => [276, 2, 1, 0], + 'CONFIDENCE' => [277, 3, 1, 0], + 'CRITBINOM' => [278, 3, 1, 0], + 'EVEN' => [279, 1, 1, 0], + 'EXPONDIST' => [280, 3, 1, 0], + 'FDIST' => [281, 3, 1, 0], + 'FINV' => [282, 3, 1, 0], + 'FISHER' => [283, 1, 1, 0], + 'FISHERINV' => [284, 1, 1, 0], + 'FLOOR' => [285, 2, 1, 0], + 'GAMMADIST' => [286, 4, 1, 0], + 'GAMMAINV' => [287, 3, 1, 0], + 'CEILING' => [288, 2, 1, 0], + 'HYPGEOMDIST' => [289, 4, 1, 0], + 'LOGNORMDIST' => [290, 3, 1, 0], + 'LOGINV' => [291, 3, 1, 0], + 'NEGBINOMDIST' => [292, 3, 1, 0], + 'NORMDIST' => [293, 4, 1, 0], + 'NORMSDIST' => [294, 1, 1, 0], + 'NORMINV' => [295, 3, 1, 0], + 'NORMSINV' => [296, 1, 1, 0], + 'STANDARDIZE' => [297, 3, 1, 0], + 'ODD' => [298, 1, 1, 0], + 'PERMUT' => [299, 2, 1, 0], + 'POISSON' => [300, 3, 1, 0], + 'TDIST' => [301, 3, 1, 0], + 'WEIBULL' => [302, 4, 1, 0], + 'SUMXMY2' => [303, 2, 2, 0], + 'SUMX2MY2' => [304, 2, 2, 0], + 'SUMX2PY2' => [305, 2, 2, 0], + 'CHITEST' => [306, 2, 2, 0], + 'CORREL' => [307, 2, 2, 0], + 'COVAR' => [308, 2, 2, 0], + 'FORECAST' => [309, 3, 2, 0], + 'FTEST' => [310, 2, 2, 0], + 'INTERCEPT' => [311, 2, 2, 0], + 'PEARSON' => [312, 2, 2, 0], + 'RSQ' => [313, 2, 2, 0], + 'STEYX' => [314, 2, 2, 0], + 'SLOPE' => [315, 2, 2, 0], + 'TTEST' => [316, 4, 2, 0], + 'PROB' => [317, -1, 2, 0], + 'DEVSQ' => [318, -1, 0, 0], + 'GEOMEAN' => [319, -1, 0, 0], + 'HARMEAN' => [320, -1, 0, 0], + 'SUMSQ' => [321, -1, 0, 0], + 'KURT' => [322, -1, 0, 0], + 'SKEW' => [323, -1, 0, 0], + 'ZTEST' => [324, -1, 0, 0], + 'LARGE' => [325, 2, 0, 0], + 'SMALL' => [326, 2, 0, 0], + 'QUARTILE' => [327, 2, 0, 0], + 'PERCENTILE' => [328, 2, 0, 0], + 'PERCENTRANK' => [329, -1, 0, 0], + 'MODE' => [330, -1, 2, 0], + 'TRIMMEAN' => [331, 2, 0, 0], + 'TINV' => [332, 2, 1, 0], + 'CONCATENATE' => [336, -1, 1, 0], + 'POWER' => [337, 2, 1, 0], + 'RADIANS' => [342, 1, 1, 0], + 'DEGREES' => [343, 1, 1, 0], + 'SUBTOTAL' => [344, -1, 0, 0], + 'SUMIF' => [345, -1, 0, 0], + 'COUNTIF' => [346, 2, 0, 0], + 'COUNTBLANK' => [347, 1, 0, 0], + 'ISPMT' => [350, 4, 1, 0], + 'DATEDIF' => [351, 3, 1, 0], + 'DATESTRING' => [352, 1, 1, 0], + 'NUMBERSTRING' => [353, 2, 1, 0], + 'ROMAN' => [354, -1, 1, 0], + 'GETPIVOTDATA' => [358, -1, 0, 0], + 'HYPERLINK' => [359, -1, 1, 0], + 'PHONETIC' => [360, 1, 0, 0], + 'AVERAGEA' => [361, -1, 0, 0], + 'MAXA' => [362, -1, 0, 0], + 'MINA' => [363, -1, 0, 0], + 'STDEVPA' => [364, -1, 0, 0], + 'VARPA' => [365, -1, 0, 0], + 'STDEVA' => [366, -1, 0, 0], + 'VARA' => [367, -1, 0, 0], + 'BAHTTEXT' => [368, 1, 0, 0], + ]; + + /** + * The class constructor. + */ + public function __construct() + { + $this->currentCharacter = 0; + $this->currentToken = ''; // The token we are working on. + $this->formula = ''; // The formula to parse. + $this->lookAhead = ''; // The character ahead of the current char. + $this->parseTree = ''; // The parse tree to be generated. + $this->externalSheets = []; + $this->references = []; + } + + /** + * Convert a token to the proper ptg value. + * + * @param mixed $token the token to convert + * + * @return mixed the converted token on success + */ + private function convert($token) + { + if (preg_match('/"([^"]|""){0,255}"/', $token)) { + return $this->convertString($token); + } elseif (is_numeric($token)) { + return $this->convertNumber($token); + // match references like A1 or $A$1 + } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) { + return $this->convertRef2d($token); + // match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1 + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?(\\d+)$/u', $token)) { + return $this->convertRef3d($token); + // match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1 + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\\d+)$/u", $token)) { + return $this->convertRef3d($token); + // match ranges like A1:B2 or $A$1:$B$2 + } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) { + return $this->convertRange2d($token); + // match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2 + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?([A-Ia-i]?[A-Za-z])?\$?(\\d+)\\:\$?([A-Ia-i]?[A-Za-z])?\$?(\\d+)$/u', $token)) { + return $this->convertRange3d($token); + // match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2 + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\\d+)\\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\\d+)$/u", $token)) { + return $this->convertRange3d($token); + // operators (including parentheses) + } elseif (isset($this->ptg[$token])) { + return pack('C', $this->ptg[$token]); + // match error codes + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $token) or $token == '#N/A') { + return $this->convertError($token); + // commented so argument number can be processed correctly. See toReversePolish(). + /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token)) + { + return($this->convertFunction($token, $this->_func_args)); + }*/ + // if it's an argument, ignore the token (the argument remains) + } elseif ($token == 'arg') { + return ''; + } + + // TODO: use real error codes + throw new WriterException("Unknown token $token"); + } + + /** + * Convert a number token to ptgInt or ptgNum. + * + * @param mixed $num an integer or double for conversion to its ptg value + * + * @return string + */ + private function convertNumber($num) + { + // Integer in the range 0..2**16-1 + if ((preg_match('/^\\d+$/', $num)) and ($num <= 65535)) { + return pack('Cv', $this->ptg['ptgInt'], $num); + } + + // A float + if (BIFFwriter::getByteOrder()) { // if it's Big Endian + $num = strrev($num); + } + + return pack('Cd', $this->ptg['ptgNum'], $num); + } + + /** + * Convert a string token to ptgStr. + * + * @param string $string a string for conversion to its ptg value + * + * @return mixed the converted token on success + */ + private function convertString($string) + { + // chop away beggining and ending quotes + $string = substr($string, 1, -1); + if (strlen($string) > 255) { + throw new WriterException('String is too long'); + } + + return pack('C', $this->ptg['ptgStr']) . StringHelper::UTF8toBIFF8UnicodeShort($string); + } + + /** + * Convert a function to a ptgFunc or ptgFuncVarV depending on the number of + * args that it takes. + * + * @param string $token the name of the function for convertion to ptg value + * @param int $num_args the number of arguments the function receives + * + * @return string The packed ptg for the function + */ + private function convertFunction($token, $num_args) + { + $args = $this->functions[$token][1]; + + // Fixed number of args eg. TIME($i, $j, $k). + if ($args >= 0) { + return pack('Cv', $this->ptg['ptgFuncV'], $this->functions[$token][0]); + } + // Variable number of args eg. SUM($i, $j, $k, ..). + if ($args == -1) { + return pack('CCv', $this->ptg['ptgFuncVarV'], $num_args, $this->functions[$token][0]); + } + } + + /** + * Convert an Excel range such as A1:D4 to a ptgRefV. + * + * @param string $range An Excel range in the A1:A2 + * @param int $class + * + * @return string + */ + private function convertRange2d($range, $class = 0) + { + // TODO: possible class value 0,1,2 check Formula.pm + // Split the range into 2 cell refs + if (preg_match('/^(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)\:(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)$/', $range)) { + [$cell1, $cell2] = explode(':', $range); + } else { + // TODO: use real error codes + throw new WriterException('Unknown range separator'); + } + + // Convert the cell references + [$row1, $col1] = $this->cellToPackedRowcol($cell1); + [$row2, $col2] = $this->cellToPackedRowcol($cell2); + + // The ptg value depends on the class of the ptg. + if ($class == 0) { + $ptgArea = pack('C', $this->ptg['ptgArea']); + } elseif ($class == 1) { + $ptgArea = pack('C', $this->ptg['ptgAreaV']); + } elseif ($class == 2) { + $ptgArea = pack('C', $this->ptg['ptgAreaA']); + } else { + // TODO: use real error codes + throw new WriterException("Unknown class $class"); + } + + return $ptgArea . $row1 . $row2 . $col1 . $col2; + } + + /** + * Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to + * a ptgArea3d. + * + * @param string $token an Excel range in the Sheet1!A1:A2 format + * + * @return mixed the packed ptgArea3d token on success + */ + private function convertRange3d($token) + { + // Split the ref at the ! symbol + [$ext_ref, $range] = PhpspreadsheetWorksheet::extractSheetTitle($token, true); + + // Convert the external reference part (different for BIFF8) + $ext_ref = $this->getRefIndex($ext_ref); + + // Split the range into 2 cell refs + [$cell1, $cell2] = explode(':', $range); + + // Convert the cell references + if (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\\d+)$/', $cell1)) { + [$row1, $col1] = $this->cellToPackedRowcol($cell1); + [$row2, $col2] = $this->cellToPackedRowcol($cell2); + } else { // It's a rows range (like 26:27) + [$row1, $col1, $row2, $col2] = $this->rangeToPackedRange($cell1 . ':' . $cell2); + } + + // The ptg value depends on the class of the ptg. + $ptgArea = pack('C', $this->ptg['ptgArea3d']); + + return $ptgArea . $ext_ref . $row1 . $row2 . $col1 . $col2; + } + + /** + * Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV. + * + * @param string $cell An Excel cell reference + * + * @return string The cell in packed() format with the corresponding ptg + */ + private function convertRef2d($cell) + { + // Convert the cell reference + $cell_array = $this->cellToPackedRowcol($cell); + [$row, $col] = $cell_array; + + // The ptg value depends on the class of the ptg. + $ptgRef = pack('C', $this->ptg['ptgRefA']); + + return $ptgRef . $row . $col; + } + + /** + * Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a + * ptgRef3d. + * + * @param string $cell An Excel cell reference + * + * @return mixed the packed ptgRef3d token on success + */ + private function convertRef3d($cell) + { + // Split the ref at the ! symbol + [$ext_ref, $cell] = PhpspreadsheetWorksheet::extractSheetTitle($cell, true); + + // Convert the external reference part (different for BIFF8) + $ext_ref = $this->getRefIndex($ext_ref); + + // Convert the cell reference part + [$row, $col] = $this->cellToPackedRowcol($cell); + + // The ptg value depends on the class of the ptg. + $ptgRef = pack('C', $this->ptg['ptgRef3dA']); + + return $ptgRef . $ext_ref . $row . $col; + } + + /** + * Convert an error code to a ptgErr. + * + * @param string $errorCode The error code for conversion to its ptg value + * + * @return string The error code ptgErr + */ + private function convertError($errorCode) + { + switch ($errorCode) { + case '#NULL!': + return pack('C', 0x00); + case '#DIV/0!': + return pack('C', 0x07); + case '#VALUE!': + return pack('C', 0x0F); + case '#REF!': + return pack('C', 0x17); + case '#NAME?': + return pack('C', 0x1D); + case '#NUM!': + return pack('C', 0x24); + case '#N/A': + return pack('C', 0x2A); + } + + return pack('C', 0xFF); + } + + /** + * Look up the REF index that corresponds to an external sheet name + * (or range). If it doesn't exist yet add it to the workbook's references + * array. It assumes all sheet names given must exist. + * + * @param string $ext_ref The name of the external reference + * + * @return mixed The reference index in packed() format on success + */ + private function getRefIndex($ext_ref) + { + $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any. + $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any. + $ext_ref = str_replace('\'\'', '\'', $ext_ref); // Replace escaped '' with ' + + // Check if there is a sheet range eg., Sheet1:Sheet2. + if (preg_match('/:/', $ext_ref)) { + [$sheet_name1, $sheet_name2] = explode(':', $ext_ref); + + $sheet1 = $this->getSheetIndex($sheet_name1); + if ($sheet1 == -1) { + throw new WriterException("Unknown sheet name $sheet_name1 in formula"); + } + $sheet2 = $this->getSheetIndex($sheet_name2); + if ($sheet2 == -1) { + throw new WriterException("Unknown sheet name $sheet_name2 in formula"); + } + + // Reverse max and min sheet numbers if necessary + if ($sheet1 > $sheet2) { + [$sheet1, $sheet2] = [$sheet2, $sheet1]; + } + } else { // Single sheet name only. + $sheet1 = $this->getSheetIndex($ext_ref); + if ($sheet1 == -1) { + throw new WriterException("Unknown sheet name $ext_ref in formula"); + } + $sheet2 = $sheet1; + } + + // assume all references belong to this document + $supbook_index = 0x00; + $ref = pack('vvv', $supbook_index, $sheet1, $sheet2); + $totalreferences = count($this->references); + $index = -1; + for ($i = 0; $i < $totalreferences; ++$i) { + if ($ref == $this->references[$i]) { + $index = $i; + + break; + } + } + // if REF was not found add it to references array + if ($index == -1) { + $this->references[$totalreferences] = $ref; + $index = $totalreferences; + } + + return pack('v', $index); + } + + /** + * Look up the index that corresponds to an external sheet name. The hash of + * sheet names is updated by the addworksheet() method of the + * \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook class. + * + * @param string $sheet_name Sheet name + * + * @return int The sheet index, -1 if the sheet was not found + */ + private function getSheetIndex($sheet_name) + { + if (!isset($this->externalSheets[$sheet_name])) { + return -1; + } + + return $this->externalSheets[$sheet_name]; + } + + /** + * This method is used to update the array of sheet names. It is + * called by the addWorksheet() method of the + * \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook class. + * + * @see \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook::addWorksheet() + * + * @param string $name The name of the worksheet being added + * @param int $index The index of the worksheet being added + */ + public function setExtSheet($name, $index) + { + $this->externalSheets[$name] = $index; + } + + /** + * pack() row and column into the required 3 or 4 byte format. + * + * @param string $cell The Excel cell reference to be packed + * + * @return array Array containing the row and column in packed() format + */ + private function cellToPackedRowcol($cell) + { + $cell = strtoupper($cell); + [$row, $col, $row_rel, $col_rel] = $this->cellToRowcol($cell); + if ($col >= 256) { + throw new WriterException("Column in: $cell greater than 255"); + } + if ($row >= 65536) { + throw new WriterException("Row in: $cell greater than 65536 "); + } + + // Set the high bits to indicate if row or col are relative. + $col |= $col_rel << 14; + $col |= $row_rel << 15; + $col = pack('v', $col); + + $row = pack('v', $row); + + return [$row, $col]; + } + + /** + * pack() row range into the required 3 or 4 byte format. + * Just using maximum col/rows, which is probably not the correct solution. + * + * @param string $range The Excel range to be packed + * + * @return array Array containing (row1,col1,row2,col2) in packed() format + */ + private function rangeToPackedRange($range) + { + preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match); + // return absolute rows if there is a $ in the ref + $row1_rel = empty($match[1]) ? 1 : 0; + $row1 = $match[2]; + $row2_rel = empty($match[3]) ? 1 : 0; + $row2 = $match[4]; + // Convert 1-index to zero-index + --$row1; + --$row2; + // Trick poor inocent Excel + $col1 = 0; + $col2 = 65535; // FIXME: maximum possible value for Excel 5 (change this!!!) + + // FIXME: this changes for BIFF8 + if (($row1 >= 65536) or ($row2 >= 65536)) { + throw new WriterException("Row in: $range greater than 65536 "); + } + + // Set the high bits to indicate if rows are relative. + $col1 |= $row1_rel << 15; + $col2 |= $row2_rel << 15; + $col1 = pack('v', $col1); + $col2 = pack('v', $col2); + + $row1 = pack('v', $row1); + $row2 = pack('v', $row2); + + return [$row1, $col1, $row2, $col2]; + } + + /** + * Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero + * indexed row and column number. Also returns two (0,1) values to indicate + * whether the row or column are relative references. + * + * @param string $cell the Excel cell reference in A1 format + * + * @return array + */ + private function cellToRowcol($cell) + { + preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/', $cell, $match); + // return absolute column if there is a $ in the ref + $col_rel = empty($match[1]) ? 1 : 0; + $col_ref = $match[2]; + $row_rel = empty($match[3]) ? 1 : 0; + $row = $match[4]; + + // Convert base26 column string to a number. + $expn = strlen($col_ref) - 1; + $col = 0; + $col_ref_length = strlen($col_ref); + for ($i = 0; $i < $col_ref_length; ++$i) { + $col += (ord($col_ref[$i]) - 64) * pow(26, $expn); + --$expn; + } + + // Convert 1-index to zero-index + --$row; + --$col; + + return [$row, $col, $row_rel, $col_rel]; + } + + /** + * Advance to the next valid token. + */ + private function advance() + { + $i = $this->currentCharacter; + $formula_length = strlen($this->formula); + // eat up white spaces + if ($i < $formula_length) { + while ($this->formula[$i] == ' ') { + ++$i; + } + + if ($i < ($formula_length - 1)) { + $this->lookAhead = $this->formula[$i + 1]; + } + $token = ''; + } + + while ($i < $formula_length) { + $token .= $this->formula[$i]; + + if ($i < ($formula_length - 1)) { + $this->lookAhead = $this->formula[$i + 1]; + } else { + $this->lookAhead = ''; + } + + if ($this->match($token) != '') { + $this->currentCharacter = $i + 1; + $this->currentToken = $token; + + return 1; + } + + if ($i < ($formula_length - 2)) { + $this->lookAhead = $this->formula[$i + 2]; + } else { // if we run out of characters lookAhead becomes empty + $this->lookAhead = ''; + } + ++$i; + } + //die("Lexical error ".$this->currentCharacter); + } + + /** + * Checks if it's a valid token. + * + * @param mixed $token the token to check + * + * @return mixed The checked token or false on failure + */ + private function match($token) + { + switch ($token) { + case '+': + case '-': + case '*': + case '/': + case '(': + case ')': + case ',': + case ';': + case '>=': + case '<=': + case '=': + case '<>': + case '^': + case '&': + case '%': + return $token; + + break; + case '>': + if ($this->lookAhead === '=') { // it's a GE token + break; + } + + return $token; + + break; + case '<': + // it's a LE or a NE token + if (($this->lookAhead === '=') or ($this->lookAhead === '>')) { + break; + } + + return $token; + + break; + default: + // if it's a reference A1 or $A$1 or $A1 or A$1 + if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?\d+$/', $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead !== ':') and ($this->lookAhead !== '.') and ($this->lookAhead !== '!')) { + return $token; + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?\\d+$/u', $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead !== ':') and ($this->lookAhead !== '.')) { + // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1) + return $token; + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?\\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead) and ($this->lookAhead !== ':') and ($this->lookAhead !== '.')) { + // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1) + return $token; + } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+:(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+$/', $token) && !preg_match('/\d/', $this->lookAhead)) { + // if it's a range A1:A2 or $A$1:$A$2 + return $token; + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?([A-Ia-i]?[A-Za-z])?\$?\\d+:\$?([A-Ia-i]?[A-Za-z])?\$?\\d+$/u', $token) and !preg_match('/\d/', $this->lookAhead)) { + // If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2 + return $token; + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+$/u", $token) and !preg_match('/\d/', $this->lookAhead)) { + // If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2 + return $token; + } elseif (is_numeric($token) and (!is_numeric($token . $this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead !== '!') and ($this->lookAhead !== ':')) { + // If it's a number (check that it's not a sheet name or range) + return $token; + } elseif (preg_match('/"([^"]|""){0,255}"/', $token) and $this->lookAhead !== '"' and (substr_count($token, '"') % 2 == 0)) { + // If it's a string (of maximum 255 characters) + return $token; + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $token) or $token === '#N/A') { + // If it's an error code + return $token; + } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $token) and ($this->lookAhead === '(')) { + // if it's a function call + return $token; + } elseif (substr($token, -1) === ')') { + // It's an argument of some description (e.g. a named range), + // precise nature yet to be determined + return $token; + } + + return ''; + } + } + + /** + * The parsing method. It parses a formula. + * + * @param string $formula the formula to parse, without the initial equal + * sign (=) + * + * @return mixed true on success + */ + public function parse($formula) + { + $this->currentCharacter = 0; + $this->formula = (string) $formula; + $this->lookAhead = $formula[1] ?? ''; + $this->advance(); + $this->parseTree = $this->condition(); + + return true; + } + + /** + * It parses a condition. It assumes the following rule: + * Cond -> Expr [(">" | "<") Expr]. + * + * @return mixed The parsed ptg'd tree on success + */ + private function condition() + { + $result = $this->expression(); + if ($this->currentToken == '<') { + $this->advance(); + $result2 = $this->expression(); + $result = $this->createTree('ptgLT', $result, $result2); + } elseif ($this->currentToken == '>') { + $this->advance(); + $result2 = $this->expression(); + $result = $this->createTree('ptgGT', $result, $result2); + } elseif ($this->currentToken == '<=') { + $this->advance(); + $result2 = $this->expression(); + $result = $this->createTree('ptgLE', $result, $result2); + } elseif ($this->currentToken == '>=') { + $this->advance(); + $result2 = $this->expression(); + $result = $this->createTree('ptgGE', $result, $result2); + } elseif ($this->currentToken == '=') { + $this->advance(); + $result2 = $this->expression(); + $result = $this->createTree('ptgEQ', $result, $result2); + } elseif ($this->currentToken == '<>') { + $this->advance(); + $result2 = $this->expression(); + $result = $this->createTree('ptgNE', $result, $result2); + } elseif ($this->currentToken == '&') { + $this->advance(); + $result2 = $this->expression(); + $result = $this->createTree('ptgConcat', $result, $result2); + } + + return $result; + } + + /** + * It parses a expression. It assumes the following rule: + * Expr -> Term [("+" | "-") Term] + * -> "string" + * -> "-" Term : Negative value + * -> "+" Term : Positive value + * -> Error code. + * + * @return mixed The parsed ptg'd tree on success + */ + private function expression() + { + // If it's a string return a string node + if (preg_match('/"([^"]|""){0,255}"/', $this->currentToken)) { + $tmp = str_replace('""', '"', $this->currentToken); + if (($tmp == '"') || ($tmp == '')) { + // Trap for "" that has been used for an empty string + $tmp = '""'; + } + $result = $this->createTree($tmp, '', ''); + $this->advance(); + + return $result; + // If it's an error code + } elseif (preg_match('/^#[A-Z0\\/]{3,5}[!?]{1}$/', $this->currentToken) or $this->currentToken == '#N/A') { + $result = $this->createTree($this->currentToken, 'ptgErr', ''); + $this->advance(); + + return $result; + // If it's a negative value + } elseif ($this->currentToken == '-') { + // catch "-" Term + $this->advance(); + $result2 = $this->expression(); + + return $this->createTree('ptgUminus', $result2, ''); + // If it's a positive value + } elseif ($this->currentToken == '+') { + // catch "+" Term + $this->advance(); + $result2 = $this->expression(); + + return $this->createTree('ptgUplus', $result2, ''); + } + $result = $this->term(); + while (($this->currentToken == '+') or + ($this->currentToken == '-') or + ($this->currentToken == '^')) { + if ($this->currentToken == '+') { + $this->advance(); + $result2 = $this->term(); + $result = $this->createTree('ptgAdd', $result, $result2); + } elseif ($this->currentToken == '-') { + $this->advance(); + $result2 = $this->term(); + $result = $this->createTree('ptgSub', $result, $result2); + } else { + $this->advance(); + $result2 = $this->term(); + $result = $this->createTree('ptgPower', $result, $result2); + } + } + + return $result; + } + + /** + * This function just introduces a ptgParen element in the tree, so that Excel + * doesn't get confused when working with a parenthesized formula afterwards. + * + * @see fact() + * + * @return array The parsed ptg'd tree + */ + private function parenthesizedExpression() + { + return $this->createTree('ptgParen', $this->expression(), ''); + } + + /** + * It parses a term. It assumes the following rule: + * Term -> Fact [("*" | "/") Fact]. + * + * @return mixed The parsed ptg'd tree on success + */ + private function term() + { + $result = $this->fact(); + while (($this->currentToken == '*') or + ($this->currentToken == '/')) { + if ($this->currentToken == '*') { + $this->advance(); + $result2 = $this->fact(); + $result = $this->createTree('ptgMul', $result, $result2); + } else { + $this->advance(); + $result2 = $this->fact(); + $result = $this->createTree('ptgDiv', $result, $result2); + } + } + + return $result; + } + + /** + * It parses a factor. It assumes the following rule: + * Fact -> ( Expr ) + * | CellRef + * | CellRange + * | Number + * | Function. + * + * @return mixed The parsed ptg'd tree on success + */ + private function fact() + { + if ($this->currentToken === '(') { + $this->advance(); // eat the "(" + $result = $this->parenthesizedExpression(); + if ($this->currentToken !== ')') { + throw new WriterException("')' token expected."); + } + $this->advance(); // eat the ")" + return $result; + } + // if it's a reference + if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?\d+$/', $this->currentToken)) { + $result = $this->createTree($this->currentToken, '', ''); + $this->advance(); + + return $result; + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?[A-Ia-i]?[A-Za-z]\$?\\d+$/u', $this->currentToken)) { + // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1) + $result = $this->createTree($this->currentToken, '', ''); + $this->advance(); + + return $result; + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?[A-Ia-i]?[A-Za-z]\\$?\\d+$/u", $this->currentToken)) { + // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1) + $result = $this->createTree($this->currentToken, '', ''); + $this->advance(); + + return $result; + } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+:(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+$/', $this->currentToken) or + preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?\d+$/', $this->currentToken)) { + // if it's a range A1:B2 or $A$1:$B$2 + // must be an error? + $result = $this->createTree($this->currentToken, '', ''); + $this->advance(); + + return $result; + } elseif (preg_match('/^' . self::REGEX_SHEET_TITLE_UNQUOTED . '(\\:' . self::REGEX_SHEET_TITLE_UNQUOTED . ')?\\!\$?([A-Ia-i]?[A-Za-z])?\$?\\d+:\$?([A-Ia-i]?[A-Za-z])?\$?\\d+$/u', $this->currentToken)) { + // If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2) + // must be an error? + $result = $this->createTree($this->currentToken, '', ''); + $this->advance(); + + return $result; + } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . '(\\:' . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+:\\$?([A-Ia-i]?[A-Za-z])?\\$?\\d+$/u", $this->currentToken)) { + // If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2) + // must be an error? + $result = $this->createTree($this->currentToken, '', ''); + $this->advance(); + + return $result; + } elseif (is_numeric($this->currentToken)) { + // If it's a number or a percent + if ($this->lookAhead === '%') { + $result = $this->createTree('ptgPercent', $this->currentToken, ''); + $this->advance(); // Skip the percentage operator once we've pre-built that tree + } else { + $result = $this->createTree($this->currentToken, '', ''); + } + $this->advance(); + + return $result; + } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $this->currentToken)) { + // if it's a function call + return $this->func(); + } + + throw new WriterException('Syntax error: ' . $this->currentToken . ', lookahead: ' . $this->lookAhead . ', current char: ' . $this->currentCharacter); + } + + /** + * It parses a function call. It assumes the following rule: + * Func -> ( Expr [,Expr]* ). + * + * @return mixed The parsed ptg'd tree on success + */ + private function func() + { + $num_args = 0; // number of arguments received + $function = strtoupper($this->currentToken); + $result = ''; // initialize result + $this->advance(); + $this->advance(); // eat the "(" + while ($this->currentToken !== ')') { + if ($num_args > 0) { + if ($this->currentToken === ',' || $this->currentToken === ';') { + $this->advance(); // eat the "," or ";" + } else { + throw new WriterException("Syntax error: comma expected in function $function, arg #{$num_args}"); + } + $result2 = $this->condition(); + $result = $this->createTree('arg', $result, $result2); + } else { // first argument + $result2 = $this->condition(); + $result = $this->createTree('arg', '', $result2); + } + ++$num_args; + } + if (!isset($this->functions[$function])) { + throw new WriterException("Function $function() doesn't exist"); + } + $args = $this->functions[$function][1]; + // If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid. + if (($args >= 0) and ($args != $num_args)) { + throw new WriterException("Incorrect number of arguments in function $function() "); + } + + $result = $this->createTree($function, $result, $num_args); + $this->advance(); // eat the ")" + return $result; + } + + /** + * Creates a tree. In fact an array which may have one or two arrays (sub-trees) + * as elements. + * + * @param mixed $value the value of this node + * @param mixed $left the left array (sub-tree) or a final node + * @param mixed $right the right array (sub-tree) or a final node + * + * @return array A tree + */ + private function createTree($value, $left, $right) + { + return ['value' => $value, 'left' => $left, 'right' => $right]; + } + + /** + * Builds a string containing the tree in reverse polish notation (What you + * would use in a HP calculator stack). + * The following tree:. + * + * + + * / \ + * 2 3 + * + * produces: "23+" + * + * The following tree: + * + * + + * / \ + * 3 * + * / \ + * 6 A1 + * + * produces: "36A1*+" + * + * In fact all operands, functions, references, etc... are written as ptg's + * + * @param array $tree the optional tree to convert + * + * @return string The tree in reverse polish notation + */ + public function toReversePolish($tree = []) + { + $polish = ''; // the string we are going to return + if (empty($tree)) { // If it's the first call use parseTree + $tree = $this->parseTree; + } + + if (is_array($tree['left'])) { + $converted_tree = $this->toReversePolish($tree['left']); + $polish .= $converted_tree; + } elseif ($tree['left'] != '') { // It's a final node + $converted_tree = $this->convert($tree['left']); + $polish .= $converted_tree; + } + if (is_array($tree['right'])) { + $converted_tree = $this->toReversePolish($tree['right']); + $polish .= $converted_tree; + } elseif ($tree['right'] != '') { // It's a final node + $converted_tree = $this->convert($tree['right']); + $polish .= $converted_tree; + } + // if it's a function convert it here (so we can set it's arguments) + if (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/", $tree['value']) and + !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and + !preg_match('/^[A-Ia-i]?[A-Za-z](\\d+)\\.\\.[A-Ia-i]?[A-Za-z](\\d+)$/', $tree['value']) and + !is_numeric($tree['value']) and + !isset($this->ptg[$tree['value']])) { + // left subtree for a function is always an array. + if ($tree['left'] != '') { + $left_tree = $this->toReversePolish($tree['left']); + } else { + $left_tree = ''; + } + // add it's left subtree and return. + return $left_tree . $this->convertFunction($tree['value'], $tree['right']); + } + $converted_tree = $this->convert($tree['value']); + + return $polish . $converted_tree; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Workbook.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Workbook.php new file mode 100644 index 0000000..41c8e64 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Workbook.php @@ -0,0 +1,1150 @@ + +// * +// * The majority of this is _NOT_ my code. I simply ported it from the +// * PERL Spreadsheet::WriteExcel module. +// * +// * The author of the Spreadsheet::WriteExcel module is John McNamara +// * +// * +// * I _DO_ maintain this code, and John McNamara has nothing to do with the +// * porting of this code to PHP. Any questions directly related to this +// * class library should be directed to me. +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ +class Workbook extends BIFFwriter +{ + /** + * Formula parser. + * + * @var \PhpOffice\PhpSpreadsheet\Writer\Xls\Parser + */ + private $parser; + + /** + * The BIFF file size for the workbook. + * + * @var int + * + * @see calcSheetOffsets() + */ + private $biffSize; + + /** + * XF Writers. + * + * @var \PhpOffice\PhpSpreadsheet\Writer\Xls\Xf[] + */ + private $xfWriters = []; + + /** + * Array containing the colour palette. + * + * @var array + */ + private $palette; + + /** + * The codepage indicates the text encoding used for strings. + * + * @var int + */ + private $codepage; + + /** + * The country code used for localization. + * + * @var int + */ + private $countryCode; + + /** + * Workbook. + * + * @var Spreadsheet + */ + private $spreadsheet; + + /** + * Fonts writers. + * + * @var Font[] + */ + private $fontWriters = []; + + /** + * Added fonts. Maps from font's hash => index in workbook. + * + * @var array + */ + private $addedFonts = []; + + /** + * Shared number formats. + * + * @var array + */ + private $numberFormats = []; + + /** + * Added number formats. Maps from numberFormat's hash => index in workbook. + * + * @var array + */ + private $addedNumberFormats = []; + + /** + * Sizes of the binary worksheet streams. + * + * @var array + */ + private $worksheetSizes = []; + + /** + * Offsets of the binary worksheet streams relative to the start of the global workbook stream. + * + * @var array + */ + private $worksheetOffsets = []; + + /** + * Total number of shared strings in workbook. + * + * @var int + */ + private $stringTotal; + + /** + * Number of unique shared strings in workbook. + * + * @var int + */ + private $stringUnique; + + /** + * Array of unique shared strings in workbook. + * + * @var array + */ + private $stringTable; + + /** + * Color cache. + */ + private $colors; + + /** + * Escher object corresponding to MSODRAWINGGROUP. + * + * @var \PhpOffice\PhpSpreadsheet\Shared\Escher + */ + private $escher; + + /** + * Class constructor. + * + * @param Spreadsheet $spreadsheet The Workbook + * @param int $str_total Total number of strings + * @param int $str_unique Total number of unique strings + * @param array $str_table String Table + * @param array $colors Colour Table + * @param Parser $parser The formula parser created for the Workbook + */ + public function __construct(Spreadsheet $spreadsheet, &$str_total, &$str_unique, &$str_table, &$colors, Parser $parser) + { + // It needs to call its parent's constructor explicitly + parent::__construct(); + + $this->parser = $parser; + $this->biffSize = 0; + $this->palette = []; + $this->countryCode = -1; + + $this->stringTotal = &$str_total; + $this->stringUnique = &$str_unique; + $this->stringTable = &$str_table; + $this->colors = &$colors; + $this->setPaletteXl97(); + + $this->spreadsheet = $spreadsheet; + + $this->codepage = 0x04B0; + + // Add empty sheets and Build color cache + $countSheets = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $countSheets; ++$i) { + $phpSheet = $spreadsheet->getSheet($i); + + $this->parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser + + $supbook_index = 0x00; + $ref = pack('vvv', $supbook_index, $i, $i); + $this->parser->references[] = $ref; // Register reference with parser + + // Sheet tab colors? + if ($phpSheet->isTabColorSet()) { + $this->addColor($phpSheet->getTabColor()->getRGB()); + } + } + } + + /** + * Add a new XF writer. + * + * @param Style $style + * @param bool $isStyleXf Is it a style XF? + * + * @return int Index to XF record + */ + public function addXfWriter(Style $style, $isStyleXf = false) + { + $xfWriter = new Xf($style); + $xfWriter->setIsStyleXf($isStyleXf); + + // Add the font if not already added + $fontIndex = $this->addFont($style->getFont()); + + // Assign the font index to the xf record + $xfWriter->setFontIndex($fontIndex); + + // Background colors, best to treat these after the font so black will come after white in custom palette + $xfWriter->setFgColor($this->addColor($style->getFill()->getStartColor()->getRGB())); + $xfWriter->setBgColor($this->addColor($style->getFill()->getEndColor()->getRGB())); + $xfWriter->setBottomColor($this->addColor($style->getBorders()->getBottom()->getColor()->getRGB())); + $xfWriter->setTopColor($this->addColor($style->getBorders()->getTop()->getColor()->getRGB())); + $xfWriter->setRightColor($this->addColor($style->getBorders()->getRight()->getColor()->getRGB())); + $xfWriter->setLeftColor($this->addColor($style->getBorders()->getLeft()->getColor()->getRGB())); + $xfWriter->setDiagColor($this->addColor($style->getBorders()->getDiagonal()->getColor()->getRGB())); + + // Add the number format if it is not a built-in one and not already added + if ($style->getNumberFormat()->getBuiltInFormatCode() === false) { + $numberFormatHashCode = $style->getNumberFormat()->getHashCode(); + + if (isset($this->addedNumberFormats[$numberFormatHashCode])) { + $numberFormatIndex = $this->addedNumberFormats[$numberFormatHashCode]; + } else { + $numberFormatIndex = 164 + count($this->numberFormats); + $this->numberFormats[$numberFormatIndex] = $style->getNumberFormat(); + $this->addedNumberFormats[$numberFormatHashCode] = $numberFormatIndex; + } + } else { + $numberFormatIndex = (int) $style->getNumberFormat()->getBuiltInFormatCode(); + } + + // Assign the number format index to xf record + $xfWriter->setNumberFormatIndex($numberFormatIndex); + + $this->xfWriters[] = $xfWriter; + + return count($this->xfWriters) - 1; + } + + /** + * Add a font to added fonts. + * + * @param \PhpOffice\PhpSpreadsheet\Style\Font $font + * + * @return int Index to FONT record + */ + public function addFont(\PhpOffice\PhpSpreadsheet\Style\Font $font) + { + $fontHashCode = $font->getHashCode(); + if (isset($this->addedFonts[$fontHashCode])) { + $fontIndex = $this->addedFonts[$fontHashCode]; + } else { + $countFonts = count($this->fontWriters); + $fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1; + + $fontWriter = new Font($font); + $fontWriter->setColorIndex($this->addColor($font->getColor()->getRGB())); + $this->fontWriters[] = $fontWriter; + + $this->addedFonts[$fontHashCode] = $fontIndex; + } + + return $fontIndex; + } + + /** + * Alter color palette adding a custom color. + * + * @param string $rgb E.g. 'FF00AA' + * + * @return int Color index + */ + private function addColor($rgb) + { + if (!isset($this->colors[$rgb])) { + $color = + [ + hexdec(substr($rgb, 0, 2)), + hexdec(substr($rgb, 2, 2)), + hexdec(substr($rgb, 4)), + 0, + ]; + $colorIndex = array_search($color, $this->palette); + if ($colorIndex) { + $this->colors[$rgb] = $colorIndex; + } else { + if (count($this->colors) === 0) { + $lastColor = 7; + } else { + $lastColor = end($this->colors); + } + if ($lastColor < 57) { + // then we add a custom color altering the palette + $colorIndex = $lastColor + 1; + $this->palette[$colorIndex] = $color; + $this->colors[$rgb] = $colorIndex; + } else { + // no room for more custom colors, just map to black + $colorIndex = 0; + } + } + } else { + // fetch already added custom color + $colorIndex = $this->colors[$rgb]; + } + + return $colorIndex; + } + + /** + * Sets the colour palette to the Excel 97+ default. + */ + private function setPaletteXl97() + { + $this->palette = [ + 0x08 => [0x00, 0x00, 0x00, 0x00], + 0x09 => [0xff, 0xff, 0xff, 0x00], + 0x0A => [0xff, 0x00, 0x00, 0x00], + 0x0B => [0x00, 0xff, 0x00, 0x00], + 0x0C => [0x00, 0x00, 0xff, 0x00], + 0x0D => [0xff, 0xff, 0x00, 0x00], + 0x0E => [0xff, 0x00, 0xff, 0x00], + 0x0F => [0x00, 0xff, 0xff, 0x00], + 0x10 => [0x80, 0x00, 0x00, 0x00], + 0x11 => [0x00, 0x80, 0x00, 0x00], + 0x12 => [0x00, 0x00, 0x80, 0x00], + 0x13 => [0x80, 0x80, 0x00, 0x00], + 0x14 => [0x80, 0x00, 0x80, 0x00], + 0x15 => [0x00, 0x80, 0x80, 0x00], + 0x16 => [0xc0, 0xc0, 0xc0, 0x00], + 0x17 => [0x80, 0x80, 0x80, 0x00], + 0x18 => [0x99, 0x99, 0xff, 0x00], + 0x19 => [0x99, 0x33, 0x66, 0x00], + 0x1A => [0xff, 0xff, 0xcc, 0x00], + 0x1B => [0xcc, 0xff, 0xff, 0x00], + 0x1C => [0x66, 0x00, 0x66, 0x00], + 0x1D => [0xff, 0x80, 0x80, 0x00], + 0x1E => [0x00, 0x66, 0xcc, 0x00], + 0x1F => [0xcc, 0xcc, 0xff, 0x00], + 0x20 => [0x00, 0x00, 0x80, 0x00], + 0x21 => [0xff, 0x00, 0xff, 0x00], + 0x22 => [0xff, 0xff, 0x00, 0x00], + 0x23 => [0x00, 0xff, 0xff, 0x00], + 0x24 => [0x80, 0x00, 0x80, 0x00], + 0x25 => [0x80, 0x00, 0x00, 0x00], + 0x26 => [0x00, 0x80, 0x80, 0x00], + 0x27 => [0x00, 0x00, 0xff, 0x00], + 0x28 => [0x00, 0xcc, 0xff, 0x00], + 0x29 => [0xcc, 0xff, 0xff, 0x00], + 0x2A => [0xcc, 0xff, 0xcc, 0x00], + 0x2B => [0xff, 0xff, 0x99, 0x00], + 0x2C => [0x99, 0xcc, 0xff, 0x00], + 0x2D => [0xff, 0x99, 0xcc, 0x00], + 0x2E => [0xcc, 0x99, 0xff, 0x00], + 0x2F => [0xff, 0xcc, 0x99, 0x00], + 0x30 => [0x33, 0x66, 0xff, 0x00], + 0x31 => [0x33, 0xcc, 0xcc, 0x00], + 0x32 => [0x99, 0xcc, 0x00, 0x00], + 0x33 => [0xff, 0xcc, 0x00, 0x00], + 0x34 => [0xff, 0x99, 0x00, 0x00], + 0x35 => [0xff, 0x66, 0x00, 0x00], + 0x36 => [0x66, 0x66, 0x99, 0x00], + 0x37 => [0x96, 0x96, 0x96, 0x00], + 0x38 => [0x00, 0x33, 0x66, 0x00], + 0x39 => [0x33, 0x99, 0x66, 0x00], + 0x3A => [0x00, 0x33, 0x00, 0x00], + 0x3B => [0x33, 0x33, 0x00, 0x00], + 0x3C => [0x99, 0x33, 0x00, 0x00], + 0x3D => [0x99, 0x33, 0x66, 0x00], + 0x3E => [0x33, 0x33, 0x99, 0x00], + 0x3F => [0x33, 0x33, 0x33, 0x00], + ]; + } + + /** + * Assemble worksheets into a workbook and send the BIFF data to an OLE + * storage. + * + * @param array $pWorksheetSizes The sizes in bytes of the binary worksheet streams + * + * @return string Binary data for workbook stream + */ + public function writeWorkbook(array $pWorksheetSizes) + { + $this->worksheetSizes = $pWorksheetSizes; + + // Calculate the number of selected worksheet tabs and call the finalization + // methods for each worksheet + $total_worksheets = $this->spreadsheet->getSheetCount(); + + // Add part 1 of the Workbook globals, what goes before the SHEET records + $this->storeBof(0x0005); + $this->writeCodepage(); + $this->writeWindow1(); + + $this->writeDateMode(); + $this->writeAllFonts(); + $this->writeAllNumberFormats(); + $this->writeAllXfs(); + $this->writeAllStyles(); + $this->writePalette(); + + // Prepare part 3 of the workbook global stream, what goes after the SHEET records + $part3 = ''; + if ($this->countryCode !== -1) { + $part3 .= $this->writeCountry(); + } + $part3 .= $this->writeRecalcId(); + + $part3 .= $this->writeSupbookInternal(); + /* TODO: store external SUPBOOK records and XCT and CRN records + in case of external references for BIFF8 */ + $part3 .= $this->writeExternalsheetBiff8(); + $part3 .= $this->writeAllDefinedNamesBiff8(); + $part3 .= $this->writeMsoDrawingGroup(); + $part3 .= $this->writeSharedStringsTable(); + + $part3 .= $this->writeEof(); + + // Add part 2 of the Workbook globals, the SHEET records + $this->calcSheetOffsets(); + for ($i = 0; $i < $total_worksheets; ++$i) { + $this->writeBoundSheet($this->spreadsheet->getSheet($i), $this->worksheetOffsets[$i]); + } + + // Add part 3 of the Workbook globals + $this->_data .= $part3; + + return $this->_data; + } + + /** + * Calculate offsets for Worksheet BOF records. + */ + private function calcSheetOffsets() + { + $boundsheet_length = 10; // fixed length for a BOUNDSHEET record + + // size of Workbook globals part 1 + 3 + $offset = $this->_datasize; + + // add size of Workbook globals part 2, the length of the SHEET records + $total_worksheets = count($this->spreadsheet->getAllSheets()); + foreach ($this->spreadsheet->getWorksheetIterator() as $sheet) { + $offset += $boundsheet_length + strlen(StringHelper::UTF8toBIFF8UnicodeShort($sheet->getTitle())); + } + + // add the sizes of each of the Sheet substreams, respectively + for ($i = 0; $i < $total_worksheets; ++$i) { + $this->worksheetOffsets[$i] = $offset; + $offset += $this->worksheetSizes[$i]; + } + $this->biffSize = $offset; + } + + /** + * Store the Excel FONT records. + */ + private function writeAllFonts() + { + foreach ($this->fontWriters as $fontWriter) { + $this->append($fontWriter->writeFont()); + } + } + + /** + * Store user defined numerical formats i.e. FORMAT records. + */ + private function writeAllNumberFormats() + { + foreach ($this->numberFormats as $numberFormatIndex => $numberFormat) { + $this->writeNumberFormat($numberFormat->getFormatCode(), $numberFormatIndex); + } + } + + /** + * Write all XF records. + */ + private function writeAllXfs() + { + foreach ($this->xfWriters as $xfWriter) { + $this->append($xfWriter->writeXf()); + } + } + + /** + * Write all STYLE records. + */ + private function writeAllStyles() + { + $this->writeStyle(); + } + + /** + * Writes all the DEFINEDNAME records (BIFF8). + * So far this is only used for repeating rows/columns (print titles) and print areas. + */ + private function writeAllDefinedNamesBiff8() + { + $chunk = ''; + + // Named ranges + if (count($this->spreadsheet->getNamedRanges()) > 0) { + // Loop named ranges + $namedRanges = $this->spreadsheet->getNamedRanges(); + foreach ($namedRanges as $namedRange) { + // Create absolute coordinate + $range = Coordinate::splitRange($namedRange->getRange()); + $iMax = count($range); + for ($i = 0; $i < $iMax; ++$i) { + $range[$i][0] = '\'' . str_replace("'", "''", $namedRange->getWorksheet()->getTitle()) . '\'!' . Coordinate::absoluteCoordinate($range[$i][0]); + if (isset($range[$i][1])) { + $range[$i][1] = Coordinate::absoluteCoordinate($range[$i][1]); + } + } + $range = Coordinate::buildRange($range); // e.g. Sheet1!$A$1:$B$2 + + // parse formula + try { + $error = $this->parser->parse($range); + $formulaData = $this->parser->toReversePolish(); + + // make sure tRef3d is of type tRef3dR (0x3A) + if (isset($formulaData[0]) and ($formulaData[0] == "\x7A" or $formulaData[0] == "\x5A")) { + $formulaData = "\x3A" . substr($formulaData, 1); + } + + if ($namedRange->getLocalOnly()) { + // local scope + $scope = $this->spreadsheet->getIndex($namedRange->getScope()) + 1; + } else { + // global scope + $scope = 0; + } + $chunk .= $this->writeData($this->writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false)); + } catch (PhpSpreadsheetException $e) { + // do nothing + } + } + } + + // total number of sheets + $total_worksheets = $this->spreadsheet->getSheetCount(); + + // write the print titles (repeating rows, columns), if any + for ($i = 0; $i < $total_worksheets; ++$i) { + $sheetSetup = $this->spreadsheet->getSheet($i)->getPageSetup(); + // simultaneous repeatColumns repeatRows + if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) { + $repeat = $sheetSetup->getColumnsToRepeatAtLeft(); + $colmin = Coordinate::columnIndexFromString($repeat[0]) - 1; + $colmax = Coordinate::columnIndexFromString($repeat[1]) - 1; + + $repeat = $sheetSetup->getRowsToRepeatAtTop(); + $rowmin = $repeat[0] - 1; + $rowmax = $repeat[1] - 1; + + // construct formula data manually + $formulaData = pack('Cv', 0x29, 0x17); // tMemFunc + $formulaData .= pack('Cvvvvv', 0x3B, $i, 0, 65535, $colmin, $colmax); // tArea3d + $formulaData .= pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, 0, 255); // tArea3d + $formulaData .= pack('C', 0x10); // tList + + // store the DEFINEDNAME record + $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true)); + + // (exclusive) either repeatColumns or repeatRows + } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) { + // Columns to repeat + if ($sheetSetup->isColumnsToRepeatAtLeftSet()) { + $repeat = $sheetSetup->getColumnsToRepeatAtLeft(); + $colmin = Coordinate::columnIndexFromString($repeat[0]) - 1; + $colmax = Coordinate::columnIndexFromString($repeat[1]) - 1; + } else { + $colmin = 0; + $colmax = 255; + } + // Rows to repeat + if ($sheetSetup->isRowsToRepeatAtTopSet()) { + $repeat = $sheetSetup->getRowsToRepeatAtTop(); + $rowmin = $repeat[0] - 1; + $rowmax = $repeat[1] - 1; + } else { + $rowmin = 0; + $rowmax = 65535; + } + + // construct formula data manually because parser does not recognize absolute 3d cell references + $formulaData = pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, $colmin, $colmax); + + // store the DEFINEDNAME record + $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true)); + } + } + + // write the print areas, if any + for ($i = 0; $i < $total_worksheets; ++$i) { + $sheetSetup = $this->spreadsheet->getSheet($i)->getPageSetup(); + if ($sheetSetup->isPrintAreaSet()) { + // Print area, e.g. A3:J6,H1:X20 + $printArea = Coordinate::splitRange($sheetSetup->getPrintArea()); + $countPrintArea = count($printArea); + + $formulaData = ''; + for ($j = 0; $j < $countPrintArea; ++$j) { + $printAreaRect = $printArea[$j]; // e.g. A3:J6 + $printAreaRect[0] = Coordinate::coordinateFromString($printAreaRect[0]); + $printAreaRect[1] = Coordinate::coordinateFromString($printAreaRect[1]); + + $print_rowmin = $printAreaRect[0][1] - 1; + $print_rowmax = $printAreaRect[1][1] - 1; + $print_colmin = Coordinate::columnIndexFromString($printAreaRect[0][0]) - 1; + $print_colmax = Coordinate::columnIndexFromString($printAreaRect[1][0]) - 1; + + // construct formula data manually because parser does not recognize absolute 3d cell references + $formulaData .= pack('Cvvvvv', 0x3B, $i, $print_rowmin, $print_rowmax, $print_colmin, $print_colmax); + + if ($j > 0) { + $formulaData .= pack('C', 0x10); // list operator token ',' + } + } + + // store the DEFINEDNAME record + $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x06), $formulaData, $i + 1, true)); + } + } + + // write autofilters, if any + for ($i = 0; $i < $total_worksheets; ++$i) { + $sheetAutoFilter = $this->spreadsheet->getSheet($i)->getAutoFilter(); + $autoFilterRange = $sheetAutoFilter->getRange(); + if (!empty($autoFilterRange)) { + $rangeBounds = Coordinate::rangeBoundaries($autoFilterRange); + + //Autofilter built in name + $name = pack('C', 0x0D); + + $chunk .= $this->writeData($this->writeShortNameBiff8($name, $i + 1, $rangeBounds, true)); + } + } + + return $chunk; + } + + /** + * Write a DEFINEDNAME record for BIFF8 using explicit binary formula data. + * + * @param string $name The name in UTF-8 + * @param string $formulaData The binary formula data + * @param int $sheetIndex 1-based sheet index the defined name applies to. 0 = global + * @param bool $isBuiltIn Built-in name? + * + * @return string Complete binary record data + */ + private function writeDefinedNameBiff8($name, $formulaData, $sheetIndex = 0, $isBuiltIn = false) + { + $record = 0x0018; + + // option flags + $options = $isBuiltIn ? 0x20 : 0x00; + + // length of the name, character count + $nlen = StringHelper::countCharacters($name); + + // name with stripped length field + $name = substr(StringHelper::UTF8toBIFF8UnicodeLong($name), 2); + + // size of the formula (in bytes) + $sz = strlen($formulaData); + + // combine the parts + $data = pack('vCCvvvCCCC', $options, 0, $nlen, $sz, 0, $sheetIndex, 0, 0, 0, 0) + . $name . $formulaData; + $length = strlen($data); + + $header = pack('vv', $record, $length); + + return $header . $data; + } + + /** + * Write a short NAME record. + * + * @param string $name + * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global + * @param integer[][] $rangeBounds range boundaries + * @param bool $isHidden + * + * @return string Complete binary record data + * */ + private function writeShortNameBiff8($name, $sheetIndex, $rangeBounds, $isHidden = false) + { + $record = 0x0018; + + // option flags + $options = ($isHidden ? 0x21 : 0x00); + + $extra = pack( + 'Cvvvvv', + 0x3B, + $sheetIndex - 1, + $rangeBounds[0][1] - 1, + $rangeBounds[1][1] - 1, + $rangeBounds[0][0] - 1, + $rangeBounds[1][0] - 1 + ); + + // size of the formula (in bytes) + $sz = strlen($extra); + + // combine the parts + $data = pack('vCCvvvCCCCC', $options, 0, 1, $sz, 0, $sheetIndex, 0, 0, 0, 0, 0) + . $name . $extra; + $length = strlen($data); + + $header = pack('vv', $record, $length); + + return $header . $data; + } + + /** + * Stores the CODEPAGE biff record. + */ + private function writeCodepage() + { + $record = 0x0042; // Record identifier + $length = 0x0002; // Number of bytes to follow + $cv = $this->codepage; // The code page + + $header = pack('vv', $record, $length); + $data = pack('v', $cv); + + $this->append($header . $data); + } + + /** + * Write Excel BIFF WINDOW1 record. + */ + private function writeWindow1() + { + $record = 0x003D; // Record identifier + $length = 0x0012; // Number of bytes to follow + + $xWn = 0x0000; // Horizontal position of window + $yWn = 0x0000; // Vertical position of window + $dxWn = 0x25BC; // Width of window + $dyWn = 0x1572; // Height of window + + $grbit = 0x0038; // Option flags + + // not supported by PhpSpreadsheet, so there is only one selected sheet, the active + $ctabsel = 1; // Number of workbook tabs selected + + $wTabRatio = 0x0258; // Tab to scrollbar ratio + + // not supported by PhpSpreadsheet, set to 0 + $itabFirst = 0; // 1st displayed worksheet + $itabCur = $this->spreadsheet->getActiveSheetIndex(); // Active worksheet + + $header = pack('vv', $record, $length); + $data = pack('vvvvvvvvv', $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio); + $this->append($header . $data); + } + + /** + * Writes Excel BIFF BOUNDSHEET record. + * + * @param Worksheet $sheet Worksheet name + * @param int $offset Location of worksheet BOF + */ + private function writeBoundSheet($sheet, $offset) + { + $sheetname = $sheet->getTitle(); + $record = 0x0085; // Record identifier + + // sheet state + switch ($sheet->getSheetState()) { + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VISIBLE: + $ss = 0x00; + + break; + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN: + $ss = 0x01; + + break; + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN: + $ss = 0x02; + + break; + default: + $ss = 0x00; + + break; + } + + // sheet type + $st = 0x00; + + $grbit = 0x0000; // Visibility and sheet type + + $data = pack('VCC', $offset, $ss, $st); + $data .= StringHelper::UTF8toBIFF8UnicodeShort($sheetname); + + $length = strlen($data); + $header = pack('vv', $record, $length); + $this->append($header . $data); + } + + /** + * Write Internal SUPBOOK record. + */ + private function writeSupbookInternal() + { + $record = 0x01AE; // Record identifier + $length = 0x0004; // Bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('vv', $this->spreadsheet->getSheetCount(), 0x0401); + + return $this->writeData($header . $data); + } + + /** + * Writes the Excel BIFF EXTERNSHEET record. These references are used by + * formulas. + */ + private function writeExternalsheetBiff8() + { + $totalReferences = count($this->parser->references); + $record = 0x0017; // Record identifier + $length = 2 + 6 * $totalReferences; // Number of bytes to follow + + $supbook_index = 0; // FIXME: only using internal SUPBOOK record + $header = pack('vv', $record, $length); + $data = pack('v', $totalReferences); + for ($i = 0; $i < $totalReferences; ++$i) { + $data .= $this->parser->references[$i]; + } + + return $this->writeData($header . $data); + } + + /** + * Write Excel BIFF STYLE records. + */ + private function writeStyle() + { + $record = 0x0293; // Record identifier + $length = 0x0004; // Bytes to follow + + $ixfe = 0x8000; // Index to cell style XF + $BuiltIn = 0x00; // Built-in style + $iLevel = 0xff; // Outline style level + + $header = pack('vv', $record, $length); + $data = pack('vCC', $ixfe, $BuiltIn, $iLevel); + $this->append($header . $data); + } + + /** + * Writes Excel FORMAT record for non "built-in" numerical formats. + * + * @param string $format Custom format string + * @param int $ifmt Format index code + */ + private function writeNumberFormat($format, $ifmt) + { + $record = 0x041E; // Record identifier + + $numberFormatString = StringHelper::UTF8toBIFF8UnicodeLong($format); + $length = 2 + strlen($numberFormatString); // Number of bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('v', $ifmt) . $numberFormatString; + $this->append($header . $data); + } + + /** + * Write DATEMODE record to indicate the date system in use (1904 or 1900). + */ + private function writeDateMode() + { + $record = 0x0022; // Record identifier + $length = 0x0002; // Bytes to follow + + $f1904 = (Date::getExcelCalendar() === Date::CALENDAR_MAC_1904) + ? 1 + : 0; // Flag for 1904 date system + + $header = pack('vv', $record, $length); + $data = pack('v', $f1904); + $this->append($header . $data); + } + + /** + * Stores the COUNTRY record for localization. + * + * @return string + */ + private function writeCountry() + { + $record = 0x008C; // Record identifier + $length = 4; // Number of bytes to follow + + $header = pack('vv', $record, $length); + // using the same country code always for simplicity + $data = pack('vv', $this->countryCode, $this->countryCode); + + return $this->writeData($header . $data); + } + + /** + * Write the RECALCID record. + * + * @return string + */ + private function writeRecalcId() + { + $record = 0x01C1; // Record identifier + $length = 8; // Number of bytes to follow + + $header = pack('vv', $record, $length); + + // by inspection of real Excel files, MS Office Excel 2007 writes this + $data = pack('VV', 0x000001C1, 0x00001E667); + + return $this->writeData($header . $data); + } + + /** + * Stores the PALETTE biff record. + */ + private function writePalette() + { + $aref = $this->palette; + + $record = 0x0092; // Record identifier + $length = 2 + 4 * count($aref); // Number of bytes to follow + $ccv = count($aref); // Number of RGB values to follow + $data = ''; // The RGB data + + // Pack the RGB data + foreach ($aref as $color) { + foreach ($color as $byte) { + $data .= pack('C', $byte); + } + } + + $header = pack('vvv', $record, $length, $ccv); + $this->append($header . $data); + } + + /** + * Handling of the SST continue blocks is complicated by the need to include an + * additional continuation byte depending on whether the string is split between + * blocks or whether it starts at the beginning of the block. (There are also + * additional complications that will arise later when/if Rich Strings are + * supported). + * + * The Excel documentation says that the SST record should be followed by an + * EXTSST record. The EXTSST record is a hash table that is used to optimise + * access to SST. However, despite the documentation it doesn't seem to be + * required so we will ignore it. + * + * @return string Binary data + */ + private function writeSharedStringsTable() + { + // maximum size of record data (excluding record header) + $continue_limit = 8224; + + // initialize array of record data blocks + $recordDatas = []; + + // start SST record data block with total number of strings, total number of unique strings + $recordData = pack('VV', $this->stringTotal, $this->stringUnique); + + // loop through all (unique) strings in shared strings table + foreach (array_keys($this->stringTable) as $string) { + // here $string is a BIFF8 encoded string + + // length = character count + $headerinfo = unpack('vlength/Cencoding', $string); + + // currently, this is always 1 = uncompressed + $encoding = $headerinfo['encoding']; + + // initialize finished writing current $string + $finished = false; + + while ($finished === false) { + // normally, there will be only one cycle, but if string cannot immediately be written as is + // there will be need for more than one cylcle, if string longer than one record data block, there + // may be need for even more cycles + + if (strlen($recordData) + strlen($string) <= $continue_limit) { + // then we can write the string (or remainder of string) without any problems + $recordData .= $string; + + if (strlen($recordData) + strlen($string) == $continue_limit) { + // we close the record data block, and initialize a new one + $recordDatas[] = $recordData; + $recordData = ''; + } + + // we are finished writing this string + $finished = true; + } else { + // special treatment writing the string (or remainder of the string) + // If the string is very long it may need to be written in more than one CONTINUE record. + + // check how many bytes more there is room for in the current record + $space_remaining = $continue_limit - strlen($recordData); + + // minimum space needed + // uncompressed: 2 byte string length length field + 1 byte option flags + 2 byte character + // compressed: 2 byte string length length field + 1 byte option flags + 1 byte character + $min_space_needed = ($encoding == 1) ? 5 : 4; + + // We have two cases + // 1. space remaining is less than minimum space needed + // here we must waste the space remaining and move to next record data block + // 2. space remaining is greater than or equal to minimum space needed + // here we write as much as we can in the current block, then move to next record data block + + // 1. space remaining is less than minimum space needed + if ($space_remaining < $min_space_needed) { + // we close the block, store the block data + $recordDatas[] = $recordData; + + // and start new record data block where we start writing the string + $recordData = ''; + + // 2. space remaining is greater than or equal to minimum space needed + } else { + // initialize effective remaining space, for Unicode strings this may need to be reduced by 1, see below + $effective_space_remaining = $space_remaining; + + // for uncompressed strings, sometimes effective space remaining is reduced by 1 + if ($encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1) { + --$effective_space_remaining; + } + + // one block fininshed, store the block data + $recordData .= substr($string, 0, $effective_space_remaining); + + $string = substr($string, $effective_space_remaining); // for next cycle in while loop + $recordDatas[] = $recordData; + + // start new record data block with the repeated option flags + $recordData = pack('C', $encoding); + } + } + } + } + + // Store the last record data block unless it is empty + // if there was no need for any continue records, this will be the for SST record data block itself + if (strlen($recordData) > 0) { + $recordDatas[] = $recordData; + } + + // combine into one chunk with all the blocks SST, CONTINUE,... + $chunk = ''; + foreach ($recordDatas as $i => $recordData) { + // first block should have the SST record header, remaing should have CONTINUE header + $record = ($i == 0) ? 0x00FC : 0x003C; + + $header = pack('vv', $record, strlen($recordData)); + $data = $header . $recordData; + + $chunk .= $this->writeData($data); + } + + return $chunk; + } + + /** + * Writes the MSODRAWINGGROUP record if needed. Possibly split using CONTINUE records. + */ + private function writeMsoDrawingGroup() + { + // write the Escher stream if necessary + if (isset($this->escher)) { + $writer = new Escher($this->escher); + $data = $writer->close(); + + $record = 0x00EB; + $length = strlen($data); + $header = pack('vv', $record, $length); + + return $this->writeData($header . $data); + } + + return ''; + } + + /** + * Get Escher object. + * + * @return \PhpOffice\PhpSpreadsheet\Shared\Escher + */ + public function getEscher() + { + return $this->escher; + } + + /** + * Set Escher object. + * + * @param \PhpOffice\PhpSpreadsheet\Shared\Escher $pValue + */ + public function setEscher(\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null) + { + $this->escher = $pValue; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php new file mode 100644 index 0000000..5a6fa61 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Worksheet.php @@ -0,0 +1,4484 @@ + +// * +// * The majority of this is _NOT_ my code. I simply ported it from the +// * PERL Spreadsheet::WriteExcel module. +// * +// * The author of the Spreadsheet::WriteExcel module is John McNamara +// * +// * +// * I _DO_ maintain this code, and John McNamara has nothing to do with the +// * porting of this code to PHP. Any questions directly related to this +// * class library should be directed to me. +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ +class Worksheet extends BIFFwriter +{ + /** + * Formula parser. + * + * @var \PhpOffice\PhpSpreadsheet\Writer\Xls\Parser + */ + private $parser; + + /** + * Maximum number of characters for a string (LABEL record in BIFF5). + * + * @var int + */ + private $xlsStringMaxLength; + + /** + * Array containing format information for columns. + * + * @var array + */ + private $columnInfo; + + /** + * Array containing the selected area for the worksheet. + * + * @var array + */ + private $selection; + + /** + * The active pane for the worksheet. + * + * @var int + */ + private $activePane; + + /** + * Whether to use outline. + * + * @var int + */ + private $outlineOn; + + /** + * Auto outline styles. + * + * @var bool + */ + private $outlineStyle; + + /** + * Whether to have outline summary below. + * + * @var bool + */ + private $outlineBelow; + + /** + * Whether to have outline summary at the right. + * + * @var bool + */ + private $outlineRight; + + /** + * Reference to the total number of strings in the workbook. + * + * @var int + */ + private $stringTotal; + + /** + * Reference to the number of unique strings in the workbook. + * + * @var int + */ + private $stringUnique; + + /** + * Reference to the array containing all the unique strings in the workbook. + * + * @var array + */ + private $stringTable; + + /** + * Color cache. + */ + private $colors; + + /** + * Index of first used row (at least 0). + * + * @var int + */ + private $firstRowIndex; + + /** + * Index of last used row. (no used rows means -1). + * + * @var int + */ + private $lastRowIndex; + + /** + * Index of first used column (at least 0). + * + * @var int + */ + private $firstColumnIndex; + + /** + * Index of last used column (no used columns means -1). + * + * @var int + */ + private $lastColumnIndex; + + /** + * Sheet object. + * + * @var \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet + */ + public $phpSheet; + + /** + * Count cell style Xfs. + * + * @var int + */ + private $countCellStyleXfs; + + /** + * Escher object corresponding to MSODRAWING. + * + * @var \PhpOffice\PhpSpreadsheet\Shared\Escher + */ + private $escher; + + /** + * Array of font hashes associated to FONT records index. + * + * @var array + */ + public $fontHashIndex; + + /** + * @var bool + */ + private $preCalculateFormulas; + + /** + * @var int + */ + private $printHeaders; + + /** + * Constructor. + * + * @param int $str_total Total number of strings + * @param int $str_unique Total number of unique strings + * @param array &$str_table String Table + * @param array &$colors Colour Table + * @param Parser $parser The formula parser created for the Workbook + * @param bool $preCalculateFormulas Flag indicating whether formulas should be calculated or just written + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $phpSheet The worksheet to write + */ + public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, Parser $parser, $preCalculateFormulas, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $phpSheet) + { + // It needs to call its parent's constructor explicitly + parent::__construct(); + + $this->preCalculateFormulas = $preCalculateFormulas; + $this->stringTotal = &$str_total; + $this->stringUnique = &$str_unique; + $this->stringTable = &$str_table; + $this->colors = &$colors; + $this->parser = $parser; + + $this->phpSheet = $phpSheet; + + $this->xlsStringMaxLength = 255; + $this->columnInfo = []; + $this->selection = [0, 0, 0, 0]; + $this->activePane = 3; + + $this->printHeaders = 0; + + $this->outlineStyle = 0; + $this->outlineBelow = 1; + $this->outlineRight = 1; + $this->outlineOn = 1; + + $this->fontHashIndex = []; + + // calculate values for DIMENSIONS record + $minR = 1; + $minC = 'A'; + + $maxR = $this->phpSheet->getHighestRow(); + $maxC = $this->phpSheet->getHighestColumn(); + + // Determine lowest and highest column and row + $this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR; + + $this->firstColumnIndex = Coordinate::columnIndexFromString($minC); + $this->lastColumnIndex = Coordinate::columnIndexFromString($maxC); + +// if ($this->firstColumnIndex > 255) $this->firstColumnIndex = 255; + if ($this->lastColumnIndex > 255) { + $this->lastColumnIndex = 255; + } + + $this->countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection()); + } + + /** + * Add data to the beginning of the workbook (note the reverse order) + * and to the end of the workbook. + * + * @see \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook::storeWorkbook() + */ + public function close() + { + $phpSheet = $this->phpSheet; + + // Storing selected cells and active sheet because it changes while parsing cells with formulas. + $selectedCells = $this->phpSheet->getSelectedCells(); + $activeSheetIndex = $this->phpSheet->getParent()->getActiveSheetIndex(); + + // Write BOF record + $this->storeBof(0x0010); + + // Write PRINTHEADERS + $this->writePrintHeaders(); + + // Write PRINTGRIDLINES + $this->writePrintGridlines(); + + // Write GRIDSET + $this->writeGridset(); + + // Calculate column widths + $phpSheet->calculateColumnWidths(); + + // Column dimensions + if (($defaultWidth = $phpSheet->getDefaultColumnDimension()->getWidth()) < 0) { + $defaultWidth = \PhpOffice\PhpSpreadsheet\Shared\Font::getDefaultColumnWidthByFont($phpSheet->getParent()->getDefaultStyle()->getFont()); + } + + $columnDimensions = $phpSheet->getColumnDimensions(); + $maxCol = $this->lastColumnIndex - 1; + for ($i = 0; $i <= $maxCol; ++$i) { + $hidden = 0; + $level = 0; + $xfIndex = 15; // there are 15 cell style Xfs + + $width = $defaultWidth; + + $columnLetter = Coordinate::stringFromColumnIndex($i + 1); + if (isset($columnDimensions[$columnLetter])) { + $columnDimension = $columnDimensions[$columnLetter]; + if ($columnDimension->getWidth() >= 0) { + $width = $columnDimension->getWidth(); + } + $hidden = $columnDimension->getVisible() ? 0 : 1; + $level = $columnDimension->getOutlineLevel(); + $xfIndex = $columnDimension->getXfIndex() + 15; // there are 15 cell style Xfs + } + + // Components of columnInfo: + // $firstcol first column on the range + // $lastcol last column on the range + // $width width to set + // $xfIndex The optional cell style Xf index to apply to the columns + // $hidden The optional hidden atribute + // $level The optional outline level + $this->columnInfo[] = [$i, $i, $width, $xfIndex, $hidden, $level]; + } + + // Write GUTS + $this->writeGuts(); + + // Write DEFAULTROWHEIGHT + $this->writeDefaultRowHeight(); + // Write WSBOOL + $this->writeWsbool(); + // Write horizontal and vertical page breaks + $this->writeBreaks(); + // Write page header + $this->writeHeader(); + // Write page footer + $this->writeFooter(); + // Write page horizontal centering + $this->writeHcenter(); + // Write page vertical centering + $this->writeVcenter(); + // Write left margin + $this->writeMarginLeft(); + // Write right margin + $this->writeMarginRight(); + // Write top margin + $this->writeMarginTop(); + // Write bottom margin + $this->writeMarginBottom(); + // Write page setup + $this->writeSetup(); + // Write sheet protection + $this->writeProtect(); + // Write SCENPROTECT + $this->writeScenProtect(); + // Write OBJECTPROTECT + $this->writeObjectProtect(); + // Write sheet password + $this->writePassword(); + // Write DEFCOLWIDTH record + $this->writeDefcol(); + + // Write the COLINFO records if they exist + if (!empty($this->columnInfo)) { + $colcount = count($this->columnInfo); + for ($i = 0; $i < $colcount; ++$i) { + $this->writeColinfo($this->columnInfo[$i]); + } + } + $autoFilterRange = $phpSheet->getAutoFilter()->getRange(); + if (!empty($autoFilterRange)) { + // Write AUTOFILTERINFO + $this->writeAutoFilterInfo(); + } + + // Write sheet dimensions + $this->writeDimensions(); + + // Row dimensions + foreach ($phpSheet->getRowDimensions() as $rowDimension) { + $xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs + $this->writeRow($rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel()); + } + + // Write Cells + foreach ($phpSheet->getCoordinates() as $coordinate) { + $cell = $phpSheet->getCell($coordinate); + $row = $cell->getRow() - 1; + $column = Coordinate::columnIndexFromString($cell->getColumn()) - 1; + + // Don't break Excel break the code! + if ($row > 65535 || $column > 255) { + throw new WriterException('Rows or columns overflow! Excel5 has limit to 65535 rows and 255 columns. Use XLSX instead.'); + } + + // Write cell value + $xfIndex = $cell->getXfIndex() + 15; // there are 15 cell style Xfs + + $cVal = $cell->getValue(); + if ($cVal instanceof RichText) { + $arrcRun = []; + $str_len = StringHelper::countCharacters($cVal->getPlainText(), 'UTF-8'); + $str_pos = 0; + $elements = $cVal->getRichTextElements(); + foreach ($elements as $element) { + // FONT Index + if ($element instanceof Run) { + $str_fontidx = $this->fontHashIndex[$element->getFont()->getHashCode()]; + } else { + $str_fontidx = 0; + } + $arrcRun[] = ['strlen' => $str_pos, 'fontidx' => $str_fontidx]; + // Position FROM + $str_pos += StringHelper::countCharacters($element->getText(), 'UTF-8'); + } + $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun); + } else { + switch ($cell->getDatatype()) { + case DataType::TYPE_STRING: + case DataType::TYPE_NULL: + if ($cVal === '' || $cVal === null) { + $this->writeBlank($row, $column, $xfIndex); + } else { + $this->writeString($row, $column, $cVal, $xfIndex); + } + + break; + case DataType::TYPE_NUMERIC: + $this->writeNumber($row, $column, $cVal, $xfIndex); + + break; + case DataType::TYPE_FORMULA: + $calculatedValue = $this->preCalculateFormulas ? + $cell->getCalculatedValue() : null; + if (self::WRITE_FORMULA_EXCEPTION == $this->writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue)) { + if ($calculatedValue === null) { + $calculatedValue = $cell->getCalculatedValue(); + } + $calctype = gettype($calculatedValue); + switch ($calctype) { + case 'integer': + case 'double': + $this->writeNumber($row, $column, $calculatedValue, $xfIndex); + + break; + case 'string': + $this->writeString($row, $column, $calculatedValue, $xfIndex); + + break; + case 'boolean': + $this->writeBoolErr($row, $column, $calculatedValue, 0, $xfIndex); + + break; + default: + $this->writeString($row, $column, $cVal, $xfIndex); + } + } + + break; + case DataType::TYPE_BOOL: + $this->writeBoolErr($row, $column, $cVal, 0, $xfIndex); + + break; + case DataType::TYPE_ERROR: + $this->writeBoolErr($row, $column, self::mapErrorCode($cVal), 1, $xfIndex); + + break; + } + } + } + + // Append + $this->writeMsoDrawing(); + + // Restoring active sheet. + $this->phpSheet->getParent()->setActiveSheetIndex($activeSheetIndex); + + // Write WINDOW2 record + $this->writeWindow2(); + + // Write PLV record + $this->writePageLayoutView(); + + // Write ZOOM record + $this->writeZoom(); + if ($phpSheet->getFreezePane()) { + $this->writePanes(); + } + + // Restoring selected cells. + $this->phpSheet->setSelectedCells($selectedCells); + + // Write SELECTION record + $this->writeSelection(); + + // Write MergedCellsTable Record + $this->writeMergedCells(); + + // Hyperlinks + foreach ($phpSheet->getHyperLinkCollection() as $coordinate => $hyperlink) { + [$column, $row] = Coordinate::coordinateFromString($coordinate); + + $url = $hyperlink->getUrl(); + + if (strpos($url, 'sheet://') !== false) { + // internal to current workbook + $url = str_replace('sheet://', 'internal:', $url); + } elseif (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) { + // URL + } else { + // external (local file) + $url = 'external:' . $url; + } + + $this->writeUrl($row - 1, Coordinate::columnIndexFromString($column) - 1, $url); + } + + $this->writeDataValidity(); + $this->writeSheetLayout(); + + // Write SHEETPROTECTION record + $this->writeSheetProtection(); + $this->writeRangeProtection(); + + $arrConditionalStyles = $phpSheet->getConditionalStylesCollection(); + if (!empty($arrConditionalStyles)) { + $arrConditional = []; + // @todo CFRule & CFHeader + // Write CFHEADER record + $this->writeCFHeader(); + // Write ConditionalFormattingTable records + foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) { + foreach ($conditionalStyles as $conditional) { + if ($conditional->getConditionType() == Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == Conditional::CONDITION_CELLIS) { + if (!isset($arrConditional[$conditional->getHashCode()])) { + // This hash code has been handled + $arrConditional[$conditional->getHashCode()] = true; + + // Write CFRULE record + $this->writeCFRule($conditional); + } + } + } + } + } + + $this->storeEof(); + } + + /** + * Write a cell range address in BIFF8 + * always fixed range + * See section 2.5.14 in OpenOffice.org's Documentation of the Microsoft Excel File Format. + * + * @param string $range E.g. 'A1' or 'A1:B6' + * + * @return string Binary data + */ + private function writeBIFF8CellRangeAddressFixed($range) + { + $explodes = explode(':', $range); + + // extract first cell, e.g. 'A1' + $firstCell = $explodes[0]; + + // extract last cell, e.g. 'B6' + if (count($explodes) == 1) { + $lastCell = $firstCell; + } else { + $lastCell = $explodes[1]; + } + + $firstCellCoordinates = Coordinate::coordinateFromString($firstCell); // e.g. [0, 1] + $lastCellCoordinates = Coordinate::coordinateFromString($lastCell); // e.g. [1, 6] + + return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, Coordinate::columnIndexFromString($firstCellCoordinates[0]) - 1, Coordinate::columnIndexFromString($lastCellCoordinates[0]) - 1); + } + + /** + * Retrieves data from memory in one chunk, or from disk in $buffer + * sized chunks. + * + * @return string The data + */ + public function getData() + { + $buffer = 4096; + + // Return data stored in memory + if (isset($this->_data)) { + $tmp = $this->_data; + unset($this->_data); + + return $tmp; + } + // No data to return + return false; + } + + /** + * Set the option to print the row and column headers on the printed page. + * + * @param int $print Whether to print the headers or not. Defaults to 1 (print). + */ + public function printRowColHeaders($print = 1) + { + $this->printHeaders = $print; + } + + /** + * This method sets the properties for outlining and grouping. The defaults + * correspond to Excel's defaults. + * + * @param bool $visible + * @param bool $symbols_below + * @param bool $symbols_right + * @param bool $auto_style + */ + public function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false) + { + $this->outlineOn = $visible; + $this->outlineBelow = $symbols_below; + $this->outlineRight = $symbols_right; + $this->outlineStyle = $auto_style; + + // Ensure this is a boolean vale for Window2 + if ($this->outlineOn) { + $this->outlineOn = 1; + } + } + + /** + * Write a double to the specified row and column (zero indexed). + * An integer can be written as a double. Excel will display an + * integer. $format is optional. + * + * Returns 0 : normal termination + * -2 : row or column out of range + * + * @param int $row Zero indexed row + * @param int $col Zero indexed column + * @param float $num The number to write + * @param mixed $xfIndex The optional XF format + * + * @return int + */ + private function writeNumber($row, $col, $num, $xfIndex) + { + $record = 0x0203; // Record identifier + $length = 0x000E; // Number of bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('vvv', $row, $col, $xfIndex); + $xl_double = pack('d', $num); + if (self::getByteOrder()) { // if it's Big Endian + $xl_double = strrev($xl_double); + } + + $this->append($header . $data . $xl_double); + + return 0; + } + + /** + * Write a LABELSST record or a LABEL record. Which one depends on BIFF version. + * + * @param int $row Row index (0-based) + * @param int $col Column index (0-based) + * @param string $str The string + * @param int $xfIndex Index to XF record + */ + private function writeString($row, $col, $str, $xfIndex) + { + $this->writeLabelSst($row, $col, $str, $xfIndex); + } + + /** + * Write a LABELSST record or a LABEL record. Which one depends on BIFF version + * It differs from writeString by the writing of rich text strings. + * + * @param int $row Row index (0-based) + * @param int $col Column index (0-based) + * @param string $str The string + * @param int $xfIndex The XF format index for the cell + * @param array $arrcRun Index to Font record and characters beginning + */ + private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun) + { + $record = 0x00FD; // Record identifier + $length = 0x000A; // Bytes to follow + $str = StringHelper::UTF8toBIFF8UnicodeShort($str, $arrcRun); + + // check if string is already present + if (!isset($this->stringTable[$str])) { + $this->stringTable[$str] = $this->stringUnique++; + } + ++$this->stringTotal; + + $header = pack('vv', $record, $length); + $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]); + $this->append($header . $data); + } + + /** + * Write a string to the specified row and column (zero indexed). + * This is the BIFF8 version (no 255 chars limit). + * $format is optional. + * + * @param int $row Zero indexed row + * @param int $col Zero indexed column + * @param string $str The string to write + * @param mixed $xfIndex The XF format index for the cell + */ + private function writeLabelSst($row, $col, $str, $xfIndex) + { + $record = 0x00FD; // Record identifier + $length = 0x000A; // Bytes to follow + + $str = StringHelper::UTF8toBIFF8UnicodeLong($str); + + // check if string is already present + if (!isset($this->stringTable[$str])) { + $this->stringTable[$str] = $this->stringUnique++; + } + ++$this->stringTotal; + + $header = pack('vv', $record, $length); + $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]); + $this->append($header . $data); + } + + /** + * Write a blank cell to the specified row and column (zero indexed). + * A blank cell is used to specify formatting without adding a string + * or a number. + * + * A blank cell without a format serves no purpose. Therefore, we don't write + * a BLANK record unless a format is specified. + * + * Returns 0 : normal termination (including no format) + * -1 : insufficient number of arguments + * -2 : row or column out of range + * + * @param int $row Zero indexed row + * @param int $col Zero indexed column + * @param mixed $xfIndex The XF format index + * + * @return int + */ + public function writeBlank($row, $col, $xfIndex) + { + $record = 0x0201; // Record identifier + $length = 0x0006; // Number of bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('vvv', $row, $col, $xfIndex); + $this->append($header . $data); + + return 0; + } + + /** + * Write a boolean or an error type to the specified row and column (zero indexed). + * + * @param int $row Row index (0-based) + * @param int $col Column index (0-based) + * @param int $value + * @param bool $isError Error or Boolean? + * @param int $xfIndex + * + * @return int + */ + private function writeBoolErr($row, $col, $value, $isError, $xfIndex) + { + $record = 0x0205; + $length = 8; + + $header = pack('vv', $record, $length); + $data = pack('vvvCC', $row, $col, $xfIndex, $value, $isError); + $this->append($header . $data); + + return 0; + } + + const WRITE_FORMULA_NORMAL = 0; + const WRITE_FORMULA_ERRORS = -1; + const WRITE_FORMULA_RANGE = -2; + const WRITE_FORMULA_EXCEPTION = -3; + + /** + * Write a formula to the specified row and column (zero indexed). + * The textual representation of the formula is passed to the parser in + * Parser.php which returns a packed binary string. + * + * Returns 0 : WRITE_FORMULA_NORMAL normal termination + * -1 : WRITE_FORMULA_ERRORS formula errors (bad formula) + * -2 : WRITE_FORMULA_RANGE row or column out of range + * -3 : WRITE_FORMULA_EXCEPTION parse raised exception, probably due to definedname + * + * @param int $row Zero indexed row + * @param int $col Zero indexed column + * @param string $formula The formula text string + * @param mixed $xfIndex The XF format index + * @param mixed $calculatedValue Calculated value + * + * @return int + */ + private function writeFormula($row, $col, $formula, $xfIndex, $calculatedValue) + { + $record = 0x0006; // Record identifier + + // Initialize possible additional value for STRING record that should be written after the FORMULA record? + $stringValue = null; + + // calculated value + if (isset($calculatedValue)) { + // Since we can't yet get the data type of the calculated value, + // we use best effort to determine data type + if (is_bool($calculatedValue)) { + // Boolean value + $num = pack('CCCvCv', 0x01, 0x00, (int) $calculatedValue, 0x00, 0x00, 0xFFFF); + } elseif (is_int($calculatedValue) || is_float($calculatedValue)) { + // Numeric value + $num = pack('d', $calculatedValue); + } elseif (is_string($calculatedValue)) { + $errorCodes = DataType::getErrorCodes(); + if (isset($errorCodes[$calculatedValue])) { + // Error value + $num = pack('CCCvCv', 0x02, 0x00, self::mapErrorCode($calculatedValue), 0x00, 0x00, 0xFFFF); + } elseif ($calculatedValue === '') { + // Empty string (and BIFF8) + $num = pack('CCCvCv', 0x03, 0x00, 0x00, 0x00, 0x00, 0xFFFF); + } else { + // Non-empty string value (or empty string BIFF5) + $stringValue = $calculatedValue; + $num = pack('CCCvCv', 0x00, 0x00, 0x00, 0x00, 0x00, 0xFFFF); + } + } else { + // We are really not supposed to reach here + $num = pack('d', 0x00); + } + } else { + $num = pack('d', 0x00); + } + + $grbit = 0x03; // Option flags + $unknown = 0x0000; // Must be zero + + // Strip the '=' or '@' sign at the beginning of the formula string + if ($formula[0] == '=') { + $formula = substr($formula, 1); + } else { + // Error handling + $this->writeString($row, $col, 'Unrecognised character for formula', 0); + + return self::WRITE_FORMULA_ERRORS; + } + + // Parse the formula using the parser in Parser.php + try { + $error = $this->parser->parse($formula); + $formula = $this->parser->toReversePolish(); + + $formlen = strlen($formula); // Length of the binary string + $length = 0x16 + $formlen; // Length of the record data + + $header = pack('vv', $record, $length); + + $data = pack('vvv', $row, $col, $xfIndex) + . $num + . pack('vVv', $grbit, $unknown, $formlen); + $this->append($header . $data . $formula); + + // Append also a STRING record if necessary + if ($stringValue !== null) { + $this->writeStringRecord($stringValue); + } + + return self::WRITE_FORMULA_NORMAL; + } catch (PhpSpreadsheetException $e) { + return self::WRITE_FORMULA_EXCEPTION; + } + } + + /** + * Write a STRING record. This. + * + * @param string $stringValue + */ + private function writeStringRecord($stringValue) + { + $record = 0x0207; // Record identifier + $data = StringHelper::UTF8toBIFF8UnicodeLong($stringValue); + + $length = strlen($data); + $header = pack('vv', $record, $length); + + $this->append($header . $data); + } + + /** + * Write a hyperlink. + * This is comprised of two elements: the visible label and + * the invisible link. The visible label is the same as the link unless an + * alternative string is specified. The label is written using the + * writeString() method. Therefore the 255 characters string limit applies. + * $string and $format are optional. + * + * The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external + * directory url. + * + * Returns 0 : normal termination + * -2 : row or column out of range + * -3 : long string truncated to 255 chars + * + * @param int $row Row + * @param int $col Column + * @param string $url URL string + * + * @return int + */ + private function writeUrl($row, $col, $url) + { + // Add start row and col to arg list + return $this->writeUrlRange($row, $col, $row, $col, $url); + } + + /** + * This is the more general form of writeUrl(). It allows a hyperlink to be + * written to a range of cells. This function also decides the type of hyperlink + * to be written. These are either, Web (http, ftp, mailto), Internal + * (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1'). + * + * @see writeUrl() + * + * @param int $row1 Start row + * @param int $col1 Start column + * @param int $row2 End row + * @param int $col2 End column + * @param string $url URL string + * + * @return int + */ + public function writeUrlRange($row1, $col1, $row2, $col2, $url) + { + // Check for internal/external sheet links or default to web link + if (preg_match('[^internal:]', $url)) { + return $this->writeUrlInternal($row1, $col1, $row2, $col2, $url); + } + if (preg_match('[^external:]', $url)) { + return $this->writeUrlExternal($row1, $col1, $row2, $col2, $url); + } + + return $this->writeUrlWeb($row1, $col1, $row2, $col2, $url); + } + + /** + * Used to write http, ftp and mailto hyperlinks. + * The link type ($options) is 0x03 is the same as absolute dir ref without + * sheet. However it is differentiated by the $unknown2 data stream. + * + * @see writeUrl() + * + * @param int $row1 Start row + * @param int $col1 Start column + * @param int $row2 End row + * @param int $col2 End column + * @param string $url URL string + * + * @return int + */ + public function writeUrlWeb($row1, $col1, $row2, $col2, $url) + { + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow + + // Pack the undocumented parts of the hyperlink stream + $unknown1 = pack('H*', 'D0C9EA79F9BACE118C8200AA004BA90B02000000'); + $unknown2 = pack('H*', 'E0C9EA79F9BACE118C8200AA004BA90B'); + + // Pack the option flags + $options = pack('V', 0x03); + + // Convert URL to a null terminated wchar string + $url = implode("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY)); + $url = $url . "\0\0\0"; + + // Pack the length of the URL + $url_len = pack('V', strlen($url)); + + // Calculate the data length + $length = 0x34 + strlen($url); + + // Pack the header data + $header = pack('vv', $record, $length); + $data = pack('vvvv', $row1, $row2, $col1, $col2); + + // Write the packed data + $this->append($header . $data . $unknown1 . $options . $unknown2 . $url_len . $url); + + return 0; + } + + /** + * Used to write internal reference hyperlinks such as "Sheet1!A1". + * + * @see writeUrl() + * + * @param int $row1 Start row + * @param int $col1 Start column + * @param int $row2 End row + * @param int $col2 End column + * @param string $url URL string + * + * @return int + */ + public function writeUrlInternal($row1, $col1, $row2, $col2, $url) + { + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow + + // Strip URL type + $url = preg_replace('/^internal:/', '', $url); + + // Pack the undocumented parts of the hyperlink stream + $unknown1 = pack('H*', 'D0C9EA79F9BACE118C8200AA004BA90B02000000'); + + // Pack the option flags + $options = pack('V', 0x08); + + // Convert the URL type and to a null terminated wchar string + $url .= "\0"; + + // character count + $url_len = StringHelper::countCharacters($url); + $url_len = pack('V', $url_len); + + $url = StringHelper::convertEncoding($url, 'UTF-16LE', 'UTF-8'); + + // Calculate the data length + $length = 0x24 + strlen($url); + + // Pack the header data + $header = pack('vv', $record, $length); + $data = pack('vvvv', $row1, $row2, $col1, $col2); + + // Write the packed data + $this->append($header . $data . $unknown1 . $options . $url_len . $url); + + return 0; + } + + /** + * Write links to external directory names such as 'c:\foo.xls', + * c:\foo.xls#Sheet1!A1', '../../foo.xls'. and '../../foo.xls#Sheet1!A1'. + * + * Note: Excel writes some relative links with the $dir_long string. We ignore + * these cases for the sake of simpler code. + * + * @see writeUrl() + * + * @param int $row1 Start row + * @param int $col1 Start column + * @param int $row2 End row + * @param int $col2 End column + * @param string $url URL string + * + * @return int + */ + public function writeUrlExternal($row1, $col1, $row2, $col2, $url) + { + // Network drives are different. We will handle them separately + // MS/Novell network drives and shares start with \\ + if (preg_match('[^external:\\\\]', $url)) { + return; //($this->writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format)); + } + + $record = 0x01B8; // Record identifier + $length = 0x00000; // Bytes to follow + + // Strip URL type and change Unix dir separator to Dos style (if needed) + // + $url = preg_replace('/^external:/', '', $url); + $url = preg_replace('/\//', '\\', $url); + + // Determine if the link is relative or absolute: + // relative if link contains no dir separator, "somefile.xls" + // relative if link starts with up-dir, "..\..\somefile.xls" + // otherwise, absolute + + $absolute = 0x00; // relative path + if (preg_match('/^[A-Z]:/', $url)) { + $absolute = 0x02; // absolute path on Windows, e.g. C:\... + } + $link_type = 0x01 | $absolute; + + // Determine if the link contains a sheet reference and change some of the + // parameters accordingly. + // Split the dir name and sheet name (if it exists) + $dir_long = $url; + if (preg_match('/\\#/', $url)) { + $link_type |= 0x08; + } + + // Pack the link type + $link_type = pack('V', $link_type); + + // Calculate the up-level dir count e.g.. (..\..\..\ == 3) + $up_count = preg_match_all('/\\.\\.\\\\/', $dir_long, $useless); + $up_count = pack('v', $up_count); + + // Store the short dos dir name (null terminated) + $dir_short = preg_replace('/\\.\\.\\\\/', '', $dir_long) . "\0"; + + // Store the long dir name as a wchar string (non-null terminated) + $dir_long = $dir_long . "\0"; + + // Pack the lengths of the dir strings + $dir_short_len = pack('V', strlen($dir_short)); + $dir_long_len = pack('V', strlen($dir_long)); + $stream_len = pack('V', 0); //strlen($dir_long) + 0x06); + + // Pack the undocumented parts of the hyperlink stream + $unknown1 = pack('H*', 'D0C9EA79F9BACE118C8200AA004BA90B02000000'); + $unknown2 = pack('H*', '0303000000000000C000000000000046'); + $unknown3 = pack('H*', 'FFFFADDE000000000000000000000000000000000000000'); + $unknown4 = pack('v', 0x03); + + // Pack the main data stream + $data = pack('vvvv', $row1, $row2, $col1, $col2) . + $unknown1 . + $link_type . + $unknown2 . + $up_count . + $dir_short_len . + $dir_short . + $unknown3 . + $stream_len; /*. + $dir_long_len . + $unknown4 . + $dir_long . + $sheet_len . + $sheet ;*/ + + // Pack the header data + $length = strlen($data); + $header = pack('vv', $record, $length); + + // Write the packed data + $this->append($header . $data); + + return 0; + } + + /** + * This method is used to set the height and format for a row. + * + * @param int $row The row to set + * @param int $height Height we are giving to the row. + * Use null to set XF without setting height + * @param int $xfIndex The optional cell style Xf index to apply to the columns + * @param bool $hidden The optional hidden attribute + * @param int $level The optional outline level for row, in range [0,7] + */ + private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0) + { + $record = 0x0208; // Record identifier + $length = 0x0010; // Number of bytes to follow + + $colMic = 0x0000; // First defined column + $colMac = 0x0000; // Last defined column + $irwMac = 0x0000; // Used by Excel to optimise loading + $reserved = 0x0000; // Reserved + $grbit = 0x0000; // Option flags + $ixfe = $xfIndex; + + if ($height < 0) { + $height = null; + } + + // Use writeRow($row, null, $XF) to set XF format without setting height + if ($height != null) { + $miyRw = $height * 20; // row height + } else { + $miyRw = 0xff; // default row height is 256 + } + + // Set the options flags. fUnsynced is used to show that the font and row + // heights are not compatible. This is usually the case for WriteExcel. + // The collapsed flag 0x10 doesn't seem to be used to indicate that a row + // is collapsed. Instead it is used to indicate that the previous row is + // collapsed. The zero height flag, 0x20, is used to collapse a row. + + $grbit |= $level; + if ($hidden) { + $grbit |= 0x0030; + } + if ($height !== null) { + $grbit |= 0x0040; // fUnsynced + } + if ($xfIndex !== 0xF) { + $grbit |= 0x0080; + } + $grbit |= 0x0100; + + $header = pack('vv', $record, $length); + $data = pack('vvvvvvvv', $row, $colMic, $colMac, $miyRw, $irwMac, $reserved, $grbit, $ixfe); + $this->append($header . $data); + } + + /** + * Writes Excel DIMENSIONS to define the area in which there is data. + */ + private function writeDimensions() + { + $record = 0x0200; // Record identifier + + $length = 0x000E; + $data = pack('VVvvv', $this->firstRowIndex, $this->lastRowIndex + 1, $this->firstColumnIndex, $this->lastColumnIndex + 1, 0x0000); // reserved + + $header = pack('vv', $record, $length); + $this->append($header . $data); + } + + /** + * Write BIFF record Window2. + */ + private function writeWindow2() + { + $record = 0x023E; // Record identifier + $length = 0x0012; + + $grbit = 0x00B6; // Option flags + $rwTop = 0x0000; // Top row visible in window + $colLeft = 0x0000; // Leftmost column visible in window + + // The options flags that comprise $grbit + $fDspFmla = 0; // 0 - bit + $fDspGrid = $this->phpSheet->getShowGridlines() ? 1 : 0; // 1 + $fDspRwCol = $this->phpSheet->getShowRowColHeaders() ? 1 : 0; // 2 + $fFrozen = $this->phpSheet->getFreezePane() ? 1 : 0; // 3 + $fDspZeros = 1; // 4 + $fDefaultHdr = 1; // 5 + $fArabic = $this->phpSheet->getRightToLeft() ? 1 : 0; // 6 + $fDspGuts = $this->outlineOn; // 7 + $fFrozenNoSplit = 0; // 0 - bit + // no support in PhpSpreadsheet for selected sheet, therefore sheet is only selected if it is the active sheet + $fSelected = ($this->phpSheet === $this->phpSheet->getParent()->getActiveSheet()) ? 1 : 0; + $fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW; + + $grbit = $fDspFmla; + $grbit |= $fDspGrid << 1; + $grbit |= $fDspRwCol << 2; + $grbit |= $fFrozen << 3; + $grbit |= $fDspZeros << 4; + $grbit |= $fDefaultHdr << 5; + $grbit |= $fArabic << 6; + $grbit |= $fDspGuts << 7; + $grbit |= $fFrozenNoSplit << 8; + $grbit |= $fSelected << 9; // Selected sheets. + $grbit |= $fSelected << 10; // Active sheet. + $grbit |= $fPageBreakPreview << 11; + + $header = pack('vv', $record, $length); + $data = pack('vvv', $grbit, $rwTop, $colLeft); + + // FIXME !!! + $rgbHdr = 0x0040; // Row/column heading and gridline color index + $zoom_factor_page_break = ($fPageBreakPreview ? $this->phpSheet->getSheetView()->getZoomScale() : 0x0000); + $zoom_factor_normal = $this->phpSheet->getSheetView()->getZoomScaleNormal(); + + $data .= pack('vvvvV', $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000); + + $this->append($header . $data); + } + + /** + * Write BIFF record DEFAULTROWHEIGHT. + */ + private function writeDefaultRowHeight() + { + $defaultRowHeight = $this->phpSheet->getDefaultRowDimension()->getRowHeight(); + + if ($defaultRowHeight < 0) { + return; + } + + // convert to twips + $defaultRowHeight = (int) 20 * $defaultRowHeight; + + $record = 0x0225; // Record identifier + $length = 0x0004; // Number of bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('vv', 1, $defaultRowHeight); + $this->append($header . $data); + } + + /** + * Write BIFF record DEFCOLWIDTH if COLINFO records are in use. + */ + private function writeDefcol() + { + $defaultColWidth = 8; + + $record = 0x0055; // Record identifier + $length = 0x0002; // Number of bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('v', $defaultColWidth); + $this->append($header . $data); + } + + /** + * Write BIFF record COLINFO to define column widths. + * + * Note: The SDK says the record length is 0x0B but Excel writes a 0x0C + * length record. + * + * @param array $col_array This is the only parameter received and is composed of the following: + * 0 => First formatted column, + * 1 => Last formatted column, + * 2 => Col width (8.43 is Excel default), + * 3 => The optional XF format of the column, + * 4 => Option flags. + * 5 => Optional outline level + */ + private function writeColinfo($col_array) + { + if (isset($col_array[0])) { + $colFirst = $col_array[0]; + } + if (isset($col_array[1])) { + $colLast = $col_array[1]; + } + if (isset($col_array[2])) { + $coldx = $col_array[2]; + } else { + $coldx = 8.43; + } + if (isset($col_array[3])) { + $xfIndex = $col_array[3]; + } else { + $xfIndex = 15; + } + if (isset($col_array[4])) { + $grbit = $col_array[4]; + } else { + $grbit = 0; + } + if (isset($col_array[5])) { + $level = $col_array[5]; + } else { + $level = 0; + } + $record = 0x007D; // Record identifier + $length = 0x000C; // Number of bytes to follow + + $coldx *= 256; // Convert to units of 1/256 of a char + + $ixfe = $xfIndex; + $reserved = 0x0000; // Reserved + + $level = max(0, min($level, 7)); + $grbit |= $level << 8; + + $header = pack('vv', $record, $length); + $data = pack('vvvvvv', $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved); + $this->append($header . $data); + } + + /** + * Write BIFF record SELECTION. + */ + private function writeSelection() + { + // look up the selected cell range + $selectedCells = Coordinate::splitRange($this->phpSheet->getSelectedCells()); + $selectedCells = $selectedCells[0]; + if (count($selectedCells) == 2) { + [$first, $last] = $selectedCells; + } else { + $first = $selectedCells[0]; + $last = $selectedCells[0]; + } + + [$colFirst, $rwFirst] = Coordinate::coordinateFromString($first); + $colFirst = Coordinate::columnIndexFromString($colFirst) - 1; // base 0 column index + --$rwFirst; // base 0 row index + + [$colLast, $rwLast] = Coordinate::coordinateFromString($last); + $colLast = Coordinate::columnIndexFromString($colLast) - 1; // base 0 column index + --$rwLast; // base 0 row index + + // make sure we are not out of bounds + $colFirst = min($colFirst, 255); + $colLast = min($colLast, 255); + + $rwFirst = min($rwFirst, 65535); + $rwLast = min($rwLast, 65535); + + $record = 0x001D; // Record identifier + $length = 0x000F; // Number of bytes to follow + + $pnn = $this->activePane; // Pane position + $rwAct = $rwFirst; // Active row + $colAct = $colFirst; // Active column + $irefAct = 0; // Active cell ref + $cref = 1; // Number of refs + + if (!isset($rwLast)) { + $rwLast = $rwFirst; // Last row in reference + } + if (!isset($colLast)) { + $colLast = $colFirst; // Last col in reference + } + + // Swap last row/col for first row/col as necessary + if ($rwFirst > $rwLast) { + [$rwFirst, $rwLast] = [$rwLast, $rwFirst]; + } + + if ($colFirst > $colLast) { + [$colFirst, $colLast] = [$colLast, $colFirst]; + } + + $header = pack('vv', $record, $length); + $data = pack('CvvvvvvCC', $pnn, $rwAct, $colAct, $irefAct, $cref, $rwFirst, $rwLast, $colFirst, $colLast); + $this->append($header . $data); + } + + /** + * Store the MERGEDCELLS records for all ranges of merged cells. + */ + private function writeMergedCells() + { + $mergeCells = $this->phpSheet->getMergeCells(); + $countMergeCells = count($mergeCells); + + if ($countMergeCells == 0) { + return; + } + + // maximum allowed number of merged cells per record + $maxCountMergeCellsPerRecord = 1027; + + // record identifier + $record = 0x00E5; + + // counter for total number of merged cells treated so far by the writer + $i = 0; + + // counter for number of merged cells written in record currently being written + $j = 0; + + // initialize record data + $recordData = ''; + + // loop through the merged cells + foreach ($mergeCells as $mergeCell) { + ++$i; + ++$j; + + // extract the row and column indexes + $range = Coordinate::splitRange($mergeCell); + [$first, $last] = $range[0]; + [$firstColumn, $firstRow] = Coordinate::coordinateFromString($first); + [$lastColumn, $lastRow] = Coordinate::coordinateFromString($last); + + $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, Coordinate::columnIndexFromString($firstColumn) - 1, Coordinate::columnIndexFromString($lastColumn) - 1); + + // flush record if we have reached limit for number of merged cells, or reached final merged cell + if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) { + $recordData = pack('v', $j) . $recordData; + $length = strlen($recordData); + $header = pack('vv', $record, $length); + $this->append($header . $recordData); + + // initialize for next record, if any + $recordData = ''; + $j = 0; + } + } + } + + /** + * Write SHEETLAYOUT record. + */ + private function writeSheetLayout() + { + if (!$this->phpSheet->isTabColorSet()) { + return; + } + + $recordData = pack( + 'vvVVVvv', + 0x0862, + 0x0000, // unused + 0x00000000, // unused + 0x00000000, // unused + 0x00000014, // size of record data + $this->colors[$this->phpSheet->getTabColor()->getRGB()], // color index + 0x0000 // unused + ); + + $length = strlen($recordData); + + $record = 0x0862; // Record identifier + $header = pack('vv', $record, $length); + $this->append($header . $recordData); + } + + /** + * Write SHEETPROTECTION. + */ + private function writeSheetProtection() + { + // record identifier + $record = 0x0867; + + // prepare options + $options = (int) !$this->phpSheet->getProtection()->getObjects() + | (int) !$this->phpSheet->getProtection()->getScenarios() << 1 + | (int) !$this->phpSheet->getProtection()->getFormatCells() << 2 + | (int) !$this->phpSheet->getProtection()->getFormatColumns() << 3 + | (int) !$this->phpSheet->getProtection()->getFormatRows() << 4 + | (int) !$this->phpSheet->getProtection()->getInsertColumns() << 5 + | (int) !$this->phpSheet->getProtection()->getInsertRows() << 6 + | (int) !$this->phpSheet->getProtection()->getInsertHyperlinks() << 7 + | (int) !$this->phpSheet->getProtection()->getDeleteColumns() << 8 + | (int) !$this->phpSheet->getProtection()->getDeleteRows() << 9 + | (int) !$this->phpSheet->getProtection()->getSelectLockedCells() << 10 + | (int) !$this->phpSheet->getProtection()->getSort() << 11 + | (int) !$this->phpSheet->getProtection()->getAutoFilter() << 12 + | (int) !$this->phpSheet->getProtection()->getPivotTables() << 13 + | (int) !$this->phpSheet->getProtection()->getSelectUnlockedCells() << 14; + + // record data + $recordData = pack( + 'vVVCVVvv', + 0x0867, // repeated record identifier + 0x0000, // not used + 0x0000, // not used + 0x00, // not used + 0x01000200, // unknown data + 0xFFFFFFFF, // unknown data + $options, // options + 0x0000 // not used + ); + + $length = strlen($recordData); + $header = pack('vv', $record, $length); + + $this->append($header . $recordData); + } + + /** + * Write BIFF record RANGEPROTECTION. + * + * Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records + * Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records + */ + private function writeRangeProtection() + { + foreach ($this->phpSheet->getProtectedCells() as $range => $password) { + // number of ranges, e.g. 'A1:B3 C20:D25' + $cellRanges = explode(' ', $range); + $cref = count($cellRanges); + + $recordData = pack( + 'vvVVvCVvVv', + 0x0868, + 0x00, + 0x0000, + 0x0000, + 0x02, + 0x0, + 0x0000, + $cref, + 0x0000, + 0x00 + ); + + foreach ($cellRanges as $cellRange) { + $recordData .= $this->writeBIFF8CellRangeAddressFixed($cellRange); + } + + // the rgbFeat structure + $recordData .= pack( + 'VV', + 0x0000, + hexdec($password) + ); + + $recordData .= StringHelper::UTF8toBIFF8UnicodeLong('p' . md5($recordData)); + + $length = strlen($recordData); + + $record = 0x0868; // Record identifier + $header = pack('vv', $record, $length); + $this->append($header . $recordData); + } + } + + /** + * Writes the Excel BIFF PANE record. + * The panes can either be frozen or thawed (unfrozen). + * Frozen panes are specified in terms of an integer number of rows and columns. + * Thawed panes are specified in terms of Excel's units for rows and columns. + */ + private function writePanes() + { + $panes = []; + if ($this->phpSheet->getFreezePane()) { + [$column, $row] = Coordinate::coordinateFromString($this->phpSheet->getFreezePane()); + $panes[0] = Coordinate::columnIndexFromString($column) - 1; + $panes[1] = $row - 1; + + [$leftMostColumn, $topRow] = Coordinate::coordinateFromString($this->phpSheet->getTopLeftCell()); + //Coordinates are zero-based in xls files + $panes[2] = $topRow - 1; + $panes[3] = Coordinate::columnIndexFromString($leftMostColumn) - 1; + } else { + // thaw panes + return; + } + + $x = $panes[0] ?? null; + $y = $panes[1] ?? null; + $rwTop = $panes[2] ?? null; + $colLeft = $panes[3] ?? null; + if (count($panes) > 4) { // if Active pane was received + $pnnAct = $panes[4]; + } else { + $pnnAct = null; + } + $record = 0x0041; // Record identifier + $length = 0x000A; // Number of bytes to follow + + // Code specific to frozen or thawed panes. + if ($this->phpSheet->getFreezePane()) { + // Set default values for $rwTop and $colLeft + if (!isset($rwTop)) { + $rwTop = $y; + } + if (!isset($colLeft)) { + $colLeft = $x; + } + } else { + // Set default values for $rwTop and $colLeft + if (!isset($rwTop)) { + $rwTop = 0; + } + if (!isset($colLeft)) { + $colLeft = 0; + } + + // Convert Excel's row and column units to the internal units. + // The default row height is 12.75 + // The default column width is 8.43 + // The following slope and intersection values were interpolated. + // + $y = 20 * $y + 255; + $x = 113.879 * $x + 390; + } + + // Determine which pane should be active. There is also the undocumented + // option to override this should it be necessary: may be removed later. + // + if (!isset($pnnAct)) { + if ($x != 0 && $y != 0) { + $pnnAct = 0; // Bottom right + } + if ($x != 0 && $y == 0) { + $pnnAct = 1; // Top right + } + if ($x == 0 && $y != 0) { + $pnnAct = 2; // Bottom left + } + if ($x == 0 && $y == 0) { + $pnnAct = 3; // Top left + } + } + + $this->activePane = $pnnAct; // Used in writeSelection + + $header = pack('vv', $record, $length); + $data = pack('vvvvv', $x, $y, $rwTop, $colLeft, $pnnAct); + $this->append($header . $data); + } + + /** + * Store the page setup SETUP BIFF record. + */ + private function writeSetup() + { + $record = 0x00A1; // Record identifier + $length = 0x0022; // Number of bytes to follow + + $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size + + $iScale = $this->phpSheet->getPageSetup()->getScale() ? + $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor + + $iPageStart = 0x01; // Starting page number + $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide + $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high + $grbit = 0x00; // Option flags + $iRes = 0x0258; // Print resolution + $iVRes = 0x0258; // Vertical print resolution + + $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin + + $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin + $iCopies = 0x01; // Number of copies + + $fLeftToRight = 0x0; // Print over then down + + // Page orientation + $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == PageSetup::ORIENTATION_LANDSCAPE) ? + 0x0 : 0x1; + + $fNoPls = 0x0; // Setup not read from printer + $fNoColor = 0x0; // Print black and white + $fDraft = 0x0; // Print draft quality + $fNotes = 0x0; // Print notes + $fNoOrient = 0x0; // Orientation not set + $fUsePage = 0x0; // Use custom starting page + + $grbit = $fLeftToRight; + $grbit |= $fLandscape << 1; + $grbit |= $fNoPls << 2; + $grbit |= $fNoColor << 3; + $grbit |= $fDraft << 4; + $grbit |= $fNotes << 5; + $grbit |= $fNoOrient << 6; + $grbit |= $fUsePage << 7; + + $numHdr = pack('d', $numHdr); + $numFtr = pack('d', $numFtr); + if (self::getByteOrder()) { // if it's Big Endian + $numHdr = strrev($numHdr); + $numFtr = strrev($numFtr); + } + + $header = pack('vv', $record, $length); + $data1 = pack('vvvvvvvv', $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes); + $data2 = $numHdr . $numFtr; + $data3 = pack('v', $iCopies); + $this->append($header . $data1 . $data2 . $data3); + } + + /** + * Store the header caption BIFF record. + */ + private function writeHeader() + { + $record = 0x0014; // Record identifier + + /* removing for now + // need to fix character count (multibyte!) + if (strlen($this->phpSheet->getHeaderFooter()->getOddHeader()) <= 255) { + $str = $this->phpSheet->getHeaderFooter()->getOddHeader(); // header string + } else { + $str = ''; + } + */ + + $recordData = StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader()); + $length = strlen($recordData); + + $header = pack('vv', $record, $length); + + $this->append($header . $recordData); + } + + /** + * Store the footer caption BIFF record. + */ + private function writeFooter() + { + $record = 0x0015; // Record identifier + + /* removing for now + // need to fix character count (multibyte!) + if (strlen($this->phpSheet->getHeaderFooter()->getOddFooter()) <= 255) { + $str = $this->phpSheet->getHeaderFooter()->getOddFooter(); + } else { + $str = ''; + } + */ + + $recordData = StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter()); + $length = strlen($recordData); + + $header = pack('vv', $record, $length); + + $this->append($header . $recordData); + } + + /** + * Store the horizontal centering HCENTER BIFF record. + */ + private function writeHcenter() + { + $record = 0x0083; // Record identifier + $length = 0x0002; // Bytes to follow + + $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering + + $header = pack('vv', $record, $length); + $data = pack('v', $fHCenter); + + $this->append($header . $data); + } + + /** + * Store the vertical centering VCENTER BIFF record. + */ + private function writeVcenter() + { + $record = 0x0084; // Record identifier + $length = 0x0002; // Bytes to follow + + $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering + + $header = pack('vv', $record, $length); + $data = pack('v', $fVCenter); + $this->append($header . $data); + } + + /** + * Store the LEFTMARGIN BIFF record. + */ + private function writeMarginLeft() + { + $record = 0x0026; // Record identifier + $length = 0x0008; // Bytes to follow + + $margin = $this->phpSheet->getPageMargins()->getLeft(); // Margin in inches + + $header = pack('vv', $record, $length); + $data = pack('d', $margin); + if (self::getByteOrder()) { // if it's Big Endian + $data = strrev($data); + } + + $this->append($header . $data); + } + + /** + * Store the RIGHTMARGIN BIFF record. + */ + private function writeMarginRight() + { + $record = 0x0027; // Record identifier + $length = 0x0008; // Bytes to follow + + $margin = $this->phpSheet->getPageMargins()->getRight(); // Margin in inches + + $header = pack('vv', $record, $length); + $data = pack('d', $margin); + if (self::getByteOrder()) { // if it's Big Endian + $data = strrev($data); + } + + $this->append($header . $data); + } + + /** + * Store the TOPMARGIN BIFF record. + */ + private function writeMarginTop() + { + $record = 0x0028; // Record identifier + $length = 0x0008; // Bytes to follow + + $margin = $this->phpSheet->getPageMargins()->getTop(); // Margin in inches + + $header = pack('vv', $record, $length); + $data = pack('d', $margin); + if (self::getByteOrder()) { // if it's Big Endian + $data = strrev($data); + } + + $this->append($header . $data); + } + + /** + * Store the BOTTOMMARGIN BIFF record. + */ + private function writeMarginBottom() + { + $record = 0x0029; // Record identifier + $length = 0x0008; // Bytes to follow + + $margin = $this->phpSheet->getPageMargins()->getBottom(); // Margin in inches + + $header = pack('vv', $record, $length); + $data = pack('d', $margin); + if (self::getByteOrder()) { // if it's Big Endian + $data = strrev($data); + } + + $this->append($header . $data); + } + + /** + * Write the PRINTHEADERS BIFF record. + */ + private function writePrintHeaders() + { + $record = 0x002a; // Record identifier + $length = 0x0002; // Bytes to follow + + $fPrintRwCol = $this->printHeaders; // Boolean flag + + $header = pack('vv', $record, $length); + $data = pack('v', $fPrintRwCol); + $this->append($header . $data); + } + + /** + * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the + * GRIDSET record. + */ + private function writePrintGridlines() + { + $record = 0x002b; // Record identifier + $length = 0x0002; // Bytes to follow + + $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag + + $header = pack('vv', $record, $length); + $data = pack('v', $fPrintGrid); + $this->append($header . $data); + } + + /** + * Write the GRIDSET BIFF record. Must be used in conjunction with the + * PRINTGRIDLINES record. + */ + private function writeGridset() + { + $record = 0x0082; // Record identifier + $length = 0x0002; // Bytes to follow + + $fGridSet = !$this->phpSheet->getPrintGridlines(); // Boolean flag + + $header = pack('vv', $record, $length); + $data = pack('v', $fGridSet); + $this->append($header . $data); + } + + /** + * Write the AUTOFILTERINFO BIFF record. This is used to configure the number of autofilter select used in the sheet. + */ + private function writeAutoFilterInfo() + { + $record = 0x009D; // Record identifier + $length = 0x0002; // Bytes to follow + + $rangeBounds = Coordinate::rangeBoundaries($this->phpSheet->getAutoFilter()->getRange()); + $iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0]; + + $header = pack('vv', $record, $length); + $data = pack('v', $iNumFilters); + $this->append($header . $data); + } + + /** + * Write the GUTS BIFF record. This is used to configure the gutter margins + * where Excel outline symbols are displayed. The visibility of the gutters is + * controlled by a flag in WSBOOL. + * + * @see writeWsbool() + */ + private function writeGuts() + { + $record = 0x0080; // Record identifier + $length = 0x0008; // Bytes to follow + + $dxRwGut = 0x0000; // Size of row gutter + $dxColGut = 0x0000; // Size of col gutter + + // determine maximum row outline level + $maxRowOutlineLevel = 0; + foreach ($this->phpSheet->getRowDimensions() as $rowDimension) { + $maxRowOutlineLevel = max($maxRowOutlineLevel, $rowDimension->getOutlineLevel()); + } + + $col_level = 0; + + // Calculate the maximum column outline level. The equivalent calculation + // for the row outline level is carried out in writeRow(). + $colcount = count($this->columnInfo); + for ($i = 0; $i < $colcount; ++$i) { + $col_level = max($this->columnInfo[$i][5], $col_level); + } + + // Set the limits for the outline levels (0 <= x <= 7). + $col_level = max(0, min($col_level, 7)); + + // The displayed level is one greater than the max outline levels + if ($maxRowOutlineLevel) { + ++$maxRowOutlineLevel; + } + if ($col_level) { + ++$col_level; + } + + $header = pack('vv', $record, $length); + $data = pack('vvvv', $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level); + + $this->append($header . $data); + } + + /** + * Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction + * with the SETUP record. + */ + private function writeWsbool() + { + $record = 0x0081; // Record identifier + $length = 0x0002; // Bytes to follow + $grbit = 0x0000; + + // The only option that is of interest is the flag for fit to page. So we + // set all the options in one go. + // + // Set the option flags + $grbit |= 0x0001; // Auto page breaks visible + if ($this->outlineStyle) { + $grbit |= 0x0020; // Auto outline styles + } + if ($this->phpSheet->getShowSummaryBelow()) { + $grbit |= 0x0040; // Outline summary below + } + if ($this->phpSheet->getShowSummaryRight()) { + $grbit |= 0x0080; // Outline summary right + } + if ($this->phpSheet->getPageSetup()->getFitToPage()) { + $grbit |= 0x0100; // Page setup fit to page + } + if ($this->outlineOn) { + $grbit |= 0x0400; // Outline symbols displayed + } + + $header = pack('vv', $record, $length); + $data = pack('v', $grbit); + $this->append($header . $data); + } + + /** + * Write the HORIZONTALPAGEBREAKS and VERTICALPAGEBREAKS BIFF records. + */ + private function writeBreaks() + { + // initialize + $vbreaks = []; + $hbreaks = []; + + foreach ($this->phpSheet->getBreaks() as $cell => $breakType) { + // Fetch coordinates + $coordinates = Coordinate::coordinateFromString($cell); + + // Decide what to do by the type of break + switch ($breakType) { + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_COLUMN: + // Add to list of vertical breaks + $vbreaks[] = Coordinate::columnIndexFromString($coordinates[0]) - 1; + + break; + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_ROW: + // Add to list of horizontal breaks + $hbreaks[] = $coordinates[1]; + + break; + case \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_NONE: + default: + // Nothing to do + break; + } + } + + //horizontal page breaks + if (!empty($hbreaks)) { + // Sort and filter array of page breaks + sort($hbreaks, SORT_NUMERIC); + if ($hbreaks[0] == 0) { // don't use first break if it's 0 + array_shift($hbreaks); + } + + $record = 0x001b; // Record identifier + $cbrk = count($hbreaks); // Number of page breaks + $length = 2 + 6 * $cbrk; // Bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('v', $cbrk); + + // Append each page break + foreach ($hbreaks as $hbreak) { + $data .= pack('vvv', $hbreak, 0x0000, 0x00ff); + } + + $this->append($header . $data); + } + + // vertical page breaks + if (!empty($vbreaks)) { + // 1000 vertical pagebreaks appears to be an internal Excel 5 limit. + // It is slightly higher in Excel 97/200, approx. 1026 + $vbreaks = array_slice($vbreaks, 0, 1000); + + // Sort and filter array of page breaks + sort($vbreaks, SORT_NUMERIC); + if ($vbreaks[0] == 0) { // don't use first break if it's 0 + array_shift($vbreaks); + } + + $record = 0x001a; // Record identifier + $cbrk = count($vbreaks); // Number of page breaks + $length = 2 + 6 * $cbrk; // Bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('v', $cbrk); + + // Append each page break + foreach ($vbreaks as $vbreak) { + $data .= pack('vvv', $vbreak, 0x0000, 0xffff); + } + + $this->append($header . $data); + } + } + + /** + * Set the Biff PROTECT record to indicate that the worksheet is protected. + */ + private function writeProtect() + { + // Exit unless sheet protection has been specified + if (!$this->phpSheet->getProtection()->getSheet()) { + return; + } + + $record = 0x0012; // Record identifier + $length = 0x0002; // Bytes to follow + + $fLock = 1; // Worksheet is protected + + $header = pack('vv', $record, $length); + $data = pack('v', $fLock); + + $this->append($header . $data); + } + + /** + * Write SCENPROTECT. + */ + private function writeScenProtect() + { + // Exit if sheet protection is not active + if (!$this->phpSheet->getProtection()->getSheet()) { + return; + } + + // Exit if scenarios are not protected + if (!$this->phpSheet->getProtection()->getScenarios()) { + return; + } + + $record = 0x00DD; // Record identifier + $length = 0x0002; // Bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('v', 1); + + $this->append($header . $data); + } + + /** + * Write OBJECTPROTECT. + */ + private function writeObjectProtect() + { + // Exit if sheet protection is not active + if (!$this->phpSheet->getProtection()->getSheet()) { + return; + } + + // Exit if objects are not protected + if (!$this->phpSheet->getProtection()->getObjects()) { + return; + } + + $record = 0x0063; // Record identifier + $length = 0x0002; // Bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('v', 1); + + $this->append($header . $data); + } + + /** + * Write the worksheet PASSWORD record. + */ + private function writePassword() + { + // Exit unless sheet protection and password have been specified + if (!$this->phpSheet->getProtection()->getSheet() || !$this->phpSheet->getProtection()->getPassword()) { + return; + } + + $record = 0x0013; // Record identifier + $length = 0x0002; // Bytes to follow + + $wPassword = hexdec($this->phpSheet->getProtection()->getPassword()); // Encoded password + + $header = pack('vv', $record, $length); + $data = pack('v', $wPassword); + + $this->append($header . $data); + } + + /** + * Insert a 24bit bitmap image in a worksheet. + * + * @param int $row The row we are going to insert the bitmap into + * @param int $col The column we are going to insert the bitmap into + * @param mixed $bitmap The bitmap filename or GD-image resource + * @param int $x the horizontal position (offset) of the image inside the cell + * @param int $y the vertical position (offset) of the image inside the cell + * @param float $scale_x The horizontal scale + * @param float $scale_y The vertical scale + */ + public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1) + { + $bitmap_array = (is_resource($bitmap) ? $this->processBitmapGd($bitmap) : $this->processBitmap($bitmap)); + [$width, $height, $size, $data] = $bitmap_array; + + // Scale the frame of the image. + $width *= $scale_x; + $height *= $scale_y; + + // Calculate the vertices of the image and write the OBJ record + $this->positionImage($col, $row, $x, $y, $width, $height); + + // Write the IMDATA record to store the bitmap data + $record = 0x007f; + $length = 8 + $size; + $cf = 0x09; + $env = 0x01; + $lcb = $size; + + $header = pack('vvvvV', $record, $length, $cf, $env, $lcb); + $this->append($header . $data); + } + + /** + * Calculate the vertices that define the position of the image as required by + * the OBJ record. + * + * +------------+------------+ + * | A | B | + * +-----+------------+------------+ + * | |(x1,y1) | | + * | 1 |(A1)._______|______ | + * | | | | | + * | | | | | + * +-----+----| BITMAP |-----+ + * | | | | | + * | 2 | |______________. | + * | | | (B2)| + * | | | (x2,y2)| + * +---- +------------+------------+ + * + * Example of a bitmap that covers some of the area from cell A1 to cell B2. + * + * Based on the width and height of the bitmap we need to calculate 8 vars: + * $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2. + * The width and height of the cells are also variable and have to be taken into + * account. + * The values of $col_start and $row_start are passed in from the calling + * function. The values of $col_end and $row_end are calculated by subtracting + * the width and height of the bitmap from the width and height of the + * underlying cells. + * The vertices are expressed as a percentage of the underlying cell width as + * follows (rhs values are in pixels): + * + * x1 = X / W *1024 + * y1 = Y / H *256 + * x2 = (X-1) / W *1024 + * y2 = (Y-1) / H *256 + * + * Where: X is distance from the left side of the underlying cell + * Y is distance from the top of the underlying cell + * W is the width of the cell + * H is the height of the cell + * The SDK incorrectly states that the height should be expressed as a + * percentage of 1024. + * + * @param int $col_start Col containing upper left corner of object + * @param int $row_start Row containing top left corner of object + * @param int $x1 Distance to left side of object + * @param int $y1 Distance to top of object + * @param int $width Width of image frame + * @param int $height Height of image frame + */ + public function positionImage($col_start, $row_start, $x1, $y1, $width, $height) + { + // Initialise end cell to the same as the start cell + $col_end = $col_start; // Col containing lower right corner of object + $row_end = $row_start; // Row containing bottom right corner of object + + // Zero the specified offset if greater than the cell dimensions + if ($x1 >= Xls::sizeCol($this->phpSheet, Coordinate::stringFromColumnIndex($col_start + 1))) { + $x1 = 0; + } + if ($y1 >= Xls::sizeRow($this->phpSheet, $row_start + 1)) { + $y1 = 0; + } + + $width = $width + $x1 - 1; + $height = $height + $y1 - 1; + + // Subtract the underlying cell widths to find the end cell of the image + while ($width >= Xls::sizeCol($this->phpSheet, Coordinate::stringFromColumnIndex($col_end + 1))) { + $width -= Xls::sizeCol($this->phpSheet, Coordinate::stringFromColumnIndex($col_end + 1)); + ++$col_end; + } + + // Subtract the underlying cell heights to find the end cell of the image + while ($height >= Xls::sizeRow($this->phpSheet, $row_end + 1)) { + $height -= Xls::sizeRow($this->phpSheet, $row_end + 1); + ++$row_end; + } + + // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell + // with zero eight or width. + // + if (Xls::sizeCol($this->phpSheet, Coordinate::stringFromColumnIndex($col_start + 1)) == 0) { + return; + } + if (Xls::sizeCol($this->phpSheet, Coordinate::stringFromColumnIndex($col_end + 1)) == 0) { + return; + } + if (Xls::sizeRow($this->phpSheet, $row_start + 1) == 0) { + return; + } + if (Xls::sizeRow($this->phpSheet, $row_end + 1) == 0) { + return; + } + + // Convert the pixel values to the percentage value expected by Excel + $x1 = $x1 / Xls::sizeCol($this->phpSheet, Coordinate::stringFromColumnIndex($col_start + 1)) * 1024; + $y1 = $y1 / Xls::sizeRow($this->phpSheet, $row_start + 1) * 256; + $x2 = $width / Xls::sizeCol($this->phpSheet, Coordinate::stringFromColumnIndex($col_end + 1)) * 1024; // Distance to right side of object + $y2 = $height / Xls::sizeRow($this->phpSheet, $row_end + 1) * 256; // Distance to bottom of object + + $this->writeObjPicture($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2); + } + + /** + * Store the OBJ record that precedes an IMDATA record. This could be generalise + * to support other Excel objects. + * + * @param int $colL Column containing upper left corner of object + * @param int $dxL Distance from left side of cell + * @param int $rwT Row containing top left corner of object + * @param int $dyT Distance from top of cell + * @param int $colR Column containing lower right corner of object + * @param int $dxR Distance from right of cell + * @param int $rwB Row containing bottom right corner of object + * @param int $dyB Distance from bottom of cell + */ + private function writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB) + { + $record = 0x005d; // Record identifier + $length = 0x003c; // Bytes to follow + + $cObj = 0x0001; // Count of objects in file (set to 1) + $OT = 0x0008; // Object type. 8 = Picture + $id = 0x0001; // Object ID + $grbit = 0x0614; // Option flags + + $cbMacro = 0x0000; // Length of FMLA structure + $Reserved1 = 0x0000; // Reserved + $Reserved2 = 0x0000; // Reserved + + $icvBack = 0x09; // Background colour + $icvFore = 0x09; // Foreground colour + $fls = 0x00; // Fill pattern + $fAuto = 0x00; // Automatic fill + $icv = 0x08; // Line colour + $lns = 0xff; // Line style + $lnw = 0x01; // Line weight + $fAutoB = 0x00; // Automatic border + $frs = 0x0000; // Frame style + $cf = 0x0009; // Image format, 9 = bitmap + $Reserved3 = 0x0000; // Reserved + $cbPictFmla = 0x0000; // Length of FMLA structure + $Reserved4 = 0x0000; // Reserved + $grbit2 = 0x0001; // Option flags + $Reserved5 = 0x0000; // Reserved + + $header = pack('vv', $record, $length); + $data = pack('V', $cObj); + $data .= pack('v', $OT); + $data .= pack('v', $id); + $data .= pack('v', $grbit); + $data .= pack('v', $colL); + $data .= pack('v', $dxL); + $data .= pack('v', $rwT); + $data .= pack('v', $dyT); + $data .= pack('v', $colR); + $data .= pack('v', $dxR); + $data .= pack('v', $rwB); + $data .= pack('v', $dyB); + $data .= pack('v', $cbMacro); + $data .= pack('V', $Reserved1); + $data .= pack('v', $Reserved2); + $data .= pack('C', $icvBack); + $data .= pack('C', $icvFore); + $data .= pack('C', $fls); + $data .= pack('C', $fAuto); + $data .= pack('C', $icv); + $data .= pack('C', $lns); + $data .= pack('C', $lnw); + $data .= pack('C', $fAutoB); + $data .= pack('v', $frs); + $data .= pack('V', $cf); + $data .= pack('v', $Reserved3); + $data .= pack('v', $cbPictFmla); + $data .= pack('v', $Reserved4); + $data .= pack('v', $grbit2); + $data .= pack('V', $Reserved5); + + $this->append($header . $data); + } + + /** + * Convert a GD-image into the internal format. + * + * @param resource $image The image to process + * + * @return array Array with data and properties of the bitmap + */ + public function processBitmapGd($image) + { + $width = imagesx($image); + $height = imagesy($image); + + $data = pack('Vvvvv', 0x000c, $width, $height, 0x01, 0x18); + for ($j = $height; --$j;) { + for ($i = 0; $i < $width; ++$i) { + $color = imagecolorsforindex($image, imagecolorat($image, $i, $j)); + foreach (['red', 'green', 'blue'] as $key) { + $color[$key] = $color[$key] + round((255 - $color[$key]) * $color['alpha'] / 127); + } + $data .= chr($color['blue']) . chr($color['green']) . chr($color['red']); + } + if (3 * $width % 4) { + $data .= str_repeat("\x00", 4 - 3 * $width % 4); + } + } + + return [$width, $height, strlen($data), $data]; + } + + /** + * Convert a 24 bit bitmap into the modified internal format used by Windows. + * This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the + * MSDN library. + * + * @param string $bitmap The bitmap to process + * + * @return array Array with data and properties of the bitmap + */ + public function processBitmap($bitmap) + { + // Open file. + $bmp_fd = @fopen($bitmap, 'rb'); + if (!$bmp_fd) { + throw new WriterException("Couldn't import $bitmap"); + } + + // Slurp the file into a string. + $data = fread($bmp_fd, filesize($bitmap)); + + // Check that the file is big enough to be a bitmap. + if (strlen($data) <= 0x36) { + throw new WriterException("$bitmap doesn't contain enough data.\n"); + } + + // The first 2 bytes are used to identify the bitmap. + $identity = unpack('A2ident', $data); + if ($identity['ident'] != 'BM') { + throw new WriterException("$bitmap doesn't appear to be a valid bitmap image.\n"); + } + + // Remove bitmap data: ID. + $data = substr($data, 2); + + // Read and remove the bitmap size. This is more reliable than reading + // the data size at offset 0x22. + // + $size_array = unpack('Vsa', substr($data, 0, 4)); + $size = $size_array['sa']; + $data = substr($data, 4); + $size -= 0x36; // Subtract size of bitmap header. + $size += 0x0C; // Add size of BIFF header. + + // Remove bitmap data: reserved, offset, header length. + $data = substr($data, 12); + + // Read and remove the bitmap width and height. Verify the sizes. + $width_and_height = unpack('V2', substr($data, 0, 8)); + $width = $width_and_height[1]; + $height = $width_and_height[2]; + $data = substr($data, 8); + if ($width > 0xFFFF) { + throw new WriterException("$bitmap: largest image width supported is 65k.\n"); + } + if ($height > 0xFFFF) { + throw new WriterException("$bitmap: largest image height supported is 65k.\n"); + } + + // Read and remove the bitmap planes and bpp data. Verify them. + $planes_and_bitcount = unpack('v2', substr($data, 0, 4)); + $data = substr($data, 4); + if ($planes_and_bitcount[2] != 24) { // Bitcount + throw new WriterException("$bitmap isn't a 24bit true color bitmap.\n"); + } + if ($planes_and_bitcount[1] != 1) { + throw new WriterException("$bitmap: only 1 plane supported in bitmap image.\n"); + } + + // Read and remove the bitmap compression. Verify compression. + $compression = unpack('Vcomp', substr($data, 0, 4)); + $data = substr($data, 4); + + if ($compression['comp'] != 0) { + throw new WriterException("$bitmap: compression not supported in bitmap image.\n"); + } + + // Remove bitmap data: data size, hres, vres, colours, imp. colours. + $data = substr($data, 20); + + // Add the BITMAPCOREHEADER data + $header = pack('Vvvvv', 0x000c, $width, $height, 0x01, 0x18); + $data = $header . $data; + + return [$width, $height, $size, $data]; + } + + /** + * Store the window zoom factor. This should be a reduced fraction but for + * simplicity we will store all fractions with a numerator of 100. + */ + private function writeZoom() + { + // If scale is 100 we don't need to write a record + if ($this->phpSheet->getSheetView()->getZoomScale() == 100) { + return; + } + + $record = 0x00A0; // Record identifier + $length = 0x0004; // Bytes to follow + + $header = pack('vv', $record, $length); + $data = pack('vv', $this->phpSheet->getSheetView()->getZoomScale(), 100); + $this->append($header . $data); + } + + /** + * Get Escher object. + * + * @return \PhpOffice\PhpSpreadsheet\Shared\Escher + */ + public function getEscher() + { + return $this->escher; + } + + /** + * Set Escher object. + * + * @param \PhpOffice\PhpSpreadsheet\Shared\Escher $pValue + */ + public function setEscher(\PhpOffice\PhpSpreadsheet\Shared\Escher $pValue = null) + { + $this->escher = $pValue; + } + + /** + * Write MSODRAWING record. + */ + private function writeMsoDrawing() + { + // write the Escher stream if necessary + if (isset($this->escher)) { + $writer = new Escher($this->escher); + $data = $writer->close(); + $spOffsets = $writer->getSpOffsets(); + $spTypes = $writer->getSpTypes(); + // write the neccesary MSODRAWING, OBJ records + + // split the Escher stream + $spOffsets[0] = 0; + $nm = count($spOffsets) - 1; // number of shapes excluding first shape + for ($i = 1; $i <= $nm; ++$i) { + // MSODRAWING record + $record = 0x00EC; // Record identifier + + // chunk of Escher stream for one shape + $dataChunk = substr($data, $spOffsets[$i - 1], $spOffsets[$i] - $spOffsets[$i - 1]); + + $length = strlen($dataChunk); + $header = pack('vv', $record, $length); + + $this->append($header . $dataChunk); + + // OBJ record + $record = 0x005D; // record identifier + $objData = ''; + + // ftCmo + if ($spTypes[$i] == 0x00C9) { + // Add ftCmo (common object data) subobject + $objData .= + pack( + 'vvvvvVVV', + 0x0015, // 0x0015 = ftCmo + 0x0012, // length of ftCmo data + 0x0014, // object type, 0x0014 = filter + $i, // object id number, Excel seems to use 1-based index, local for the sheet + 0x2101, // option flags, 0x2001 is what OpenOffice.org uses + 0, // reserved + 0, // reserved + 0 // reserved + ); + + // Add ftSbs Scroll bar subobject + $objData .= pack('vv', 0x00C, 0x0014); + $objData .= pack('H*', '0000000000000000640001000A00000010000100'); + // Add ftLbsData (List box data) subobject + $objData .= pack('vv', 0x0013, 0x1FEE); + $objData .= pack('H*', '00000000010001030000020008005700'); + } else { + // Add ftCmo (common object data) subobject + $objData .= + pack( + 'vvvvvVVV', + 0x0015, // 0x0015 = ftCmo + 0x0012, // length of ftCmo data + 0x0008, // object type, 0x0008 = picture + $i, // object id number, Excel seems to use 1-based index, local for the sheet + 0x6011, // option flags, 0x6011 is what OpenOffice.org uses + 0, // reserved + 0, // reserved + 0 // reserved + ); + } + + // ftEnd + $objData .= + pack( + 'vv', + 0x0000, // 0x0000 = ftEnd + 0x0000 // length of ftEnd data + ); + + $length = strlen($objData); + $header = pack('vv', $record, $length); + $this->append($header . $objData); + } + } + } + + /** + * Store the DATAVALIDATIONS and DATAVALIDATION records. + */ + private function writeDataValidity() + { + // Datavalidation collection + $dataValidationCollection = $this->phpSheet->getDataValidationCollection(); + + // Write data validations? + if (!empty($dataValidationCollection)) { + // DATAVALIDATIONS record + $record = 0x01B2; // Record identifier + $length = 0x0012; // Bytes to follow + + $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records + $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position + $verPos = 0x00000000; // Vertical position of prompt box, if fixed position + $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible + + $header = pack('vv', $record, $length); + $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, count($dataValidationCollection)); + $this->append($header . $data); + + // DATAVALIDATION records + $record = 0x01BE; // Record identifier + + foreach ($dataValidationCollection as $cellCoordinate => $dataValidation) { + // initialize record data + $data = ''; + + // options + $options = 0x00000000; + + // data type + $type = 0x00; + switch ($dataValidation->getType()) { + case DataValidation::TYPE_NONE: + $type = 0x00; + + break; + case DataValidation::TYPE_WHOLE: + $type = 0x01; + + break; + case DataValidation::TYPE_DECIMAL: + $type = 0x02; + + break; + case DataValidation::TYPE_LIST: + $type = 0x03; + + break; + case DataValidation::TYPE_DATE: + $type = 0x04; + + break; + case DataValidation::TYPE_TIME: + $type = 0x05; + + break; + case DataValidation::TYPE_TEXTLENGTH: + $type = 0x06; + + break; + case DataValidation::TYPE_CUSTOM: + $type = 0x07; + + break; + } + + $options |= $type << 0; + + // error style + $errorStyle = 0x00; + switch ($dataValidation->getErrorStyle()) { + case DataValidation::STYLE_STOP: + $errorStyle = 0x00; + + break; + case DataValidation::STYLE_WARNING: + $errorStyle = 0x01; + + break; + case DataValidation::STYLE_INFORMATION: + $errorStyle = 0x02; + + break; + } + + $options |= $errorStyle << 4; + + // explicit formula? + if ($type == 0x03 && preg_match('/^\".*\"$/', $dataValidation->getFormula1())) { + $options |= 0x01 << 7; + } + + // empty cells allowed + $options |= $dataValidation->getAllowBlank() << 8; + + // show drop down + $options |= (!$dataValidation->getShowDropDown()) << 9; + + // show input message + $options |= $dataValidation->getShowInputMessage() << 18; + + // show error message + $options |= $dataValidation->getShowErrorMessage() << 19; + + // condition operator + $operator = 0x00; + switch ($dataValidation->getOperator()) { + case DataValidation::OPERATOR_BETWEEN: + $operator = 0x00; + + break; + case DataValidation::OPERATOR_NOTBETWEEN: + $operator = 0x01; + + break; + case DataValidation::OPERATOR_EQUAL: + $operator = 0x02; + + break; + case DataValidation::OPERATOR_NOTEQUAL: + $operator = 0x03; + + break; + case DataValidation::OPERATOR_GREATERTHAN: + $operator = 0x04; + + break; + case DataValidation::OPERATOR_LESSTHAN: + $operator = 0x05; + + break; + case DataValidation::OPERATOR_GREATERTHANOREQUAL: + $operator = 0x06; + + break; + case DataValidation::OPERATOR_LESSTHANOREQUAL: + $operator = 0x07; + + break; + } + + $options |= $operator << 20; + + $data = pack('V', $options); + + // prompt title + $promptTitle = $dataValidation->getPromptTitle() !== '' ? + $dataValidation->getPromptTitle() : chr(0); + $data .= StringHelper::UTF8toBIFF8UnicodeLong($promptTitle); + + // error title + $errorTitle = $dataValidation->getErrorTitle() !== '' ? + $dataValidation->getErrorTitle() : chr(0); + $data .= StringHelper::UTF8toBIFF8UnicodeLong($errorTitle); + + // prompt text + $prompt = $dataValidation->getPrompt() !== '' ? + $dataValidation->getPrompt() : chr(0); + $data .= StringHelper::UTF8toBIFF8UnicodeLong($prompt); + + // error text + $error = $dataValidation->getError() !== '' ? + $dataValidation->getError() : chr(0); + $data .= StringHelper::UTF8toBIFF8UnicodeLong($error); + + // formula 1 + try { + $formula1 = $dataValidation->getFormula1(); + if ($type == 0x03) { // list type + $formula1 = str_replace(',', chr(0), $formula1); + } + $this->parser->parse($formula1); + $formula1 = $this->parser->toReversePolish(); + $sz1 = strlen($formula1); + } catch (PhpSpreadsheetException $e) { + $sz1 = 0; + $formula1 = ''; + } + $data .= pack('vv', $sz1, 0x0000); + $data .= $formula1; + + // formula 2 + try { + $formula2 = $dataValidation->getFormula2(); + if ($formula2 === '') { + throw new WriterException('No formula2'); + } + $this->parser->parse($formula2); + $formula2 = $this->parser->toReversePolish(); + $sz2 = strlen($formula2); + } catch (PhpSpreadsheetException $e) { + $sz2 = 0; + $formula2 = ''; + } + $data .= pack('vv', $sz2, 0x0000); + $data .= $formula2; + + // cell range address list + $data .= pack('v', 0x0001); + $data .= $this->writeBIFF8CellRangeAddressFixed($cellCoordinate); + + $length = strlen($data); + $header = pack('vv', $record, $length); + + $this->append($header . $data); + } + } + } + + /** + * Map Error code. + * + * @param string $errorCode + * + * @return int + */ + private static function mapErrorCode($errorCode) + { + switch ($errorCode) { + case '#NULL!': + return 0x00; + case '#DIV/0!': + return 0x07; + case '#VALUE!': + return 0x0F; + case '#REF!': + return 0x17; + case '#NAME?': + return 0x1D; + case '#NUM!': + return 0x24; + case '#N/A': + return 0x2A; + } + + return 0; + } + + /** + * Write PLV Record. + */ + private function writePageLayoutView() + { + $record = 0x088B; // Record identifier + $length = 0x0010; // Bytes to follow + + $rt = 0x088B; // 2 + $grbitFrt = 0x0000; // 2 + $reserved = 0x0000000000000000; // 8 + $wScalvePLV = $this->phpSheet->getSheetView()->getZoomScale(); // 2 + + // The options flags that comprise $grbit + if ($this->phpSheet->getSheetView()->getView() == SheetView::SHEETVIEW_PAGE_LAYOUT) { + $fPageLayoutView = 1; + } else { + $fPageLayoutView = 0; + } + $fRulerVisible = 0; + $fWhitespaceHidden = 0; + + $grbit = $fPageLayoutView; // 2 + $grbit |= $fRulerVisible << 1; + $grbit |= $fWhitespaceHidden << 3; + + $header = pack('vv', $record, $length); + $data = pack('vvVVvv', $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit); + $this->append($header . $data); + } + + /** + * Write CFRule Record. + * + * @param Conditional $conditional + */ + private function writeCFRule(Conditional $conditional) + { + $record = 0x01B1; // Record identifier + + // $type : Type of the CF + // $operatorType : Comparison operator + if ($conditional->getConditionType() == Conditional::CONDITION_EXPRESSION) { + $type = 0x02; + $operatorType = 0x00; + } elseif ($conditional->getConditionType() == Conditional::CONDITION_CELLIS) { + $type = 0x01; + + switch ($conditional->getOperatorType()) { + case Conditional::OPERATOR_NONE: + $operatorType = 0x00; + + break; + case Conditional::OPERATOR_EQUAL: + $operatorType = 0x03; + + break; + case Conditional::OPERATOR_GREATERTHAN: + $operatorType = 0x05; + + break; + case Conditional::OPERATOR_GREATERTHANOREQUAL: + $operatorType = 0x07; + + break; + case Conditional::OPERATOR_LESSTHAN: + $operatorType = 0x06; + + break; + case Conditional::OPERATOR_LESSTHANOREQUAL: + $operatorType = 0x08; + + break; + case Conditional::OPERATOR_NOTEQUAL: + $operatorType = 0x04; + + break; + case Conditional::OPERATOR_BETWEEN: + $operatorType = 0x01; + + break; + // not OPERATOR_NOTBETWEEN 0x02 + } + } + + // $szValue1 : size of the formula data for first value or formula + // $szValue2 : size of the formula data for second value or formula + $arrConditions = $conditional->getConditions(); + $numConditions = count($arrConditions); + if ($numConditions == 1) { + $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); + $szValue2 = 0x0000; + $operand1 = pack('Cv', 0x1E, $arrConditions[0]); + $operand2 = null; + } elseif ($numConditions == 2 && ($conditional->getOperatorType() == Conditional::OPERATOR_BETWEEN)) { + $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000); + $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000); + $operand1 = pack('Cv', 0x1E, $arrConditions[0]); + $operand2 = pack('Cv', 0x1E, $arrConditions[1]); + } else { + $szValue1 = 0x0000; + $szValue2 = 0x0000; + $operand1 = null; + $operand2 = null; + } + + // $flags : Option flags + // Alignment + $bAlignHz = ($conditional->getStyle()->getAlignment()->getHorizontal() == null ? 1 : 0); + $bAlignVt = ($conditional->getStyle()->getAlignment()->getVertical() == null ? 1 : 0); + $bAlignWrapTx = ($conditional->getStyle()->getAlignment()->getWrapText() == false ? 1 : 0); + $bTxRotation = ($conditional->getStyle()->getAlignment()->getTextRotation() == null ? 1 : 0); + $bIndent = ($conditional->getStyle()->getAlignment()->getIndent() == 0 ? 1 : 0); + $bShrinkToFit = ($conditional->getStyle()->getAlignment()->getShrinkToFit() == false ? 1 : 0); + if ($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0) { + $bFormatAlign = 1; + } else { + $bFormatAlign = 0; + } + // Protection + $bProtLocked = ($conditional->getStyle()->getProtection()->getLocked() == null ? 1 : 0); + $bProtHidden = ($conditional->getStyle()->getProtection()->getHidden() == null ? 1 : 0); + if ($bProtLocked == 0 || $bProtHidden == 0) { + $bFormatProt = 1; + } else { + $bFormatProt = 0; + } + // Border + $bBorderLeft = ($conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == Border::BORDER_NONE ? 1 : 0); + $bBorderRight = ($conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == Border::BORDER_NONE ? 1 : 0); + $bBorderTop = ($conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == Border::BORDER_NONE ? 1 : 0); + $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == Color::COLOR_BLACK + && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == Border::BORDER_NONE ? 1 : 0); + if ($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0) { + $bFormatBorder = 1; + } else { + $bFormatBorder = 0; + } + // Pattern + $bFillStyle = ($conditional->getStyle()->getFill()->getFillType() == null ? 0 : 1); + $bFillColor = ($conditional->getStyle()->getFill()->getStartColor()->getARGB() == null ? 0 : 1); + $bFillColorBg = ($conditional->getStyle()->getFill()->getEndColor()->getARGB() == null ? 0 : 1); + if ($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0) { + $bFormatFill = 1; + } else { + $bFormatFill = 0; + } + // Font + if ($conditional->getStyle()->getFont()->getName() != null + || $conditional->getStyle()->getFont()->getSize() != null + || $conditional->getStyle()->getFont()->getBold() != null + || $conditional->getStyle()->getFont()->getItalic() != null + || $conditional->getStyle()->getFont()->getSuperscript() != null + || $conditional->getStyle()->getFont()->getSubscript() != null + || $conditional->getStyle()->getFont()->getUnderline() != null + || $conditional->getStyle()->getFont()->getStrikethrough() != null + || $conditional->getStyle()->getFont()->getColor()->getARGB() != null) { + $bFormatFont = 1; + } else { + $bFormatFont = 0; + } + // Alignment + $flags = 0; + $flags |= (1 == $bAlignHz ? 0x00000001 : 0); + $flags |= (1 == $bAlignVt ? 0x00000002 : 0); + $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0); + $flags |= (1 == $bTxRotation ? 0x00000008 : 0); + // Justify last line flag + $flags |= (1 == 1 ? 0x00000010 : 0); + $flags |= (1 == $bIndent ? 0x00000020 : 0); + $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0); + // Default + $flags |= (1 == 1 ? 0x00000080 : 0); + // Protection + $flags |= (1 == $bProtLocked ? 0x00000100 : 0); + $flags |= (1 == $bProtHidden ? 0x00000200 : 0); + // Border + $flags |= (1 == $bBorderLeft ? 0x00000400 : 0); + $flags |= (1 == $bBorderRight ? 0x00000800 : 0); + $flags |= (1 == $bBorderTop ? 0x00001000 : 0); + $flags |= (1 == $bBorderBottom ? 0x00002000 : 0); + $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border + $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border + // Pattern + $flags |= (1 == $bFillStyle ? 0x00010000 : 0); + $flags |= (1 == $bFillColor ? 0x00020000 : 0); + $flags |= (1 == $bFillColorBg ? 0x00040000 : 0); + $flags |= (1 == 1 ? 0x00380000 : 0); + // Font + $flags |= (1 == $bFormatFont ? 0x04000000 : 0); + // Alignment: + $flags |= (1 == $bFormatAlign ? 0x08000000 : 0); + // Border + $flags |= (1 == $bFormatBorder ? 0x10000000 : 0); + // Pattern + $flags |= (1 == $bFormatFill ? 0x20000000 : 0); + // Protection + $flags |= (1 == $bFormatProt ? 0x40000000 : 0); + // Text direction + $flags |= (1 == 0 ? 0x80000000 : 0); + + // Data Blocks + if ($bFormatFont == 1) { + // Font Name + if ($conditional->getStyle()->getFont()->getName() == null) { + $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); + $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000); + } else { + $dataBlockFont = StringHelper::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName()); + } + // Font Size + if ($conditional->getStyle()->getFont()->getSize() == null) { + $dataBlockFont .= pack('V', 20 * 11); + } else { + $dataBlockFont .= pack('V', 20 * $conditional->getStyle()->getFont()->getSize()); + } + // Font Options + $dataBlockFont .= pack('V', 0); + // Font weight + if ($conditional->getStyle()->getFont()->getBold() == true) { + $dataBlockFont .= pack('v', 0x02BC); + } else { + $dataBlockFont .= pack('v', 0x0190); + } + // Escapement type + if ($conditional->getStyle()->getFont()->getSubscript() == true) { + $dataBlockFont .= pack('v', 0x02); + $fontEscapement = 0; + } elseif ($conditional->getStyle()->getFont()->getSuperscript() == true) { + $dataBlockFont .= pack('v', 0x01); + $fontEscapement = 0; + } else { + $dataBlockFont .= pack('v', 0x00); + $fontEscapement = 1; + } + // Underline type + switch ($conditional->getStyle()->getFont()->getUnderline()) { + case \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_NONE: + $dataBlockFont .= pack('C', 0x00); + $fontUnderline = 0; + + break; + case \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE: + $dataBlockFont .= pack('C', 0x02); + $fontUnderline = 0; + + break; + case \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLEACCOUNTING: + $dataBlockFont .= pack('C', 0x22); + $fontUnderline = 0; + + break; + case \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE: + $dataBlockFont .= pack('C', 0x01); + $fontUnderline = 0; + + break; + case \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLEACCOUNTING: + $dataBlockFont .= pack('C', 0x21); + $fontUnderline = 0; + + break; + default: + $dataBlockFont .= pack('C', 0x00); + $fontUnderline = 1; + + break; + } + // Not used (3) + $dataBlockFont .= pack('vC', 0x0000, 0x00); + // Font color index + switch ($conditional->getStyle()->getFont()->getColor()->getRGB()) { + case '000000': + $colorIdx = 0x08; + + break; + case 'FFFFFF': + $colorIdx = 0x09; + + break; + case 'FF0000': + $colorIdx = 0x0A; + + break; + case '00FF00': + $colorIdx = 0x0B; + + break; + case '0000FF': + $colorIdx = 0x0C; + + break; + case 'FFFF00': + $colorIdx = 0x0D; + + break; + case 'FF00FF': + $colorIdx = 0x0E; + + break; + case '00FFFF': + $colorIdx = 0x0F; + + break; + case '800000': + $colorIdx = 0x10; + + break; + case '008000': + $colorIdx = 0x11; + + break; + case '000080': + $colorIdx = 0x12; + + break; + case '808000': + $colorIdx = 0x13; + + break; + case '800080': + $colorIdx = 0x14; + + break; + case '008080': + $colorIdx = 0x15; + + break; + case 'C0C0C0': + $colorIdx = 0x16; + + break; + case '808080': + $colorIdx = 0x17; + + break; + case '9999FF': + $colorIdx = 0x18; + + break; + case '993366': + $colorIdx = 0x19; + + break; + case 'FFFFCC': + $colorIdx = 0x1A; + + break; + case 'CCFFFF': + $colorIdx = 0x1B; + + break; + case '660066': + $colorIdx = 0x1C; + + break; + case 'FF8080': + $colorIdx = 0x1D; + + break; + case '0066CC': + $colorIdx = 0x1E; + + break; + case 'CCCCFF': + $colorIdx = 0x1F; + + break; + case '000080': + $colorIdx = 0x20; + + break; + case 'FF00FF': + $colorIdx = 0x21; + + break; + case 'FFFF00': + $colorIdx = 0x22; + + break; + case '00FFFF': + $colorIdx = 0x23; + + break; + case '800080': + $colorIdx = 0x24; + + break; + case '800000': + $colorIdx = 0x25; + + break; + case '008080': + $colorIdx = 0x26; + + break; + case '0000FF': + $colorIdx = 0x27; + + break; + case '00CCFF': + $colorIdx = 0x28; + + break; + case 'CCFFFF': + $colorIdx = 0x29; + + break; + case 'CCFFCC': + $colorIdx = 0x2A; + + break; + case 'FFFF99': + $colorIdx = 0x2B; + + break; + case '99CCFF': + $colorIdx = 0x2C; + + break; + case 'FF99CC': + $colorIdx = 0x2D; + + break; + case 'CC99FF': + $colorIdx = 0x2E; + + break; + case 'FFCC99': + $colorIdx = 0x2F; + + break; + case '3366FF': + $colorIdx = 0x30; + + break; + case '33CCCC': + $colorIdx = 0x31; + + break; + case '99CC00': + $colorIdx = 0x32; + + break; + case 'FFCC00': + $colorIdx = 0x33; + + break; + case 'FF9900': + $colorIdx = 0x34; + + break; + case 'FF6600': + $colorIdx = 0x35; + + break; + case '666699': + $colorIdx = 0x36; + + break; + case '969696': + $colorIdx = 0x37; + + break; + case '003366': + $colorIdx = 0x38; + + break; + case '339966': + $colorIdx = 0x39; + + break; + case '003300': + $colorIdx = 0x3A; + + break; + case '333300': + $colorIdx = 0x3B; + + break; + case '993300': + $colorIdx = 0x3C; + + break; + case '993366': + $colorIdx = 0x3D; + + break; + case '333399': + $colorIdx = 0x3E; + + break; + case '333333': + $colorIdx = 0x3F; + + break; + default: + $colorIdx = 0x00; + + break; + } + $dataBlockFont .= pack('V', $colorIdx); + // Not used (4) + $dataBlockFont .= pack('V', 0x00000000); + // Options flags for modified font attributes + $optionsFlags = 0; + $optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() == null ? 1 : 0); + $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0); + $optionsFlags |= (1 == 1 ? 0x00000008 : 0); + $optionsFlags |= (1 == 1 ? 0x00000010 : 0); + $optionsFlags |= (1 == 0 ? 0x00000020 : 0); + $optionsFlags |= (1 == 1 ? 0x00000080 : 0); + $dataBlockFont .= pack('V', $optionsFlags); + // Escapement type + $dataBlockFont .= pack('V', $fontEscapement); + // Underline type + $dataBlockFont .= pack('V', $fontUnderline); + // Always + $dataBlockFont .= pack('V', 0x00000000); + // Always + $dataBlockFont .= pack('V', 0x00000000); + // Not used (8) + $dataBlockFont .= pack('VV', 0x00000000, 0x00000000); + // Always + $dataBlockFont .= pack('v', 0x0001); + } + if ($bFormatAlign == 1) { + $blockAlign = 0; + // Alignment and text break + switch ($conditional->getStyle()->getAlignment()->getHorizontal()) { + case Alignment::HORIZONTAL_GENERAL: + $blockAlign = 0; + + break; + case Alignment::HORIZONTAL_LEFT: + $blockAlign = 1; + + break; + case Alignment::HORIZONTAL_RIGHT: + $blockAlign = 3; + + break; + case Alignment::HORIZONTAL_CENTER: + $blockAlign = 2; + + break; + case Alignment::HORIZONTAL_CENTER_CONTINUOUS: + $blockAlign = 6; + + break; + case Alignment::HORIZONTAL_JUSTIFY: + $blockAlign = 5; + + break; + } + if ($conditional->getStyle()->getAlignment()->getWrapText() == true) { + $blockAlign |= 1 << 3; + } else { + $blockAlign |= 0 << 3; + } + switch ($conditional->getStyle()->getAlignment()->getVertical()) { + case Alignment::VERTICAL_BOTTOM: + $blockAlign = 2 << 4; + + break; + case Alignment::VERTICAL_TOP: + $blockAlign = 0 << 4; + + break; + case Alignment::VERTICAL_CENTER: + $blockAlign = 1 << 4; + + break; + case Alignment::VERTICAL_JUSTIFY: + $blockAlign = 3 << 4; + + break; + } + $blockAlign |= 0 << 7; + + // Text rotation angle + $blockRotation = $conditional->getStyle()->getAlignment()->getTextRotation(); + + // Indentation + $blockIndent = $conditional->getStyle()->getAlignment()->getIndent(); + if ($conditional->getStyle()->getAlignment()->getShrinkToFit() == true) { + $blockIndent |= 1 << 4; + } else { + $blockIndent |= 0 << 4; + } + $blockIndent |= 0 << 6; + + // Relative indentation + $blockIndentRelative = 255; + + $dataBlockAlign = pack('CCvvv', $blockAlign, $blockRotation, $blockIndent, $blockIndentRelative, 0x0000); + } + if ($bFormatBorder == 1) { + $blockLineStyle = 0; + switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()) { + case Border::BORDER_NONE: + $blockLineStyle |= 0x00; + + break; + case Border::BORDER_THIN: + $blockLineStyle |= 0x01; + + break; + case Border::BORDER_MEDIUM: + $blockLineStyle |= 0x02; + + break; + case Border::BORDER_DASHED: + $blockLineStyle |= 0x03; + + break; + case Border::BORDER_DOTTED: + $blockLineStyle |= 0x04; + + break; + case Border::BORDER_THICK: + $blockLineStyle |= 0x05; + + break; + case Border::BORDER_DOUBLE: + $blockLineStyle |= 0x06; + + break; + case Border::BORDER_HAIR: + $blockLineStyle |= 0x07; + + break; + case Border::BORDER_MEDIUMDASHED: + $blockLineStyle |= 0x08; + + break; + case Border::BORDER_DASHDOT: + $blockLineStyle |= 0x09; + + break; + case Border::BORDER_MEDIUMDASHDOT: + $blockLineStyle |= 0x0A; + + break; + case Border::BORDER_DASHDOTDOT: + $blockLineStyle |= 0x0B; + + break; + case Border::BORDER_MEDIUMDASHDOTDOT: + $blockLineStyle |= 0x0C; + + break; + case Border::BORDER_SLANTDASHDOT: + $blockLineStyle |= 0x0D; + + break; + } + switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()) { + case Border::BORDER_NONE: + $blockLineStyle |= 0x00 << 4; + + break; + case Border::BORDER_THIN: + $blockLineStyle |= 0x01 << 4; + + break; + case Border::BORDER_MEDIUM: + $blockLineStyle |= 0x02 << 4; + + break; + case Border::BORDER_DASHED: + $blockLineStyle |= 0x03 << 4; + + break; + case Border::BORDER_DOTTED: + $blockLineStyle |= 0x04 << 4; + + break; + case Border::BORDER_THICK: + $blockLineStyle |= 0x05 << 4; + + break; + case Border::BORDER_DOUBLE: + $blockLineStyle |= 0x06 << 4; + + break; + case Border::BORDER_HAIR: + $blockLineStyle |= 0x07 << 4; + + break; + case Border::BORDER_MEDIUMDASHED: + $blockLineStyle |= 0x08 << 4; + + break; + case Border::BORDER_DASHDOT: + $blockLineStyle |= 0x09 << 4; + + break; + case Border::BORDER_MEDIUMDASHDOT: + $blockLineStyle |= 0x0A << 4; + + break; + case Border::BORDER_DASHDOTDOT: + $blockLineStyle |= 0x0B << 4; + + break; + case Border::BORDER_MEDIUMDASHDOTDOT: + $blockLineStyle |= 0x0C << 4; + + break; + case Border::BORDER_SLANTDASHDOT: + $blockLineStyle |= 0x0D << 4; + + break; + } + switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()) { + case Border::BORDER_NONE: + $blockLineStyle |= 0x00 << 8; + + break; + case Border::BORDER_THIN: + $blockLineStyle |= 0x01 << 8; + + break; + case Border::BORDER_MEDIUM: + $blockLineStyle |= 0x02 << 8; + + break; + case Border::BORDER_DASHED: + $blockLineStyle |= 0x03 << 8; + + break; + case Border::BORDER_DOTTED: + $blockLineStyle |= 0x04 << 8; + + break; + case Border::BORDER_THICK: + $blockLineStyle |= 0x05 << 8; + + break; + case Border::BORDER_DOUBLE: + $blockLineStyle |= 0x06 << 8; + + break; + case Border::BORDER_HAIR: + $blockLineStyle |= 0x07 << 8; + + break; + case Border::BORDER_MEDIUMDASHED: + $blockLineStyle |= 0x08 << 8; + + break; + case Border::BORDER_DASHDOT: + $blockLineStyle |= 0x09 << 8; + + break; + case Border::BORDER_MEDIUMDASHDOT: + $blockLineStyle |= 0x0A << 8; + + break; + case Border::BORDER_DASHDOTDOT: + $blockLineStyle |= 0x0B << 8; + + break; + case Border::BORDER_MEDIUMDASHDOTDOT: + $blockLineStyle |= 0x0C << 8; + + break; + case Border::BORDER_SLANTDASHDOT: + $blockLineStyle |= 0x0D << 8; + + break; + } + switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()) { + case Border::BORDER_NONE: + $blockLineStyle |= 0x00 << 12; + + break; + case Border::BORDER_THIN: + $blockLineStyle |= 0x01 << 12; + + break; + case Border::BORDER_MEDIUM: + $blockLineStyle |= 0x02 << 12; + + break; + case Border::BORDER_DASHED: + $blockLineStyle |= 0x03 << 12; + + break; + case Border::BORDER_DOTTED: + $blockLineStyle |= 0x04 << 12; + + break; + case Border::BORDER_THICK: + $blockLineStyle |= 0x05 << 12; + + break; + case Border::BORDER_DOUBLE: + $blockLineStyle |= 0x06 << 12; + + break; + case Border::BORDER_HAIR: + $blockLineStyle |= 0x07 << 12; + + break; + case Border::BORDER_MEDIUMDASHED: + $blockLineStyle |= 0x08 << 12; + + break; + case Border::BORDER_DASHDOT: + $blockLineStyle |= 0x09 << 12; + + break; + case Border::BORDER_MEDIUMDASHDOT: + $blockLineStyle |= 0x0A << 12; + + break; + case Border::BORDER_DASHDOTDOT: + $blockLineStyle |= 0x0B << 12; + + break; + case Border::BORDER_MEDIUMDASHDOTDOT: + $blockLineStyle |= 0x0C << 12; + + break; + case Border::BORDER_SLANTDASHDOT: + $blockLineStyle |= 0x0D << 12; + + break; + } + //@todo writeCFRule() => $blockLineStyle => Index Color for left line + //@todo writeCFRule() => $blockLineStyle => Index Color for right line + //@todo writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off + //@todo writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off + $blockColor = 0; + //@todo writeCFRule() => $blockColor => Index Color for top line + //@todo writeCFRule() => $blockColor => Index Color for bottom line + //@todo writeCFRule() => $blockColor => Index Color for diagonal line + switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()) { + case Border::BORDER_NONE: + $blockColor |= 0x00 << 21; + + break; + case Border::BORDER_THIN: + $blockColor |= 0x01 << 21; + + break; + case Border::BORDER_MEDIUM: + $blockColor |= 0x02 << 21; + + break; + case Border::BORDER_DASHED: + $blockColor |= 0x03 << 21; + + break; + case Border::BORDER_DOTTED: + $blockColor |= 0x04 << 21; + + break; + case Border::BORDER_THICK: + $blockColor |= 0x05 << 21; + + break; + case Border::BORDER_DOUBLE: + $blockColor |= 0x06 << 21; + + break; + case Border::BORDER_HAIR: + $blockColor |= 0x07 << 21; + + break; + case Border::BORDER_MEDIUMDASHED: + $blockColor |= 0x08 << 21; + + break; + case Border::BORDER_DASHDOT: + $blockColor |= 0x09 << 21; + + break; + case Border::BORDER_MEDIUMDASHDOT: + $blockColor |= 0x0A << 21; + + break; + case Border::BORDER_DASHDOTDOT: + $blockColor |= 0x0B << 21; + + break; + case Border::BORDER_MEDIUMDASHDOTDOT: + $blockColor |= 0x0C << 21; + + break; + case Border::BORDER_SLANTDASHDOT: + $blockColor |= 0x0D << 21; + + break; + } + $dataBlockBorder = pack('vv', $blockLineStyle, $blockColor); + } + if ($bFormatFill == 1) { + // Fill Patern Style + $blockFillPatternStyle = 0; + switch ($conditional->getStyle()->getFill()->getFillType()) { + case Fill::FILL_NONE: + $blockFillPatternStyle = 0x00; + + break; + case Fill::FILL_SOLID: + $blockFillPatternStyle = 0x01; + + break; + case Fill::FILL_PATTERN_MEDIUMGRAY: + $blockFillPatternStyle = 0x02; + + break; + case Fill::FILL_PATTERN_DARKGRAY: + $blockFillPatternStyle = 0x03; + + break; + case Fill::FILL_PATTERN_LIGHTGRAY: + $blockFillPatternStyle = 0x04; + + break; + case Fill::FILL_PATTERN_DARKHORIZONTAL: + $blockFillPatternStyle = 0x05; + + break; + case Fill::FILL_PATTERN_DARKVERTICAL: + $blockFillPatternStyle = 0x06; + + break; + case Fill::FILL_PATTERN_DARKDOWN: + $blockFillPatternStyle = 0x07; + + break; + case Fill::FILL_PATTERN_DARKUP: + $blockFillPatternStyle = 0x08; + + break; + case Fill::FILL_PATTERN_DARKGRID: + $blockFillPatternStyle = 0x09; + + break; + case Fill::FILL_PATTERN_DARKTRELLIS: + $blockFillPatternStyle = 0x0A; + + break; + case Fill::FILL_PATTERN_LIGHTHORIZONTAL: + $blockFillPatternStyle = 0x0B; + + break; + case Fill::FILL_PATTERN_LIGHTVERTICAL: + $blockFillPatternStyle = 0x0C; + + break; + case Fill::FILL_PATTERN_LIGHTDOWN: + $blockFillPatternStyle = 0x0D; + + break; + case Fill::FILL_PATTERN_LIGHTUP: + $blockFillPatternStyle = 0x0E; + + break; + case Fill::FILL_PATTERN_LIGHTGRID: + $blockFillPatternStyle = 0x0F; + + break; + case Fill::FILL_PATTERN_LIGHTTRELLIS: + $blockFillPatternStyle = 0x10; + + break; + case Fill::FILL_PATTERN_GRAY125: + $blockFillPatternStyle = 0x11; + + break; + case Fill::FILL_PATTERN_GRAY0625: + $blockFillPatternStyle = 0x12; + + break; + case Fill::FILL_GRADIENT_LINEAR: + $blockFillPatternStyle = 0x00; + + break; // does not exist in BIFF8 + case Fill::FILL_GRADIENT_PATH: + $blockFillPatternStyle = 0x00; + + break; // does not exist in BIFF8 + default: + $blockFillPatternStyle = 0x00; + + break; + } + // Color + switch ($conditional->getStyle()->getFill()->getStartColor()->getRGB()) { + case '000000': + $colorIdxBg = 0x08; + + break; + case 'FFFFFF': + $colorIdxBg = 0x09; + + break; + case 'FF0000': + $colorIdxBg = 0x0A; + + break; + case '00FF00': + $colorIdxBg = 0x0B; + + break; + case '0000FF': + $colorIdxBg = 0x0C; + + break; + case 'FFFF00': + $colorIdxBg = 0x0D; + + break; + case 'FF00FF': + $colorIdxBg = 0x0E; + + break; + case '00FFFF': + $colorIdxBg = 0x0F; + + break; + case '800000': + $colorIdxBg = 0x10; + + break; + case '008000': + $colorIdxBg = 0x11; + + break; + case '000080': + $colorIdxBg = 0x12; + + break; + case '808000': + $colorIdxBg = 0x13; + + break; + case '800080': + $colorIdxBg = 0x14; + + break; + case '008080': + $colorIdxBg = 0x15; + + break; + case 'C0C0C0': + $colorIdxBg = 0x16; + + break; + case '808080': + $colorIdxBg = 0x17; + + break; + case '9999FF': + $colorIdxBg = 0x18; + + break; + case '993366': + $colorIdxBg = 0x19; + + break; + case 'FFFFCC': + $colorIdxBg = 0x1A; + + break; + case 'CCFFFF': + $colorIdxBg = 0x1B; + + break; + case '660066': + $colorIdxBg = 0x1C; + + break; + case 'FF8080': + $colorIdxBg = 0x1D; + + break; + case '0066CC': + $colorIdxBg = 0x1E; + + break; + case 'CCCCFF': + $colorIdxBg = 0x1F; + + break; + case '000080': + $colorIdxBg = 0x20; + + break; + case 'FF00FF': + $colorIdxBg = 0x21; + + break; + case 'FFFF00': + $colorIdxBg = 0x22; + + break; + case '00FFFF': + $colorIdxBg = 0x23; + + break; + case '800080': + $colorIdxBg = 0x24; + + break; + case '800000': + $colorIdxBg = 0x25; + + break; + case '008080': + $colorIdxBg = 0x26; + + break; + case '0000FF': + $colorIdxBg = 0x27; + + break; + case '00CCFF': + $colorIdxBg = 0x28; + + break; + case 'CCFFFF': + $colorIdxBg = 0x29; + + break; + case 'CCFFCC': + $colorIdxBg = 0x2A; + + break; + case 'FFFF99': + $colorIdxBg = 0x2B; + + break; + case '99CCFF': + $colorIdxBg = 0x2C; + + break; + case 'FF99CC': + $colorIdxBg = 0x2D; + + break; + case 'CC99FF': + $colorIdxBg = 0x2E; + + break; + case 'FFCC99': + $colorIdxBg = 0x2F; + + break; + case '3366FF': + $colorIdxBg = 0x30; + + break; + case '33CCCC': + $colorIdxBg = 0x31; + + break; + case '99CC00': + $colorIdxBg = 0x32; + + break; + case 'FFCC00': + $colorIdxBg = 0x33; + + break; + case 'FF9900': + $colorIdxBg = 0x34; + + break; + case 'FF6600': + $colorIdxBg = 0x35; + + break; + case '666699': + $colorIdxBg = 0x36; + + break; + case '969696': + $colorIdxBg = 0x37; + + break; + case '003366': + $colorIdxBg = 0x38; + + break; + case '339966': + $colorIdxBg = 0x39; + + break; + case '003300': + $colorIdxBg = 0x3A; + + break; + case '333300': + $colorIdxBg = 0x3B; + + break; + case '993300': + $colorIdxBg = 0x3C; + + break; + case '993366': + $colorIdxBg = 0x3D; + + break; + case '333399': + $colorIdxBg = 0x3E; + + break; + case '333333': + $colorIdxBg = 0x3F; + + break; + default: + $colorIdxBg = 0x41; + + break; + } + // Fg Color + switch ($conditional->getStyle()->getFill()->getEndColor()->getRGB()) { + case '000000': + $colorIdxFg = 0x08; + + break; + case 'FFFFFF': + $colorIdxFg = 0x09; + + break; + case 'FF0000': + $colorIdxFg = 0x0A; + + break; + case '00FF00': + $colorIdxFg = 0x0B; + + break; + case '0000FF': + $colorIdxFg = 0x0C; + + break; + case 'FFFF00': + $colorIdxFg = 0x0D; + + break; + case 'FF00FF': + $colorIdxFg = 0x0E; + + break; + case '00FFFF': + $colorIdxFg = 0x0F; + + break; + case '800000': + $colorIdxFg = 0x10; + + break; + case '008000': + $colorIdxFg = 0x11; + + break; + case '000080': + $colorIdxFg = 0x12; + + break; + case '808000': + $colorIdxFg = 0x13; + + break; + case '800080': + $colorIdxFg = 0x14; + + break; + case '008080': + $colorIdxFg = 0x15; + + break; + case 'C0C0C0': + $colorIdxFg = 0x16; + + break; + case '808080': + $colorIdxFg = 0x17; + + break; + case '9999FF': + $colorIdxFg = 0x18; + + break; + case '993366': + $colorIdxFg = 0x19; + + break; + case 'FFFFCC': + $colorIdxFg = 0x1A; + + break; + case 'CCFFFF': + $colorIdxFg = 0x1B; + + break; + case '660066': + $colorIdxFg = 0x1C; + + break; + case 'FF8080': + $colorIdxFg = 0x1D; + + break; + case '0066CC': + $colorIdxFg = 0x1E; + + break; + case 'CCCCFF': + $colorIdxFg = 0x1F; + + break; + case '000080': + $colorIdxFg = 0x20; + + break; + case 'FF00FF': + $colorIdxFg = 0x21; + + break; + case 'FFFF00': + $colorIdxFg = 0x22; + + break; + case '00FFFF': + $colorIdxFg = 0x23; + + break; + case '800080': + $colorIdxFg = 0x24; + + break; + case '800000': + $colorIdxFg = 0x25; + + break; + case '008080': + $colorIdxFg = 0x26; + + break; + case '0000FF': + $colorIdxFg = 0x27; + + break; + case '00CCFF': + $colorIdxFg = 0x28; + + break; + case 'CCFFFF': + $colorIdxFg = 0x29; + + break; + case 'CCFFCC': + $colorIdxFg = 0x2A; + + break; + case 'FFFF99': + $colorIdxFg = 0x2B; + + break; + case '99CCFF': + $colorIdxFg = 0x2C; + + break; + case 'FF99CC': + $colorIdxFg = 0x2D; + + break; + case 'CC99FF': + $colorIdxFg = 0x2E; + + break; + case 'FFCC99': + $colorIdxFg = 0x2F; + + break; + case '3366FF': + $colorIdxFg = 0x30; + + break; + case '33CCCC': + $colorIdxFg = 0x31; + + break; + case '99CC00': + $colorIdxFg = 0x32; + + break; + case 'FFCC00': + $colorIdxFg = 0x33; + + break; + case 'FF9900': + $colorIdxFg = 0x34; + + break; + case 'FF6600': + $colorIdxFg = 0x35; + + break; + case '666699': + $colorIdxFg = 0x36; + + break; + case '969696': + $colorIdxFg = 0x37; + + break; + case '003366': + $colorIdxFg = 0x38; + + break; + case '339966': + $colorIdxFg = 0x39; + + break; + case '003300': + $colorIdxFg = 0x3A; + + break; + case '333300': + $colorIdxFg = 0x3B; + + break; + case '993300': + $colorIdxFg = 0x3C; + + break; + case '993366': + $colorIdxFg = 0x3D; + + break; + case '333399': + $colorIdxFg = 0x3E; + + break; + case '333333': + $colorIdxFg = 0x3F; + + break; + default: + $colorIdxFg = 0x40; + + break; + } + $dataBlockFill = pack('v', $blockFillPatternStyle); + $dataBlockFill .= pack('v', $colorIdxFg | ($colorIdxBg << 7)); + } + if ($bFormatProt == 1) { + $dataBlockProtection = 0; + if ($conditional->getStyle()->getProtection()->getLocked() == Protection::PROTECTION_PROTECTED) { + $dataBlockProtection = 1; + } + if ($conditional->getStyle()->getProtection()->getHidden() == Protection::PROTECTION_PROTECTED) { + $dataBlockProtection = 1 << 1; + } + } + + $data = pack('CCvvVv', $type, $operatorType, $szValue1, $szValue2, $flags, 0x0000); + if ($bFormatFont == 1) { // Block Formatting : OK + $data .= $dataBlockFont; + } + if ($bFormatAlign == 1) { + $data .= $dataBlockAlign; + } + if ($bFormatBorder == 1) { + $data .= $dataBlockBorder; + } + if ($bFormatFill == 1) { // Block Formatting : OK + $data .= $dataBlockFill; + } + if ($bFormatProt == 1) { + $data .= $dataBlockProtection; + } + if ($operand1 !== null) { + $data .= $operand1; + } + if ($operand2 !== null) { + $data .= $operand2; + } + $header = pack('vv', $record, strlen($data)); + $this->append($header . $data); + } + + /** + * Write CFHeader record. + */ + private function writeCFHeader() + { + $record = 0x01B0; // Record identifier + $length = 0x0016; // Bytes to follow + + $numColumnMin = null; + $numColumnMax = null; + $numRowMin = null; + $numRowMax = null; + $arrConditional = []; + foreach ($this->phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { + foreach ($conditionalStyles as $conditional) { + if ($conditional->getConditionType() == Conditional::CONDITION_EXPRESSION + || $conditional->getConditionType() == Conditional::CONDITION_CELLIS) { + if (!in_array($conditional->getHashCode(), $arrConditional)) { + $arrConditional[] = $conditional->getHashCode(); + } + // Cells + $arrCoord = Coordinate::coordinateFromString($cellCoordinate); + if (!is_numeric($arrCoord[0])) { + $arrCoord[0] = Coordinate::columnIndexFromString($arrCoord[0]); + } + if ($numColumnMin === null || ($numColumnMin > $arrCoord[0])) { + $numColumnMin = $arrCoord[0]; + } + if ($numColumnMax === null || ($numColumnMax < $arrCoord[0])) { + $numColumnMax = $arrCoord[0]; + } + if ($numRowMin === null || ($numRowMin > $arrCoord[1])) { + $numRowMin = $arrCoord[1]; + } + if ($numRowMax === null || ($numRowMax < $arrCoord[1])) { + $numRowMax = $arrCoord[1]; + } + } + } + } + $needRedraw = 1; + $cellRange = pack('vvvv', $numRowMin - 1, $numRowMax - 1, $numColumnMin - 1, $numColumnMax - 1); + + $header = pack('vv', $record, $length); + $data = pack('vv', count($arrConditional), $needRedraw); + $data .= $cellRange; + $data .= pack('v', 0x0001); + $data .= $cellRange; + $this->append($header . $data); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Xf.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Xf.php new file mode 100644 index 0000000..238fb34 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/Xf.php @@ -0,0 +1,548 @@ + +// * +// * The majority of this is _NOT_ my code. I simply ported it from the +// * PERL Spreadsheet::WriteExcel module. +// * +// * The author of the Spreadsheet::WriteExcel module is John McNamara +// * +// * +// * I _DO_ maintain this code, and John McNamara has nothing to do with the +// * porting of this code to PHP. Any questions directly related to this +// * class library should be directed to me. +// * +// * License Information: +// * +// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets +// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com +// * +// * This library is free software; you can redistribute it and/or +// * modify it under the terms of the GNU Lesser General Public +// * License as published by the Free Software Foundation; either +// * version 2.1 of the License, or (at your option) any later version. +// * +// * This library is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this library; if not, write to the Free Software +// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// */ +class Xf +{ + /** + * Style XF or a cell XF ? + * + * @var bool + */ + private $isStyleXf; + + /** + * Index to the FONT record. Index 4 does not exist. + * + * @var int + */ + private $fontIndex; + + /** + * An index (2 bytes) to a FORMAT record (number format). + * + * @var int + */ + private $numberFormatIndex; + + /** + * 1 bit, apparently not used. + * + * @var int + */ + private $textJustLast; + + /** + * The cell's foreground color. + * + * @var int + */ + private $foregroundColor; + + /** + * The cell's background color. + * + * @var int + */ + private $backgroundColor; + + /** + * Color of the bottom border of the cell. + * + * @var int + */ + private $bottomBorderColor; + + /** + * Color of the top border of the cell. + * + * @var int + */ + private $topBorderColor; + + /** + * Color of the left border of the cell. + * + * @var int + */ + private $leftBorderColor; + + /** + * Color of the right border of the cell. + * + * @var int + */ + private $rightBorderColor; + + /** + * Constructor. + * + * @param Style $style The XF format + */ + public function __construct(Style $style) + { + $this->isStyleXf = false; + $this->fontIndex = 0; + + $this->numberFormatIndex = 0; + + $this->textJustLast = 0; + + $this->foregroundColor = 0x40; + $this->backgroundColor = 0x41; + + $this->_diag = 0; + + $this->bottomBorderColor = 0x40; + $this->topBorderColor = 0x40; + $this->leftBorderColor = 0x40; + $this->rightBorderColor = 0x40; + $this->_diag_color = 0x40; + $this->_style = $style; + } + + /** + * Generate an Excel BIFF XF record (style or cell). + * + * @return string The XF record + */ + public function writeXf() + { + // Set the type of the XF record and some of the attributes. + if ($this->isStyleXf) { + $style = 0xFFF5; + } else { + $style = self::mapLocked($this->_style->getProtection()->getLocked()); + $style |= self::mapHidden($this->_style->getProtection()->getHidden()) << 1; + } + + // Flags to indicate if attributes have been set. + $atr_num = ($this->numberFormatIndex != 0) ? 1 : 0; + $atr_fnt = ($this->fontIndex != 0) ? 1 : 0; + $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0; + $atr_bdr = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || + self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || + self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || + self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle())) ? 1 : 0; + $atr_pat = (($this->foregroundColor != 0x40) || + ($this->backgroundColor != 0x41) || + self::mapFillType($this->_style->getFill()->getFillType())) ? 1 : 0; + $atr_prot = self::mapLocked($this->_style->getProtection()->getLocked()) + | self::mapHidden($this->_style->getProtection()->getHidden()); + + // Zero the default border colour if the border has not been set. + if (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) { + $this->bottomBorderColor = 0; + } + if (self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) { + $this->topBorderColor = 0; + } + if (self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) { + $this->rightBorderColor = 0; + } + if (self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) { + $this->leftBorderColor = 0; + } + if (self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) { + $this->_diag_color = 0; + } + + $record = 0x00E0; // Record identifier + $length = 0x0014; // Number of bytes to follow + + $ifnt = $this->fontIndex; // Index to FONT record + $ifmt = $this->numberFormatIndex; // Index to FORMAT record + + $align = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment + $align |= (int) $this->_style->getAlignment()->getWrapText() << 3; + $align |= self::mapVAlign($this->_style->getAlignment()->getVertical()) << 4; + $align |= $this->textJustLast << 7; + + $used_attrib = $atr_num << 2; + $used_attrib |= $atr_fnt << 3; + $used_attrib |= $atr_alc << 4; + $used_attrib |= $atr_bdr << 5; + $used_attrib |= $atr_pat << 6; + $used_attrib |= $atr_prot << 7; + + $icv = $this->foregroundColor; // fg and bg pattern colors + $icv |= $this->backgroundColor << 7; + + $border1 = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color + $border1 |= self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4; + $border1 |= self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8; + $border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12; + $border1 |= $this->leftBorderColor << 16; + $border1 |= $this->rightBorderColor << 23; + + $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection(); + $diag_tl_to_rb = $diagonalDirection == Borders::DIAGONAL_BOTH + || $diagonalDirection == Borders::DIAGONAL_DOWN; + $diag_tr_to_lb = $diagonalDirection == Borders::DIAGONAL_BOTH + || $diagonalDirection == Borders::DIAGONAL_UP; + $border1 |= $diag_tl_to_rb << 30; + $border1 |= $diag_tr_to_lb << 31; + + $border2 = $this->topBorderColor; // Border color + $border2 |= $this->bottomBorderColor << 7; + $border2 |= $this->_diag_color << 14; + $border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; + $border2 |= self::mapFillType($this->_style->getFill()->getFillType()) << 26; + + $header = pack('vv', $record, $length); + + //BIFF8 options: identation, shrinkToFit and text direction + $biff8_options = $this->_style->getAlignment()->getIndent(); + $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4; + + $data = pack('vvvC', $ifnt, $ifmt, $style, $align); + $data .= pack('CCC', self::mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib); + $data .= pack('VVv', $border1, $border2, $icv); + + return $header . $data; + } + + /** + * Is this a style XF ? + * + * @param bool $value + */ + public function setIsStyleXf($value) + { + $this->isStyleXf = $value; + } + + /** + * Sets the cell's bottom border color. + * + * @param int $colorIndex Color index + */ + public function setBottomColor($colorIndex) + { + $this->bottomBorderColor = $colorIndex; + } + + /** + * Sets the cell's top border color. + * + * @param int $colorIndex Color index + */ + public function setTopColor($colorIndex) + { + $this->topBorderColor = $colorIndex; + } + + /** + * Sets the cell's left border color. + * + * @param int $colorIndex Color index + */ + public function setLeftColor($colorIndex) + { + $this->leftBorderColor = $colorIndex; + } + + /** + * Sets the cell's right border color. + * + * @param int $colorIndex Color index + */ + public function setRightColor($colorIndex) + { + $this->rightBorderColor = $colorIndex; + } + + /** + * Sets the cell's diagonal border color. + * + * @param int $colorIndex Color index + */ + public function setDiagColor($colorIndex) + { + $this->_diag_color = $colorIndex; + } + + /** + * Sets the cell's foreground color. + * + * @param int $colorIndex Color index + */ + public function setFgColor($colorIndex) + { + $this->foregroundColor = $colorIndex; + } + + /** + * Sets the cell's background color. + * + * @param int $colorIndex Color index + */ + public function setBgColor($colorIndex) + { + $this->backgroundColor = $colorIndex; + } + + /** + * Sets the index to the number format record + * It can be date, time, currency, etc... + * + * @param int $numberFormatIndex Index to format record + */ + public function setNumberFormatIndex($numberFormatIndex) + { + $this->numberFormatIndex = $numberFormatIndex; + } + + /** + * Set the font index. + * + * @param int $value Font index, note that value 4 does not exist + */ + public function setFontIndex($value) + { + $this->fontIndex = $value; + } + + /** + * Map of BIFF2-BIFF8 codes for border styles. + * + * @var array of int + */ + private static $mapBorderStyles = [ + Border::BORDER_NONE => 0x00, + Border::BORDER_THIN => 0x01, + Border::BORDER_MEDIUM => 0x02, + Border::BORDER_DASHED => 0x03, + Border::BORDER_DOTTED => 0x04, + Border::BORDER_THICK => 0x05, + Border::BORDER_DOUBLE => 0x06, + Border::BORDER_HAIR => 0x07, + Border::BORDER_MEDIUMDASHED => 0x08, + Border::BORDER_DASHDOT => 0x09, + Border::BORDER_MEDIUMDASHDOT => 0x0A, + Border::BORDER_DASHDOTDOT => 0x0B, + Border::BORDER_MEDIUMDASHDOTDOT => 0x0C, + Border::BORDER_SLANTDASHDOT => 0x0D, + ]; + + /** + * Map border style. + * + * @param string $borderStyle + * + * @return int + */ + private static function mapBorderStyle($borderStyle) + { + if (isset(self::$mapBorderStyles[$borderStyle])) { + return self::$mapBorderStyles[$borderStyle]; + } + + return 0x00; + } + + /** + * Map of BIFF2-BIFF8 codes for fill types. + * + * @var array of int + */ + private static $mapFillTypes = [ + Fill::FILL_NONE => 0x00, + Fill::FILL_SOLID => 0x01, + Fill::FILL_PATTERN_MEDIUMGRAY => 0x02, + Fill::FILL_PATTERN_DARKGRAY => 0x03, + Fill::FILL_PATTERN_LIGHTGRAY => 0x04, + Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05, + Fill::FILL_PATTERN_DARKVERTICAL => 0x06, + Fill::FILL_PATTERN_DARKDOWN => 0x07, + Fill::FILL_PATTERN_DARKUP => 0x08, + Fill::FILL_PATTERN_DARKGRID => 0x09, + Fill::FILL_PATTERN_DARKTRELLIS => 0x0A, + Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B, + Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C, + Fill::FILL_PATTERN_LIGHTDOWN => 0x0D, + Fill::FILL_PATTERN_LIGHTUP => 0x0E, + Fill::FILL_PATTERN_LIGHTGRID => 0x0F, + Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10, + Fill::FILL_PATTERN_GRAY125 => 0x11, + Fill::FILL_PATTERN_GRAY0625 => 0x12, + Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8 + Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8 + ]; + + /** + * Map fill type. + * + * @param string $fillType + * + * @return int + */ + private static function mapFillType($fillType) + { + if (isset(self::$mapFillTypes[$fillType])) { + return self::$mapFillTypes[$fillType]; + } + + return 0x00; + } + + /** + * Map of BIFF2-BIFF8 codes for horizontal alignment. + * + * @var array of int + */ + private static $mapHAlignments = [ + Alignment::HORIZONTAL_GENERAL => 0, + Alignment::HORIZONTAL_LEFT => 1, + Alignment::HORIZONTAL_CENTER => 2, + Alignment::HORIZONTAL_RIGHT => 3, + Alignment::HORIZONTAL_FILL => 4, + Alignment::HORIZONTAL_JUSTIFY => 5, + Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, + ]; + + /** + * Map to BIFF2-BIFF8 codes for horizontal alignment. + * + * @param string $hAlign + * + * @return int + */ + private function mapHAlign($hAlign) + { + if (isset(self::$mapHAlignments[$hAlign])) { + return self::$mapHAlignments[$hAlign]; + } + + return 0; + } + + /** + * Map of BIFF2-BIFF8 codes for vertical alignment. + * + * @var array of int + */ + private static $mapVAlignments = [ + Alignment::VERTICAL_TOP => 0, + Alignment::VERTICAL_CENTER => 1, + Alignment::VERTICAL_BOTTOM => 2, + Alignment::VERTICAL_JUSTIFY => 3, + ]; + + /** + * Map to BIFF2-BIFF8 codes for vertical alignment. + * + * @param string $vAlign + * + * @return int + */ + private static function mapVAlign($vAlign) + { + if (isset(self::$mapVAlignments[$vAlign])) { + return self::$mapVAlignments[$vAlign]; + } + + return 2; + } + + /** + * Map to BIFF8 codes for text rotation angle. + * + * @param int $textRotation + * + * @return int + */ + private static function mapTextRotation($textRotation) + { + if ($textRotation >= 0) { + return $textRotation; + } elseif ($textRotation == -165) { + return 255; + } elseif ($textRotation < 0) { + return 90 - $textRotation; + } + } + + /** + * Map locked. + * + * @param string $locked + * + * @return int + */ + private static function mapLocked($locked) + { + switch ($locked) { + case Protection::PROTECTION_INHERIT: + return 1; + case Protection::PROTECTION_PROTECTED: + return 1; + case Protection::PROTECTION_UNPROTECTED: + return 0; + default: + return 1; + } + } + + /** + * Map hidden. + * + * @param string $hidden + * + * @return int + */ + private static function mapHidden($hidden) + { + switch ($hidden) { + case Protection::PROTECTION_INHERIT: + return 0; + case Protection::PROTECTION_PROTECTED: + return 1; + case Protection::PROTECTION_UNPROTECTED: + return 0; + default: + return 0; + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php new file mode 100644 index 0000000..1fa59e5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php @@ -0,0 +1,558 @@ +setSpreadsheet($spreadsheet); + + $writerPartsArray = [ + 'stringtable' => StringTable::class, + 'contenttypes' => ContentTypes::class, + 'docprops' => DocProps::class, + 'rels' => Rels::class, + 'theme' => Theme::class, + 'style' => Style::class, + 'workbook' => Workbook::class, + 'worksheet' => Worksheet::class, + 'drawing' => Drawing::class, + 'comments' => Comments::class, + 'chart' => Chart::class, + 'relsvba' => RelsVBA::class, + 'relsribbonobjects' => RelsRibbon::class, + ]; + + // Initialise writer parts + // and Assign their parent IWriters + foreach ($writerPartsArray as $writer => $class) { + $this->writerParts[$writer] = new $class($this); + } + + $hashTablesArray = ['stylesConditionalHashTable', 'fillHashTable', 'fontHashTable', + 'bordersHashTable', 'numFmtHashTable', 'drawingHashTable', + 'styleHashTable', + ]; + + // Set HashTable variables + foreach ($hashTablesArray as $tableName) { + $this->$tableName = new HashTable(); + } + } + + /** + * Get writer part. + * + * @param string $pPartName Writer part name + * + * @return \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart + */ + public function getWriterPart($pPartName) + { + if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) { + return $this->writerParts[strtolower($pPartName)]; + } + + return null; + } + + /** + * Save PhpSpreadsheet to file. + * + * @param string $pFilename + * + * @throws WriterException + */ + public function save($pFilename) + { + if ($this->spreadSheet !== null) { + // garbage collect + $this->spreadSheet->garbageCollect(); + + // If $pFilename is php://output or php://stdout, make it a temporary file... + $originalFilename = $pFilename; + if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') { + $pFilename = @tempnam(File::sysGetTempDir(), 'phpxltmp'); + if ($pFilename == '') { + $pFilename = $originalFilename; + } + } + + $saveDebugLog = Calculation::getInstance($this->spreadSheet)->getDebugLog()->getWriteDebugLog(); + Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog(false); + $saveDateReturnType = Functions::getReturnDateType(); + Functions::setReturnDateType(Functions::RETURNDATE_EXCEL); + + // Create string lookup table + $this->stringTable = []; + for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) { + $this->stringTable = $this->getWriterPart('StringTable')->createStringTable($this->spreadSheet->getSheet($i), $this->stringTable); + } + + // Create styles dictionaries + $this->styleHashTable->addFromSource($this->getWriterPart('Style')->allStyles($this->spreadSheet)); + $this->stylesConditionalHashTable->addFromSource($this->getWriterPart('Style')->allConditionalStyles($this->spreadSheet)); + $this->fillHashTable->addFromSource($this->getWriterPart('Style')->allFills($this->spreadSheet)); + $this->fontHashTable->addFromSource($this->getWriterPart('Style')->allFonts($this->spreadSheet)); + $this->bordersHashTable->addFromSource($this->getWriterPart('Style')->allBorders($this->spreadSheet)); + $this->numFmtHashTable->addFromSource($this->getWriterPart('Style')->allNumberFormats($this->spreadSheet)); + + // Create drawing dictionary + $this->drawingHashTable->addFromSource($this->getWriterPart('Drawing')->allDrawings($this->spreadSheet)); + + $zip = new ZipArchive(); + + if (file_exists($pFilename)) { + unlink($pFilename); + } + // Try opening the ZIP file + if ($zip->open($pFilename, ZipArchive::OVERWRITE) !== true) { + if ($zip->open($pFilename, ZipArchive::CREATE) !== true) { + throw new WriterException('Could not open ' . $pFilename . ' for writing.'); + } + } + + // Add [Content_Types].xml to ZIP file + $zip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->spreadSheet, $this->includeCharts)); + + //if hasMacros, add the vbaProject.bin file, Certificate file(if exists) + if ($this->spreadSheet->hasMacros()) { + $macrosCode = $this->spreadSheet->getMacrosCode(); + if ($macrosCode !== null) { + // we have the code ? + $zip->addFromString('xl/vbaProject.bin', $macrosCode); //allways in 'xl', allways named vbaProject.bin + if ($this->spreadSheet->hasMacrosCertificate()) { + //signed macros ? + // Yes : add the certificate file and the related rels file + $zip->addFromString('xl/vbaProjectSignature.bin', $this->spreadSheet->getMacrosCertificate()); + $zip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->writeVBARelationships($this->spreadSheet)); + } + } + } + //a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels) + if ($this->spreadSheet->hasRibbon()) { + $tmpRibbonTarget = $this->spreadSheet->getRibbonXMLData('target'); + $zip->addFromString($tmpRibbonTarget, $this->spreadSheet->getRibbonXMLData('data')); + if ($this->spreadSheet->hasRibbonBinObjects()) { + $tmpRootPath = dirname($tmpRibbonTarget) . '/'; + $ribbonBinObjects = $this->spreadSheet->getRibbonBinObjects('data'); //the files to write + foreach ($ribbonBinObjects as $aPath => $aContent) { + $zip->addFromString($tmpRootPath . $aPath, $aContent); + } + //the rels for files + $zip->addFromString($tmpRootPath . '_rels/' . basename($tmpRibbonTarget) . '.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->spreadSheet)); + } + } + + // Add relationships to ZIP file + $zip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->spreadSheet)); + $zip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->spreadSheet)); + + // Add document properties to ZIP file + $zip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->spreadSheet)); + $zip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->spreadSheet)); + $customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->spreadSheet); + if ($customPropertiesPart !== null) { + $zip->addFromString('docProps/custom.xml', $customPropertiesPart); + } + + // Add theme to ZIP file + $zip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->spreadSheet)); + + // Add string table to ZIP file + $zip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->stringTable)); + + // Add styles to ZIP file + $zip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->spreadSheet)); + + // Add workbook to ZIP file + $zip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->spreadSheet, $this->preCalculateFormulas)); + + $chartCount = 0; + // Add worksheets + for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) { + $zip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->spreadSheet->getSheet($i), $this->stringTable, $this->includeCharts)); + if ($this->includeCharts) { + $charts = $this->spreadSheet->getSheet($i)->getChartCollection(); + if (count($charts) > 0) { + foreach ($charts as $chart) { + $zip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->writeChart($chart, $this->preCalculateFormulas)); + ++$chartCount; + } + } + } + } + + $chartRef1 = 0; + // Add worksheet relationships (drawings, ...) + for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) { + // Add relationships + $zip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->spreadSheet->getSheet($i), ($i + 1), $this->includeCharts)); + + // Add unparsedLoadedData + $sheetCodeName = $this->spreadSheet->getSheet($i)->getCodeName(); + $unparsedLoadedData = $this->spreadSheet->getUnparsedLoadedData(); + if (isset($unparsedLoadedData['sheets'][$sheetCodeName]['ctrlProps'])) { + foreach ($unparsedLoadedData['sheets'][$sheetCodeName]['ctrlProps'] as $ctrlProp) { + $zip->addFromString($ctrlProp['filePath'], $ctrlProp['content']); + } + } + if (isset($unparsedLoadedData['sheets'][$sheetCodeName]['printerSettings'])) { + foreach ($unparsedLoadedData['sheets'][$sheetCodeName]['printerSettings'] as $ctrlProp) { + $zip->addFromString($ctrlProp['filePath'], $ctrlProp['content']); + } + } + + $drawings = $this->spreadSheet->getSheet($i)->getDrawingCollection(); + $drawingCount = count($drawings); + if ($this->includeCharts) { + $chartCount = $this->spreadSheet->getSheet($i)->getChartCount(); + } + + // Add drawing and image relationship parts + if (($drawingCount > 0) || ($chartCount > 0)) { + // Drawing relationships + $zip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->spreadSheet->getSheet($i), $chartRef1, $this->includeCharts)); + + // Drawings + $zip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->spreadSheet->getSheet($i), $this->includeCharts)); + } elseif (isset($unparsedLoadedData['sheets'][$sheetCodeName]['drawingAlternateContents'])) { + // Drawings + $zip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->spreadSheet->getSheet($i), $this->includeCharts)); + } + + // Add unparsed drawings + if (isset($unparsedLoadedData['sheets'][$sheetCodeName]['Drawings'])) { + foreach ($unparsedLoadedData['sheets'][$sheetCodeName]['Drawings'] as $relId => $drawingXml) { + $drawingFile = array_search($relId, $unparsedLoadedData['sheets'][$sheetCodeName]['drawingOriginalIds']); + if ($drawingFile !== false) { + $drawingFile = ltrim($drawingFile, '.'); + $zip->addFromString('xl' . $drawingFile, $drawingXml); + } + } + } + + // Add comment relationship parts + if (count($this->spreadSheet->getSheet($i)->getComments()) > 0) { + // VML Comments + $zip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->spreadSheet->getSheet($i))); + + // Comments + $zip->addFromString('xl/comments' . ($i + 1) . '.xml', $this->getWriterPart('Comments')->writeComments($this->spreadSheet->getSheet($i))); + } + + // Add unparsed relationship parts + if (isset($unparsedLoadedData['sheets'][$sheetCodeName]['vmlDrawings'])) { + foreach ($unparsedLoadedData['sheets'][$sheetCodeName]['vmlDrawings'] as $vmlDrawing) { + $zip->addFromString($vmlDrawing['filePath'], $vmlDrawing['content']); + } + } + + // Add header/footer relationship parts + if (count($this->spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) { + // VML Drawings + $zip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->spreadSheet->getSheet($i))); + + // VML Drawing relationships + $zip->addFromString('xl/drawings/_rels/vmlDrawingHF' . ($i + 1) . '.vml.rels', $this->getWriterPart('Rels')->writeHeaderFooterDrawingRelationships($this->spreadSheet->getSheet($i))); + + // Media + foreach ($this->spreadSheet->getSheet($i)->getHeaderFooter()->getImages() as $image) { + $zip->addFromString('xl/media/' . $image->getIndexedFilename(), file_get_contents($image->getPath())); + } + } + } + + // Add media + for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) { + if ($this->getDrawingHashTable()->getByIndex($i) instanceof WorksheetDrawing) { + $imageContents = null; + $imagePath = $this->getDrawingHashTable()->getByIndex($i)->getPath(); + if (strpos($imagePath, 'zip://') !== false) { + $imagePath = substr($imagePath, 6); + $imagePathSplitted = explode('#', $imagePath); + + $imageZip = new ZipArchive(); + $imageZip->open($imagePathSplitted[0]); + $imageContents = $imageZip->getFromName($imagePathSplitted[1]); + $imageZip->close(); + unset($imageZip); + } else { + $imageContents = file_get_contents($imagePath); + } + + $zip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); + } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof MemoryDrawing) { + ob_start(); + call_user_func( + $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), + $this->getDrawingHashTable()->getByIndex($i)->getImageResource() + ); + $imageContents = ob_get_contents(); + ob_end_clean(); + + $zip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); + } + } + + Functions::setReturnDateType($saveDateReturnType); + Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog); + + // Close file + if ($zip->close() === false) { + throw new WriterException("Could not close zip file $pFilename."); + } + + // If a temporary file was used, copy it to the correct file stream + if ($originalFilename != $pFilename) { + if (copy($pFilename, $originalFilename) === false) { + throw new WriterException("Could not copy temporary zip file $pFilename to $originalFilename."); + } + @unlink($pFilename); + } + } else { + throw new WriterException('PhpSpreadsheet object unassigned.'); + } + } + + /** + * Get Spreadsheet object. + * + * @throws WriterException + * + * @return Spreadsheet + */ + public function getSpreadsheet() + { + if ($this->spreadSheet !== null) { + return $this->spreadSheet; + } + + throw new WriterException('No Spreadsheet object assigned.'); + } + + /** + * Set Spreadsheet object. + * + * @param Spreadsheet $spreadsheet PhpSpreadsheet object + * + * @return $this + */ + public function setSpreadsheet(Spreadsheet $spreadsheet) + { + $this->spreadSheet = $spreadsheet; + + return $this; + } + + /** + * Get string table. + * + * @return string[] + */ + public function getStringTable() + { + return $this->stringTable; + } + + /** + * Get Style HashTable. + * + * @return HashTable + */ + public function getStyleHashTable() + { + return $this->styleHashTable; + } + + /** + * Get Conditional HashTable. + * + * @return HashTable + */ + public function getStylesConditionalHashTable() + { + return $this->stylesConditionalHashTable; + } + + /** + * Get Fill HashTable. + * + * @return HashTable + */ + public function getFillHashTable() + { + return $this->fillHashTable; + } + + /** + * Get \PhpOffice\PhpSpreadsheet\Style\Font HashTable. + * + * @return HashTable + */ + public function getFontHashTable() + { + return $this->fontHashTable; + } + + /** + * Get Borders HashTable. + * + * @return HashTable + */ + public function getBordersHashTable() + { + return $this->bordersHashTable; + } + + /** + * Get NumberFormat HashTable. + * + * @return HashTable + */ + public function getNumFmtHashTable() + { + return $this->numFmtHashTable; + } + + /** + * Get \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable. + * + * @return HashTable + */ + public function getDrawingHashTable() + { + return $this->drawingHashTable; + } + + /** + * Get Office2003 compatibility. + * + * @return bool + */ + public function getOffice2003Compatibility() + { + return $this->office2003compatibility; + } + + /** + * Set Office2003 compatibility. + * + * @param bool $pValue Office2003 compatibility? + * + * @return $this + */ + public function setOffice2003Compatibility($pValue) + { + $this->office2003compatibility = $pValue; + + return $this; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Chart.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Chart.php new file mode 100644 index 0000000..c9c3e05 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Chart.php @@ -0,0 +1,1541 @@ +calculateCellValues = $calculateCellValues; + + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + // Ensure that data series values are up-to-date before we save + if ($this->calculateCellValues) { + $pChart->refresh(); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // c:chartSpace + $objWriter->startElement('c:chartSpace'); + $objWriter->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart'); + $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + $objWriter->startElement('c:date1904'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + $objWriter->startElement('c:lang'); + $objWriter->writeAttribute('val', 'en-GB'); + $objWriter->endElement(); + $objWriter->startElement('c:roundedCorners'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $this->writeAlternateContent($objWriter); + + $objWriter->startElement('c:chart'); + + $this->writeTitle($objWriter, $pChart->getTitle()); + + $objWriter->startElement('c:autoTitleDeleted'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $this->writePlotArea($objWriter, $pChart->getWorksheet(), $pChart->getPlotArea(), $pChart->getXAxisLabel(), $pChart->getYAxisLabel(), $pChart->getChartAxisX(), $pChart->getChartAxisY(), $pChart->getMajorGridlines(), $pChart->getMinorGridlines()); + + $this->writeLegend($objWriter, $pChart->getLegend()); + + $objWriter->startElement('c:plotVisOnly'); + $objWriter->writeAttribute('val', (int) $pChart->getPlotVisibleOnly()); + $objWriter->endElement(); + + $objWriter->startElement('c:dispBlanksAs'); + $objWriter->writeAttribute('val', $pChart->getDisplayBlanksAs()); + $objWriter->endElement(); + + $objWriter->startElement('c:showDLblsOverMax'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $objWriter->endElement(); + + $this->writePrintSettings($objWriter); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write Chart Title. + * + * @param XMLWriter $objWriter XML Writer + * @param Title $title + * + * @throws WriterException + */ + private function writeTitle(XMLWriter $objWriter, Title $title = null) + { + if ($title === null) { + return; + } + + $objWriter->startElement('c:title'); + $objWriter->startElement('c:tx'); + $objWriter->startElement('c:rich'); + + $objWriter->startElement('a:bodyPr'); + $objWriter->endElement(); + + $objWriter->startElement('a:lstStyle'); + $objWriter->endElement(); + + $objWriter->startElement('a:p'); + + $caption = $title->getCaption(); + if ((is_array($caption)) && (count($caption) > 0)) { + $caption = $caption[0]; + } + $this->getParentWriter()->getWriterPart('stringtable')->writeRichTextForCharts($objWriter, $caption, 'a'); + + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + + $this->writeLayout($objWriter, $title->getLayout()); + + $objWriter->startElement('c:overlay'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Chart Legend. + * + * @param XMLWriter $objWriter XML Writer + * @param Legend $legend + * + * @throws WriterException + */ + private function writeLegend(XMLWriter $objWriter, Legend $legend = null) + { + if ($legend === null) { + return; + } + + $objWriter->startElement('c:legend'); + + $objWriter->startElement('c:legendPos'); + $objWriter->writeAttribute('val', $legend->getPosition()); + $objWriter->endElement(); + + $this->writeLayout($objWriter, $legend->getLayout()); + + $objWriter->startElement('c:overlay'); + $objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0'); + $objWriter->endElement(); + + $objWriter->startElement('c:txPr'); + $objWriter->startElement('a:bodyPr'); + $objWriter->endElement(); + + $objWriter->startElement('a:lstStyle'); + $objWriter->endElement(); + + $objWriter->startElement('a:p'); + $objWriter->startElement('a:pPr'); + $objWriter->writeAttribute('rtl', 0); + + $objWriter->startElement('a:defRPr'); + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->startElement('a:endParaRPr'); + $objWriter->writeAttribute('lang', 'en-US'); + $objWriter->endElement(); + + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Chart Plot Area. + * + * @param XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet + * @param PlotArea $plotArea + * @param Title $xAxisLabel + * @param Title $yAxisLabel + * @param Axis $xAxis + * @param Axis $yAxis + * @param null|GridLines $majorGridlines + * @param null|GridLines $minorGridlines + * + * @throws WriterException + */ + private function writePlotArea(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pSheet, PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, Axis $xAxis = null, Axis $yAxis = null, GridLines $majorGridlines = null, GridLines $minorGridlines = null) + { + if ($plotArea === null) { + return; + } + + $id1 = $id2 = 0; + $this->seriesIndex = 0; + $objWriter->startElement('c:plotArea'); + + $layout = $plotArea->getLayout(); + + $this->writeLayout($objWriter, $layout); + + $chartTypes = self::getChartType($plotArea); + $catIsMultiLevelSeries = $valIsMultiLevelSeries = false; + $plotGroupingType = ''; + foreach ($chartTypes as $chartType) { + $objWriter->startElement('c:' . $chartType); + + $groupCount = $plotArea->getPlotGroupCount(); + for ($i = 0; $i < $groupCount; ++$i) { + $plotGroup = $plotArea->getPlotGroupByIndex($i); + $groupType = $plotGroup->getPlotType(); + if ($groupType == $chartType) { + $plotStyle = $plotGroup->getPlotStyle(); + if ($groupType === DataSeries::TYPE_RADARCHART) { + $objWriter->startElement('c:radarStyle'); + $objWriter->writeAttribute('val', $plotStyle); + $objWriter->endElement(); + } elseif ($groupType === DataSeries::TYPE_SCATTERCHART) { + $objWriter->startElement('c:scatterStyle'); + $objWriter->writeAttribute('val', $plotStyle); + $objWriter->endElement(); + } + + $this->writePlotGroup($plotGroup, $chartType, $objWriter, $catIsMultiLevelSeries, $valIsMultiLevelSeries, $plotGroupingType); + } + } + + $this->writeDataLabels($objWriter, $layout); + + if ($chartType === DataSeries::TYPE_LINECHART) { + // Line only, Line3D can't be smoothed + $objWriter->startElement('c:smooth'); + $objWriter->writeAttribute('val', (int) $plotGroup->getSmoothLine()); + $objWriter->endElement(); + } elseif (($chartType === DataSeries::TYPE_BARCHART) || ($chartType === DataSeries::TYPE_BARCHART_3D)) { + $objWriter->startElement('c:gapWidth'); + $objWriter->writeAttribute('val', 150); + $objWriter->endElement(); + + if ($plotGroupingType == 'percentStacked' || $plotGroupingType == 'stacked') { + $objWriter->startElement('c:overlap'); + $objWriter->writeAttribute('val', 100); + $objWriter->endElement(); + } + } elseif ($chartType === DataSeries::TYPE_BUBBLECHART) { + $objWriter->startElement('c:bubbleScale'); + $objWriter->writeAttribute('val', 25); + $objWriter->endElement(); + + $objWriter->startElement('c:showNegBubbles'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + } elseif ($chartType === DataSeries::TYPE_STOCKCHART) { + $objWriter->startElement('c:hiLowLines'); + $objWriter->endElement(); + + $objWriter->startElement('c:upDownBars'); + + $objWriter->startElement('c:gapWidth'); + $objWriter->writeAttribute('val', 300); + $objWriter->endElement(); + + $objWriter->startElement('c:upBars'); + $objWriter->endElement(); + + $objWriter->startElement('c:downBars'); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + // Generate 2 unique numbers to use for axId values + $id1 = '75091328'; + $id2 = '75089408'; + + if (($chartType !== DataSeries::TYPE_PIECHART) && ($chartType !== DataSeries::TYPE_PIECHART_3D) && ($chartType !== DataSeries::TYPE_DONUTCHART)) { + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', $id1); + $objWriter->endElement(); + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', $id2); + $objWriter->endElement(); + } else { + $objWriter->startElement('c:firstSliceAng'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + if ($chartType === DataSeries::TYPE_DONUTCHART) { + $objWriter->startElement('c:holeSize'); + $objWriter->writeAttribute('val', 50); + $objWriter->endElement(); + } + } + + $objWriter->endElement(); + } + + if (($chartType !== DataSeries::TYPE_PIECHART) && ($chartType !== DataSeries::TYPE_PIECHART_3D) && ($chartType !== DataSeries::TYPE_DONUTCHART)) { + if ($chartType === DataSeries::TYPE_BUBBLECHART) { + $this->writeValueAxis($objWriter, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $majorGridlines, $minorGridlines); + } else { + $this->writeCategoryAxis($objWriter, $xAxisLabel, $id1, $id2, $catIsMultiLevelSeries, $yAxis); + } + + $this->writeValueAxis($objWriter, $yAxisLabel, $chartType, $id1, $id2, $valIsMultiLevelSeries, $xAxis, $majorGridlines, $minorGridlines); + } + + $objWriter->endElement(); + } + + /** + * Write Data Labels. + * + * @param XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpSpreadsheet\Chart\Layout $chartLayout Chart layout + */ + private function writeDataLabels(XMLWriter $objWriter, Layout $chartLayout = null) + { + $objWriter->startElement('c:dLbls'); + + $objWriter->startElement('c:showLegendKey'); + $showLegendKey = (empty($chartLayout)) ? 0 : $chartLayout->getShowLegendKey(); + $objWriter->writeAttribute('val', ((empty($showLegendKey)) ? 0 : 1)); + $objWriter->endElement(); + + $objWriter->startElement('c:showVal'); + $showVal = (empty($chartLayout)) ? 0 : $chartLayout->getShowVal(); + $objWriter->writeAttribute('val', ((empty($showVal)) ? 0 : 1)); + $objWriter->endElement(); + + $objWriter->startElement('c:showCatName'); + $showCatName = (empty($chartLayout)) ? 0 : $chartLayout->getShowCatName(); + $objWriter->writeAttribute('val', ((empty($showCatName)) ? 0 : 1)); + $objWriter->endElement(); + + $objWriter->startElement('c:showSerName'); + $showSerName = (empty($chartLayout)) ? 0 : $chartLayout->getShowSerName(); + $objWriter->writeAttribute('val', ((empty($showSerName)) ? 0 : 1)); + $objWriter->endElement(); + + $objWriter->startElement('c:showPercent'); + $showPercent = (empty($chartLayout)) ? 0 : $chartLayout->getShowPercent(); + $objWriter->writeAttribute('val', ((empty($showPercent)) ? 0 : 1)); + $objWriter->endElement(); + + $objWriter->startElement('c:showBubbleSize'); + $showBubbleSize = (empty($chartLayout)) ? 0 : $chartLayout->getShowBubbleSize(); + $objWriter->writeAttribute('val', ((empty($showBubbleSize)) ? 0 : 1)); + $objWriter->endElement(); + + $objWriter->startElement('c:showLeaderLines'); + $showLeaderLines = (empty($chartLayout)) ? 1 : $chartLayout->getShowLeaderLines(); + $objWriter->writeAttribute('val', ((empty($showLeaderLines)) ? 0 : 1)); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Category Axis. + * + * @param XMLWriter $objWriter XML Writer + * @param Title $xAxisLabel + * @param string $id1 + * @param string $id2 + * @param bool $isMultiLevelSeries + * @param Axis $yAxis + * + * @throws WriterException + */ + private function writeCategoryAxis($objWriter, $xAxisLabel, $id1, $id2, $isMultiLevelSeries, Axis $yAxis) + { + $objWriter->startElement('c:catAx'); + + if ($id1 > 0) { + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', $id1); + $objWriter->endElement(); + } + + $objWriter->startElement('c:scaling'); + $objWriter->startElement('c:orientation'); + $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('orientation')); + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->startElement('c:delete'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $objWriter->startElement('c:axPos'); + $objWriter->writeAttribute('val', 'b'); + $objWriter->endElement(); + + if ($xAxisLabel !== null) { + $objWriter->startElement('c:title'); + $objWriter->startElement('c:tx'); + $objWriter->startElement('c:rich'); + + $objWriter->startElement('a:bodyPr'); + $objWriter->endElement(); + + $objWriter->startElement('a:lstStyle'); + $objWriter->endElement(); + + $objWriter->startElement('a:p'); + $objWriter->startElement('a:r'); + + $caption = $xAxisLabel->getCaption(); + if (is_array($caption)) { + $caption = $caption[0]; + } + $objWriter->startElement('a:t'); + $objWriter->writeRawData(StringHelper::controlCharacterPHP2OOXML($caption)); + $objWriter->endElement(); + + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + + $layout = $xAxisLabel->getLayout(); + $this->writeLayout($objWriter, $layout); + + $objWriter->startElement('c:overlay'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + $objWriter->startElement('c:numFmt'); + $objWriter->writeAttribute('formatCode', $yAxis->getAxisNumberFormat()); + $objWriter->writeAttribute('sourceLinked', $yAxis->getAxisNumberSourceLinked()); + $objWriter->endElement(); + + $objWriter->startElement('c:majorTickMark'); + $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('major_tick_mark')); + $objWriter->endElement(); + + $objWriter->startElement('c:minorTickMark'); + $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('minor_tick_mark')); + $objWriter->endElement(); + + $objWriter->startElement('c:tickLblPos'); + $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('axis_labels')); + $objWriter->endElement(); + + if ($id2 > 0) { + $objWriter->startElement('c:crossAx'); + $objWriter->writeAttribute('val', $id2); + $objWriter->endElement(); + + $objWriter->startElement('c:crosses'); + $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('horizontal_crosses')); + $objWriter->endElement(); + } + + $objWriter->startElement('c:auto'); + $objWriter->writeAttribute('val', 1); + $objWriter->endElement(); + + $objWriter->startElement('c:lblAlgn'); + $objWriter->writeAttribute('val', 'ctr'); + $objWriter->endElement(); + + $objWriter->startElement('c:lblOffset'); + $objWriter->writeAttribute('val', 100); + $objWriter->endElement(); + + if ($isMultiLevelSeries) { + $objWriter->startElement('c:noMultiLvlLbl'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + } + $objWriter->endElement(); + } + + /** + * Write Value Axis. + * + * @param XMLWriter $objWriter XML Writer + * @param Title $yAxisLabel + * @param string $groupType Chart type + * @param string $id1 + * @param string $id2 + * @param bool $isMultiLevelSeries + * @param Axis $xAxis + * @param GridLines $majorGridlines + * @param GridLines $minorGridlines + * + * @throws WriterException + */ + private function writeValueAxis($objWriter, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, Axis $xAxis, GridLines $majorGridlines, GridLines $minorGridlines) + { + $objWriter->startElement('c:valAx'); + + if ($id2 > 0) { + $objWriter->startElement('c:axId'); + $objWriter->writeAttribute('val', $id2); + $objWriter->endElement(); + } + + $objWriter->startElement('c:scaling'); + + if ($xAxis->getAxisOptionsProperty('maximum') !== null) { + $objWriter->startElement('c:max'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('maximum')); + $objWriter->endElement(); + } + + if ($xAxis->getAxisOptionsProperty('minimum') !== null) { + $objWriter->startElement('c:min'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minimum')); + $objWriter->endElement(); + } + + $objWriter->startElement('c:orientation'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('orientation')); + + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->startElement('c:delete'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $objWriter->startElement('c:axPos'); + $objWriter->writeAttribute('val', 'l'); + $objWriter->endElement(); + + $objWriter->startElement('c:majorGridlines'); + $objWriter->startElement('c:spPr'); + + if ($majorGridlines->getLineColorProperty('value') !== null) { + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', $majorGridlines->getLineStyleProperty('width')); + $objWriter->startElement('a:solidFill'); + $objWriter->startElement("a:{$majorGridlines->getLineColorProperty('type')}"); + $objWriter->writeAttribute('val', $majorGridlines->getLineColorProperty('value')); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $majorGridlines->getLineColorProperty('alpha')); + $objWriter->endElement(); //end alpha + $objWriter->endElement(); //end srgbClr + $objWriter->endElement(); //end solidFill + + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', $majorGridlines->getLineStyleProperty('dash')); + $objWriter->endElement(); + + if ($majorGridlines->getLineStyleProperty('join') == 'miter') { + $objWriter->startElement('a:miter'); + $objWriter->writeAttribute('lim', '800000'); + $objWriter->endElement(); + } else { + $objWriter->startElement('a:bevel'); + $objWriter->endElement(); + } + + if ($majorGridlines->getLineStyleProperty(['arrow', 'head', 'type']) !== null) { + $objWriter->startElement('a:headEnd'); + $objWriter->writeAttribute('type', $majorGridlines->getLineStyleProperty(['arrow', 'head', 'type'])); + $objWriter->writeAttribute('w', $majorGridlines->getLineStyleArrowParameters('head', 'w')); + $objWriter->writeAttribute('len', $majorGridlines->getLineStyleArrowParameters('head', 'len')); + $objWriter->endElement(); + } + + if ($majorGridlines->getLineStyleProperty(['arrow', 'end', 'type']) !== null) { + $objWriter->startElement('a:tailEnd'); + $objWriter->writeAttribute('type', $majorGridlines->getLineStyleProperty(['arrow', 'end', 'type'])); + $objWriter->writeAttribute('w', $majorGridlines->getLineStyleArrowParameters('end', 'w')); + $objWriter->writeAttribute('len', $majorGridlines->getLineStyleArrowParameters('end', 'len')); + $objWriter->endElement(); + } + $objWriter->endElement(); //end ln + } + $objWriter->startElement('a:effectLst'); + + if ($majorGridlines->getGlowSize() !== null) { + $objWriter->startElement('a:glow'); + $objWriter->writeAttribute('rad', $majorGridlines->getGlowSize()); + $objWriter->startElement("a:{$majorGridlines->getGlowColor('type')}"); + $objWriter->writeAttribute('val', $majorGridlines->getGlowColor('value')); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $majorGridlines->getGlowColor('alpha')); + $objWriter->endElement(); //end alpha + $objWriter->endElement(); //end schemeClr + $objWriter->endElement(); //end glow + } + + if ($majorGridlines->getShadowProperty('presets') !== null) { + $objWriter->startElement("a:{$majorGridlines->getShadowProperty('effect')}"); + if ($majorGridlines->getShadowProperty('blur') !== null) { + $objWriter->writeAttribute('blurRad', $majorGridlines->getShadowProperty('blur')); + } + if ($majorGridlines->getShadowProperty('distance') !== null) { + $objWriter->writeAttribute('dist', $majorGridlines->getShadowProperty('distance')); + } + if ($majorGridlines->getShadowProperty('direction') !== null) { + $objWriter->writeAttribute('dir', $majorGridlines->getShadowProperty('direction')); + } + if ($majorGridlines->getShadowProperty('algn') !== null) { + $objWriter->writeAttribute('algn', $majorGridlines->getShadowProperty('algn')); + } + if ($majorGridlines->getShadowProperty(['size', 'sx']) !== null) { + $objWriter->writeAttribute('sx', $majorGridlines->getShadowProperty(['size', 'sx'])); + } + if ($majorGridlines->getShadowProperty(['size', 'sy']) !== null) { + $objWriter->writeAttribute('sy', $majorGridlines->getShadowProperty(['size', 'sy'])); + } + if ($majorGridlines->getShadowProperty(['size', 'kx']) !== null) { + $objWriter->writeAttribute('kx', $majorGridlines->getShadowProperty(['size', 'kx'])); + } + if ($majorGridlines->getShadowProperty('rotWithShape') !== null) { + $objWriter->writeAttribute('rotWithShape', $majorGridlines->getShadowProperty('rotWithShape')); + } + $objWriter->startElement("a:{$majorGridlines->getShadowProperty(['color', 'type'])}"); + $objWriter->writeAttribute('val', $majorGridlines->getShadowProperty(['color', 'value'])); + + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $majorGridlines->getShadowProperty(['color', 'alpha'])); + $objWriter->endElement(); //end alpha + + $objWriter->endElement(); //end color:type + $objWriter->endElement(); //end shadow + } + + if ($majorGridlines->getSoftEdgesSize() !== null) { + $objWriter->startElement('a:softEdge'); + $objWriter->writeAttribute('rad', $majorGridlines->getSoftEdgesSize()); + $objWriter->endElement(); //end softEdge + } + + $objWriter->endElement(); //end effectLst + $objWriter->endElement(); //end spPr + $objWriter->endElement(); //end majorGridLines + + if ($minorGridlines->getObjectState()) { + $objWriter->startElement('c:minorGridlines'); + $objWriter->startElement('c:spPr'); + + if ($minorGridlines->getLineColorProperty('value') !== null) { + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', $minorGridlines->getLineStyleProperty('width')); + $objWriter->startElement('a:solidFill'); + $objWriter->startElement("a:{$minorGridlines->getLineColorProperty('type')}"); + $objWriter->writeAttribute('val', $minorGridlines->getLineColorProperty('value')); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $minorGridlines->getLineColorProperty('alpha')); + $objWriter->endElement(); //end alpha + $objWriter->endElement(); //end srgbClr + $objWriter->endElement(); //end solidFill + + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', $minorGridlines->getLineStyleProperty('dash')); + $objWriter->endElement(); + + if ($minorGridlines->getLineStyleProperty('join') == 'miter') { + $objWriter->startElement('a:miter'); + $objWriter->writeAttribute('lim', '800000'); + $objWriter->endElement(); + } else { + $objWriter->startElement('a:bevel'); + $objWriter->endElement(); + } + + if ($minorGridlines->getLineStyleProperty(['arrow', 'head', 'type']) !== null) { + $objWriter->startElement('a:headEnd'); + $objWriter->writeAttribute('type', $minorGridlines->getLineStyleProperty(['arrow', 'head', 'type'])); + $objWriter->writeAttribute('w', $minorGridlines->getLineStyleArrowParameters('head', 'w')); + $objWriter->writeAttribute('len', $minorGridlines->getLineStyleArrowParameters('head', 'len')); + $objWriter->endElement(); + } + + if ($minorGridlines->getLineStyleProperty(['arrow', 'end', 'type']) !== null) { + $objWriter->startElement('a:tailEnd'); + $objWriter->writeAttribute('type', $minorGridlines->getLineStyleProperty(['arrow', 'end', 'type'])); + $objWriter->writeAttribute('w', $minorGridlines->getLineStyleArrowParameters('end', 'w')); + $objWriter->writeAttribute('len', $minorGridlines->getLineStyleArrowParameters('end', 'len')); + $objWriter->endElement(); + } + $objWriter->endElement(); //end ln + } + + $objWriter->startElement('a:effectLst'); + + if ($minorGridlines->getGlowSize() !== null) { + $objWriter->startElement('a:glow'); + $objWriter->writeAttribute('rad', $minorGridlines->getGlowSize()); + $objWriter->startElement("a:{$minorGridlines->getGlowColor('type')}"); + $objWriter->writeAttribute('val', $minorGridlines->getGlowColor('value')); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $minorGridlines->getGlowColor('alpha')); + $objWriter->endElement(); //end alpha + $objWriter->endElement(); //end schemeClr + $objWriter->endElement(); //end glow + } + + if ($minorGridlines->getShadowProperty('presets') !== null) { + $objWriter->startElement("a:{$minorGridlines->getShadowProperty('effect')}"); + if ($minorGridlines->getShadowProperty('blur') !== null) { + $objWriter->writeAttribute('blurRad', $minorGridlines->getShadowProperty('blur')); + } + if ($minorGridlines->getShadowProperty('distance') !== null) { + $objWriter->writeAttribute('dist', $minorGridlines->getShadowProperty('distance')); + } + if ($minorGridlines->getShadowProperty('direction') !== null) { + $objWriter->writeAttribute('dir', $minorGridlines->getShadowProperty('direction')); + } + if ($minorGridlines->getShadowProperty('algn') !== null) { + $objWriter->writeAttribute('algn', $minorGridlines->getShadowProperty('algn')); + } + if ($minorGridlines->getShadowProperty(['size', 'sx']) !== null) { + $objWriter->writeAttribute('sx', $minorGridlines->getShadowProperty(['size', 'sx'])); + } + if ($minorGridlines->getShadowProperty(['size', 'sy']) !== null) { + $objWriter->writeAttribute('sy', $minorGridlines->getShadowProperty(['size', 'sy'])); + } + if ($minorGridlines->getShadowProperty(['size', 'kx']) !== null) { + $objWriter->writeAttribute('kx', $minorGridlines->getShadowProperty(['size', 'kx'])); + } + if ($minorGridlines->getShadowProperty('rotWithShape') !== null) { + $objWriter->writeAttribute('rotWithShape', $minorGridlines->getShadowProperty('rotWithShape')); + } + $objWriter->startElement("a:{$minorGridlines->getShadowProperty(['color', 'type'])}"); + $objWriter->writeAttribute('val', $minorGridlines->getShadowProperty(['color', 'value'])); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $minorGridlines->getShadowProperty(['color', 'alpha'])); + $objWriter->endElement(); //end alpha + $objWriter->endElement(); //end color:type + $objWriter->endElement(); //end shadow + } + + if ($minorGridlines->getSoftEdgesSize() !== null) { + $objWriter->startElement('a:softEdge'); + $objWriter->writeAttribute('rad', $minorGridlines->getSoftEdgesSize()); + $objWriter->endElement(); //end softEdge + } + + $objWriter->endElement(); //end effectLst + $objWriter->endElement(); //end spPr + $objWriter->endElement(); //end minorGridLines + } + + if ($yAxisLabel !== null) { + $objWriter->startElement('c:title'); + $objWriter->startElement('c:tx'); + $objWriter->startElement('c:rich'); + + $objWriter->startElement('a:bodyPr'); + $objWriter->endElement(); + + $objWriter->startElement('a:lstStyle'); + $objWriter->endElement(); + + $objWriter->startElement('a:p'); + $objWriter->startElement('a:r'); + + $caption = $yAxisLabel->getCaption(); + if (is_array($caption)) { + $caption = $caption[0]; + } + + $objWriter->startElement('a:t'); + $objWriter->writeRawData(StringHelper::controlCharacterPHP2OOXML($caption)); + $objWriter->endElement(); + + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + + if ($groupType !== DataSeries::TYPE_BUBBLECHART) { + $layout = $yAxisLabel->getLayout(); + $this->writeLayout($objWriter, $layout); + } + + $objWriter->startElement('c:overlay'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + $objWriter->startElement('c:numFmt'); + $objWriter->writeAttribute('formatCode', $xAxis->getAxisNumberFormat()); + $objWriter->writeAttribute('sourceLinked', $xAxis->getAxisNumberSourceLinked()); + $objWriter->endElement(); + + $objWriter->startElement('c:majorTickMark'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('major_tick_mark')); + $objWriter->endElement(); + + $objWriter->startElement('c:minorTickMark'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minor_tick_mark')); + $objWriter->endElement(); + + $objWriter->startElement('c:tickLblPos'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('axis_labels')); + $objWriter->endElement(); + + $objWriter->startElement('c:spPr'); + + if ($xAxis->getFillProperty('value') !== null) { + $objWriter->startElement('a:solidFill'); + $objWriter->startElement('a:' . $xAxis->getFillProperty('type')); + $objWriter->writeAttribute('val', $xAxis->getFillProperty('value')); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $xAxis->getFillProperty('alpha')); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + } + + $objWriter->startElement('a:ln'); + + $objWriter->writeAttribute('w', $xAxis->getLineStyleProperty('width')); + $objWriter->writeAttribute('cap', $xAxis->getLineStyleProperty('cap')); + $objWriter->writeAttribute('cmpd', $xAxis->getLineStyleProperty('compound')); + + if ($xAxis->getLineProperty('value') !== null) { + $objWriter->startElement('a:solidFill'); + $objWriter->startElement('a:' . $xAxis->getLineProperty('type')); + $objWriter->writeAttribute('val', $xAxis->getLineProperty('value')); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $xAxis->getLineProperty('alpha')); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + } + + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', $xAxis->getLineStyleProperty('dash')); + $objWriter->endElement(); + + if ($xAxis->getLineStyleProperty('join') == 'miter') { + $objWriter->startElement('a:miter'); + $objWriter->writeAttribute('lim', '800000'); + $objWriter->endElement(); + } else { + $objWriter->startElement('a:bevel'); + $objWriter->endElement(); + } + + if ($xAxis->getLineStyleProperty(['arrow', 'head', 'type']) !== null) { + $objWriter->startElement('a:headEnd'); + $objWriter->writeAttribute('type', $xAxis->getLineStyleProperty(['arrow', 'head', 'type'])); + $objWriter->writeAttribute('w', $xAxis->getLineStyleArrowWidth('head')); + $objWriter->writeAttribute('len', $xAxis->getLineStyleArrowLength('head')); + $objWriter->endElement(); + } + + if ($xAxis->getLineStyleProperty(['arrow', 'end', 'type']) !== null) { + $objWriter->startElement('a:tailEnd'); + $objWriter->writeAttribute('type', $xAxis->getLineStyleProperty(['arrow', 'end', 'type'])); + $objWriter->writeAttribute('w', $xAxis->getLineStyleArrowWidth('end')); + $objWriter->writeAttribute('len', $xAxis->getLineStyleArrowLength('end')); + $objWriter->endElement(); + } + + $objWriter->endElement(); + + $objWriter->startElement('a:effectLst'); + + if ($xAxis->getGlowProperty('size') !== null) { + $objWriter->startElement('a:glow'); + $objWriter->writeAttribute('rad', $xAxis->getGlowProperty('size')); + $objWriter->startElement("a:{$xAxis->getGlowProperty(['color', 'type'])}"); + $objWriter->writeAttribute('val', $xAxis->getGlowProperty(['color', 'value'])); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $xAxis->getGlowProperty(['color', 'alpha'])); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + } + + if ($xAxis->getShadowProperty('presets') !== null) { + $objWriter->startElement("a:{$xAxis->getShadowProperty('effect')}"); + + if ($xAxis->getShadowProperty('blur') !== null) { + $objWriter->writeAttribute('blurRad', $xAxis->getShadowProperty('blur')); + } + if ($xAxis->getShadowProperty('distance') !== null) { + $objWriter->writeAttribute('dist', $xAxis->getShadowProperty('distance')); + } + if ($xAxis->getShadowProperty('direction') !== null) { + $objWriter->writeAttribute('dir', $xAxis->getShadowProperty('direction')); + } + if ($xAxis->getShadowProperty('algn') !== null) { + $objWriter->writeAttribute('algn', $xAxis->getShadowProperty('algn')); + } + if ($xAxis->getShadowProperty(['size', 'sx']) !== null) { + $objWriter->writeAttribute('sx', $xAxis->getShadowProperty(['size', 'sx'])); + } + if ($xAxis->getShadowProperty(['size', 'sy']) !== null) { + $objWriter->writeAttribute('sy', $xAxis->getShadowProperty(['size', 'sy'])); + } + if ($xAxis->getShadowProperty(['size', 'kx']) !== null) { + $objWriter->writeAttribute('kx', $xAxis->getShadowProperty(['size', 'kx'])); + } + if ($xAxis->getShadowProperty('rotWithShape') !== null) { + $objWriter->writeAttribute('rotWithShape', $xAxis->getShadowProperty('rotWithShape')); + } + + $objWriter->startElement("a:{$xAxis->getShadowProperty(['color', 'type'])}"); + $objWriter->writeAttribute('val', $xAxis->getShadowProperty(['color', 'value'])); + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $xAxis->getShadowProperty(['color', 'alpha'])); + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + if ($xAxis->getSoftEdgesSize() !== null) { + $objWriter->startElement('a:softEdge'); + $objWriter->writeAttribute('rad', $xAxis->getSoftEdgesSize()); + $objWriter->endElement(); + } + + $objWriter->endElement(); //effectList + $objWriter->endElement(); //end spPr + + if ($id1 > 0) { + $objWriter->startElement('c:crossAx'); + $objWriter->writeAttribute('val', $id2); + $objWriter->endElement(); + + if ($xAxis->getAxisOptionsProperty('horizontal_crosses_value') !== null) { + $objWriter->startElement('c:crossesAt'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('horizontal_crosses_value')); + $objWriter->endElement(); + } else { + $objWriter->startElement('c:crosses'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('horizontal_crosses')); + $objWriter->endElement(); + } + + $objWriter->startElement('c:crossBetween'); + $objWriter->writeAttribute('val', 'midCat'); + $objWriter->endElement(); + + if ($xAxis->getAxisOptionsProperty('major_unit') !== null) { + $objWriter->startElement('c:majorUnit'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('major_unit')); + $objWriter->endElement(); + } + + if ($xAxis->getAxisOptionsProperty('minor_unit') !== null) { + $objWriter->startElement('c:minorUnit'); + $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minor_unit')); + $objWriter->endElement(); + } + } + + if ($isMultiLevelSeries) { + if ($groupType !== DataSeries::TYPE_BUBBLECHART) { + $objWriter->startElement('c:noMultiLvlLbl'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + } + } + + $objWriter->endElement(); + } + + /** + * Get the data series type(s) for a chart plot series. + * + * @param PlotArea $plotArea + * + * @throws WriterException + * + * @return array|string + */ + private static function getChartType($plotArea) + { + $groupCount = $plotArea->getPlotGroupCount(); + + if ($groupCount == 1) { + $chartType = [$plotArea->getPlotGroupByIndex(0)->getPlotType()]; + } else { + $chartTypes = []; + for ($i = 0; $i < $groupCount; ++$i) { + $chartTypes[] = $plotArea->getPlotGroupByIndex($i)->getPlotType(); + } + $chartType = array_unique($chartTypes); + if (count($chartTypes) == 0) { + throw new WriterException('Chart is not yet implemented'); + } + } + + return $chartType; + } + + /** + * Method writing plot series values. + * + * @param XMLWriter $objWriter XML Writer + * @param int $val value for idx (default: 3) + * @param string $fillColor hex color (default: FF9900) + * + * @return XMLWriter XML Writer + */ + private function writePlotSeriesValuesElement($objWriter, $val = 3, $fillColor = 'FF9900') + { + $objWriter->startElement('c:dPt'); + $objWriter->startElement('c:idx'); + $objWriter->writeAttribute('val', $val); + $objWriter->endElement(); + + $objWriter->startElement('c:bubble3D'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + + $objWriter->startElement('c:spPr'); + $objWriter->startElement('a:solidFill'); + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $fillColor); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + + return $objWriter; + } + + /** + * Write Plot Group (series of related plots). + * + * @param DataSeries $plotGroup + * @param string $groupType Type of plot for dataseries + * @param XMLWriter $objWriter XML Writer + * @param bool &$catIsMultiLevelSeries Is category a multi-series category + * @param bool &$valIsMultiLevelSeries Is value set a multi-series set + * @param string &$plotGroupingType Type of grouping for multi-series values + * + * @throws WriterException + */ + private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType) + { + if ($plotGroup === null) { + return; + } + + if (($groupType == DataSeries::TYPE_BARCHART) || ($groupType == DataSeries::TYPE_BARCHART_3D)) { + $objWriter->startElement('c:barDir'); + $objWriter->writeAttribute('val', $plotGroup->getPlotDirection()); + $objWriter->endElement(); + } + + if ($plotGroup->getPlotGrouping() !== null) { + $plotGroupingType = $plotGroup->getPlotGrouping(); + $objWriter->startElement('c:grouping'); + $objWriter->writeAttribute('val', $plotGroupingType); + $objWriter->endElement(); + } + + // Get these details before the loop, because we can use the count to check for varyColors + $plotSeriesOrder = $plotGroup->getPlotOrder(); + $plotSeriesCount = count($plotSeriesOrder); + + if (($groupType !== DataSeries::TYPE_RADARCHART) && ($groupType !== DataSeries::TYPE_STOCKCHART)) { + if ($groupType !== DataSeries::TYPE_LINECHART) { + if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) { + $objWriter->startElement('c:varyColors'); + $objWriter->writeAttribute('val', 1); + $objWriter->endElement(); + } else { + $objWriter->startElement('c:varyColors'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + } + } + } + + foreach ($plotSeriesOrder as $plotSeriesIdx => $plotSeriesRef) { + $objWriter->startElement('c:ser'); + + $plotLabel = $plotGroup->getPlotLabelByIndex($plotSeriesIdx); + if ($plotLabel) { + $fillColor = $plotLabel->getFillColor(); + if ($fillColor !== null && !is_array($fillColor)) { + $objWriter->startElement('c:spPr'); + $objWriter->startElement('a:solidFill'); + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $fillColor); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + } + } + + $objWriter->startElement('c:idx'); + $objWriter->writeAttribute('val', $this->seriesIndex + $plotSeriesIdx); + $objWriter->endElement(); + + $objWriter->startElement('c:order'); + $objWriter->writeAttribute('val', $this->seriesIndex + $plotSeriesRef); + $objWriter->endElement(); + + // Values + $plotSeriesValues = $plotGroup->getPlotValuesByIndex($plotSeriesRef); + + if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) { + $fillColorValues = $plotSeriesValues->getFillColor(); + if ($fillColorValues !== null && is_array($fillColorValues)) { + foreach ($plotSeriesValues->getDataValues() as $dataKey => $dataValue) { + $this->writePlotSeriesValuesElement($objWriter, $dataKey, ($fillColorValues[$dataKey] ?? 'FF9900')); + } + } else { + $this->writePlotSeriesValuesElement($objWriter); + } + } + + // Labels + $plotSeriesLabel = $plotGroup->getPlotLabelByIndex($plotSeriesRef); + if ($plotSeriesLabel && ($plotSeriesLabel->getPointCount() > 0)) { + $objWriter->startElement('c:tx'); + $objWriter->startElement('c:strRef'); + $this->writePlotSeriesLabel($plotSeriesLabel, $objWriter); + $objWriter->endElement(); + $objWriter->endElement(); + } + + // Formatting for the points + if (($groupType == DataSeries::TYPE_LINECHART) || ($groupType == DataSeries::TYPE_STOCKCHART)) { + $plotLineWidth = 12700; + if ($plotSeriesValues) { + $plotLineWidth = $plotSeriesValues->getLineWidth(); + } + + $objWriter->startElement('c:spPr'); + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', $plotLineWidth); + if ($groupType == DataSeries::TYPE_STOCKCHART) { + $objWriter->startElement('a:noFill'); + $objWriter->endElement(); + } + $objWriter->endElement(); + $objWriter->endElement(); + } + + if ($plotSeriesValues) { + $plotSeriesMarker = $plotSeriesValues->getPointMarker(); + if ($plotSeriesMarker) { + $objWriter->startElement('c:marker'); + $objWriter->startElement('c:symbol'); + $objWriter->writeAttribute('val', $plotSeriesMarker); + $objWriter->endElement(); + + if ($plotSeriesMarker !== 'none') { + $objWriter->startElement('c:size'); + $objWriter->writeAttribute('val', 3); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + if (($groupType === DataSeries::TYPE_BARCHART) || ($groupType === DataSeries::TYPE_BARCHART_3D) || ($groupType === DataSeries::TYPE_BUBBLECHART)) { + $objWriter->startElement('c:invertIfNegative'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + } + + // Category Labels + $plotSeriesCategory = $plotGroup->getPlotCategoryByIndex($plotSeriesRef); + if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) { + $catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries(); + + if (($groupType == DataSeries::TYPE_PIECHART) || ($groupType == DataSeries::TYPE_PIECHART_3D) || ($groupType == DataSeries::TYPE_DONUTCHART)) { + if ($plotGroup->getPlotStyle() !== null) { + $plotStyle = $plotGroup->getPlotStyle(); + if ($plotStyle) { + $objWriter->startElement('c:explosion'); + $objWriter->writeAttribute('val', 25); + $objWriter->endElement(); + } + } + } + + if (($groupType === DataSeries::TYPE_BUBBLECHART) || ($groupType === DataSeries::TYPE_SCATTERCHART)) { + $objWriter->startElement('c:xVal'); + } else { + $objWriter->startElement('c:cat'); + } + + $this->writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str'); + $objWriter->endElement(); + } + + // Values + if ($plotSeriesValues) { + $valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries(); + + if (($groupType === DataSeries::TYPE_BUBBLECHART) || ($groupType === DataSeries::TYPE_SCATTERCHART)) { + $objWriter->startElement('c:yVal'); + } else { + $objWriter->startElement('c:val'); + } + + $this->writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num'); + $objWriter->endElement(); + } + + if ($groupType === DataSeries::TYPE_BUBBLECHART) { + $this->writeBubbles($plotSeriesValues, $objWriter); + } + + $objWriter->endElement(); + } + + $this->seriesIndex += $plotSeriesIdx + 1; + } + + /** + * Write Plot Series Label. + * + * @param DataSeriesValues $plotSeriesLabel + * @param XMLWriter $objWriter XML Writer + */ + private function writePlotSeriesLabel($plotSeriesLabel, $objWriter) + { + if ($plotSeriesLabel === null) { + return; + } + + $objWriter->startElement('c:f'); + $objWriter->writeRawData($plotSeriesLabel->getDataSource()); + $objWriter->endElement(); + + $objWriter->startElement('c:strCache'); + $objWriter->startElement('c:ptCount'); + $objWriter->writeAttribute('val', $plotSeriesLabel->getPointCount()); + $objWriter->endElement(); + + foreach ($plotSeriesLabel->getDataValues() as $plotLabelKey => $plotLabelValue) { + $objWriter->startElement('c:pt'); + $objWriter->writeAttribute('idx', $plotLabelKey); + + $objWriter->startElement('c:v'); + $objWriter->writeRawData($plotLabelValue); + $objWriter->endElement(); + $objWriter->endElement(); + } + $objWriter->endElement(); + } + + /** + * Write Plot Series Values. + * + * @param DataSeriesValues $plotSeriesValues + * @param XMLWriter $objWriter XML Writer + * @param string $groupType Type of plot for dataseries + * @param string $dataType Datatype of series values + */ + private function writePlotSeriesValues($plotSeriesValues, XMLWriter $objWriter, $groupType, $dataType = 'str') + { + if ($plotSeriesValues === null) { + return; + } + + if ($plotSeriesValues->isMultiLevelSeries()) { + $levelCount = $plotSeriesValues->multiLevelCount(); + + $objWriter->startElement('c:multiLvlStrRef'); + + $objWriter->startElement('c:f'); + $objWriter->writeRawData($plotSeriesValues->getDataSource()); + $objWriter->endElement(); + + $objWriter->startElement('c:multiLvlStrCache'); + + $objWriter->startElement('c:ptCount'); + $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount()); + $objWriter->endElement(); + + for ($level = 0; $level < $levelCount; ++$level) { + $objWriter->startElement('c:lvl'); + + foreach ($plotSeriesValues->getDataValues() as $plotSeriesKey => $plotSeriesValue) { + if (isset($plotSeriesValue[$level])) { + $objWriter->startElement('c:pt'); + $objWriter->writeAttribute('idx', $plotSeriesKey); + + $objWriter->startElement('c:v'); + $objWriter->writeRawData($plotSeriesValue[$level]); + $objWriter->endElement(); + $objWriter->endElement(); + } + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + + $objWriter->endElement(); + } else { + $objWriter->startElement('c:' . $dataType . 'Ref'); + + $objWriter->startElement('c:f'); + $objWriter->writeRawData($plotSeriesValues->getDataSource()); + $objWriter->endElement(); + + $objWriter->startElement('c:' . $dataType . 'Cache'); + + if (($groupType != DataSeries::TYPE_PIECHART) && ($groupType != DataSeries::TYPE_PIECHART_3D) && ($groupType != DataSeries::TYPE_DONUTCHART)) { + if (($plotSeriesValues->getFormatCode() !== null) && ($plotSeriesValues->getFormatCode() !== '')) { + $objWriter->startElement('c:formatCode'); + $objWriter->writeRawData($plotSeriesValues->getFormatCode()); + $objWriter->endElement(); + } + } + + $objWriter->startElement('c:ptCount'); + $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount()); + $objWriter->endElement(); + + $dataValues = $plotSeriesValues->getDataValues(); + if (!empty($dataValues)) { + if (is_array($dataValues)) { + foreach ($dataValues as $plotSeriesKey => $plotSeriesValue) { + $objWriter->startElement('c:pt'); + $objWriter->writeAttribute('idx', $plotSeriesKey); + + $objWriter->startElement('c:v'); + $objWriter->writeRawData($plotSeriesValue); + $objWriter->endElement(); + $objWriter->endElement(); + } + } + } + + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + + /** + * Write Bubble Chart Details. + * + * @param DataSeriesValues $plotSeriesValues + * @param XMLWriter $objWriter XML Writer + */ + private function writeBubbles($plotSeriesValues, $objWriter) + { + if ($plotSeriesValues === null) { + return; + } + + $objWriter->startElement('c:bubbleSize'); + $objWriter->startElement('c:numLit'); + + $objWriter->startElement('c:formatCode'); + $objWriter->writeRawData('General'); + $objWriter->endElement(); + + $objWriter->startElement('c:ptCount'); + $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount()); + $objWriter->endElement(); + + $dataValues = $plotSeriesValues->getDataValues(); + if (!empty($dataValues)) { + if (is_array($dataValues)) { + foreach ($dataValues as $plotSeriesKey => $plotSeriesValue) { + $objWriter->startElement('c:pt'); + $objWriter->writeAttribute('idx', $plotSeriesKey); + $objWriter->startElement('c:v'); + $objWriter->writeRawData(1); + $objWriter->endElement(); + $objWriter->endElement(); + } + } + } + + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->startElement('c:bubble3D'); + $objWriter->writeAttribute('val', 0); + $objWriter->endElement(); + } + + /** + * Write Layout. + * + * @param XMLWriter $objWriter XML Writer + * @param Layout $layout + */ + private function writeLayout(XMLWriter $objWriter, Layout $layout = null) + { + $objWriter->startElement('c:layout'); + + if ($layout !== null) { + $objWriter->startElement('c:manualLayout'); + + $layoutTarget = $layout->getLayoutTarget(); + if ($layoutTarget !== null) { + $objWriter->startElement('c:layoutTarget'); + $objWriter->writeAttribute('val', $layoutTarget); + $objWriter->endElement(); + } + + $xMode = $layout->getXMode(); + if ($xMode !== null) { + $objWriter->startElement('c:xMode'); + $objWriter->writeAttribute('val', $xMode); + $objWriter->endElement(); + } + + $yMode = $layout->getYMode(); + if ($yMode !== null) { + $objWriter->startElement('c:yMode'); + $objWriter->writeAttribute('val', $yMode); + $objWriter->endElement(); + } + + $x = $layout->getXPosition(); + if ($x !== null) { + $objWriter->startElement('c:x'); + $objWriter->writeAttribute('val', $x); + $objWriter->endElement(); + } + + $y = $layout->getYPosition(); + if ($y !== null) { + $objWriter->startElement('c:y'); + $objWriter->writeAttribute('val', $y); + $objWriter->endElement(); + } + + $w = $layout->getWidth(); + if ($w !== null) { + $objWriter->startElement('c:w'); + $objWriter->writeAttribute('val', $w); + $objWriter->endElement(); + } + + $h = $layout->getHeight(); + if ($h !== null) { + $objWriter->startElement('c:h'); + $objWriter->writeAttribute('val', $h); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + /** + * Write Alternate Content block. + * + * @param XMLWriter $objWriter XML Writer + */ + private function writeAlternateContent($objWriter) + { + $objWriter->startElement('mc:AlternateContent'); + $objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006'); + + $objWriter->startElement('mc:Choice'); + $objWriter->writeAttribute('xmlns:c14', 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart'); + $objWriter->writeAttribute('Requires', 'c14'); + + $objWriter->startElement('c14:style'); + $objWriter->writeAttribute('val', '102'); + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->startElement('mc:Fallback'); + $objWriter->startElement('c:style'); + $objWriter->writeAttribute('val', '2'); + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Printer Settings. + * + * @param XMLWriter $objWriter XML Writer + */ + private function writePrintSettings($objWriter) + { + $objWriter->startElement('c:printSettings'); + + $objWriter->startElement('c:headerFooter'); + $objWriter->endElement(); + + $objWriter->startElement('c:pageMargins'); + $objWriter->writeAttribute('footer', 0.3); + $objWriter->writeAttribute('header', 0.3); + $objWriter->writeAttribute('r', 0.7); + $objWriter->writeAttribute('l', 0.7); + $objWriter->writeAttribute('t', 0.75); + $objWriter->writeAttribute('b', 0.75); + $objWriter->endElement(); + + $objWriter->startElement('c:pageSetup'); + $objWriter->writeAttribute('orientation', 'portrait'); + $objWriter->endElement(); + + $objWriter->endElement(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php new file mode 100644 index 0000000..a95298a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Comments.php @@ -0,0 +1,242 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Comments cache + $comments = $pWorksheet->getComments(); + + // Authors cache + $authors = []; + $authorId = 0; + foreach ($comments as $comment) { + if (!isset($authors[$comment->getAuthor()])) { + $authors[$comment->getAuthor()] = $authorId++; + } + } + + // comments + $objWriter->startElement('comments'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + + // Loop through authors + $objWriter->startElement('authors'); + foreach ($authors as $author => $index) { + $objWriter->writeElement('author', $author); + } + $objWriter->endElement(); + + // Loop through comments + $objWriter->startElement('commentList'); + foreach ($comments as $key => $value) { + $this->writeComment($objWriter, $key, $value, $authors); + } + $objWriter->endElement(); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write comment to XML format. + * + * @param XMLWriter $objWriter XML Writer + * @param string $pCellReference Cell reference + * @param Comment $pComment Comment + * @param array $pAuthors Array of authors + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + */ + private function writeComment(XMLWriter $objWriter, $pCellReference, Comment $pComment, array $pAuthors) + { + // comment + $objWriter->startElement('comment'); + $objWriter->writeAttribute('ref', $pCellReference); + $objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]); + + // text + $objWriter->startElement('text'); + $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText()); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write VML comments to XML format. + * + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * + * @return string XML Output + */ + public function writeVMLComments(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Comments cache + $comments = $pWorksheet->getComments(); + + // xml + $objWriter->startElement('xml'); + $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml'); + $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office'); + $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel'); + + // o:shapelayout + $objWriter->startElement('o:shapelayout'); + $objWriter->writeAttribute('v:ext', 'edit'); + + // o:idmap + $objWriter->startElement('o:idmap'); + $objWriter->writeAttribute('v:ext', 'edit'); + $objWriter->writeAttribute('data', '1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // v:shapetype + $objWriter->startElement('v:shapetype'); + $objWriter->writeAttribute('id', '_x0000_t202'); + $objWriter->writeAttribute('coordsize', '21600,21600'); + $objWriter->writeAttribute('o:spt', '202'); + $objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe'); + + // v:stroke + $objWriter->startElement('v:stroke'); + $objWriter->writeAttribute('joinstyle', 'miter'); + $objWriter->endElement(); + + // v:path + $objWriter->startElement('v:path'); + $objWriter->writeAttribute('gradientshapeok', 't'); + $objWriter->writeAttribute('o:connecttype', 'rect'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Loop through comments + foreach ($comments as $key => $value) { + $this->writeVMLComment($objWriter, $key, $value); + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write VML comment to XML format. + * + * @param XMLWriter $objWriter XML Writer + * @param string $pCellReference Cell reference, eg: 'A1' + * @param Comment $pComment Comment + */ + private function writeVMLComment(XMLWriter $objWriter, $pCellReference, Comment $pComment) + { + // Metadata + [$column, $row] = Coordinate::coordinateFromString($pCellReference); + $column = Coordinate::columnIndexFromString($column); + $id = 1024 + $column + $row; + $id = substr($id, 0, 4); + + // v:shape + $objWriter->startElement('v:shape'); + $objWriter->writeAttribute('id', '_x0000_s' . $id); + $objWriter->writeAttribute('type', '#_x0000_t202'); + $objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden')); + $objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB()); + $objWriter->writeAttribute('o:insetmode', 'auto'); + + // v:fill + $objWriter->startElement('v:fill'); + $objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB()); + $objWriter->endElement(); + + // v:shadow + $objWriter->startElement('v:shadow'); + $objWriter->writeAttribute('on', 't'); + $objWriter->writeAttribute('color', 'black'); + $objWriter->writeAttribute('obscured', 't'); + $objWriter->endElement(); + + // v:path + $objWriter->startElement('v:path'); + $objWriter->writeAttribute('o:connecttype', 'none'); + $objWriter->endElement(); + + // v:textbox + $objWriter->startElement('v:textbox'); + $objWriter->writeAttribute('style', 'mso-direction-alt:auto'); + + // div + $objWriter->startElement('div'); + $objWriter->writeAttribute('style', 'text-align:left'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // x:ClientData + $objWriter->startElement('x:ClientData'); + $objWriter->writeAttribute('ObjectType', 'Note'); + + // x:MoveWithCells + $objWriter->writeElement('x:MoveWithCells', ''); + + // x:SizeWithCells + $objWriter->writeElement('x:SizeWithCells', ''); + + // x:AutoFill + $objWriter->writeElement('x:AutoFill', 'False'); + + // x:Row + $objWriter->writeElement('x:Row', ($row - 1)); + + // x:Column + $objWriter->writeElement('x:Column', ($column - 1)); + + $objWriter->endElement(); + + $objWriter->endElement(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php new file mode 100644 index 0000000..6b22d71 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/ContentTypes.php @@ -0,0 +1,249 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Types + $objWriter->startElement('Types'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types'); + + // Theme + $this->writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml'); + + // Styles + $this->writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'); + + // Rels + $this->writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml'); + + // XML + $this->writeDefaultContentType($objWriter, 'xml', 'application/xml'); + + // VML + $this->writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'); + + // Workbook + if ($spreadsheet->hasMacros()) { //Macros in workbook ? + // Yes : not standard content but "macroEnabled" + $this->writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'); + //... and define a new type for the VBA project + // Better use Override, because we can use 'bin' also for xl\printerSettings\printerSettings1.bin + $this->writeOverrideContentType($objWriter, '/xl/vbaProject.bin', 'application/vnd.ms-office.vbaProject'); + if ($spreadsheet->hasMacrosCertificate()) { + // signed macros ? + // Yes : add needed information + $this->writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature'); + } + } else { + // no macros in workbook, so standard type + $this->writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'); + } + + // DocProps + $this->writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml'); + + $this->writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml'); + + $customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); + if (!empty($customPropertyList)) { + $this->writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml'); + } + + // Worksheets + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + $this->writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'); + } + + // Shared strings + $this->writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'); + + // Add worksheet relationship content types + $unparsedLoadedData = $spreadsheet->getUnparsedLoadedData(); + $chart = 1; + for ($i = 0; $i < $sheetCount; ++$i) { + $drawings = $spreadsheet->getSheet($i)->getDrawingCollection(); + $drawingCount = count($drawings); + $chartCount = ($includeCharts) ? $spreadsheet->getSheet($i)->getChartCount() : 0; + $hasUnparsedDrawing = isset($unparsedLoadedData['sheets'][$spreadsheet->getSheet($i)->getCodeName()]['drawingOriginalIds']); + + // We need a drawing relationship for the worksheet if we have either drawings or charts + if (($drawingCount > 0) || ($chartCount > 0) || $hasUnparsedDrawing) { + $this->writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml'); + } + + // If we have charts, then we need a chart relationship for every individual chart + if ($chartCount > 0) { + for ($c = 0; $c < $chartCount; ++$c) { + $this->writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml'); + } + } + } + + // Comments + for ($i = 0; $i < $sheetCount; ++$i) { + if (count($spreadsheet->getSheet($i)->getComments()) > 0) { + $this->writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml'); + } + } + + // Add media content-types + $aMediaContentTypes = []; + $mediaCount = $this->getParentWriter()->getDrawingHashTable()->count(); + for ($i = 0; $i < $mediaCount; ++$i) { + $extension = ''; + $mimeType = ''; + + if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof \PhpOffice\PhpSpreadsheet\Worksheet\Drawing) { + $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); + $mimeType = $this->getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath()); + } elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof MemoryDrawing) { + $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); + $extension = explode('/', $extension); + $extension = $extension[1]; + + $mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType(); + } + + if (!isset($aMediaContentTypes[$extension])) { + $aMediaContentTypes[$extension] = $mimeType; + + $this->writeDefaultContentType($objWriter, $extension, $mimeType); + } + } + if ($spreadsheet->hasRibbonBinObjects()) { + // Some additional objects in the ribbon ? + // we need to write "Extension" but not already write for media content + $tabRibbonTypes = array_diff($spreadsheet->getRibbonBinObjects('types'), array_keys($aMediaContentTypes)); + foreach ($tabRibbonTypes as $aRibbonType) { + $mimeType = 'image/.' . $aRibbonType; //we wrote $mimeType like customUI Editor + $this->writeDefaultContentType($objWriter, $aRibbonType, $mimeType); + } + } + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + if (count($spreadsheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) { + foreach ($spreadsheet->getSheet($i)->getHeaderFooter()->getImages() as $image) { + if (!isset($aMediaContentTypes[strtolower($image->getExtension())])) { + $aMediaContentTypes[strtolower($image->getExtension())] = $this->getImageMimeType($image->getPath()); + + $this->writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]); + } + } + } + } + + // unparsed defaults + if (isset($unparsedLoadedData['default_content_types'])) { + foreach ($unparsedLoadedData['default_content_types'] as $extName => $contentType) { + $this->writeDefaultContentType($objWriter, $extName, $contentType); + } + } + + // unparsed overrides + if (isset($unparsedLoadedData['override_content_types'])) { + foreach ($unparsedLoadedData['override_content_types'] as $partName => $overrideType) { + $this->writeOverrideContentType($objWriter, $partName, $overrideType); + } + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Get image mime type. + * + * @param string $pFile Filename + * + * @throws WriterException + * + * @return string Mime Type + */ + private function getImageMimeType($pFile) + { + if (File::fileExists($pFile)) { + $image = getimagesize($pFile); + + return image_type_to_mime_type($image[2]); + } + + throw new WriterException("File $pFile does not exist"); + } + + /** + * Write Default content type. + * + * @param XMLWriter $objWriter XML Writer + * @param string $pPartname Part name + * @param string $pContentType Content type + * + * @throws WriterException + */ + private function writeDefaultContentType(XMLWriter $objWriter, $pPartname, $pContentType) + { + if ($pPartname != '' && $pContentType != '') { + // Write content type + $objWriter->startElement('Default'); + $objWriter->writeAttribute('Extension', $pPartname); + $objWriter->writeAttribute('ContentType', $pContentType); + $objWriter->endElement(); + } else { + throw new WriterException('Invalid parameters passed.'); + } + } + + /** + * Write Override content type. + * + * @param XMLWriter $objWriter XML Writer + * @param string $pPartname Part name + * @param string $pContentType Content type + * + * @throws WriterException + */ + private function writeOverrideContentType(XMLWriter $objWriter, $pPartname, $pContentType) + { + if ($pPartname != '' && $pContentType != '') { + // Write content type + $objWriter->startElement('Override'); + $objWriter->writeAttribute('PartName', $pPartname); + $objWriter->writeAttribute('ContentType', $pContentType); + $objWriter->endElement(); + } else { + throw new WriterException('Invalid parameters passed.'); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php new file mode 100644 index 0000000..2a18d5c --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php @@ -0,0 +1,251 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Properties + $objWriter->startElement('Properties'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties'); + $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'); + + // Application + $objWriter->writeElement('Application', 'Microsoft Excel'); + + // DocSecurity + $objWriter->writeElement('DocSecurity', '0'); + + // ScaleCrop + $objWriter->writeElement('ScaleCrop', 'false'); + + // HeadingPairs + $objWriter->startElement('HeadingPairs'); + + // Vector + $objWriter->startElement('vt:vector'); + $objWriter->writeAttribute('size', '2'); + $objWriter->writeAttribute('baseType', 'variant'); + + // Variant + $objWriter->startElement('vt:variant'); + $objWriter->writeElement('vt:lpstr', 'Worksheets'); + $objWriter->endElement(); + + // Variant + $objWriter->startElement('vt:variant'); + $objWriter->writeElement('vt:i4', $spreadsheet->getSheetCount()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // TitlesOfParts + $objWriter->startElement('TitlesOfParts'); + + // Vector + $objWriter->startElement('vt:vector'); + $objWriter->writeAttribute('size', $spreadsheet->getSheetCount()); + $objWriter->writeAttribute('baseType', 'lpstr'); + + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + $objWriter->writeElement('vt:lpstr', $spreadsheet->getSheet($i)->getTitle()); + } + + $objWriter->endElement(); + + $objWriter->endElement(); + + // Company + $objWriter->writeElement('Company', $spreadsheet->getProperties()->getCompany()); + + // Company + $objWriter->writeElement('Manager', $spreadsheet->getProperties()->getManager()); + + // LinksUpToDate + $objWriter->writeElement('LinksUpToDate', 'false'); + + // SharedDoc + $objWriter->writeElement('SharedDoc', 'false'); + + // HyperlinksChanged + $objWriter->writeElement('HyperlinksChanged', 'false'); + + // AppVersion + $objWriter->writeElement('AppVersion', '12.0000'); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write docProps/core.xml to XML format. + * + * @param Spreadsheet $spreadsheet + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * + * @return string XML Output + */ + public function writeDocPropsCore(Spreadsheet $spreadsheet) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // cp:coreProperties + $objWriter->startElement('cp:coreProperties'); + $objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties'); + $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); + $objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/'); + $objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/'); + $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + + // dc:creator + $objWriter->writeElement('dc:creator', $spreadsheet->getProperties()->getCreator()); + + // cp:lastModifiedBy + $objWriter->writeElement('cp:lastModifiedBy', $spreadsheet->getProperties()->getLastModifiedBy()); + + // dcterms:created + $objWriter->startElement('dcterms:created'); + $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); + $objWriter->writeRawData(date(DATE_W3C, $spreadsheet->getProperties()->getCreated())); + $objWriter->endElement(); + + // dcterms:modified + $objWriter->startElement('dcterms:modified'); + $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); + $objWriter->writeRawData(date(DATE_W3C, $spreadsheet->getProperties()->getModified())); + $objWriter->endElement(); + + // dc:title + $objWriter->writeElement('dc:title', $spreadsheet->getProperties()->getTitle()); + + // dc:description + $objWriter->writeElement('dc:description', $spreadsheet->getProperties()->getDescription()); + + // dc:subject + $objWriter->writeElement('dc:subject', $spreadsheet->getProperties()->getSubject()); + + // cp:keywords + $objWriter->writeElement('cp:keywords', $spreadsheet->getProperties()->getKeywords()); + + // cp:category + $objWriter->writeElement('cp:category', $spreadsheet->getProperties()->getCategory()); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write docProps/custom.xml to XML format. + * + * @param Spreadsheet $spreadsheet + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * + * @return string XML Output + */ + public function writeDocPropsCustom(Spreadsheet $spreadsheet) + { + $customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); + if (empty($customPropertyList)) { + return; + } + + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // cp:coreProperties + $objWriter->startElement('Properties'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties'); + $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes'); + + foreach ($customPropertyList as $key => $customProperty) { + $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); + $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); + + $objWriter->startElement('property'); + $objWriter->writeAttribute('fmtid', '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}'); + $objWriter->writeAttribute('pid', $key + 2); + $objWriter->writeAttribute('name', $customProperty); + + switch ($propertyType) { + case 'i': + $objWriter->writeElement('vt:i4', $propertyValue); + + break; + case 'f': + $objWriter->writeElement('vt:r8', $propertyValue); + + break; + case 'b': + $objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false'); + + break; + case 'd': + $objWriter->startElement('vt:filetime'); + $objWriter->writeRawData(date(DATE_W3C, $propertyValue)); + $objWriter->endElement(); + + break; + default: + $objWriter->writeElement('vt:lpwstr', $propertyValue); + + break; + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + + return $objWriter->getData(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php new file mode 100644 index 0000000..08256a1 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Drawing.php @@ -0,0 +1,519 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // xdr:wsDr + $objWriter->startElement('xdr:wsDr'); + $objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing'); + $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); + + // Loop through images and write drawings + $i = 1; + $iterator = $pWorksheet->getDrawingCollection()->getIterator(); + while ($iterator->valid()) { + /** @var BaseDrawing $pDrawing */ + $pDrawing = $iterator->current(); + $pRelationId = $i; + $hlinkClickId = $pDrawing->getHyperlink() === null ? null : ++$i; + + $this->writeDrawing($objWriter, $pDrawing, $pRelationId, $hlinkClickId); + + $iterator->next(); + ++$i; + } + + if ($includeCharts) { + $chartCount = $pWorksheet->getChartCount(); + // Loop through charts and write the chart position + if ($chartCount > 0) { + for ($c = 0; $c < $chartCount; ++$c) { + $this->writeChart($objWriter, $pWorksheet->getChartByIndex($c), $c + $i); + } + } + } + + // unparsed AlternateContent + $unparsedLoadedData = $pWorksheet->getParent()->getUnparsedLoadedData(); + if (isset($unparsedLoadedData['sheets'][$pWorksheet->getCodeName()]['drawingAlternateContents'])) { + foreach ($unparsedLoadedData['sheets'][$pWorksheet->getCodeName()]['drawingAlternateContents'] as $drawingAlternateContent) { + $objWriter->writeRaw($drawingAlternateContent); + } + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write drawings to XML format. + * + * @param XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart + * @param int $pRelationId + */ + public function writeChart(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Chart\Chart $pChart, $pRelationId = -1) + { + $tl = $pChart->getTopLeftPosition(); + $tl['colRow'] = Coordinate::coordinateFromString($tl['cell']); + $br = $pChart->getBottomRightPosition(); + $br['colRow'] = Coordinate::coordinateFromString($br['cell']); + + $objWriter->startElement('xdr:twoCellAnchor'); + + $objWriter->startElement('xdr:from'); + $objWriter->writeElement('xdr:col', Coordinate::columnIndexFromString($tl['colRow'][0]) - 1); + $objWriter->writeElement('xdr:colOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($tl['xOffset'])); + $objWriter->writeElement('xdr:row', $tl['colRow'][1] - 1); + $objWriter->writeElement('xdr:rowOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($tl['yOffset'])); + $objWriter->endElement(); + $objWriter->startElement('xdr:to'); + $objWriter->writeElement('xdr:col', Coordinate::columnIndexFromString($br['colRow'][0]) - 1); + $objWriter->writeElement('xdr:colOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($br['xOffset'])); + $objWriter->writeElement('xdr:row', $br['colRow'][1] - 1); + $objWriter->writeElement('xdr:rowOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($br['yOffset'])); + $objWriter->endElement(); + + $objWriter->startElement('xdr:graphicFrame'); + $objWriter->writeAttribute('macro', ''); + $objWriter->startElement('xdr:nvGraphicFramePr'); + $objWriter->startElement('xdr:cNvPr'); + $objWriter->writeAttribute('name', 'Chart ' . $pRelationId); + $objWriter->writeAttribute('id', 1025 * $pRelationId); + $objWriter->endElement(); + $objWriter->startElement('xdr:cNvGraphicFramePr'); + $objWriter->startElement('a:graphicFrameLocks'); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->startElement('xdr:xfrm'); + $objWriter->startElement('a:off'); + $objWriter->writeAttribute('x', '0'); + $objWriter->writeAttribute('y', '0'); + $objWriter->endElement(); + $objWriter->startElement('a:ext'); + $objWriter->writeAttribute('cx', '0'); + $objWriter->writeAttribute('cy', '0'); + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->startElement('a:graphic'); + $objWriter->startElement('a:graphicData'); + $objWriter->writeAttribute('uri', 'http://schemas.openxmlformats.org/drawingml/2006/chart'); + $objWriter->startElement('c:chart'); + $objWriter->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + $objWriter->writeAttribute('r:id', 'rId' . $pRelationId); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + $objWriter->endElement(); + + $objWriter->startElement('xdr:clientData'); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write drawings to XML format. + * + * @param XMLWriter $objWriter XML Writer + * @param BaseDrawing $pDrawing + * @param int $pRelationId + * @param null|int $hlinkClickId + * + * @throws WriterException + */ + public function writeDrawing(XMLWriter $objWriter, BaseDrawing $pDrawing, $pRelationId = -1, $hlinkClickId = null) + { + if ($pRelationId >= 0) { + // xdr:oneCellAnchor + $objWriter->startElement('xdr:oneCellAnchor'); + // Image location + $aCoordinates = Coordinate::coordinateFromString($pDrawing->getCoordinates()); + $aCoordinates[0] = Coordinate::columnIndexFromString($aCoordinates[0]); + + // xdr:from + $objWriter->startElement('xdr:from'); + $objWriter->writeElement('xdr:col', $aCoordinates[0] - 1); + $objWriter->writeElement('xdr:colOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($pDrawing->getOffsetX())); + $objWriter->writeElement('xdr:row', $aCoordinates[1] - 1); + $objWriter->writeElement('xdr:rowOff', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($pDrawing->getOffsetY())); + $objWriter->endElement(); + + // xdr:ext + $objWriter->startElement('xdr:ext'); + $objWriter->writeAttribute('cx', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($pDrawing->getWidth())); + $objWriter->writeAttribute('cy', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($pDrawing->getHeight())); + $objWriter->endElement(); + + // xdr:pic + $objWriter->startElement('xdr:pic'); + + // xdr:nvPicPr + $objWriter->startElement('xdr:nvPicPr'); + + // xdr:cNvPr + $objWriter->startElement('xdr:cNvPr'); + $objWriter->writeAttribute('id', $pRelationId); + $objWriter->writeAttribute('name', $pDrawing->getName()); + $objWriter->writeAttribute('descr', $pDrawing->getDescription()); + + //a:hlinkClick + $this->writeHyperLinkDrawing($objWriter, $hlinkClickId); + + $objWriter->endElement(); + + // xdr:cNvPicPr + $objWriter->startElement('xdr:cNvPicPr'); + + // a:picLocks + $objWriter->startElement('a:picLocks'); + $objWriter->writeAttribute('noChangeAspect', '1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // xdr:blipFill + $objWriter->startElement('xdr:blipFill'); + + // a:blip + $objWriter->startElement('a:blip'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + $objWriter->writeAttribute('r:embed', 'rId' . $pRelationId); + $objWriter->endElement(); + + // a:stretch + $objWriter->startElement('a:stretch'); + $objWriter->writeElement('a:fillRect', null); + $objWriter->endElement(); + + $objWriter->endElement(); + + // xdr:spPr + $objWriter->startElement('xdr:spPr'); + + // a:xfrm + $objWriter->startElement('a:xfrm'); + $objWriter->writeAttribute('rot', \PhpOffice\PhpSpreadsheet\Shared\Drawing::degreesToAngle($pDrawing->getRotation())); + $objWriter->endElement(); + + // a:prstGeom + $objWriter->startElement('a:prstGeom'); + $objWriter->writeAttribute('prst', 'rect'); + + // a:avLst + $objWriter->writeElement('a:avLst', null); + + $objWriter->endElement(); + + if ($pDrawing->getShadow()->getVisible()) { + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius())); + $objWriter->writeAttribute('dist', \PhpOffice\PhpSpreadsheet\Shared\Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance())); + $objWriter->writeAttribute('dir', \PhpOffice\PhpSpreadsheet\Shared\Drawing::degreesToAngle($pDrawing->getShadow()->getDirection())); + $objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment()); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB()); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + $objWriter->endElement(); + + $objWriter->endElement(); + + // xdr:clientData + $objWriter->writeElement('xdr:clientData', null); + + $objWriter->endElement(); + } else { + throw new WriterException('Invalid parameters passed.'); + } + } + + /** + * Write VML header/footer images to XML format. + * + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet + * + * @throws WriterException + * + * @return string XML Output + */ + public function writeVMLHeaderFooterImages(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Header/footer images + $images = $pWorksheet->getHeaderFooter()->getImages(); + + // xml + $objWriter->startElement('xml'); + $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml'); + $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office'); + $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel'); + + // o:shapelayout + $objWriter->startElement('o:shapelayout'); + $objWriter->writeAttribute('v:ext', 'edit'); + + // o:idmap + $objWriter->startElement('o:idmap'); + $objWriter->writeAttribute('v:ext', 'edit'); + $objWriter->writeAttribute('data', '1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // v:shapetype + $objWriter->startElement('v:shapetype'); + $objWriter->writeAttribute('id', '_x0000_t75'); + $objWriter->writeAttribute('coordsize', '21600,21600'); + $objWriter->writeAttribute('o:spt', '75'); + $objWriter->writeAttribute('o:preferrelative', 't'); + $objWriter->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe'); + $objWriter->writeAttribute('filled', 'f'); + $objWriter->writeAttribute('stroked', 'f'); + + // v:stroke + $objWriter->startElement('v:stroke'); + $objWriter->writeAttribute('joinstyle', 'miter'); + $objWriter->endElement(); + + // v:formulas + $objWriter->startElement('v:formulas'); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum @0 1 0'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum 0 0 @1'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @2 1 2'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @3 21600 pixelWidth'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @3 21600 pixelHeight'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum @0 0 1'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @6 1 2'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @7 21600 pixelWidth'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum @8 21600 0'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'prod @7 21600 pixelHeight'); + $objWriter->endElement(); + + // v:f + $objWriter->startElement('v:f'); + $objWriter->writeAttribute('eqn', 'sum @10 21600 0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // v:path + $objWriter->startElement('v:path'); + $objWriter->writeAttribute('o:extrusionok', 'f'); + $objWriter->writeAttribute('gradientshapeok', 't'); + $objWriter->writeAttribute('o:connecttype', 'rect'); + $objWriter->endElement(); + + // o:lock + $objWriter->startElement('o:lock'); + $objWriter->writeAttribute('v:ext', 'edit'); + $objWriter->writeAttribute('aspectratio', 't'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Loop through images + foreach ($images as $key => $value) { + $this->writeVMLHeaderFooterImage($objWriter, $key, $value); + } + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write VML comment to XML format. + * + * @param XMLWriter $objWriter XML Writer + * @param string $pReference Reference + * @param HeaderFooterDrawing $pImage Image + */ + private function writeVMLHeaderFooterImage(XMLWriter $objWriter, $pReference, HeaderFooterDrawing $pImage) + { + // Calculate object id + preg_match('{(\d+)}', md5($pReference), $m); + $id = 1500 + (substr($m[1], 0, 2) * 1); + + // Calculate offset + $width = $pImage->getWidth(); + $height = $pImage->getHeight(); + $marginLeft = $pImage->getOffsetX(); + $marginTop = $pImage->getOffsetY(); + + // v:shape + $objWriter->startElement('v:shape'); + $objWriter->writeAttribute('id', $pReference); + $objWriter->writeAttribute('o:spid', '_x0000_s' . $id); + $objWriter->writeAttribute('type', '#_x0000_t75'); + $objWriter->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1"); + + // v:imagedata + $objWriter->startElement('v:imagedata'); + $objWriter->writeAttribute('o:relid', 'rId' . $pReference); + $objWriter->writeAttribute('o:title', $pImage->getName()); + $objWriter->endElement(); + + // o:lock + $objWriter->startElement('o:lock'); + $objWriter->writeAttribute('v:ext', 'edit'); + $objWriter->writeAttribute('textRotation', 't'); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Get an array of all drawings. + * + * @param Spreadsheet $spreadsheet + * + * @return \PhpOffice\PhpSpreadsheet\Worksheet\Drawing[] All drawings in PhpSpreadsheet + */ + public function allDrawings(Spreadsheet $spreadsheet) + { + // Get an array of all drawings + $aDrawings = []; + + // Loop through PhpSpreadsheet + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + // Loop through images and add to array + $iterator = $spreadsheet->getSheet($i)->getDrawingCollection()->getIterator(); + while ($iterator->valid()) { + $aDrawings[] = $iterator->current(); + + $iterator->next(); + } + } + + return $aDrawings; + } + + /** + * @param XMLWriter $objWriter + * @param null|int $hlinkClickId + */ + private function writeHyperLinkDrawing(XMLWriter $objWriter, $hlinkClickId) + { + if ($hlinkClickId === null) { + return; + } + + $objWriter->startElement('a:hlinkClick'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + $objWriter->writeAttribute('r:id', 'rId' . $hlinkClickId); + $objWriter->endElement(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php new file mode 100644 index 0000000..76c196b --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Rels.php @@ -0,0 +1,466 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + $customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); + if (!empty($customPropertyList)) { + // Relationship docProps/app.xml + $this->writeRelationship( + $objWriter, + 4, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties', + 'docProps/custom.xml' + ); + } + + // Relationship docProps/app.xml + $this->writeRelationship( + $objWriter, + 3, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties', + 'docProps/app.xml' + ); + + // Relationship docProps/core.xml + $this->writeRelationship( + $objWriter, + 2, + 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties', + 'docProps/core.xml' + ); + + // Relationship xl/workbook.xml + $this->writeRelationship( + $objWriter, + 1, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument', + 'xl/workbook.xml' + ); + // a custom UI in workbook ? + if ($spreadsheet->hasRibbon()) { + $this->writeRelationShip( + $objWriter, + 5, + 'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility', + $spreadsheet->getRibbonXMLData('target') + ); + } + + $objWriter->endElement(); + + return $objWriter->getData(); + } + + /** + * Write workbook relationships to XML format. + * + * @param Spreadsheet $spreadsheet + * + * @throws WriterException + * + * @return string XML Output + */ + public function writeWorkbookRelationships(Spreadsheet $spreadsheet) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Relationship styles.xml + $this->writeRelationship( + $objWriter, + 1, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', + 'styles.xml' + ); + + // Relationship theme/theme1.xml + $this->writeRelationship( + $objWriter, + 2, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', + 'theme/theme1.xml' + ); + + // Relationship sharedStrings.xml + $this->writeRelationship( + $objWriter, + 3, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', + 'sharedStrings.xml' + ); + + // Relationships with sheets + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + $this->writeRelationship( + $objWriter, + ($i + 1 + 3), + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', + 'worksheets/sheet' . ($i + 1) . '.xml' + ); + } + // Relationships for vbaProject if needed + // id : just after the last sheet + if ($spreadsheet->hasMacros()) { + $this->writeRelationShip( + $objWriter, + ($i + 1 + 3), + 'http://schemas.microsoft.com/office/2006/relationships/vbaProject', + 'vbaProject.bin' + ); + ++$i; //increment i if needed for an another relation + } + + $objWriter->endElement(); + + return $objWriter->getData(); + } + + /** + * Write worksheet relationships to XML format. + * + * Numbering is as follows: + * rId1 - Drawings + * rId_hyperlink_x - Hyperlinks + * + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet + * @param int $pWorksheetId + * @param bool $includeCharts Flag indicating if we should write charts + * + * @throws WriterException + * + * @return string XML Output + */ + public function writeWorksheetRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, $pWorksheetId = 1, $includeCharts = false) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Write drawing relationships? + $d = 0; + $drawingOriginalIds = []; + $unparsedLoadedData = $pWorksheet->getParent()->getUnparsedLoadedData(); + if (isset($unparsedLoadedData['sheets'][$pWorksheet->getCodeName()]['drawingOriginalIds'])) { + $drawingOriginalIds = $unparsedLoadedData['sheets'][$pWorksheet->getCodeName()]['drawingOriginalIds']; + } + + if ($includeCharts) { + $charts = $pWorksheet->getChartCollection(); + } else { + $charts = []; + } + + if (($pWorksheet->getDrawingCollection()->count() > 0) || (count($charts) > 0) || $drawingOriginalIds) { + $relPath = '../drawings/drawing' . $pWorksheetId . '.xml'; + $rId = ++$d; + + if (isset($drawingOriginalIds[$relPath])) { + $rId = (int) (substr($drawingOriginalIds[$relPath], 3)); + } + + $this->writeRelationship( + $objWriter, + $rId, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing', + $relPath + ); + } + + // Write hyperlink relationships? + $i = 1; + foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) { + if (!$hyperlink->isInternal()) { + $this->writeRelationship( + $objWriter, + '_hyperlink_' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', + $hyperlink->getUrl(), + 'External' + ); + + ++$i; + } + } + + // Write comments relationship? + $i = 1; + if (count($pWorksheet->getComments()) > 0) { + $this->writeRelationship( + $objWriter, + '_comments_vml' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', + '../drawings/vmlDrawing' . $pWorksheetId . '.vml' + ); + + $this->writeRelationship( + $objWriter, + '_comments' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments', + '../comments' . $pWorksheetId . '.xml' + ); + } + + // Write header/footer relationship? + $i = 1; + if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) { + $this->writeRelationship( + $objWriter, + '_headerfooter_vml' . $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing', + '../drawings/vmlDrawingHF' . $pWorksheetId . '.vml' + ); + } + + $this->writeUnparsedRelationship($pWorksheet, $objWriter, 'ctrlProps', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp'); + $this->writeUnparsedRelationship($pWorksheet, $objWriter, 'vmlDrawings', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing'); + $this->writeUnparsedRelationship($pWorksheet, $objWriter, 'printerSettings', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings'); + + $objWriter->endElement(); + + return $objWriter->getData(); + } + + private function writeUnparsedRelationship(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, XMLWriter $objWriter, $relationship, $type) + { + $unparsedLoadedData = $pWorksheet->getParent()->getUnparsedLoadedData(); + if (!isset($unparsedLoadedData['sheets'][$pWorksheet->getCodeName()][$relationship])) { + return; + } + + foreach ($unparsedLoadedData['sheets'][$pWorksheet->getCodeName()][$relationship] as $rId => $value) { + $this->writeRelationship( + $objWriter, + $rId, + $type, + $value['relFilePath'] + ); + } + } + + /** + * Write drawing relationships to XML format. + * + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet + * @param int &$chartRef Chart ID + * @param bool $includeCharts Flag indicating if we should write charts + * + * @throws WriterException + * + * @return string XML Output + */ + public function writeDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet, &$chartRef, $includeCharts = false) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Loop through images and write relationships + $i = 1; + $iterator = $pWorksheet->getDrawingCollection()->getIterator(); + while ($iterator->valid()) { + if ($iterator->current() instanceof \PhpOffice\PhpSpreadsheet\Worksheet\Drawing + || $iterator->current() instanceof MemoryDrawing) { + // Write relationship for image drawing + /** @var \PhpOffice\PhpSpreadsheet\Worksheet\Drawing $drawing */ + $drawing = $iterator->current(); + $this->writeRelationship( + $objWriter, + $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', + '../media/' . str_replace(' ', '', $drawing->getIndexedFilename()) + ); + + $i = $this->writeDrawingHyperLink($objWriter, $drawing, $i); + } + + $iterator->next(); + ++$i; + } + + if ($includeCharts) { + // Loop through charts and write relationships + $chartCount = $pWorksheet->getChartCount(); + if ($chartCount > 0) { + for ($c = 0; $c < $chartCount; ++$c) { + $this->writeRelationship( + $objWriter, + $i++, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', + '../charts/chart' . ++$chartRef . '.xml' + ); + } + } + } + + $objWriter->endElement(); + + return $objWriter->getData(); + } + + /** + * Write header/footer drawing relationships to XML format. + * + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet + * + * @throws WriterException + * + * @return string XML Output + */ + public function writeHeaderFooterDrawingRelationships(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $pWorksheet) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + + // Loop through images and write relationships + foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) { + // Write relationship for image drawing + $this->writeRelationship( + $objWriter, + $key, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', + '../media/' . $value->getIndexedFilename() + ); + } + + $objWriter->endElement(); + + return $objWriter->getData(); + } + + /** + * Write Override content type. + * + * @param XMLWriter $objWriter XML Writer + * @param int $pId Relationship ID. rId will be prepended! + * @param string $pType Relationship type + * @param string $pTarget Relationship target + * @param string $pTargetMode Relationship target mode + * + * @throws WriterException + */ + private function writeRelationship(XMLWriter $objWriter, $pId, $pType, $pTarget, $pTargetMode = '') + { + if ($pType != '' && $pTarget != '') { + // Write relationship + $objWriter->startElement('Relationship'); + $objWriter->writeAttribute('Id', 'rId' . $pId); + $objWriter->writeAttribute('Type', $pType); + $objWriter->writeAttribute('Target', $pTarget); + + if ($pTargetMode != '') { + $objWriter->writeAttribute('TargetMode', $pTargetMode); + } + + $objWriter->endElement(); + } else { + throw new WriterException('Invalid parameters passed.'); + } + } + + /** + * @param $objWriter + * @param \PhpOffice\PhpSpreadsheet\Worksheet\Drawing $drawing + * @param $i + * + * @throws WriterException + * + * @return int + */ + private function writeDrawingHyperLink($objWriter, $drawing, $i) + { + if ($drawing->getHyperlink() === null) { + return $i; + } + + ++$i; + $this->writeRelationship( + $objWriter, + $i, + 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', + $drawing->getHyperlink()->getUrl(), + $drawing->getHyperlink()->getTypeHyperlink() + ); + + return $i; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php new file mode 100644 index 0000000..8a0cfe3 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsRibbon.php @@ -0,0 +1,49 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + $localRels = $spreadsheet->getRibbonBinObjects('names'); + if (is_array($localRels)) { + foreach ($localRels as $aId => $aTarget) { + $objWriter->startElement('Relationship'); + $objWriter->writeAttribute('Id', $aId); + $objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'); + $objWriter->writeAttribute('Target', $aTarget); + $objWriter->endElement(); + } + } + $objWriter->endElement(); + + return $objWriter->getData(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php new file mode 100644 index 0000000..01ad38d --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/RelsVBA.php @@ -0,0 +1,44 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Relationships + $objWriter->startElement('Relationships'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships'); + $objWriter->startElement('Relationship'); + $objWriter->writeAttribute('Id', 'rId1'); + $objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature'); + $objWriter->writeAttribute('Target', 'vbaProjectSignature.bin'); + $objWriter->endElement(); + $objWriter->endElement(); + + return $objWriter->getData(); + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php new file mode 100644 index 0000000..19604e4 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/StringTable.php @@ -0,0 +1,281 @@ +flipStringTable($aStringTable); + + // Loop through cells + foreach ($pSheet->getCoordinates() as $coordinate) { + $cell = $pSheet->getCell($coordinate); + $cellValue = $cell->getValue(); + if (!is_object($cellValue) && + ($cellValue !== null) && + $cellValue !== '' && + !isset($aFlippedStringTable[$cellValue]) && + ($cell->getDataType() == DataType::TYPE_STRING || $cell->getDataType() == DataType::TYPE_STRING2 || $cell->getDataType() == DataType::TYPE_NULL)) { + $aStringTable[] = $cellValue; + $aFlippedStringTable[$cellValue] = true; + } elseif ($cellValue instanceof RichText && + ($cellValue !== null) && + !isset($aFlippedStringTable[$cellValue->getHashCode()])) { + $aStringTable[] = $cellValue; + $aFlippedStringTable[$cellValue->getHashCode()] = true; + } + } + + return $aStringTable; + } + + /** + * Write string table to XML format. + * + * @param string[] $pStringTable + * + * @throws WriterException + * + * @return string XML Output + */ + public function writeStringTable(array $pStringTable) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // String table + $objWriter->startElement('sst'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $objWriter->writeAttribute('uniqueCount', count($pStringTable)); + + // Loop through string table + foreach ($pStringTable as $textElement) { + $objWriter->startElement('si'); + + if (!$textElement instanceof RichText) { + $textToWrite = StringHelper::controlCharacterPHP2OOXML($textElement); + $objWriter->startElement('t'); + if ($textToWrite !== trim($textToWrite)) { + $objWriter->writeAttribute('xml:space', 'preserve'); + } + $objWriter->writeRawData($textToWrite); + $objWriter->endElement(); + } elseif ($textElement instanceof RichText) { + $this->writeRichText($objWriter, $textElement); + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + + return $objWriter->getData(); + } + + /** + * Write Rich Text. + * + * @param XMLWriter $objWriter XML Writer + * @param RichText $pRichText Rich text + * @param string $prefix Optional Namespace prefix + */ + public function writeRichText(XMLWriter $objWriter, RichText $pRichText, $prefix = null) + { + if ($prefix !== null) { + $prefix .= ':'; + } + + // Loop through rich text elements + $elements = $pRichText->getRichTextElements(); + foreach ($elements as $element) { + // r + $objWriter->startElement($prefix . 'r'); + + // rPr + if ($element instanceof Run) { + // rPr + $objWriter->startElement($prefix . 'rPr'); + + // rFont + $objWriter->startElement($prefix . 'rFont'); + $objWriter->writeAttribute('val', $element->getFont()->getName()); + $objWriter->endElement(); + + // Bold + $objWriter->startElement($prefix . 'b'); + $objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false')); + $objWriter->endElement(); + + // Italic + $objWriter->startElement($prefix . 'i'); + $objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false')); + $objWriter->endElement(); + + // Superscript / subscript + if ($element->getFont()->getSuperscript() || $element->getFont()->getSubscript()) { + $objWriter->startElement($prefix . 'vertAlign'); + if ($element->getFont()->getSuperscript()) { + $objWriter->writeAttribute('val', 'superscript'); + } elseif ($element->getFont()->getSubscript()) { + $objWriter->writeAttribute('val', 'subscript'); + } + $objWriter->endElement(); + } + + // Strikethrough + $objWriter->startElement($prefix . 'strike'); + $objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false')); + $objWriter->endElement(); + + // Color + $objWriter->startElement($prefix . 'color'); + $objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB()); + $objWriter->endElement(); + + // Size + $objWriter->startElement($prefix . 'sz'); + $objWriter->writeAttribute('val', $element->getFont()->getSize()); + $objWriter->endElement(); + + // Underline + $objWriter->startElement($prefix . 'u'); + $objWriter->writeAttribute('val', $element->getFont()->getUnderline()); + $objWriter->endElement(); + + $objWriter->endElement(); + } + + // t + $objWriter->startElement($prefix . 't'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeRawData(StringHelper::controlCharacterPHP2OOXML($element->getText())); + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + + /** + * Write Rich Text. + * + * @param XMLWriter $objWriter XML Writer + * @param RichText|string $pRichText text string or Rich text + * @param string $prefix Optional Namespace prefix + */ + public function writeRichTextForCharts(XMLWriter $objWriter, $pRichText = null, $prefix = null) + { + if (!$pRichText instanceof RichText) { + $textRun = $pRichText; + $pRichText = new RichText(); + $pRichText->createTextRun($textRun); + } + + if ($prefix !== null) { + $prefix .= ':'; + } + + // Loop through rich text elements + $elements = $pRichText->getRichTextElements(); + foreach ($elements as $element) { + // r + $objWriter->startElement($prefix . 'r'); + + // rPr + $objWriter->startElement($prefix . 'rPr'); + + // Bold + $objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0)); + // Italic + $objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0)); + // Underline + $underlineType = $element->getFont()->getUnderline(); + switch ($underlineType) { + case 'single': + $underlineType = 'sng'; + + break; + case 'double': + $underlineType = 'dbl'; + + break; + } + $objWriter->writeAttribute('u', $underlineType); + // Strikethrough + $objWriter->writeAttribute('strike', ($element->getFont()->getStrikethrough() ? 'sngStrike' : 'noStrike')); + + // rFont + $objWriter->startElement($prefix . 'latin'); + $objWriter->writeAttribute('typeface', $element->getFont()->getName()); + $objWriter->endElement(); + + $objWriter->endElement(); + + // t + $objWriter->startElement($prefix . 't'); + $objWriter->writeRawData(StringHelper::controlCharacterPHP2OOXML($element->getText())); + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + + /** + * Flip string table (for index searching). + * + * @param array $stringTable Stringtable + * + * @return array + */ + public function flipStringTable(array $stringTable) + { + // Return value + $returnValue = []; + + // Loop through stringtable and add flipped items to $returnValue + foreach ($stringTable as $key => $value) { + if (!$value instanceof RichText) { + $returnValue[$value] = $key; + } elseif ($value instanceof RichText) { + $returnValue[$value->getHashCode()] = $key; + } + } + + return $returnValue; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php new file mode 100644 index 0000000..16e800e --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php @@ -0,0 +1,686 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // styleSheet + $objWriter->startElement('styleSheet'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + + // numFmts + $objWriter->startElement('numFmts'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count()); + + // numFmt + for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) { + $this->writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i); + } + + $objWriter->endElement(); + + // fonts + $objWriter->startElement('fonts'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count()); + + // font + for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) { + $this->writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i)); + } + + $objWriter->endElement(); + + // fills + $objWriter->startElement('fills'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count()); + + // fill + for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) { + $this->writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i)); + } + + $objWriter->endElement(); + + // borders + $objWriter->startElement('borders'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count()); + + // border + for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) { + $this->writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i)); + } + + $objWriter->endElement(); + + // cellStyleXfs + $objWriter->startElement('cellStyleXfs'); + $objWriter->writeAttribute('count', 1); + + // xf + $objWriter->startElement('xf'); + $objWriter->writeAttribute('numFmtId', 0); + $objWriter->writeAttribute('fontId', 0); + $objWriter->writeAttribute('fillId', 0); + $objWriter->writeAttribute('borderId', 0); + $objWriter->endElement(); + + $objWriter->endElement(); + + // cellXfs + $objWriter->startElement('cellXfs'); + $objWriter->writeAttribute('count', count($spreadsheet->getCellXfCollection())); + + // xf + foreach ($spreadsheet->getCellXfCollection() as $cellXf) { + $this->writeCellStyleXf($objWriter, $cellXf, $spreadsheet); + } + + $objWriter->endElement(); + + // cellStyles + $objWriter->startElement('cellStyles'); + $objWriter->writeAttribute('count', 1); + + // cellStyle + $objWriter->startElement('cellStyle'); + $objWriter->writeAttribute('name', 'Normal'); + $objWriter->writeAttribute('xfId', 0); + $objWriter->writeAttribute('builtinId', 0); + $objWriter->endElement(); + + $objWriter->endElement(); + + // dxfs + $objWriter->startElement('dxfs'); + $objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count()); + + // dxf + for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) { + $this->writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle()); + } + + $objWriter->endElement(); + + // tableStyles + $objWriter->startElement('tableStyles'); + $objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9'); + $objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write Fill. + * + * @param XMLWriter $objWriter XML Writer + * @param Fill $pFill Fill style + */ + private function writeFill(XMLWriter $objWriter, Fill $pFill) + { + // Check if this is a pattern type or gradient type + if ($pFill->getFillType() === Fill::FILL_GRADIENT_LINEAR || + $pFill->getFillType() === Fill::FILL_GRADIENT_PATH) { + // Gradient fill + $this->writeGradientFill($objWriter, $pFill); + } elseif ($pFill->getFillType() !== null) { + // Pattern fill + $this->writePatternFill($objWriter, $pFill); + } + } + + /** + * Write Gradient Fill. + * + * @param XMLWriter $objWriter XML Writer + * @param Fill $pFill Fill style + */ + private function writeGradientFill(XMLWriter $objWriter, Fill $pFill) + { + // fill + $objWriter->startElement('fill'); + + // gradientFill + $objWriter->startElement('gradientFill'); + $objWriter->writeAttribute('type', $pFill->getFillType()); + $objWriter->writeAttribute('degree', $pFill->getRotation()); + + // stop + $objWriter->startElement('stop'); + $objWriter->writeAttribute('position', '0'); + + // color + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + + // stop + $objWriter->startElement('stop'); + $objWriter->writeAttribute('position', '1'); + + // color + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Pattern Fill. + * + * @param XMLWriter $objWriter XML Writer + * @param Fill $pFill Fill style + */ + private function writePatternFill(XMLWriter $objWriter, Fill $pFill) + { + // fill + $objWriter->startElement('fill'); + + // patternFill + $objWriter->startElement('patternFill'); + $objWriter->writeAttribute('patternType', $pFill->getFillType()); + + if ($pFill->getFillType() !== Fill::FILL_NONE) { + // fgColor + if ($pFill->getStartColor()->getARGB()) { + $objWriter->startElement('fgColor'); + $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB()); + $objWriter->endElement(); + } + } + if ($pFill->getFillType() !== Fill::FILL_NONE) { + // bgColor + if ($pFill->getEndColor()->getARGB()) { + $objWriter->startElement('bgColor'); + $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB()); + $objWriter->endElement(); + } + } + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write Font. + * + * @param XMLWriter $objWriter XML Writer + * @param Font $pFont Font style + */ + private function writeFont(XMLWriter $objWriter, Font $pFont) + { + // font + $objWriter->startElement('font'); + // Weird! The order of these elements actually makes a difference when opening Xlsx + // files in Excel2003 with the compatibility pack. It's not documented behaviour, + // and makes for a real WTF! + + // Bold. We explicitly write this element also when false (like MS Office Excel 2007 does + // for conditional formatting). Otherwise it will apparently not be picked up in conditional + // formatting style dialog + if ($pFont->getBold() !== null) { + $objWriter->startElement('b'); + $objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0'); + $objWriter->endElement(); + } + + // Italic + if ($pFont->getItalic() !== null) { + $objWriter->startElement('i'); + $objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0'); + $objWriter->endElement(); + } + + // Strikethrough + if ($pFont->getStrikethrough() !== null) { + $objWriter->startElement('strike'); + $objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0'); + $objWriter->endElement(); + } + + // Underline + if ($pFont->getUnderline() !== null) { + $objWriter->startElement('u'); + $objWriter->writeAttribute('val', $pFont->getUnderline()); + $objWriter->endElement(); + } + + // Superscript / subscript + if ($pFont->getSuperscript() === true || $pFont->getSubscript() === true) { + $objWriter->startElement('vertAlign'); + if ($pFont->getSuperscript() === true) { + $objWriter->writeAttribute('val', 'superscript'); + } elseif ($pFont->getSubscript() === true) { + $objWriter->writeAttribute('val', 'subscript'); + } + $objWriter->endElement(); + } + + // Size + if ($pFont->getSize() !== null) { + $objWriter->startElement('sz'); + $objWriter->writeAttribute('val', StringHelper::formatNumber($pFont->getSize())); + $objWriter->endElement(); + } + + // Foreground color + if ($pFont->getColor()->getARGB() !== null) { + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB()); + $objWriter->endElement(); + } + + // Name + if ($pFont->getName() !== null) { + $objWriter->startElement('name'); + $objWriter->writeAttribute('val', $pFont->getName()); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + /** + * Write Border. + * + * @param XMLWriter $objWriter XML Writer + * @param Borders $pBorders Borders style + */ + private function writeBorder(XMLWriter $objWriter, Borders $pBorders) + { + // Write border + $objWriter->startElement('border'); + // Diagonal? + switch ($pBorders->getDiagonalDirection()) { + case Borders::DIAGONAL_UP: + $objWriter->writeAttribute('diagonalUp', 'true'); + $objWriter->writeAttribute('diagonalDown', 'false'); + + break; + case Borders::DIAGONAL_DOWN: + $objWriter->writeAttribute('diagonalUp', 'false'); + $objWriter->writeAttribute('diagonalDown', 'true'); + + break; + case Borders::DIAGONAL_BOTH: + $objWriter->writeAttribute('diagonalUp', 'true'); + $objWriter->writeAttribute('diagonalDown', 'true'); + + break; + } + + // BorderPr + $this->writeBorderPr($objWriter, 'left', $pBorders->getLeft()); + $this->writeBorderPr($objWriter, 'right', $pBorders->getRight()); + $this->writeBorderPr($objWriter, 'top', $pBorders->getTop()); + $this->writeBorderPr($objWriter, 'bottom', $pBorders->getBottom()); + $this->writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal()); + $objWriter->endElement(); + } + + /** + * Write Cell Style Xf. + * + * @param XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpSpreadsheet\Style\Style $pStyle Style + * @param Spreadsheet $spreadsheet Workbook + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + */ + private function writeCellStyleXf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle, Spreadsheet $spreadsheet) + { + // xf + $objWriter->startElement('xf'); + $objWriter->writeAttribute('xfId', 0); + $objWriter->writeAttribute('fontId', (int) $this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode())); + if ($pStyle->getQuotePrefix()) { + $objWriter->writeAttribute('quotePrefix', 1); + } + + if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) { + $objWriter->writeAttribute('numFmtId', (int) ($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164)); + } else { + $objWriter->writeAttribute('numFmtId', (int) $pStyle->getNumberFormat()->getBuiltInFormatCode()); + } + + $objWriter->writeAttribute('fillId', (int) $this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode())); + $objWriter->writeAttribute('borderId', (int) $this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode())); + + // Apply styles? + $objWriter->writeAttribute('applyFont', ($spreadsheet->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0'); + $objWriter->writeAttribute('applyNumberFormat', ($spreadsheet->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0'); + $objWriter->writeAttribute('applyFill', ($spreadsheet->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0'); + $objWriter->writeAttribute('applyBorder', ($spreadsheet->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0'); + $objWriter->writeAttribute('applyAlignment', ($spreadsheet->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0'); + if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('applyProtection', 'true'); + } + + // alignment + $objWriter->startElement('alignment'); + $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal()); + $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical()); + + $textRotation = 0; + if ($pStyle->getAlignment()->getTextRotation() >= 0) { + $textRotation = $pStyle->getAlignment()->getTextRotation(); + } elseif ($pStyle->getAlignment()->getTextRotation() < 0) { + $textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); + } + $objWriter->writeAttribute('textRotation', $textRotation); + + $objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false')); + $objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false')); + + if ($pStyle->getAlignment()->getIndent() > 0) { + $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent()); + } + if ($pStyle->getAlignment()->getReadOrder() > 0) { + $objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadOrder()); + } + $objWriter->endElement(); + + // protection + if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) { + $objWriter->startElement('protection'); + if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + } + if ($pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) { + $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + } + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + /** + * Write Cell Style Dxf. + * + * @param XMLWriter $objWriter XML Writer + * @param \PhpOffice\PhpSpreadsheet\Style\Style $pStyle Style + */ + private function writeCellStyleDxf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle) + { + // dxf + $objWriter->startElement('dxf'); + + // font + $this->writeFont($objWriter, $pStyle->getFont()); + + // numFmt + $this->writeNumFmt($objWriter, $pStyle->getNumberFormat()); + + // fill + $this->writeFill($objWriter, $pStyle->getFill()); + + // alignment + $objWriter->startElement('alignment'); + if ($pStyle->getAlignment()->getHorizontal() !== null) { + $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal()); + } + if ($pStyle->getAlignment()->getVertical() !== null) { + $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical()); + } + + if ($pStyle->getAlignment()->getTextRotation() !== null) { + $textRotation = 0; + if ($pStyle->getAlignment()->getTextRotation() >= 0) { + $textRotation = $pStyle->getAlignment()->getTextRotation(); + } elseif ($pStyle->getAlignment()->getTextRotation() < 0) { + $textRotation = 90 - $pStyle->getAlignment()->getTextRotation(); + } + $objWriter->writeAttribute('textRotation', $textRotation); + } + $objWriter->endElement(); + + // border + $this->writeBorder($objWriter, $pStyle->getBorders()); + + // protection + if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) { + if ($pStyle->getProtection()->getLocked() !== Protection::PROTECTION_INHERIT || + $pStyle->getProtection()->getHidden() !== Protection::PROTECTION_INHERIT) { + $objWriter->startElement('protection'); + if (($pStyle->getProtection()->getLocked() !== null) && + ($pStyle->getProtection()->getLocked() !== Protection::PROTECTION_INHERIT)) { + $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + } + if (($pStyle->getProtection()->getHidden() !== null) && + ($pStyle->getProtection()->getHidden() !== Protection::PROTECTION_INHERIT)) { + $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == Protection::PROTECTION_PROTECTED ? 'true' : 'false')); + } + $objWriter->endElement(); + } + } + + $objWriter->endElement(); + } + + /** + * Write BorderPr. + * + * @param XMLWriter $objWriter XML Writer + * @param string $pName Element name + * @param Border $pBorder Border style + */ + private function writeBorderPr(XMLWriter $objWriter, $pName, Border $pBorder) + { + // Write BorderPr + if ($pBorder->getBorderStyle() != Border::BORDER_NONE) { + $objWriter->startElement($pName); + $objWriter->writeAttribute('style', $pBorder->getBorderStyle()); + + // color + $objWriter->startElement('color'); + $objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB()); + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + + /** + * Write NumberFormat. + * + * @param XMLWriter $objWriter XML Writer + * @param NumberFormat $pNumberFormat Number Format + * @param int $pId Number Format identifier + */ + private function writeNumFmt(XMLWriter $objWriter, NumberFormat $pNumberFormat, $pId = 0) + { + // Translate formatcode + $formatCode = $pNumberFormat->getFormatCode(); + + // numFmt + if ($formatCode !== null) { + $objWriter->startElement('numFmt'); + $objWriter->writeAttribute('numFmtId', ($pId + 164)); + $objWriter->writeAttribute('formatCode', $formatCode); + $objWriter->endElement(); + } + } + + /** + * Get an array of all styles. + * + * @param Spreadsheet $spreadsheet + * + * @return \PhpOffice\PhpSpreadsheet\Style\Style[] All styles in PhpSpreadsheet + */ + public function allStyles(Spreadsheet $spreadsheet) + { + return $spreadsheet->getCellXfCollection(); + } + + /** + * Get an array of all conditional styles. + * + * @param Spreadsheet $spreadsheet + * + * @return Conditional[] All conditional styles in PhpSpreadsheet + */ + public function allConditionalStyles(Spreadsheet $spreadsheet) + { + // Get an array of all styles + $aStyles = []; + + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + foreach ($spreadsheet->getSheet($i)->getConditionalStylesCollection() as $conditionalStyles) { + foreach ($conditionalStyles as $conditionalStyle) { + $aStyles[] = $conditionalStyle; + } + } + } + + return $aStyles; + } + + /** + * Get an array of all fills. + * + * @param Spreadsheet $spreadsheet + * + * @return Fill[] All fills in PhpSpreadsheet + */ + public function allFills(Spreadsheet $spreadsheet) + { + // Get an array of unique fills + $aFills = []; + + // Two first fills are predefined + $fill0 = new Fill(); + $fill0->setFillType(Fill::FILL_NONE); + $aFills[] = $fill0; + + $fill1 = new Fill(); + $fill1->setFillType(Fill::FILL_PATTERN_GRAY125); + $aFills[] = $fill1; + // The remaining fills + $aStyles = $this->allStyles($spreadsheet); + /** @var \PhpOffice\PhpSpreadsheet\Style\Style $style */ + foreach ($aStyles as $style) { + if (!isset($aFills[$style->getFill()->getHashCode()])) { + $aFills[$style->getFill()->getHashCode()] = $style->getFill(); + } + } + + return $aFills; + } + + /** + * Get an array of all fonts. + * + * @param Spreadsheet $spreadsheet + * + * @return Font[] All fonts in PhpSpreadsheet + */ + public function allFonts(Spreadsheet $spreadsheet) + { + // Get an array of unique fonts + $aFonts = []; + $aStyles = $this->allStyles($spreadsheet); + + /** @var \PhpOffice\PhpSpreadsheet\Style\Style $style */ + foreach ($aStyles as $style) { + if (!isset($aFonts[$style->getFont()->getHashCode()])) { + $aFonts[$style->getFont()->getHashCode()] = $style->getFont(); + } + } + + return $aFonts; + } + + /** + * Get an array of all borders. + * + * @param Spreadsheet $spreadsheet + * + * @return Borders[] All borders in PhpSpreadsheet + */ + public function allBorders(Spreadsheet $spreadsheet) + { + // Get an array of unique borders + $aBorders = []; + $aStyles = $this->allStyles($spreadsheet); + + /** @var \PhpOffice\PhpSpreadsheet\Style\Style $style */ + foreach ($aStyles as $style) { + if (!isset($aBorders[$style->getBorders()->getHashCode()])) { + $aBorders[$style->getBorders()->getHashCode()] = $style->getBorders(); + } + } + + return $aBorders; + } + + /** + * Get an array of all number formats. + * + * @param Spreadsheet $spreadsheet + * + * @return NumberFormat[] All number formats in PhpSpreadsheet + */ + public function allNumberFormats(Spreadsheet $spreadsheet) + { + // Get an array of unique number formats + $aNumFmts = []; + $aStyles = $this->allStyles($spreadsheet); + + /** @var \PhpOffice\PhpSpreadsheet\Style\Style $style */ + foreach ($aStyles as $style) { + if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !isset($aNumFmts[$style->getNumberFormat()->getHashCode()])) { + $aNumFmts[$style->getNumberFormat()->getHashCode()] = $style->getNumberFormat(); + } + } + + return $aNumFmts; + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Theme.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Theme.php new file mode 100644 index 0000000..f5f8dc0 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Theme.php @@ -0,0 +1,846 @@ + 'MS Pゴシック', + 'Hang' => '맑은 고딕', + 'Hans' => '宋体', + 'Hant' => '新細明體', + 'Arab' => 'Times New Roman', + 'Hebr' => 'Times New Roman', + 'Thai' => 'Tahoma', + 'Ethi' => 'Nyala', + 'Beng' => 'Vrinda', + 'Gujr' => 'Shruti', + 'Khmr' => 'MoolBoran', + 'Knda' => 'Tunga', + 'Guru' => 'Raavi', + 'Cans' => 'Euphemia', + 'Cher' => 'Plantagenet Cherokee', + 'Yiii' => 'Microsoft Yi Baiti', + 'Tibt' => 'Microsoft Himalaya', + 'Thaa' => 'MV Boli', + 'Deva' => 'Mangal', + 'Telu' => 'Gautami', + 'Taml' => 'Latha', + 'Syrc' => 'Estrangelo Edessa', + 'Orya' => 'Kalinga', + 'Mlym' => 'Kartika', + 'Laoo' => 'DokChampa', + 'Sinh' => 'Iskoola Pota', + 'Mong' => 'Mongolian Baiti', + 'Viet' => 'Times New Roman', + 'Uigh' => 'Microsoft Uighur', + 'Geor' => 'Sylfaen', + ]; + + /** + * Map of Minor fonts to write. + * + * @var array of string + */ + private static $minorFonts = [ + 'Jpan' => 'MS Pゴシック', + 'Hang' => '맑은 고딕', + 'Hans' => '宋体', + 'Hant' => '新細明體', + 'Arab' => 'Arial', + 'Hebr' => 'Arial', + 'Thai' => 'Tahoma', + 'Ethi' => 'Nyala', + 'Beng' => 'Vrinda', + 'Gujr' => 'Shruti', + 'Khmr' => 'DaunPenh', + 'Knda' => 'Tunga', + 'Guru' => 'Raavi', + 'Cans' => 'Euphemia', + 'Cher' => 'Plantagenet Cherokee', + 'Yiii' => 'Microsoft Yi Baiti', + 'Tibt' => 'Microsoft Himalaya', + 'Thaa' => 'MV Boli', + 'Deva' => 'Mangal', + 'Telu' => 'Gautami', + 'Taml' => 'Latha', + 'Syrc' => 'Estrangelo Edessa', + 'Orya' => 'Kalinga', + 'Mlym' => 'Kartika', + 'Laoo' => 'DokChampa', + 'Sinh' => 'Iskoola Pota', + 'Mong' => 'Mongolian Baiti', + 'Viet' => 'Arial', + 'Uigh' => 'Microsoft Uighur', + 'Geor' => 'Sylfaen', + ]; + + /** + * Map of core colours. + * + * @var array of string + */ + private static $colourScheme = [ + 'dk2' => '1F497D', + 'lt2' => 'EEECE1', + 'accent1' => '4F81BD', + 'accent2' => 'C0504D', + 'accent3' => '9BBB59', + 'accent4' => '8064A2', + 'accent5' => '4BACC6', + 'accent6' => 'F79646', + 'hlink' => '0000FF', + 'folHlink' => '800080', + ]; + + /** + * Write theme to XML format. + * + * @param Spreadsheet $spreadsheet + * + * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * + * @return string XML Output + */ + public function writeTheme(Spreadsheet $spreadsheet) + { + // Create XML writer + $objWriter = null; + if ($this->getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // a:theme + $objWriter->startElement('a:theme'); + $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); + $objWriter->writeAttribute('name', 'Office Theme'); + + // a:themeElements + $objWriter->startElement('a:themeElements'); + + // a:clrScheme + $objWriter->startElement('a:clrScheme'); + $objWriter->writeAttribute('name', 'Office'); + + // a:dk1 + $objWriter->startElement('a:dk1'); + + // a:sysClr + $objWriter->startElement('a:sysClr'); + $objWriter->writeAttribute('val', 'windowText'); + $objWriter->writeAttribute('lastClr', '000000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lt1 + $objWriter->startElement('a:lt1'); + + // a:sysClr + $objWriter->startElement('a:sysClr'); + $objWriter->writeAttribute('val', 'window'); + $objWriter->writeAttribute('lastClr', 'FFFFFF'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:dk2 + $this->writeColourScheme($objWriter); + + $objWriter->endElement(); + + // a:fontScheme + $objWriter->startElement('a:fontScheme'); + $objWriter->writeAttribute('name', 'Office'); + + // a:majorFont + $objWriter->startElement('a:majorFont'); + $this->writeFonts($objWriter, 'Cambria', self::$majorFonts); + $objWriter->endElement(); + + // a:minorFont + $objWriter->startElement('a:minorFont'); + $this->writeFonts($objWriter, 'Calibri', self::$minorFonts); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:fmtScheme + $objWriter->startElement('a:fmtScheme'); + $objWriter->writeAttribute('name', 'Office'); + + // a:fillStyleLst + $objWriter->startElement('a:fillStyleLst'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gradFill + $objWriter->startElement('a:gradFill'); + $objWriter->writeAttribute('rotWithShape', '1'); + + // a:gsLst + $objWriter->startElement('a:gsLst'); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '0'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '50000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '300000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '35000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '37000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '300000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '100000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '15000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '350000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lin + $objWriter->startElement('a:lin'); + $objWriter->writeAttribute('ang', '16200000'); + $objWriter->writeAttribute('scaled', '1'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gradFill + $objWriter->startElement('a:gradFill'); + $objWriter->writeAttribute('rotWithShape', '1'); + + // a:gsLst + $objWriter->startElement('a:gsLst'); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '0'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '51000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '130000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '80000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '93000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '130000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '100000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '94000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '135000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lin + $objWriter->startElement('a:lin'); + $objWriter->writeAttribute('ang', '16200000'); + $objWriter->writeAttribute('scaled', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lnStyleLst + $objWriter->startElement('a:lnStyleLst'); + + // a:ln + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', '9525'); + $objWriter->writeAttribute('cap', 'flat'); + $objWriter->writeAttribute('cmpd', 'sng'); + $objWriter->writeAttribute('algn', 'ctr'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '95000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '105000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:prstDash + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', 'solid'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:ln + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', '25400'); + $objWriter->writeAttribute('cap', 'flat'); + $objWriter->writeAttribute('cmpd', 'sng'); + $objWriter->writeAttribute('algn', 'ctr'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:prstDash + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', 'solid'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:ln + $objWriter->startElement('a:ln'); + $objWriter->writeAttribute('w', '38100'); + $objWriter->writeAttribute('cap', 'flat'); + $objWriter->writeAttribute('cmpd', 'sng'); + $objWriter->writeAttribute('algn', 'ctr'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:prstDash + $objWriter->startElement('a:prstDash'); + $objWriter->writeAttribute('val', 'solid'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:effectStyleLst + $objWriter->startElement('a:effectStyleLst'); + + // a:effectStyle + $objWriter->startElement('a:effectStyle'); + + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', '40000'); + $objWriter->writeAttribute('dist', '20000'); + $objWriter->writeAttribute('dir', '5400000'); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '000000'); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', '38000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:effectStyle + $objWriter->startElement('a:effectStyle'); + + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', '40000'); + $objWriter->writeAttribute('dist', '23000'); + $objWriter->writeAttribute('dir', '5400000'); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '000000'); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', '35000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:effectStyle + $objWriter->startElement('a:effectStyle'); + + // a:effectLst + $objWriter->startElement('a:effectLst'); + + // a:outerShdw + $objWriter->startElement('a:outerShdw'); + $objWriter->writeAttribute('blurRad', '40000'); + $objWriter->writeAttribute('dist', '23000'); + $objWriter->writeAttribute('dir', '5400000'); + $objWriter->writeAttribute('rotWithShape', '0'); + + // a:srgbClr + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', '000000'); + + // a:alpha + $objWriter->startElement('a:alpha'); + $objWriter->writeAttribute('val', '35000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:scene3d + $objWriter->startElement('a:scene3d'); + + // a:camera + $objWriter->startElement('a:camera'); + $objWriter->writeAttribute('prst', 'orthographicFront'); + + // a:rot + $objWriter->startElement('a:rot'); + $objWriter->writeAttribute('lat', '0'); + $objWriter->writeAttribute('lon', '0'); + $objWriter->writeAttribute('rev', '0'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:lightRig + $objWriter->startElement('a:lightRig'); + $objWriter->writeAttribute('rig', 'threePt'); + $objWriter->writeAttribute('dir', 't'); + + // a:rot + $objWriter->startElement('a:rot'); + $objWriter->writeAttribute('lat', '0'); + $objWriter->writeAttribute('lon', '0'); + $objWriter->writeAttribute('rev', '1200000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:sp3d + $objWriter->startElement('a:sp3d'); + + // a:bevelT + $objWriter->startElement('a:bevelT'); + $objWriter->writeAttribute('w', '63500'); + $objWriter->writeAttribute('h', '25400'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:bgFillStyleLst + $objWriter->startElement('a:bgFillStyleLst'); + + // a:solidFill + $objWriter->startElement('a:solidFill'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gradFill + $objWriter->startElement('a:gradFill'); + $objWriter->writeAttribute('rotWithShape', '1'); + + // a:gsLst + $objWriter->startElement('a:gsLst'); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '0'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '40000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '350000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '40000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '45000'); + $objWriter->endElement(); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '99000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '350000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '100000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '20000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '255000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:path + $objWriter->startElement('a:path'); + $objWriter->writeAttribute('path', 'circle'); + + // a:fillToRect + $objWriter->startElement('a:fillToRect'); + $objWriter->writeAttribute('l', '50000'); + $objWriter->writeAttribute('t', '-80000'); + $objWriter->writeAttribute('r', '50000'); + $objWriter->writeAttribute('b', '180000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gradFill + $objWriter->startElement('a:gradFill'); + $objWriter->writeAttribute('rotWithShape', '1'); + + // a:gsLst + $objWriter->startElement('a:gsLst'); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '0'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:tint + $objWriter->startElement('a:tint'); + $objWriter->writeAttribute('val', '80000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '300000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:gs + $objWriter->startElement('a:gs'); + $objWriter->writeAttribute('pos', '100000'); + + // a:schemeClr + $objWriter->startElement('a:schemeClr'); + $objWriter->writeAttribute('val', 'phClr'); + + // a:shade + $objWriter->startElement('a:shade'); + $objWriter->writeAttribute('val', '30000'); + $objWriter->endElement(); + + // a:satMod + $objWriter->startElement('a:satMod'); + $objWriter->writeAttribute('val', '200000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:path + $objWriter->startElement('a:path'); + $objWriter->writeAttribute('path', 'circle'); + + // a:fillToRect + $objWriter->startElement('a:fillToRect'); + $objWriter->writeAttribute('l', '50000'); + $objWriter->writeAttribute('t', '50000'); + $objWriter->writeAttribute('r', '50000'); + $objWriter->writeAttribute('b', '50000'); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + + // a:objectDefaults + $objWriter->writeElement('a:objectDefaults', null); + + // a:extraClrSchemeLst + $objWriter->writeElement('a:extraClrSchemeLst', null); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write fonts to XML format. + * + * @param XMLWriter $objWriter + * @param string $latinFont + * @param array of string $fontSet + * + * @return string XML Output + */ + private function writeFonts($objWriter, $latinFont, $fontSet) + { + // a:latin + $objWriter->startElement('a:latin'); + $objWriter->writeAttribute('typeface', $latinFont); + $objWriter->endElement(); + + // a:ea + $objWriter->startElement('a:ea'); + $objWriter->writeAttribute('typeface', ''); + $objWriter->endElement(); + + // a:cs + $objWriter->startElement('a:cs'); + $objWriter->writeAttribute('typeface', ''); + $objWriter->endElement(); + + foreach ($fontSet as $fontScript => $typeface) { + $objWriter->startElement('a:font'); + $objWriter->writeAttribute('script', $fontScript); + $objWriter->writeAttribute('typeface', $typeface); + $objWriter->endElement(); + } + } + + /** + * Write colour scheme to XML format. + * + * @param XMLWriter $objWriter + * + * @return string XML Output + */ + private function writeColourScheme($objWriter) + { + foreach (self::$colourScheme as $colourName => $colourValue) { + $objWriter->startElement('a:' . $colourName); + + $objWriter->startElement('a:srgbClr'); + $objWriter->writeAttribute('val', $colourValue); + $objWriter->endElement(); + + $objWriter->endElement(); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php new file mode 100644 index 0000000..fd93674 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Workbook.php @@ -0,0 +1,426 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // workbook + $objWriter->startElement('workbook'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + // fileVersion + $this->writeFileVersion($objWriter); + + // workbookPr + $this->writeWorkbookPr($objWriter); + + // workbookProtection + $this->writeWorkbookProtection($objWriter, $spreadsheet); + + // bookViews + if ($this->getParentWriter()->getOffice2003Compatibility() === false) { + $this->writeBookViews($objWriter, $spreadsheet); + } + + // sheets + $this->writeSheets($objWriter, $spreadsheet); + + // definedNames + $this->writeDefinedNames($objWriter, $spreadsheet); + + // calcPr + $this->writeCalcPr($objWriter, $recalcRequired); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write file version. + * + * @param XMLWriter $objWriter XML Writer + */ + private function writeFileVersion(XMLWriter $objWriter) + { + $objWriter->startElement('fileVersion'); + $objWriter->writeAttribute('appName', 'xl'); + $objWriter->writeAttribute('lastEdited', '4'); + $objWriter->writeAttribute('lowestEdited', '4'); + $objWriter->writeAttribute('rupBuild', '4505'); + $objWriter->endElement(); + } + + /** + * Write WorkbookPr. + * + * @param XMLWriter $objWriter XML Writer + */ + private function writeWorkbookPr(XMLWriter $objWriter) + { + $objWriter->startElement('workbookPr'); + + if (Date::getExcelCalendar() === Date::CALENDAR_MAC_1904) { + $objWriter->writeAttribute('date1904', '1'); + } + + $objWriter->writeAttribute('codeName', 'ThisWorkbook'); + + $objWriter->endElement(); + } + + /** + * Write BookViews. + * + * @param XMLWriter $objWriter XML Writer + * @param Spreadsheet $spreadsheet + */ + private function writeBookViews(XMLWriter $objWriter, Spreadsheet $spreadsheet) + { + // bookViews + $objWriter->startElement('bookViews'); + + // workbookView + $objWriter->startElement('workbookView'); + + $objWriter->writeAttribute('activeTab', $spreadsheet->getActiveSheetIndex()); + $objWriter->writeAttribute('autoFilterDateGrouping', ($spreadsheet->getAutoFilterDateGrouping() ? 'true' : 'false')); + $objWriter->writeAttribute('firstSheet', $spreadsheet->getFirstSheetIndex()); + $objWriter->writeAttribute('minimized', ($spreadsheet->getMinimized() ? 'true' : 'false')); + $objWriter->writeAttribute('showHorizontalScroll', ($spreadsheet->getShowHorizontalScroll() ? 'true' : 'false')); + $objWriter->writeAttribute('showSheetTabs', ($spreadsheet->getShowSheetTabs() ? 'true' : 'false')); + $objWriter->writeAttribute('showVerticalScroll', ($spreadsheet->getShowVerticalScroll() ? 'true' : 'false')); + $objWriter->writeAttribute('tabRatio', $spreadsheet->getTabRatio()); + $objWriter->writeAttribute('visibility', $spreadsheet->getVisibility()); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write WorkbookProtection. + * + * @param XMLWriter $objWriter XML Writer + * @param Spreadsheet $spreadsheet + */ + private function writeWorkbookProtection(XMLWriter $objWriter, Spreadsheet $spreadsheet) + { + if ($spreadsheet->getSecurity()->isSecurityEnabled()) { + $objWriter->startElement('workbookProtection'); + $objWriter->writeAttribute('lockRevision', ($spreadsheet->getSecurity()->getLockRevision() ? 'true' : 'false')); + $objWriter->writeAttribute('lockStructure', ($spreadsheet->getSecurity()->getLockStructure() ? 'true' : 'false')); + $objWriter->writeAttribute('lockWindows', ($spreadsheet->getSecurity()->getLockWindows() ? 'true' : 'false')); + + if ($spreadsheet->getSecurity()->getRevisionsPassword() != '') { + $objWriter->writeAttribute('revisionsPassword', $spreadsheet->getSecurity()->getRevisionsPassword()); + } + + if ($spreadsheet->getSecurity()->getWorkbookPassword() != '') { + $objWriter->writeAttribute('workbookPassword', $spreadsheet->getSecurity()->getWorkbookPassword()); + } + + $objWriter->endElement(); + } + } + + /** + * Write calcPr. + * + * @param XMLWriter $objWriter XML Writer + * @param bool $recalcRequired Indicate whether formulas should be recalculated before writing + */ + private function writeCalcPr(XMLWriter $objWriter, $recalcRequired = true) + { + $objWriter->startElement('calcPr'); + + // Set the calcid to a higher value than Excel itself will use, otherwise Excel will always recalc + // If MS Excel does do a recalc, then users opening a file in MS Excel will be prompted to save on exit + // because the file has changed + $objWriter->writeAttribute('calcId', '999999'); + $objWriter->writeAttribute('calcMode', 'auto'); + // fullCalcOnLoad isn't needed if we've recalculating for the save + $objWriter->writeAttribute('calcCompleted', ($recalcRequired) ? 1 : 0); + $objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? 0 : 1); + $objWriter->writeAttribute('forceFullCalc', ($recalcRequired) ? 0 : 1); + + $objWriter->endElement(); + } + + /** + * Write sheets. + * + * @param XMLWriter $objWriter XML Writer + * @param Spreadsheet $spreadsheet + * + * @throws WriterException + */ + private function writeSheets(XMLWriter $objWriter, Spreadsheet $spreadsheet) + { + // Write sheets + $objWriter->startElement('sheets'); + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + // sheet + $this->writeSheet( + $objWriter, + $spreadsheet->getSheet($i)->getTitle(), + ($i + 1), + ($i + 1 + 3), + $spreadsheet->getSheet($i)->getSheetState() + ); + } + + $objWriter->endElement(); + } + + /** + * Write sheet. + * + * @param XMLWriter $objWriter XML Writer + * @param string $pSheetname Sheet name + * @param int $pSheetId Sheet id + * @param int $pRelId Relationship ID + * @param string $sheetState Sheet state (visible, hidden, veryHidden) + * + * @throws WriterException + */ + private function writeSheet(XMLWriter $objWriter, $pSheetname, $pSheetId = 1, $pRelId = 1, $sheetState = 'visible') + { + if ($pSheetname != '') { + // Write sheet + $objWriter->startElement('sheet'); + $objWriter->writeAttribute('name', $pSheetname); + $objWriter->writeAttribute('sheetId', $pSheetId); + if ($sheetState !== 'visible' && $sheetState != '') { + $objWriter->writeAttribute('state', $sheetState); + } + $objWriter->writeAttribute('r:id', 'rId' . $pRelId); + $objWriter->endElement(); + } else { + throw new WriterException('Invalid parameters passed.'); + } + } + + /** + * Write Defined Names. + * + * @param XMLWriter $objWriter XML Writer + * @param Spreadsheet $spreadsheet + * + * @throws WriterException + */ + private function writeDefinedNames(XMLWriter $objWriter, Spreadsheet $spreadsheet) + { + // Write defined names + $objWriter->startElement('definedNames'); + + // Named ranges + if (count($spreadsheet->getNamedRanges()) > 0) { + // Named ranges + $this->writeNamedRanges($objWriter, $spreadsheet); + } + + // Other defined names + $sheetCount = $spreadsheet->getSheetCount(); + for ($i = 0; $i < $sheetCount; ++$i) { + // definedName for autoFilter + $this->writeDefinedNameForAutofilter($objWriter, $spreadsheet->getSheet($i), $i); + + // definedName for Print_Titles + $this->writeDefinedNameForPrintTitles($objWriter, $spreadsheet->getSheet($i), $i); + + // definedName for Print_Area + $this->writeDefinedNameForPrintArea($objWriter, $spreadsheet->getSheet($i), $i); + } + + $objWriter->endElement(); + } + + /** + * Write named ranges. + * + * @param XMLWriter $objWriter XML Writer + * @param Spreadsheet $spreadsheet + * + * @throws WriterException + */ + private function writeNamedRanges(XMLWriter $objWriter, Spreadsheet $spreadsheet) + { + // Loop named ranges + $namedRanges = $spreadsheet->getNamedRanges(); + foreach ($namedRanges as $namedRange) { + $this->writeDefinedNameForNamedRange($objWriter, $namedRange); + } + } + + /** + * Write Defined Name for named range. + * + * @param XMLWriter $objWriter XML Writer + * @param NamedRange $pNamedRange + */ + private function writeDefinedNameForNamedRange(XMLWriter $objWriter, NamedRange $pNamedRange) + { + // definedName for named range + $objWriter->startElement('definedName'); + $objWriter->writeAttribute('name', $pNamedRange->getName()); + if ($pNamedRange->getLocalOnly()) { + $objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope())); + } + + // Create absolute coordinate and write as raw text + $range = Coordinate::splitRange($pNamedRange->getRange()); + $iMax = count($range); + for ($i = 0; $i < $iMax; ++$i) { + $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . Coordinate::absoluteReference($range[$i][0]); + if (isset($range[$i][1])) { + $range[$i][1] = Coordinate::absoluteReference($range[$i][1]); + } + } + $range = Coordinate::buildRange($range); + + $objWriter->writeRawData($range); + + $objWriter->endElement(); + } + + /** + * Write Defined Name for autoFilter. + * + * @param XMLWriter $objWriter XML Writer + * @param Worksheet $pSheet + * @param int $pSheetId + */ + private function writeDefinedNameForAutofilter(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0) + { + // definedName for autoFilter + $autoFilterRange = $pSheet->getAutoFilter()->getRange(); + if (!empty($autoFilterRange)) { + $objWriter->startElement('definedName'); + $objWriter->writeAttribute('name', '_xlnm._FilterDatabase'); + $objWriter->writeAttribute('localSheetId', $pSheetId); + $objWriter->writeAttribute('hidden', '1'); + + // Create absolute coordinate and write as raw text + $range = Coordinate::splitRange($autoFilterRange); + $range = $range[0]; + // Strip any worksheet ref so we can make the cell ref absolute + [$ws, $range[0]] = Worksheet::extractSheetTitle($range[0], true); + + $range[0] = Coordinate::absoluteCoordinate($range[0]); + $range[1] = Coordinate::absoluteCoordinate($range[1]); + $range = implode(':', $range); + + $objWriter->writeRawData('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range); + + $objWriter->endElement(); + } + } + + /** + * Write Defined Name for PrintTitles. + * + * @param XMLWriter $objWriter XML Writer + * @param Worksheet $pSheet + * @param int $pSheetId + */ + private function writeDefinedNameForPrintTitles(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0) + { + // definedName for PrintTitles + if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { + $objWriter->startElement('definedName'); + $objWriter->writeAttribute('name', '_xlnm.Print_Titles'); + $objWriter->writeAttribute('localSheetId', $pSheetId); + + // Setting string + $settingString = ''; + + // Columns to repeat + if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) { + $repeat = $pSheet->getPageSetup()->getColumnsToRepeatAtLeft(); + + $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1]; + } + + // Rows to repeat + if ($pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { + if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) { + $settingString .= ','; + } + + $repeat = $pSheet->getPageSetup()->getRowsToRepeatAtTop(); + + $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1]; + } + + $objWriter->writeRawData($settingString); + + $objWriter->endElement(); + } + } + + /** + * Write Defined Name for PrintTitles. + * + * @param XMLWriter $objWriter XML Writer + * @param Worksheet $pSheet + * @param int $pSheetId + */ + private function writeDefinedNameForPrintArea(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0) + { + // definedName for PrintArea + if ($pSheet->getPageSetup()->isPrintAreaSet()) { + $objWriter->startElement('definedName'); + $objWriter->writeAttribute('name', '_xlnm.Print_Area'); + $objWriter->writeAttribute('localSheetId', $pSheetId); + + // Print area + $printArea = Coordinate::splitRange($pSheet->getPageSetup()->getPrintArea()); + + $chunks = []; + foreach ($printArea as $printAreaRect) { + $printAreaRect[0] = Coordinate::absoluteReference($printAreaRect[0]); + $printAreaRect[1] = Coordinate::absoluteReference($printAreaRect[1]); + $chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect); + } + + $objWriter->writeRawData(implode(',', $chunks)); + + $objWriter->endElement(); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php new file mode 100644 index 0000000..1d5a995 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php @@ -0,0 +1,1241 @@ +getParentWriter()->getUseDiskCaching()) { + $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); + } else { + $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); + } + + // XML header + $objWriter->startDocument('1.0', 'UTF-8', 'yes'); + + // Worksheet + $objWriter->startElement('worksheet'); + $objWriter->writeAttribute('xml:space', 'preserve'); + $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); + $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); + + $objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing'); + $objWriter->writeAttribute('xmlns:x14', 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/main'); + $objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006'); + $objWriter->writeAttribute('mc:Ignorable', 'x14ac'); + $objWriter->writeAttribute('xmlns:x14ac', 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac'); + + // sheetPr + $this->writeSheetPr($objWriter, $pSheet); + + // Dimension + $this->writeDimension($objWriter, $pSheet); + + // sheetViews + $this->writeSheetViews($objWriter, $pSheet); + + // sheetFormatPr + $this->writeSheetFormatPr($objWriter, $pSheet); + + // cols + $this->writeCols($objWriter, $pSheet); + + // sheetData + $this->writeSheetData($objWriter, $pSheet, $pStringTable); + + // sheetProtection + $this->writeSheetProtection($objWriter, $pSheet); + + // protectedRanges + $this->writeProtectedRanges($objWriter, $pSheet); + + // autoFilter + $this->writeAutoFilter($objWriter, $pSheet); + + // mergeCells + $this->writeMergeCells($objWriter, $pSheet); + + // conditionalFormatting + $this->writeConditionalFormatting($objWriter, $pSheet); + + // dataValidations + $this->writeDataValidations($objWriter, $pSheet); + + // hyperlinks + $this->writeHyperlinks($objWriter, $pSheet); + + // Print options + $this->writePrintOptions($objWriter, $pSheet); + + // Page margins + $this->writePageMargins($objWriter, $pSheet); + + // Page setup + $this->writePageSetup($objWriter, $pSheet); + + // Header / footer + $this->writeHeaderFooter($objWriter, $pSheet); + + // Breaks + $this->writeBreaks($objWriter, $pSheet); + + // Drawings and/or Charts + $this->writeDrawings($objWriter, $pSheet, $includeCharts); + + // LegacyDrawing + $this->writeLegacyDrawing($objWriter, $pSheet); + + // LegacyDrawingHF + $this->writeLegacyDrawingHF($objWriter, $pSheet); + + // AlternateContent + $this->writeAlternateContent($objWriter, $pSheet); + + $objWriter->endElement(); + + // Return + return $objWriter->getData(); + } + + /** + * Write SheetPr. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeSheetPr(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // sheetPr + $objWriter->startElement('sheetPr'); + if ($pSheet->getParent()->hasMacros()) { + //if the workbook have macros, we need to have codeName for the sheet + if (!$pSheet->hasCodeName()) { + $pSheet->setCodeName($pSheet->getTitle()); + } + $objWriter->writeAttribute('codeName', $pSheet->getCodeName()); + } + $autoFilterRange = $pSheet->getAutoFilter()->getRange(); + if (!empty($autoFilterRange)) { + $objWriter->writeAttribute('filterMode', 1); + $pSheet->getAutoFilter()->showHideRows(); + } + + // tabColor + if ($pSheet->isTabColorSet()) { + $objWriter->startElement('tabColor'); + $objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB()); + $objWriter->endElement(); + } + + // outlinePr + $objWriter->startElement('outlinePr'); + $objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0')); + $objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0')); + $objWriter->endElement(); + + // pageSetUpPr + if ($pSheet->getPageSetup()->getFitToPage()) { + $objWriter->startElement('pageSetUpPr'); + $objWriter->writeAttribute('fitToPage', '1'); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + /** + * Write Dimension. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeDimension(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // dimension + $objWriter->startElement('dimension'); + $objWriter->writeAttribute('ref', $pSheet->calculateWorksheetDimension()); + $objWriter->endElement(); + } + + /** + * Write SheetViews. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + * + * @throws WriterException + */ + private function writeSheetViews(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // sheetViews + $objWriter->startElement('sheetViews'); + + // Sheet selected? + $sheetSelected = false; + if ($this->getParentWriter()->getSpreadsheet()->getIndex($pSheet) == $this->getParentWriter()->getSpreadsheet()->getActiveSheetIndex()) { + $sheetSelected = true; + } + + // sheetView + $objWriter->startElement('sheetView'); + $objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0'); + $objWriter->writeAttribute('workbookViewId', '0'); + + // Zoom scales + if ($pSheet->getSheetView()->getZoomScale() != 100) { + $objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale()); + } + if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) { + $objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal()); + } + + // Show zeros (Excel also writes this attribute only if set to false) + if ($pSheet->getSheetView()->getShowZeros() === false) { + $objWriter->writeAttribute('showZeros', 0); + } + + // View Layout Type + if ($pSheet->getSheetView()->getView() !== SheetView::SHEETVIEW_NORMAL) { + $objWriter->writeAttribute('view', $pSheet->getSheetView()->getView()); + } + + // Gridlines + if ($pSheet->getShowGridlines()) { + $objWriter->writeAttribute('showGridLines', 'true'); + } else { + $objWriter->writeAttribute('showGridLines', 'false'); + } + + // Row and column headers + if ($pSheet->getShowRowColHeaders()) { + $objWriter->writeAttribute('showRowColHeaders', '1'); + } else { + $objWriter->writeAttribute('showRowColHeaders', '0'); + } + + // Right-to-left + if ($pSheet->getRightToLeft()) { + $objWriter->writeAttribute('rightToLeft', 'true'); + } + + $activeCell = $pSheet->getActiveCell(); + $sqref = $pSheet->getSelectedCells(); + + // Pane + $pane = ''; + if ($pSheet->getFreezePane()) { + [$xSplit, $ySplit] = Coordinate::coordinateFromString($pSheet->getFreezePane()); + $xSplit = Coordinate::columnIndexFromString($xSplit); + --$xSplit; + --$ySplit; + + $topLeftCell = $pSheet->getTopLeftCell(); + + // pane + $pane = 'topRight'; + $objWriter->startElement('pane'); + if ($xSplit > 0) { + $objWriter->writeAttribute('xSplit', $xSplit); + } + if ($ySplit > 0) { + $objWriter->writeAttribute('ySplit', $ySplit); + $pane = ($xSplit > 0) ? 'bottomRight' : 'bottomLeft'; + } + $objWriter->writeAttribute('topLeftCell', $topLeftCell); + $objWriter->writeAttribute('activePane', $pane); + $objWriter->writeAttribute('state', 'frozen'); + $objWriter->endElement(); + + if (($xSplit > 0) && ($ySplit > 0)) { + // Write additional selections if more than two panes (ie both an X and a Y split) + $objWriter->startElement('selection'); + $objWriter->writeAttribute('pane', 'topRight'); + $objWriter->endElement(); + $objWriter->startElement('selection'); + $objWriter->writeAttribute('pane', 'bottomLeft'); + $objWriter->endElement(); + } + } + + // Selection + // Only need to write selection element if we have a split pane + // We cheat a little by over-riding the active cell selection, setting it to the split cell + $objWriter->startElement('selection'); + if ($pane != '') { + $objWriter->writeAttribute('pane', $pane); + } + $objWriter->writeAttribute('activeCell', $activeCell); + $objWriter->writeAttribute('sqref', $sqref); + $objWriter->endElement(); + + $objWriter->endElement(); + + $objWriter->endElement(); + } + + /** + * Write SheetFormatPr. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeSheetFormatPr(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // sheetFormatPr + $objWriter->startElement('sheetFormatPr'); + + // Default row height + if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) { + $objWriter->writeAttribute('customHeight', 'true'); + $objWriter->writeAttribute('defaultRowHeight', StringHelper::formatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); + } else { + $objWriter->writeAttribute('defaultRowHeight', '14.4'); + } + + // Set Zero Height row + if ((string) $pSheet->getDefaultRowDimension()->getZeroHeight() === '1' || + strtolower((string) $pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true') { + $objWriter->writeAttribute('zeroHeight', '1'); + } + + // Default column width + if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) { + $objWriter->writeAttribute('defaultColWidth', StringHelper::formatNumber($pSheet->getDefaultColumnDimension()->getWidth())); + } + + // Outline level - row + $outlineLevelRow = 0; + foreach ($pSheet->getRowDimensions() as $dimension) { + if ($dimension->getOutlineLevel() > $outlineLevelRow) { + $outlineLevelRow = $dimension->getOutlineLevel(); + } + } + $objWriter->writeAttribute('outlineLevelRow', (int) $outlineLevelRow); + + // Outline level - column + $outlineLevelCol = 0; + foreach ($pSheet->getColumnDimensions() as $dimension) { + if ($dimension->getOutlineLevel() > $outlineLevelCol) { + $outlineLevelCol = $dimension->getOutlineLevel(); + } + } + $objWriter->writeAttribute('outlineLevelCol', (int) $outlineLevelCol); + + $objWriter->endElement(); + } + + /** + * Write Cols. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeCols(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // cols + if (count($pSheet->getColumnDimensions()) > 0) { + $objWriter->startElement('cols'); + + $pSheet->calculateColumnWidths(); + + // Loop through column dimensions + foreach ($pSheet->getColumnDimensions() as $colDimension) { + // col + $objWriter->startElement('col'); + $objWriter->writeAttribute('min', Coordinate::columnIndexFromString($colDimension->getColumnIndex())); + $objWriter->writeAttribute('max', Coordinate::columnIndexFromString($colDimension->getColumnIndex())); + + if ($colDimension->getWidth() < 0) { + // No width set, apply default of 10 + $objWriter->writeAttribute('width', '9.10'); + } else { + // Width set + $objWriter->writeAttribute('width', StringHelper::formatNumber($colDimension->getWidth())); + } + + // Column visibility + if ($colDimension->getVisible() === false) { + $objWriter->writeAttribute('hidden', 'true'); + } + + // Auto size? + if ($colDimension->getAutoSize()) { + $objWriter->writeAttribute('bestFit', 'true'); + } + + // Custom width? + if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) { + $objWriter->writeAttribute('customWidth', 'true'); + } + + // Collapsed + if ($colDimension->getCollapsed() === true) { + $objWriter->writeAttribute('collapsed', 'true'); + } + + // Outline level + if ($colDimension->getOutlineLevel() > 0) { + $objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel()); + } + + // Style + $objWriter->writeAttribute('style', $colDimension->getXfIndex()); + + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write SheetProtection. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeSheetProtection(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // sheetProtection + $objWriter->startElement('sheetProtection'); + + if ($pSheet->getProtection()->getPassword() !== '') { + $objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword()); + } + + $objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false')); + $objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false')); + $objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false')); + $objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false')); + $objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false')); + $objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false')); + $objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false')); + $objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false')); + $objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false')); + $objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false')); + $objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false')); + $objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false')); + $objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false')); + $objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false')); + $objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false')); + $objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false')); + $objWriter->endElement(); + } + + /** + * Write ConditionalFormatting. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + * + * @throws WriterException + */ + private function writeConditionalFormatting(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // Conditional id + $id = 1; + + // Loop through styles in the current worksheet + foreach ($pSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) { + foreach ($conditionalStyles as $conditional) { + // WHY was this again? + // if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()) == '') { + // continue; + // } + if ($conditional->getConditionType() != Conditional::CONDITION_NONE) { + // conditionalFormatting + $objWriter->startElement('conditionalFormatting'); + $objWriter->writeAttribute('sqref', $cellCoordinate); + + // cfRule + $objWriter->startElement('cfRule'); + $objWriter->writeAttribute('type', $conditional->getConditionType()); + $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode())); + $objWriter->writeAttribute('priority', $id++); + + if (($conditional->getConditionType() == Conditional::CONDITION_CELLIS || $conditional->getConditionType() == Conditional::CONDITION_CONTAINSTEXT) + && $conditional->getOperatorType() != Conditional::OPERATOR_NONE) { + $objWriter->writeAttribute('operator', $conditional->getOperatorType()); + } + + if ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSTEXT + && $conditional->getText() !== null) { + $objWriter->writeAttribute('text', $conditional->getText()); + } + + if ($conditional->getStopIfTrue()) { + $objWriter->writeAttribute('stopIfTrue', '1'); + } + + if ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == Conditional::OPERATOR_CONTAINSTEXT + && $conditional->getText() !== null) { + $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))'); + } elseif ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == Conditional::OPERATOR_BEGINSWITH + && $conditional->getText() !== null) { + $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); + } elseif ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == Conditional::OPERATOR_ENDSWITH + && $conditional->getText() !== null) { + $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); + } elseif ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSTEXT + && $conditional->getOperatorType() == Conditional::OPERATOR_NOTCONTAINS + && $conditional->getText() !== null) { + $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))'); + } elseif ($conditional->getConditionType() == Conditional::CONDITION_CELLIS + || $conditional->getConditionType() == Conditional::CONDITION_CONTAINSTEXT + || $conditional->getConditionType() == Conditional::CONDITION_EXPRESSION) { + foreach ($conditional->getConditions() as $formula) { + // Formula + $objWriter->writeElement('formula', $formula); + } + } elseif ($conditional->getConditionType() == Conditional::CONDITION_CONTAINSBLANKS) { + // formula copied from ms xlsx xml source file + $objWriter->writeElement('formula', 'LEN(TRIM(' . $cellCoordinate . '))=0'); + } elseif ($conditional->getConditionType() == Conditional::CONDITION_NOTCONTAINSBLANKS) { + // formula copied from ms xlsx xml source file + $objWriter->writeElement('formula', 'LEN(TRIM(' . $cellCoordinate . '))>0'); + } + + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + } + } + + /** + * Write DataValidations. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeDataValidations(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // Datavalidation collection + $dataValidationCollection = $pSheet->getDataValidationCollection(); + + // Write data validations? + if (!empty($dataValidationCollection)) { + $dataValidationCollection = Coordinate::mergeRangesInCollection($dataValidationCollection); + $objWriter->startElement('dataValidations'); + $objWriter->writeAttribute('count', count($dataValidationCollection)); + + foreach ($dataValidationCollection as $coordinate => $dv) { + $objWriter->startElement('dataValidation'); + + if ($dv->getType() != '') { + $objWriter->writeAttribute('type', $dv->getType()); + } + + if ($dv->getErrorStyle() != '') { + $objWriter->writeAttribute('errorStyle', $dv->getErrorStyle()); + } + + if ($dv->getOperator() != '') { + $objWriter->writeAttribute('operator', $dv->getOperator()); + } + + $objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0')); + $objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0')); + $objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0')); + $objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0')); + + if ($dv->getErrorTitle() !== '') { + $objWriter->writeAttribute('errorTitle', $dv->getErrorTitle()); + } + if ($dv->getError() !== '') { + $objWriter->writeAttribute('error', $dv->getError()); + } + if ($dv->getPromptTitle() !== '') { + $objWriter->writeAttribute('promptTitle', $dv->getPromptTitle()); + } + if ($dv->getPrompt() !== '') { + $objWriter->writeAttribute('prompt', $dv->getPrompt()); + } + + $objWriter->writeAttribute('sqref', $coordinate); + + if ($dv->getFormula1() !== '') { + $objWriter->writeElement('formula1', $dv->getFormula1()); + } + if ($dv->getFormula2() !== '') { + $objWriter->writeElement('formula2', $dv->getFormula2()); + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write Hyperlinks. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeHyperlinks(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // Hyperlink collection + $hyperlinkCollection = $pSheet->getHyperlinkCollection(); + + // Relation ID + $relationId = 1; + + // Write hyperlinks? + if (!empty($hyperlinkCollection)) { + $objWriter->startElement('hyperlinks'); + + foreach ($hyperlinkCollection as $coordinate => $hyperlink) { + $objWriter->startElement('hyperlink'); + + $objWriter->writeAttribute('ref', $coordinate); + if (!$hyperlink->isInternal()) { + $objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId); + ++$relationId; + } else { + $objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl())); + } + + if ($hyperlink->getTooltip() !== '') { + $objWriter->writeAttribute('tooltip', $hyperlink->getTooltip()); + $objWriter->writeAttribute('display', $hyperlink->getTooltip()); + } + + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write ProtectedRanges. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeProtectedRanges(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + if (count($pSheet->getProtectedCells()) > 0) { + // protectedRanges + $objWriter->startElement('protectedRanges'); + + // Loop protectedRanges + foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) { + // protectedRange + $objWriter->startElement('protectedRange'); + $objWriter->writeAttribute('name', 'p' . md5($protectedCell)); + $objWriter->writeAttribute('sqref', $protectedCell); + if (!empty($passwordHash)) { + $objWriter->writeAttribute('password', $passwordHash); + } + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write MergeCells. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeMergeCells(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + if (count($pSheet->getMergeCells()) > 0) { + // mergeCells + $objWriter->startElement('mergeCells'); + + // Loop mergeCells + foreach ($pSheet->getMergeCells() as $mergeCell) { + // mergeCell + $objWriter->startElement('mergeCell'); + $objWriter->writeAttribute('ref', $mergeCell); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write PrintOptions. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writePrintOptions(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // printOptions + $objWriter->startElement('printOptions'); + + $objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true' : 'false')); + $objWriter->writeAttribute('gridLinesSet', 'true'); + + if ($pSheet->getPageSetup()->getHorizontalCentered()) { + $objWriter->writeAttribute('horizontalCentered', 'true'); + } + + if ($pSheet->getPageSetup()->getVerticalCentered()) { + $objWriter->writeAttribute('verticalCentered', 'true'); + } + + $objWriter->endElement(); + } + + /** + * Write PageMargins. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writePageMargins(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // pageMargins + $objWriter->startElement('pageMargins'); + $objWriter->writeAttribute('left', StringHelper::formatNumber($pSheet->getPageMargins()->getLeft())); + $objWriter->writeAttribute('right', StringHelper::formatNumber($pSheet->getPageMargins()->getRight())); + $objWriter->writeAttribute('top', StringHelper::formatNumber($pSheet->getPageMargins()->getTop())); + $objWriter->writeAttribute('bottom', StringHelper::formatNumber($pSheet->getPageMargins()->getBottom())); + $objWriter->writeAttribute('header', StringHelper::formatNumber($pSheet->getPageMargins()->getHeader())); + $objWriter->writeAttribute('footer', StringHelper::formatNumber($pSheet->getPageMargins()->getFooter())); + $objWriter->endElement(); + } + + /** + * Write AutoFilter. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeAutoFilter(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + $autoFilterRange = $pSheet->getAutoFilter()->getRange(); + if (!empty($autoFilterRange)) { + // autoFilter + $objWriter->startElement('autoFilter'); + + // Strip any worksheet reference from the filter coordinates + $range = Coordinate::splitRange($autoFilterRange); + $range = $range[0]; + // Strip any worksheet ref + [$ws, $range[0]] = PhpspreadsheetWorksheet::extractSheetTitle($range[0], true); + $range = implode(':', $range); + + $objWriter->writeAttribute('ref', str_replace('$', '', $range)); + + $columns = $pSheet->getAutoFilter()->getColumns(); + if (count($columns) > 0) { + foreach ($columns as $columnID => $column) { + $rules = $column->getRules(); + if (count($rules) > 0) { + $objWriter->startElement('filterColumn'); + $objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID)); + + $objWriter->startElement($column->getFilterType()); + if ($column->getJoin() == Column::AUTOFILTER_COLUMN_JOIN_AND) { + $objWriter->writeAttribute('and', 1); + } + + foreach ($rules as $rule) { + if (($column->getFilterType() === Column::AUTOFILTER_FILTERTYPE_FILTER) && + ($rule->getOperator() === Rule::AUTOFILTER_COLUMN_RULE_EQUAL) && + ($rule->getValue() === '')) { + // Filter rule for Blanks + $objWriter->writeAttribute('blank', 1); + } elseif ($rule->getRuleType() === Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) { + // Dynamic Filter Rule + $objWriter->writeAttribute('type', $rule->getGrouping()); + $val = $column->getAttribute('val'); + if ($val !== null) { + $objWriter->writeAttribute('val', $val); + } + $maxVal = $column->getAttribute('maxVal'); + if ($maxVal !== null) { + $objWriter->writeAttribute('maxVal', $maxVal); + } + } elseif ($rule->getRuleType() === Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) { + // Top 10 Filter Rule + $objWriter->writeAttribute('val', $rule->getValue()); + $objWriter->writeAttribute('percent', (($rule->getOperator() === Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0')); + $objWriter->writeAttribute('top', (($rule->getGrouping() === Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1' : '0')); + } else { + // Filter, DateGroupItem or CustomFilter + $objWriter->startElement($rule->getRuleType()); + + if ($rule->getOperator() !== Rule::AUTOFILTER_COLUMN_RULE_EQUAL) { + $objWriter->writeAttribute('operator', $rule->getOperator()); + } + if ($rule->getRuleType() === Rule::AUTOFILTER_RULETYPE_DATEGROUP) { + // Date Group filters + foreach ($rule->getValue() as $key => $value) { + if ($value > '') { + $objWriter->writeAttribute($key, $value); + } + } + $objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping()); + } else { + $objWriter->writeAttribute('val', $rule->getValue()); + } + + $objWriter->endElement(); + } + } + + $objWriter->endElement(); + + $objWriter->endElement(); + } + } + } + $objWriter->endElement(); + } + } + + /** + * Write PageSetup. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writePageSetup(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // pageSetup + $objWriter->startElement('pageSetup'); + $objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize()); + $objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation()); + + if ($pSheet->getPageSetup()->getScale() !== null) { + $objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale()); + } + if ($pSheet->getPageSetup()->getFitToHeight() !== null) { + $objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight()); + } else { + $objWriter->writeAttribute('fitToHeight', '0'); + } + if ($pSheet->getPageSetup()->getFitToWidth() !== null) { + $objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth()); + } else { + $objWriter->writeAttribute('fitToWidth', '0'); + } + if ($pSheet->getPageSetup()->getFirstPageNumber() !== null) { + $objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber()); + $objWriter->writeAttribute('useFirstPageNumber', '1'); + } + + $getUnparsedLoadedData = $pSheet->getParent()->getUnparsedLoadedData(); + if (isset($getUnparsedLoadedData['sheets'][$pSheet->getCodeName()]['pageSetupRelId'])) { + $objWriter->writeAttribute('r:id', $getUnparsedLoadedData['sheets'][$pSheet->getCodeName()]['pageSetupRelId']); + } + + $objWriter->endElement(); + } + + /** + * Write Header / Footer. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeHeaderFooter(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // headerFooter + $objWriter->startElement('headerFooter'); + $objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false')); + $objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false')); + $objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false')); + $objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false')); + + $objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader()); + $objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter()); + $objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader()); + $objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter()); + $objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader()); + $objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter()); + $objWriter->endElement(); + } + + /** + * Write Breaks. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeBreaks(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // Get row and column breaks + $aRowBreaks = []; + $aColumnBreaks = []; + foreach ($pSheet->getBreaks() as $cell => $breakType) { + if ($breakType == PhpspreadsheetWorksheet::BREAK_ROW) { + $aRowBreaks[] = $cell; + } elseif ($breakType == PhpspreadsheetWorksheet::BREAK_COLUMN) { + $aColumnBreaks[] = $cell; + } + } + + // rowBreaks + if (!empty($aRowBreaks)) { + $objWriter->startElement('rowBreaks'); + $objWriter->writeAttribute('count', count($aRowBreaks)); + $objWriter->writeAttribute('manualBreakCount', count($aRowBreaks)); + + foreach ($aRowBreaks as $cell) { + $coords = Coordinate::coordinateFromString($cell); + + $objWriter->startElement('brk'); + $objWriter->writeAttribute('id', $coords[1]); + $objWriter->writeAttribute('man', '1'); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + + // Second, write column breaks + if (!empty($aColumnBreaks)) { + $objWriter->startElement('colBreaks'); + $objWriter->writeAttribute('count', count($aColumnBreaks)); + $objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks)); + + foreach ($aColumnBreaks as $cell) { + $coords = Coordinate::coordinateFromString($cell); + + $objWriter->startElement('brk'); + $objWriter->writeAttribute('id', Coordinate::columnIndexFromString($coords[0]) - 1); + $objWriter->writeAttribute('man', '1'); + $objWriter->endElement(); + } + + $objWriter->endElement(); + } + } + + /** + * Write SheetData. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + * @param string[] $pStringTable String table + * + * @throws WriterException + */ + private function writeSheetData(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, array $pStringTable) + { + // Flipped stringtable, for faster index searching + $aFlippedStringTable = $this->getParentWriter()->getWriterPart('stringtable')->flipStringTable($pStringTable); + + // sheetData + $objWriter->startElement('sheetData'); + + // Get column count + $colCount = Coordinate::columnIndexFromString($pSheet->getHighestColumn()); + + // Highest row number + $highestRow = $pSheet->getHighestRow(); + + // Loop through cells + $cellsByRow = []; + foreach ($pSheet->getCoordinates() as $coordinate) { + $cellAddress = Coordinate::coordinateFromString($coordinate); + $cellsByRow[$cellAddress[1]][] = $coordinate; + } + + $currentRow = 0; + while ($currentRow++ < $highestRow) { + // Get row dimension + $rowDimension = $pSheet->getRowDimension($currentRow); + + // Write current row? + $writeCurrentRow = isset($cellsByRow[$currentRow]) || $rowDimension->getRowHeight() >= 0 || $rowDimension->getVisible() == false || $rowDimension->getCollapsed() == true || $rowDimension->getOutlineLevel() > 0 || $rowDimension->getXfIndex() !== null; + + if ($writeCurrentRow) { + // Start a new row + $objWriter->startElement('row'); + $objWriter->writeAttribute('r', $currentRow); + $objWriter->writeAttribute('spans', '1:' . $colCount); + + // Row dimensions + if ($rowDimension->getRowHeight() >= 0) { + $objWriter->writeAttribute('customHeight', '1'); + $objWriter->writeAttribute('ht', StringHelper::formatNumber($rowDimension->getRowHeight())); + } + + // Row visibility + if (!$rowDimension->getVisible() === true) { + $objWriter->writeAttribute('hidden', 'true'); + } + + // Collapsed + if ($rowDimension->getCollapsed() === true) { + $objWriter->writeAttribute('collapsed', 'true'); + } + + // Outline level + if ($rowDimension->getOutlineLevel() > 0) { + $objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel()); + } + + // Style + if ($rowDimension->getXfIndex() !== null) { + $objWriter->writeAttribute('s', $rowDimension->getXfIndex()); + $objWriter->writeAttribute('customFormat', '1'); + } + + // Write cells + if (isset($cellsByRow[$currentRow])) { + foreach ($cellsByRow[$currentRow] as $cellAddress) { + // Write cell + $this->writeCell($objWriter, $pSheet, $cellAddress, $aFlippedStringTable); + } + } + + // End row + $objWriter->endElement(); + } + } + + $objWriter->endElement(); + } + + /** + * Write Cell. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + * @param Cell $pCellAddress Cell Address + * @param string[] $pFlippedStringTable String table (flipped), for faster index searching + * + * @throws WriterException + */ + private function writeCell(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, $pCellAddress, array $pFlippedStringTable) + { + // Cell + $pCell = $pSheet->getCell($pCellAddress); + $objWriter->startElement('c'); + $objWriter->writeAttribute('r', $pCellAddress); + + // Sheet styles + if ($pCell->getXfIndex() != '') { + $objWriter->writeAttribute('s', $pCell->getXfIndex()); + } + + // If cell value is supplied, write cell value + $cellValue = $pCell->getValue(); + if (is_object($cellValue) || $cellValue !== '') { + // Map type + $mappedType = $pCell->getDataType(); + + // Write data type depending on its type + switch (strtolower($mappedType)) { + case 'inlinestr': // Inline string + case 's': // String + case 'b': // Boolean + $objWriter->writeAttribute('t', $mappedType); + + break; + case 'f': // Formula + $calculatedValue = ($this->getParentWriter()->getPreCalculateFormulas()) ? + $pCell->getCalculatedValue() : $cellValue; + if (is_string($calculatedValue)) { + $objWriter->writeAttribute('t', 'str'); + } elseif (is_bool($calculatedValue)) { + $objWriter->writeAttribute('t', 'b'); + } + + break; + case 'e': // Error + $objWriter->writeAttribute('t', $mappedType); + } + + // Write data depending on its type + switch (strtolower($mappedType)) { + case 'inlinestr': // Inline string + if (!$cellValue instanceof RichText) { + $objWriter->writeElement('t', StringHelper::controlCharacterPHP2OOXML(htmlspecialchars($cellValue))); + } elseif ($cellValue instanceof RichText) { + $objWriter->startElement('is'); + $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue); + $objWriter->endElement(); + } + + break; + case 's': // String + if (!$cellValue instanceof RichText) { + if (isset($pFlippedStringTable[$cellValue])) { + $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]); + } + } elseif ($cellValue instanceof RichText) { + $objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]); + } + + break; + case 'f': // Formula + $attributes = $pCell->getFormulaAttributes(); + if (($attributes['t'] ?? null) === 'array') { + $objWriter->startElement('f'); + $objWriter->writeAttribute('t', 'array'); + $objWriter->writeAttribute('ref', $pCellAddress); + $objWriter->writeAttribute('aca', '1'); + $objWriter->writeAttribute('ca', '1'); + $objWriter->text(substr($cellValue, 1)); + $objWriter->endElement(); + } else { + $objWriter->writeElement('f', substr($cellValue, 1)); + } + if ($this->getParentWriter()->getOffice2003Compatibility() === false) { + if ($this->getParentWriter()->getPreCalculateFormulas()) { + if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) !== '#') { + $objWriter->writeElement('v', StringHelper::formatNumber($calculatedValue)); + } else { + $objWriter->writeElement('v', '0'); + } + } else { + $objWriter->writeElement('v', '0'); + } + } + + break; + case 'n': // Numeric + //force a decimal to be written if the type is float + if (is_float($cellValue)) { + // force point as decimal separator in case current locale uses comma + $cellValue = str_replace(',', '.', (string) $cellValue); + if (strpos($cellValue, '.') === false) { + $cellValue = $cellValue . '.0'; + } + } + $objWriter->writeElement('v', $cellValue); + + break; + case 'b': // Boolean + $objWriter->writeElement('v', ($cellValue ? '1' : '0')); + + break; + case 'e': // Error + if (substr($cellValue, 0, 1) === '=') { + $objWriter->writeElement('f', substr($cellValue, 1)); + $objWriter->writeElement('v', substr($cellValue, 1)); + } else { + $objWriter->writeElement('v', $cellValue); + } + + break; + } + } + + $objWriter->endElement(); + } + + /** + * Write Drawings. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + * @param bool $includeCharts Flag indicating if we should include drawing details for charts + */ + private function writeDrawings(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet, $includeCharts = false) + { + $unparsedLoadedData = $pSheet->getParent()->getUnparsedLoadedData(); + $hasUnparsedDrawing = isset($unparsedLoadedData['sheets'][$pSheet->getCodeName()]['drawingOriginalIds']); + $chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0; + if ($chartCount == 0 && $pSheet->getDrawingCollection()->count() == 0 && !$hasUnparsedDrawing) { + return; + } + + // If sheet contains drawings, add the relationships + $objWriter->startElement('drawing'); + + $rId = 'rId1'; + if (isset($unparsedLoadedData['sheets'][$pSheet->getCodeName()]['drawingOriginalIds'])) { + $drawingOriginalIds = $unparsedLoadedData['sheets'][$pSheet->getCodeName()]['drawingOriginalIds']; + // take first. In future can be overriten + $rId = reset($drawingOriginalIds); + } + + $objWriter->writeAttribute('r:id', $rId); + $objWriter->endElement(); + } + + /** + * Write LegacyDrawing. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeLegacyDrawing(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // If sheet contains comments, add the relationships + if (count($pSheet->getComments()) > 0) { + $objWriter->startElement('legacyDrawing'); + $objWriter->writeAttribute('r:id', 'rId_comments_vml1'); + $objWriter->endElement(); + } + } + + /** + * Write LegacyDrawingHF. + * + * @param XMLWriter $objWriter XML Writer + * @param PhpspreadsheetWorksheet $pSheet Worksheet + */ + private function writeLegacyDrawingHF(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + // If sheet contains images, add the relationships + if (count($pSheet->getHeaderFooter()->getImages()) > 0) { + $objWriter->startElement('legacyDrawingHF'); + $objWriter->writeAttribute('r:id', 'rId_headerfooter_vml1'); + $objWriter->endElement(); + } + } + + private function writeAlternateContent(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet) + { + if (empty($pSheet->getParent()->getUnparsedLoadedData()['sheets'][$pSheet->getCodeName()]['AlternateContents'])) { + return; + } + + foreach ($pSheet->getParent()->getUnparsedLoadedData()['sheets'][$pSheet->getCodeName()]['AlternateContents'] as $alternateContent) { + $objWriter->writeRaw($alternateContent); + } + } +} diff --git a/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php new file mode 100644 index 0000000..7119512 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/WriterPart.php @@ -0,0 +1,35 @@ +parentWriter; + } + + /** + * Set parent Xlsx object. + * + * @param Xlsx $pWriter + */ + public function __construct(Xlsx $pWriter) + { + $this->parentWriter = $pWriter; + } +} diff --git a/libraries/phpspreadsheet/vendor/psr/simple-cache/.editorconfig b/libraries/phpspreadsheet/vendor/psr/simple-cache/.editorconfig new file mode 100644 index 0000000..48542cb --- /dev/null +++ b/libraries/phpspreadsheet/vendor/psr/simple-cache/.editorconfig @@ -0,0 +1,12 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_size = 4 +indent_style = space +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/libraries/phpspreadsheet/vendor/psr/simple-cache/LICENSE.md b/libraries/phpspreadsheet/vendor/psr/simple-cache/LICENSE.md new file mode 100644 index 0000000..e49a7c8 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/psr/simple-cache/LICENSE.md @@ -0,0 +1,21 @@ +# The MIT License (MIT) + +Copyright (c) 2016 PHP Framework Interoperability Group + +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. diff --git a/libraries/phpspreadsheet/vendor/psr/simple-cache/README.md b/libraries/phpspreadsheet/vendor/psr/simple-cache/README.md new file mode 100644 index 0000000..43641d1 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/psr/simple-cache/README.md @@ -0,0 +1,8 @@ +PHP FIG Simple Cache PSR +======================== + +This repository holds all interfaces related to PSR-16. + +Note that this is not a cache implementation of its own. It is merely an interface that describes a cache implementation. See [the specification](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-16-simple-cache.md) for more details. + +You can find implementations of the specification by looking for packages providing the [psr/simple-cache-implementation](https://packagist.org/providers/psr/simple-cache-implementation) virtual package. diff --git a/libraries/phpspreadsheet/vendor/psr/simple-cache/composer.json b/libraries/phpspreadsheet/vendor/psr/simple-cache/composer.json new file mode 100644 index 0000000..2978fa5 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/psr/simple-cache/composer.json @@ -0,0 +1,25 @@ +{ + "name": "psr/simple-cache", + "description": "Common interfaces for simple caching", + "keywords": ["psr", "psr-16", "cache", "simple-cache", "caching"], + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/libraries/phpspreadsheet/vendor/psr/simple-cache/src/CacheException.php b/libraries/phpspreadsheet/vendor/psr/simple-cache/src/CacheException.php new file mode 100644 index 0000000..eba5381 --- /dev/null +++ b/libraries/phpspreadsheet/vendor/psr/simple-cache/src/CacheException.php @@ -0,0 +1,10 @@ + value pairs. Cache keys that do not exist or are stale will have $default as value. + * + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if $keys is neither an array nor a Traversable, + * or if any of the $keys are not a legal value. + */ + public function getMultiple($keys, $default = null); + + /** + * Persists a set of key => value pairs in the cache, with an optional TTL. + * + * @param iterable $values A list of key => value pairs for a multiple-set operation. + * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and + * the driver supports TTL then the library may set a default value + * for it or let the driver take care of that. + * + * @return bool True on success and false on failure. + * + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if $values is neither an array nor a Traversable, + * or if any of the $values are not a legal value. + */ + public function setMultiple($values, $ttl = null); + + /** + * Deletes multiple cache items in a single operation. + * + * @param iterable $keys A list of string-based keys to be deleted. + * + * @return bool True if the items were successfully removed. False if there was an error. + * + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if $keys is neither an array nor a Traversable, + * or if any of the $keys are not a legal value. + */ + public function deleteMultiple($keys); + + /** + * Determines whether an item is present in the cache. + * + * NOTE: It is recommended that has() is only to be used for cache warming type purposes + * and not to be used within your live applications operations for get/set, as this method + * is subject to a race condition where your has() will return true and immediately after, + * another script can remove it making the state of your app out of date. + * + * @param string $key The cache item key. + * + * @return bool + * + * @throws \Psr\SimpleCache\InvalidArgumentException + * MUST be thrown if the $key string is not a legal value. + */ + public function has($key); +} diff --git a/libraries/phpspreadsheet/vendor/psr/simple-cache/src/InvalidArgumentException.php b/libraries/phpspreadsheet/vendor/psr/simple-cache/src/InvalidArgumentException.php new file mode 100644 index 0000000..6a9524a --- /dev/null +++ b/libraries/phpspreadsheet/vendor/psr/simple-cache/src/InvalidArgumentException.php @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/media/css/index.html b/media/css/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/media/css/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/images/index.html b/media/images/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/media/images/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/index.html b/media/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/media/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/js/administration_part.js b/media/js/administration_part.js new file mode 100644 index 0000000..c40fc61 --- /dev/null +++ b/media/js/administration_part.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage administration_part.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/antenatal_care.js b/media/js/antenatal_care.js new file mode 100644 index 0000000..40245e8 --- /dev/null +++ b/media/js/antenatal_care.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage antenatal_care.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/breast_cancer.js b/media/js/breast_cancer.js new file mode 100644 index 0000000..2953d4d --- /dev/null +++ b/media/js/breast_cancer.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage breast_cancer.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/cervical_cancer.js b/media/js/cervical_cancer.js new file mode 100644 index 0000000..9a354f5 --- /dev/null +++ b/media/js/cervical_cancer.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage cervical_cancer.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/clinic.js b/media/js/clinic.js new file mode 100644 index 0000000..cc8840b --- /dev/null +++ b/media/js/clinic.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage clinic.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/counseling_type.js b/media/js/counseling_type.js new file mode 100644 index 0000000..6dbc45f --- /dev/null +++ b/media/js/counseling_type.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage counseling_type.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/diagnosis_type.js b/media/js/diagnosis_type.js new file mode 100644 index 0000000..a984750 --- /dev/null +++ b/media/js/diagnosis_type.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage diagnosis_type.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/family_planning.js b/media/js/family_planning.js new file mode 100644 index 0000000..376c715 --- /dev/null +++ b/media/js/family_planning.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage family_planning.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/foetal_engagement.js b/media/js/foetal_engagement.js new file mode 100644 index 0000000..81d0714 --- /dev/null +++ b/media/js/foetal_engagement.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_engagement.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/foetal_lie.js b/media/js/foetal_lie.js new file mode 100644 index 0000000..db97319 --- /dev/null +++ b/media/js/foetal_lie.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_lie.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/foetal_presentation.js b/media/js/foetal_presentation.js new file mode 100644 index 0000000..8c7ce41 --- /dev/null +++ b/media/js/foetal_presentation.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage foetal_presentation.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/general_medical_check_up.js b/media/js/general_medical_check_up.js new file mode 100644 index 0000000..4c84424 --- /dev/null +++ b/media/js/general_medical_check_up.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage general_medical_check_up.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/health_education.js b/media/js/health_education.js new file mode 100644 index 0000000..b8730f1 --- /dev/null +++ b/media/js/health_education.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage health_education.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/health_education_topic.js b/media/js/health_education_topic.js new file mode 100644 index 0000000..56eb328 --- /dev/null +++ b/media/js/health_education_topic.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage health_education_topic.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/hiv_counseling_and_testing.js b/media/js/hiv_counseling_and_testing.js new file mode 100644 index 0000000..8c47ee3 --- /dev/null +++ b/media/js/hiv_counseling_and_testing.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage hiv_counseling_and_testing.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/immunisation.js b/media/js/immunisation.js new file mode 100644 index 0000000..b6b5740 --- /dev/null +++ b/media/js/immunisation.js @@ -0,0 +1,97 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisation.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + + + +// set immunisation vaccine types that are on the page +var select_an_immunisation_vaccine_type = 'Select...'; +var create_an_immunisation_vaccine_type = 'Create...'; +immunisation_vaccine_types = {}; +var immunisation_vaccine_type = 0; +jQuery(document).ready(function($) +{ + // when it changes + $('#adminForm').on('change', '#jform_administration_part',function (e) { + e.preventDefault(); + getImmunisationVaccineType(); + }); + // set buckets + jQuery("#jform_immunisation_vaccine_type option").each(function() + { + var key = jQuery(this).val(); + var text = jQuery(this).text(); + immunisation_vaccine_types[key] = text; + }); + immunisation_vaccine_type = jQuery('#jform_immunisation_vaccine_type').val(); + // run now + getImmunisationVaccineType(); +}); + +function getImmunisationVaccineTypeServer(administration_part){ + var getUrl = JRouter("index.php?option=com_ehealth_portal&task=ajax.getImmunisationVaccineType&raw=true&format=json"); + if(token.length > 0 && administration_part > 0){ + var request = 'token='+token+'&administration_part='+administration_part; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'json', + data: request, + jsonp: false + }); +} +function getImmunisationVaccineType(){ + jQuery("#loading").show(); + // clear the selection + jQuery('#jform_immunisation_vaccine_type').find('option').remove().end(); + jQuery('#jform_immunisation_vaccine_type').trigger('liszt:updated'); + // get administration part value if set + var administration_part = jQuery('#jform_administration_part').val(); + getImmunisationVaccineTypeServer(administration_part).done(function(result) { + setImmunisationVaccineType(result); + jQuery("#loading").hide(); + if (typeof ImmunisationVaccineTypeButton !== 'undefined') { + // ensure button is correct + var immunisation_vaccine_type = jQuery('#jform_immunisation_vaccine_type').val(); + ImmunisationVaccineTypeButton(immunisation_vaccine_type); + } + }); +} +function setImmunisationVaccineType(array){ + if (array) { + jQuery('#jform_immunisation_vaccine_type').append(''); + jQuery.each( array, function( i, id ) { + if (id in immunisation_vaccine_types) { + jQuery('#jform_immunisation_vaccine_type').append(''); + } + if (id == immunisation_vaccine_type) { + jQuery('#jform_immunisation_vaccine_type').val(id); + } + }); + } else { + jQuery('#jform_immunisation_vaccine_type').append(''); + } + jQuery('#jform_immunisation_vaccine_type').trigger('liszt:updated'); +} diff --git a/media/js/immunisation_type.js b/media/js/immunisation_type.js new file mode 100644 index 0000000..ae5859c --- /dev/null +++ b/media/js/immunisation_type.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisation_type.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/immunisation_vaccine_type.js b/media/js/immunisation_vaccine_type.js new file mode 100644 index 0000000..12c0dec --- /dev/null +++ b/media/js/immunisation_vaccine_type.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage immunisation_vaccine_type.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/index.html b/media/js/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/media/js/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/media/js/medication.js b/media/js/medication.js new file mode 100644 index 0000000..76fb851 --- /dev/null +++ b/media/js/medication.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage medication.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/nonpay_reason.js b/media/js/nonpay_reason.js new file mode 100644 index 0000000..b3edadd --- /dev/null +++ b/media/js/nonpay_reason.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage nonpay_reason.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/payment.js b/media/js/payment.js new file mode 100644 index 0000000..6c16dc6 --- /dev/null +++ b/media/js/payment.js @@ -0,0 +1,118 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payment.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// Initial Script +jQuery(document).ready(function() +{ + var payment_category_vvvvvvv = jQuery("#jform_payment_category").val(); + vvvvvvv(payment_category_vvvvvvv); + + var payment_amount_vvvvvvw = jQuery("#jform_payment_amount").val(); + vvvvvvw(payment_amount_vvvvvvw); +}); + +// the vvvvvvv function +function vvvvvvv(payment_category_vvvvvvv) +{ + if (isSet(payment_category_vvvvvvv) && payment_category_vvvvvvv.constructor !== Array) + { + var temp_vvvvvvv = payment_category_vvvvvvv; + var payment_category_vvvvvvv = []; + payment_category_vvvvvvv.push(temp_vvvvvvv); + } + else if (!isSet(payment_category_vvvvvvv)) + { + var payment_category_vvvvvvv = []; + } + var payment_category = payment_category_vvvvvvv.some(payment_category_vvvvvvv_SomeFunc); + + + // set this function logic + if (payment_category) + { + jQuery('#jform_nonpay_reason').closest('.control-group').show(); + } + else + { + jQuery('#jform_nonpay_reason').closest('.control-group').hide(); + } +} + +// the vvvvvvv Some function +function payment_category_vvvvvvv_SomeFunc(payment_category_vvvvvvv) +{ + // set the function logic + if (payment_category_vvvvvvv == 1) + { + return true; + } + return false; +} + +// the vvvvvvw function +function vvvvvvw(payment_amount_vvvvvvw) +{ + if (isSet(payment_amount_vvvvvvw) && payment_amount_vvvvvvw.constructor !== Array) + { + var temp_vvvvvvw = payment_amount_vvvvvvw; + var payment_amount_vvvvvvw = []; + payment_amount_vvvvvvw.push(temp_vvvvvvw); + } + else if (!isSet(payment_amount_vvvvvvw)) + { + var payment_amount_vvvvvvw = []; + } + var payment_amount = payment_amount_vvvvvvw.some(payment_amount_vvvvvvw_SomeFunc); + + + // set this function logic + if (payment_amount) + { + jQuery('#jform_nonpay_reason').closest('.control-group').show(); + } + else + { + jQuery('#jform_nonpay_reason').closest('.control-group').hide(); + } +} + +// the vvvvvvw Some function +function payment_amount_vvvvvvw_SomeFunc(payment_amount_vvvvvvw) +{ + // set the function logic + if (payment_amount_vvvvvvw == 1) + { + return true; + } + return false; +} + +// the isSet function +function isSet(val) +{ + if ((val != undefined) && (val != null) && 0 !== val.length){ + return true; + } + return false; +} diff --git a/media/js/payment_amount.js b/media/js/payment_amount.js new file mode 100644 index 0000000..9f573e2 --- /dev/null +++ b/media/js/payment_amount.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payment_amount.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/payment_type.js b/media/js/payment_type.js new file mode 100644 index 0000000..7e3b216 --- /dev/null +++ b/media/js/payment_type.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage payment_type.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/planning_type.js b/media/js/planning_type.js new file mode 100644 index 0000000..7520703 --- /dev/null +++ b/media/js/planning_type.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage planning_type.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/prostate_and_testicular_cancer.js b/media/js/prostate_and_testicular_cancer.js new file mode 100644 index 0000000..8119e19 --- /dev/null +++ b/media/js/prostate_and_testicular_cancer.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage prostate_and_testicular_cancer.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/referral.js b/media/js/referral.js new file mode 100644 index 0000000..a52e052 --- /dev/null +++ b/media/js/referral.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage referral.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/site.js b/media/js/site.js new file mode 100644 index 0000000..c72ef94 --- /dev/null +++ b/media/js/site.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage site.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/strength.js b/media/js/strength.js new file mode 100644 index 0000000..85fe585 --- /dev/null +++ b/media/js/strength.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage strength.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/test.js b/media/js/test.js new file mode 100644 index 0000000..985fda6 --- /dev/null +++ b/media/js/test.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage test.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/testing_reason.js b/media/js/testing_reason.js new file mode 100644 index 0000000..c3c0898 --- /dev/null +++ b/media/js/testing_reason.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage testing_reason.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/tuberculosis.js b/media/js/tuberculosis.js new file mode 100644 index 0000000..6e84290 --- /dev/null +++ b/media/js/tuberculosis.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage tuberculosis.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/unit.js b/media/js/unit.js new file mode 100644 index 0000000..de1a099 --- /dev/null +++ b/media/js/unit.js @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage unit.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + + diff --git a/media/js/vmmc.js b/media/js/vmmc.js new file mode 100644 index 0000000..e5b33ac --- /dev/null +++ b/media/js/vmmc.js @@ -0,0 +1,221 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 1.0.5 + @build 24th April, 2021 + @created 13th August, 2020 + @package eHealth Portal + @subpackage vmmc.js + @author Oh Martin + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// Some Global Values +jform_vvvvvvxvvv_required = false; +jform_vvvvvvyvvw_required = false; +jform_vvvvvvyvvx_required = false; + +// Initial Script +jQuery(document).ready(function() +{ + var vmmc_gender_vvvvvvx = jQuery("#jform_vmmc_gender").val(); + vvvvvvx(vmmc_gender_vvvvvvx); + + var vmmc_gender_vvvvvvy = jQuery("#jform_vmmc_gender").val(); + vvvvvvy(vmmc_gender_vvvvvvy); +}); + +// the vvvvvvx function +function vvvvvvx(vmmc_gender_vvvvvvx) +{ + if (isSet(vmmc_gender_vvvvvvx) && vmmc_gender_vvvvvvx.constructor !== Array) + { + var temp_vvvvvvx = vmmc_gender_vvvvvvx; + var vmmc_gender_vvvvvvx = []; + vmmc_gender_vvvvvvx.push(temp_vvvvvvx); + } + else if (!isSet(vmmc_gender_vvvvvvx)) + { + var vmmc_gender_vvvvvvx = []; + } + var vmmc_gender = vmmc_gender_vvvvvvx.some(vmmc_gender_vvvvvvx_SomeFunc); + + + // set this function logic + if (vmmc_gender) + { + jQuery('#jform_partner_circumcised').closest('.control-group').show(); + // add required attribute to partner_circumcised field + if (jform_vvvvvvxvvv_required) + { + updateFieldRequired('partner_circumcised',0); + jQuery('#jform_partner_circumcised').prop('required','required'); + jQuery('#jform_partner_circumcised').attr('aria-required',true); + jQuery('#jform_partner_circumcised').addClass('required'); + jform_vvvvvvxvvv_required = false; + } + } + else + { + jQuery('#jform_partner_circumcised').closest('.control-group').hide(); + // remove required attribute from partner_circumcised field + if (!jform_vvvvvvxvvv_required) + { + updateFieldRequired('partner_circumcised',1); + jQuery('#jform_partner_circumcised').removeAttr('required'); + jQuery('#jform_partner_circumcised').removeAttr('aria-required'); + jQuery('#jform_partner_circumcised').removeClass('required'); + jform_vvvvvvxvvv_required = true; + } + } +} + +// the vvvvvvx Some function +function vmmc_gender_vvvvvvx_SomeFunc(vmmc_gender_vvvvvvx) +{ + // set the function logic + if (vmmc_gender_vvvvvvx == 1) + { + return true; + } + return false; +} + +// the vvvvvvy function +function vvvvvvy(vmmc_gender_vvvvvvy) +{ + if (isSet(vmmc_gender_vvvvvvy) && vmmc_gender_vvvvvvy.constructor !== Array) + { + var temp_vvvvvvy = vmmc_gender_vvvvvvy; + var vmmc_gender_vvvvvvy = []; + vmmc_gender_vvvvvvy.push(temp_vvvvvvy); + } + else if (!isSet(vmmc_gender_vvvvvvy)) + { + var vmmc_gender_vvvvvvy = []; + } + var vmmc_gender = vmmc_gender_vvvvvvy.some(vmmc_gender_vvvvvvy_SomeFunc); + + + // set this function logic + if (vmmc_gender) + { + jQuery('#jform_are_you_circumcised').closest('.control-group').show(); + // add required attribute to are_you_circumcised field + if (jform_vvvvvvyvvw_required) + { + updateFieldRequired('are_you_circumcised',0); + jQuery('#jform_are_you_circumcised').prop('required','required'); + jQuery('#jform_are_you_circumcised').attr('aria-required',true); + jQuery('#jform_are_you_circumcised').addClass('required'); + jform_vvvvvvyvvw_required = false; + } + jQuery('#jform_interested_in_vmmc').closest('.control-group').show(); + // add required attribute to interested_in_vmmc field + if (jform_vvvvvvyvvx_required) + { + updateFieldRequired('interested_in_vmmc',0); + jQuery('#jform_interested_in_vmmc').prop('required','required'); + jQuery('#jform_interested_in_vmmc').attr('aria-required',true); + jQuery('#jform_interested_in_vmmc').addClass('required'); + jform_vvvvvvyvvx_required = false; + } + } + else + { + jQuery('#jform_are_you_circumcised').closest('.control-group').hide(); + // remove required attribute from are_you_circumcised field + if (!jform_vvvvvvyvvw_required) + { + updateFieldRequired('are_you_circumcised',1); + jQuery('#jform_are_you_circumcised').removeAttr('required'); + jQuery('#jform_are_you_circumcised').removeAttr('aria-required'); + jQuery('#jform_are_you_circumcised').removeClass('required'); + jform_vvvvvvyvvw_required = true; + } + jQuery('#jform_interested_in_vmmc').closest('.control-group').hide(); + // remove required attribute from interested_in_vmmc field + if (!jform_vvvvvvyvvx_required) + { + updateFieldRequired('interested_in_vmmc',1); + jQuery('#jform_interested_in_vmmc').removeAttr('required'); + jQuery('#jform_interested_in_vmmc').removeAttr('aria-required'); + jQuery('#jform_interested_in_vmmc').removeClass('required'); + jform_vvvvvvyvvx_required = true; + } + } +} + +// the vvvvvvy Some function +function vmmc_gender_vvvvvvy_SomeFunc(vmmc_gender_vvvvvvy) +{ + // set the function logic + if (vmmc_gender_vvvvvvy == 0) + { + return true; + } + return false; +} + +// update fields required +function updateFieldRequired(name, status) { + // check if not_required exist + if (jQuery('#jform_not_required').length > 0) { + var not_required = jQuery('#jform_not_required').val().split(","); + + if(status == 1) + { + not_required.push(name); + } + else + { + not_required = removeFieldFromNotRequired(not_required, name); + } + + jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString()); + } +} + +// remove field from not_required +function removeFieldFromNotRequired(array, what) { + return array.filter(function(element){ + return element !== what; + }); +} + +// fix not required array +function fixNotRequiredArray(array) { + var seen = {}; + return removeEmptyFromNotRequiredArray(array).filter(function(item) { + return seen.hasOwnProperty(item) ? false : (seen[item] = true); + }); +} + +// remove empty from not_required array +function removeEmptyFromNotRequiredArray(array) { + return array.filter(function (el) { + // remove ( 一_一) as well - lol + return (el.length > 0 && '一_一' !== el); + }); +} + +// the isSet function +function isSet(val) +{ + if ((val != undefined) && (val != null) && 0 !== val.length){ + return true; + } + return false; +} diff --git a/script.php b/script.php new file mode 100644 index 0000000..b5289bf --- /dev/null +++ b/script.php @@ -0,0 +1,4565 @@ + + @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\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; +JHTML::_('behavior.modal'); + +/** + * Script File of Ehealth_portal Component + */ +class com_ehealth_portalInstallerScript +{ + /** + * Constructor + * + * @param JAdapterInstance $parent The object responsible for running this script + */ + public function __construct(JAdapterInstance $parent) {} + + /** + * Called on installation + * + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success + */ + public function install(JAdapterInstance $parent) {} + + /** + * Called on uninstallation + * + * @param JAdapterInstance $parent The object responsible for running this script + */ + public function uninstall(JAdapterInstance $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 Payment alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.payment) type alias was removed from the #__content_type table')); + } + + // Remove Payment items from the contentitem tag map table + $payment_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.payment) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Payment items from the ucm content table + $payment_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.payment) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.general_medical_check_up) type alias was removed from the #__content_type 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_ehealth_portal.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(JText::_('The (com_ehealth_portal.general_medical_check_up) type alias was removed from the #__contentitem_tag_map 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_ehealth_portal.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(JText::_('The (com_ehealth_portal.general_medical_check_up) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.antenatal_care) type alias was removed from the #__content_type table')); + } + + // Remove Antenatal_care items from the contentitem tag map table + $antenatal_care_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.antenatal_care) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Antenatal_care items from the ucm content table + $antenatal_care_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.antenatal_care) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.immunisation) type alias was removed from the #__content_type table')); + } + + // Remove Immunisation items from the contentitem tag map table + $immunisation_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.immunisation) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Immunisation items from the ucm content table + $immunisation_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.immunisation) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.vmmc) type alias was removed from the #__content_type table')); + } + + // Remove Vmmc items from the contentitem tag map table + $vmmc_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.vmmc) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Vmmc items from the ucm content table + $vmmc_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.vmmc) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.prostate_and_testicular_cancer) type alias was removed from the #__content_type 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_ehealth_portal.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(JText::_('The (com_ehealth_portal.prostate_and_testicular_cancer) type alias was removed from the #__contentitem_tag_map 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_ehealth_portal.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(JText::_('The (com_ehealth_portal.prostate_and_testicular_cancer) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.tuberculosis) type alias was removed from the #__content_type table')); + } + + // Remove Tuberculosis items from the contentitem tag map table + $tuberculosis_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.tuberculosis) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Tuberculosis items from the ucm content table + $tuberculosis_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.tuberculosis) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.hiv_counseling_and_testing) type alias was removed from the #__content_type 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_ehealth_portal.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(JText::_('The (com_ehealth_portal.hiv_counseling_and_testing) type alias was removed from the #__contentitem_tag_map 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_ehealth_portal.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(JText::_('The (com_ehealth_portal.hiv_counseling_and_testing) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.family_planning) type alias was removed from the #__content_type table')); + } + + // Remove Family_planning items from the contentitem tag map table + $family_planning_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.family_planning) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Family_planning items from the ucm content table + $family_planning_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.family_planning) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.health_education) type alias was removed from the #__content_type table')); + } + + // Remove Health_education items from the contentitem tag map table + $health_education_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.health_education) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Health_education items from the ucm content table + $health_education_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.health_education) type alias was removed from the #__ucm_content 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_ehealth_portal.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_ehealth_portal.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(JText::_('The (com_ehealth_portal.cervical_cancer) type alias was removed from the #__content_type table')); + } + + // Remove Cervical_cancer items from the contentitem tag map table + $cervical_cancer_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.cervical_cancer) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Cervical_cancer items from the ucm content table + $cervical_cancer_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.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(JText::_('The (com_ehealth_portal.cervical_cancer) type alias was removed from the #__ucm_content 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')); + $query->where($cervical_cancer_condition); + $db->setQuery($query); + // Execute the query to remove Cervical_cancer items + $db->execute(); + + // Remove Cervical_cancer items from the ucm history 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_history')); + $query->where($cervical_cancer_condition); + $db->setQuery($query); + // Execute the query to remove Cervical_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 Breast_cancer alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.breast_cancer') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $breast_cancer_found = $db->getNumRows(); + // Now check if there were any rows + if ($breast_cancer_found) + { + // Since there are load the needed breast_cancer type ids + $breast_cancer_ids = $db->loadColumn(); + // Remove Breast_cancer from the content type table + $breast_cancer_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.breast_cancer') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($breast_cancer_condition); + $db->setQuery($query); + // Execute the query to remove Breast_cancer items + $breast_cancer_done = $db->execute(); + if ($breast_cancer_done) + { + // If successfully remove Breast_cancer add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.breast_cancer) type alias was removed from the #__content_type table')); + } + + // Remove Breast_cancer items from the contentitem tag map table + $breast_cancer_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.breast_cancer') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($breast_cancer_condition); + $db->setQuery($query); + // Execute the query to remove Breast_cancer items + $breast_cancer_done = $db->execute(); + if ($breast_cancer_done) + { + // If successfully remove Breast_cancer add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.breast_cancer) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Breast_cancer items from the ucm content table + $breast_cancer_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.breast_cancer') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($breast_cancer_condition); + $db->setQuery($query); + // Execute the query to remove Breast_cancer items + $breast_cancer_done = $db->execute(); + if ($breast_cancer_done) + { + // If successfully removed Breast_cancer add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.breast_cancer) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Breast_cancer items are cleared from DB + foreach ($breast_cancer_ids as $breast_cancer_id) + { + // Remove Breast_cancer items from the ucm base table + $breast_cancer_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $breast_cancer_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($breast_cancer_condition); + $db->setQuery($query); + // Execute the query to remove Breast_cancer items + $db->execute(); + + // Remove Breast_cancer items from the ucm history table + $breast_cancer_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $breast_cancer_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($breast_cancer_condition); + $db->setQuery($query); + // Execute the query to remove Breast_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 Test alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.test') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $test_found = $db->getNumRows(); + // Now check if there were any rows + if ($test_found) + { + // Since there are load the needed test type ids + $test_ids = $db->loadColumn(); + // Remove Test from the content type table + $test_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.test') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($test_condition); + $db->setQuery($query); + // Execute the query to remove Test items + $test_done = $db->execute(); + if ($test_done) + { + // If successfully remove Test add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.test) type alias was removed from the #__content_type table')); + } + + // Remove Test items from the contentitem tag map table + $test_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.test') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($test_condition); + $db->setQuery($query); + // Execute the query to remove Test items + $test_done = $db->execute(); + if ($test_done) + { + // If successfully remove Test add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.test) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Test items from the ucm content table + $test_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.test') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($test_condition); + $db->setQuery($query); + // Execute the query to remove Test items + $test_done = $db->execute(); + if ($test_done) + { + // If successfully removed Test add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.test) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Test items are cleared from DB + foreach ($test_ids as $test_id) + { + // Remove Test items from the ucm base table + $test_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $test_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($test_condition); + $db->setQuery($query); + // Execute the query to remove Test items + $db->execute(); + + // Remove Test items from the ucm history table + $test_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $test_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($test_condition); + $db->setQuery($query); + // Execute the query to remove Test 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_vaccine_type alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.immunisation_vaccine_type') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $immunisation_vaccine_type_found = $db->getNumRows(); + // Now check if there were any rows + if ($immunisation_vaccine_type_found) + { + // Since there are load the needed immunisation_vaccine_type type ids + $immunisation_vaccine_type_ids = $db->loadColumn(); + // Remove Immunisation_vaccine_type from the content type table + $immunisation_vaccine_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.immunisation_vaccine_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($immunisation_vaccine_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_vaccine_type items + $immunisation_vaccine_type_done = $db->execute(); + if ($immunisation_vaccine_type_done) + { + // If successfully remove Immunisation_vaccine_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.immunisation_vaccine_type) type alias was removed from the #__content_type table')); + } + + // Remove Immunisation_vaccine_type items from the contentitem tag map table + $immunisation_vaccine_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.immunisation_vaccine_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($immunisation_vaccine_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_vaccine_type items + $immunisation_vaccine_type_done = $db->execute(); + if ($immunisation_vaccine_type_done) + { + // If successfully remove Immunisation_vaccine_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.immunisation_vaccine_type) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Immunisation_vaccine_type items from the ucm content table + $immunisation_vaccine_type_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.immunisation_vaccine_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($immunisation_vaccine_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_vaccine_type items + $immunisation_vaccine_type_done = $db->execute(); + if ($immunisation_vaccine_type_done) + { + // If successfully removed Immunisation_vaccine_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.immunisation_vaccine_type) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Immunisation_vaccine_type items are cleared from DB + foreach ($immunisation_vaccine_type_ids as $immunisation_vaccine_type_id) + { + // Remove Immunisation_vaccine_type items from the ucm base table + $immunisation_vaccine_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $immunisation_vaccine_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($immunisation_vaccine_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_vaccine_type items + $db->execute(); + + // Remove Immunisation_vaccine_type items from the ucm history table + $immunisation_vaccine_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $immunisation_vaccine_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($immunisation_vaccine_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_vaccine_type 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 Foetal_presentation alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_presentation') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $foetal_presentation_found = $db->getNumRows(); + // Now check if there were any rows + if ($foetal_presentation_found) + { + // Since there are load the needed foetal_presentation type ids + $foetal_presentation_ids = $db->loadColumn(); + // Remove Foetal_presentation from the content type table + $foetal_presentation_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_presentation') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($foetal_presentation_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_presentation items + $foetal_presentation_done = $db->execute(); + if ($foetal_presentation_done) + { + // If successfully remove Foetal_presentation add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_presentation) type alias was removed from the #__content_type table')); + } + + // Remove Foetal_presentation items from the contentitem tag map table + $foetal_presentation_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_presentation') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($foetal_presentation_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_presentation items + $foetal_presentation_done = $db->execute(); + if ($foetal_presentation_done) + { + // If successfully remove Foetal_presentation add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_presentation) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Foetal_presentation items from the ucm content table + $foetal_presentation_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.foetal_presentation') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($foetal_presentation_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_presentation items + $foetal_presentation_done = $db->execute(); + if ($foetal_presentation_done) + { + // If successfully removed Foetal_presentation add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_presentation) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Foetal_presentation items are cleared from DB + foreach ($foetal_presentation_ids as $foetal_presentation_id) + { + // Remove Foetal_presentation items from the ucm base table + $foetal_presentation_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $foetal_presentation_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($foetal_presentation_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_presentation items + $db->execute(); + + // Remove Foetal_presentation items from the ucm history table + $foetal_presentation_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $foetal_presentation_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($foetal_presentation_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_presentation 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 Foetal_lie alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_lie') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $foetal_lie_found = $db->getNumRows(); + // Now check if there were any rows + if ($foetal_lie_found) + { + // Since there are load the needed foetal_lie type ids + $foetal_lie_ids = $db->loadColumn(); + // Remove Foetal_lie from the content type table + $foetal_lie_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_lie') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($foetal_lie_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_lie items + $foetal_lie_done = $db->execute(); + if ($foetal_lie_done) + { + // If successfully remove Foetal_lie add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_lie) type alias was removed from the #__content_type table')); + } + + // Remove Foetal_lie items from the contentitem tag map table + $foetal_lie_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_lie') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($foetal_lie_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_lie items + $foetal_lie_done = $db->execute(); + if ($foetal_lie_done) + { + // If successfully remove Foetal_lie add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_lie) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Foetal_lie items from the ucm content table + $foetal_lie_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.foetal_lie') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($foetal_lie_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_lie items + $foetal_lie_done = $db->execute(); + if ($foetal_lie_done) + { + // If successfully removed Foetal_lie add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_lie) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Foetal_lie items are cleared from DB + foreach ($foetal_lie_ids as $foetal_lie_id) + { + // Remove Foetal_lie items from the ucm base table + $foetal_lie_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $foetal_lie_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($foetal_lie_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_lie items + $db->execute(); + + // Remove Foetal_lie items from the ucm history table + $foetal_lie_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $foetal_lie_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($foetal_lie_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_lie 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 Counseling_type alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.counseling_type') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $counseling_type_found = $db->getNumRows(); + // Now check if there were any rows + if ($counseling_type_found) + { + // Since there are load the needed counseling_type type ids + $counseling_type_ids = $db->loadColumn(); + // Remove Counseling_type from the content type table + $counseling_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.counseling_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($counseling_type_condition); + $db->setQuery($query); + // Execute the query to remove Counseling_type items + $counseling_type_done = $db->execute(); + if ($counseling_type_done) + { + // If successfully remove Counseling_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.counseling_type) type alias was removed from the #__content_type table')); + } + + // Remove Counseling_type items from the contentitem tag map table + $counseling_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.counseling_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($counseling_type_condition); + $db->setQuery($query); + // Execute the query to remove Counseling_type items + $counseling_type_done = $db->execute(); + if ($counseling_type_done) + { + // If successfully remove Counseling_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.counseling_type) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Counseling_type items from the ucm content table + $counseling_type_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.counseling_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($counseling_type_condition); + $db->setQuery($query); + // Execute the query to remove Counseling_type items + $counseling_type_done = $db->execute(); + if ($counseling_type_done) + { + // If successfully removed Counseling_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.counseling_type) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Counseling_type items are cleared from DB + foreach ($counseling_type_ids as $counseling_type_id) + { + // Remove Counseling_type items from the ucm base table + $counseling_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $counseling_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($counseling_type_condition); + $db->setQuery($query); + // Execute the query to remove Counseling_type items + $db->execute(); + + // Remove Counseling_type items from the ucm history table + $counseling_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $counseling_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($counseling_type_condition); + $db->setQuery($query); + // Execute the query to remove Counseling_type 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 Foetal_engagement alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_engagement') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $foetal_engagement_found = $db->getNumRows(); + // Now check if there were any rows + if ($foetal_engagement_found) + { + // Since there are load the needed foetal_engagement type ids + $foetal_engagement_ids = $db->loadColumn(); + // Remove Foetal_engagement from the content type table + $foetal_engagement_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_engagement') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($foetal_engagement_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_engagement items + $foetal_engagement_done = $db->execute(); + if ($foetal_engagement_done) + { + // If successfully remove Foetal_engagement add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_engagement) type alias was removed from the #__content_type table')); + } + + // Remove Foetal_engagement items from the contentitem tag map table + $foetal_engagement_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.foetal_engagement') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($foetal_engagement_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_engagement items + $foetal_engagement_done = $db->execute(); + if ($foetal_engagement_done) + { + // If successfully remove Foetal_engagement add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_engagement) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Foetal_engagement items from the ucm content table + $foetal_engagement_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.foetal_engagement') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($foetal_engagement_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_engagement items + $foetal_engagement_done = $db->execute(); + if ($foetal_engagement_done) + { + // If successfully removed Foetal_engagement add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.foetal_engagement) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Foetal_engagement items are cleared from DB + foreach ($foetal_engagement_ids as $foetal_engagement_id) + { + // Remove Foetal_engagement items from the ucm base table + $foetal_engagement_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $foetal_engagement_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($foetal_engagement_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_engagement items + $db->execute(); + + // Remove Foetal_engagement items from the ucm history table + $foetal_engagement_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $foetal_engagement_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($foetal_engagement_condition); + $db->setQuery($query); + // Execute the query to remove Foetal_engagement 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_topic alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.health_education_topic') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $health_education_topic_found = $db->getNumRows(); + // Now check if there were any rows + if ($health_education_topic_found) + { + // Since there are load the needed health_education_topic type ids + $health_education_topic_ids = $db->loadColumn(); + // Remove Health_education_topic from the content type table + $health_education_topic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.health_education_topic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($health_education_topic_condition); + $db->setQuery($query); + // Execute the query to remove Health_education_topic items + $health_education_topic_done = $db->execute(); + if ($health_education_topic_done) + { + // If successfully remove Health_education_topic add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.health_education_topic) type alias was removed from the #__content_type table')); + } + + // Remove Health_education_topic items from the contentitem tag map table + $health_education_topic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.health_education_topic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($health_education_topic_condition); + $db->setQuery($query); + // Execute the query to remove Health_education_topic items + $health_education_topic_done = $db->execute(); + if ($health_education_topic_done) + { + // If successfully remove Health_education_topic add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.health_education_topic) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Health_education_topic items from the ucm content table + $health_education_topic_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.health_education_topic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($health_education_topic_condition); + $db->setQuery($query); + // Execute the query to remove Health_education_topic items + $health_education_topic_done = $db->execute(); + if ($health_education_topic_done) + { + // If successfully removed Health_education_topic add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.health_education_topic) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Health_education_topic items are cleared from DB + foreach ($health_education_topic_ids as $health_education_topic_id) + { + // Remove Health_education_topic items from the ucm base table + $health_education_topic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $health_education_topic_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($health_education_topic_condition); + $db->setQuery($query); + // Execute the query to remove Health_education_topic items + $db->execute(); + + // Remove Health_education_topic items from the ucm history table + $health_education_topic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $health_education_topic_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($health_education_topic_condition); + $db->setQuery($query); + // Execute the query to remove Health_education_topic 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 Testing_reason alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.testing_reason') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $testing_reason_found = $db->getNumRows(); + // Now check if there were any rows + if ($testing_reason_found) + { + // Since there are load the needed testing_reason type ids + $testing_reason_ids = $db->loadColumn(); + // Remove Testing_reason from the content type table + $testing_reason_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.testing_reason') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($testing_reason_condition); + $db->setQuery($query); + // Execute the query to remove Testing_reason items + $testing_reason_done = $db->execute(); + if ($testing_reason_done) + { + // If successfully remove Testing_reason add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.testing_reason) type alias was removed from the #__content_type table')); + } + + // Remove Testing_reason items from the contentitem tag map table + $testing_reason_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.testing_reason') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($testing_reason_condition); + $db->setQuery($query); + // Execute the query to remove Testing_reason items + $testing_reason_done = $db->execute(); + if ($testing_reason_done) + { + // If successfully remove Testing_reason add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.testing_reason) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Testing_reason items from the ucm content table + $testing_reason_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.testing_reason') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($testing_reason_condition); + $db->setQuery($query); + // Execute the query to remove Testing_reason items + $testing_reason_done = $db->execute(); + if ($testing_reason_done) + { + // If successfully removed Testing_reason add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.testing_reason) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Testing_reason items are cleared from DB + foreach ($testing_reason_ids as $testing_reason_id) + { + // Remove Testing_reason items from the ucm base table + $testing_reason_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $testing_reason_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($testing_reason_condition); + $db->setQuery($query); + // Execute the query to remove Testing_reason items + $db->execute(); + + // Remove Testing_reason items from the ucm history table + $testing_reason_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $testing_reason_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($testing_reason_condition); + $db->setQuery($query); + // Execute the query to remove Testing_reason 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 Clinic alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.clinic') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $clinic_found = $db->getNumRows(); + // Now check if there were any rows + if ($clinic_found) + { + // Since there are load the needed clinic type ids + $clinic_ids = $db->loadColumn(); + // Remove Clinic from the content type table + $clinic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.clinic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $clinic_done = $db->execute(); + if ($clinic_done) + { + // If successfully remove Clinic add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.clinic) type alias was removed from the #__content_type table')); + } + + // Remove Clinic items from the contentitem tag map table + $clinic_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.clinic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $clinic_done = $db->execute(); + if ($clinic_done) + { + // If successfully remove Clinic add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.clinic) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Clinic items from the ucm content table + $clinic_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.clinic') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $clinic_done = $db->execute(); + if ($clinic_done) + { + // If successfully removed Clinic add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.clinic) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Clinic items are cleared from DB + foreach ($clinic_ids as $clinic_id) + { + // Remove Clinic items from the ucm base table + $clinic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $clinic_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic items + $db->execute(); + + // Remove Clinic items from the ucm history table + $clinic_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $clinic_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($clinic_condition); + $db->setQuery($query); + // Execute the query to remove Clinic 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_type alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.immunisation_type') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $immunisation_type_found = $db->getNumRows(); + // Now check if there were any rows + if ($immunisation_type_found) + { + // Since there are load the needed immunisation_type type ids + $immunisation_type_ids = $db->loadColumn(); + // Remove Immunisation_type from the content type table + $immunisation_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.immunisation_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($immunisation_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_type items + $immunisation_type_done = $db->execute(); + if ($immunisation_type_done) + { + // If successfully remove Immunisation_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.immunisation_type) type alias was removed from the #__content_type table')); + } + + // Remove Immunisation_type items from the contentitem tag map table + $immunisation_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.immunisation_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($immunisation_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_type items + $immunisation_type_done = $db->execute(); + if ($immunisation_type_done) + { + // If successfully remove Immunisation_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.immunisation_type) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Immunisation_type items from the ucm content table + $immunisation_type_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.immunisation_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($immunisation_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_type items + $immunisation_type_done = $db->execute(); + if ($immunisation_type_done) + { + // If successfully removed Immunisation_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.immunisation_type) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Immunisation_type items are cleared from DB + foreach ($immunisation_type_ids as $immunisation_type_id) + { + // Remove Immunisation_type items from the ucm base table + $immunisation_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $immunisation_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($immunisation_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_type items + $db->execute(); + + // Remove Immunisation_type items from the ucm history table + $immunisation_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $immunisation_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($immunisation_type_condition); + $db->setQuery($query); + // Execute the query to remove Immunisation_type 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 Unit alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.unit') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $unit_found = $db->getNumRows(); + // Now check if there were any rows + if ($unit_found) + { + // Since there are load the needed unit type ids + $unit_ids = $db->loadColumn(); + // Remove Unit from the content type table + $unit_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.unit') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($unit_condition); + $db->setQuery($query); + // Execute the query to remove Unit items + $unit_done = $db->execute(); + if ($unit_done) + { + // If successfully remove Unit add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.unit) type alias was removed from the #__content_type table')); + } + + // Remove Unit items from the contentitem tag map table + $unit_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.unit') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($unit_condition); + $db->setQuery($query); + // Execute the query to remove Unit items + $unit_done = $db->execute(); + if ($unit_done) + { + // If successfully remove Unit add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.unit) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Unit items from the ucm content table + $unit_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.unit') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($unit_condition); + $db->setQuery($query); + // Execute the query to remove Unit items + $unit_done = $db->execute(); + if ($unit_done) + { + // If successfully removed Unit add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.unit) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Unit items are cleared from DB + foreach ($unit_ids as $unit_id) + { + // Remove Unit items from the ucm base table + $unit_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $unit_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($unit_condition); + $db->setQuery($query); + // Execute the query to remove Unit items + $db->execute(); + + // Remove Unit items from the ucm history table + $unit_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $unit_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($unit_condition); + $db->setQuery($query); + // Execute the query to remove Unit 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 Referral alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.referral') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $referral_found = $db->getNumRows(); + // Now check if there were any rows + if ($referral_found) + { + // Since there are load the needed referral type ids + $referral_ids = $db->loadColumn(); + // Remove Referral from the content type table + $referral_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.referral') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($referral_condition); + $db->setQuery($query); + // Execute the query to remove Referral items + $referral_done = $db->execute(); + if ($referral_done) + { + // If successfully remove Referral add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.referral) type alias was removed from the #__content_type table')); + } + + // Remove Referral items from the contentitem tag map table + $referral_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.referral') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($referral_condition); + $db->setQuery($query); + // Execute the query to remove Referral items + $referral_done = $db->execute(); + if ($referral_done) + { + // If successfully remove Referral add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.referral) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Referral items from the ucm content table + $referral_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.referral') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($referral_condition); + $db->setQuery($query); + // Execute the query to remove Referral items + $referral_done = $db->execute(); + if ($referral_done) + { + // If successfully removed Referral add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.referral) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Referral items are cleared from DB + foreach ($referral_ids as $referral_id) + { + // Remove Referral items from the ucm base table + $referral_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $referral_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($referral_condition); + $db->setQuery($query); + // Execute the query to remove Referral items + $db->execute(); + + // Remove Referral items from the ucm history table + $referral_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $referral_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($referral_condition); + $db->setQuery($query); + // Execute the query to remove Referral 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 Planning_type alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.planning_type') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $planning_type_found = $db->getNumRows(); + // Now check if there were any rows + if ($planning_type_found) + { + // Since there are load the needed planning_type type ids + $planning_type_ids = $db->loadColumn(); + // Remove Planning_type from the content type table + $planning_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.planning_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($planning_type_condition); + $db->setQuery($query); + // Execute the query to remove Planning_type items + $planning_type_done = $db->execute(); + if ($planning_type_done) + { + // If successfully remove Planning_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.planning_type) type alias was removed from the #__content_type table')); + } + + // Remove Planning_type items from the contentitem tag map table + $planning_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.planning_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($planning_type_condition); + $db->setQuery($query); + // Execute the query to remove Planning_type items + $planning_type_done = $db->execute(); + if ($planning_type_done) + { + // If successfully remove Planning_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.planning_type) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Planning_type items from the ucm content table + $planning_type_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.planning_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($planning_type_condition); + $db->setQuery($query); + // Execute the query to remove Planning_type items + $planning_type_done = $db->execute(); + if ($planning_type_done) + { + // If successfully removed Planning_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.planning_type) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Planning_type items are cleared from DB + foreach ($planning_type_ids as $planning_type_id) + { + // Remove Planning_type items from the ucm base table + $planning_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $planning_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($planning_type_condition); + $db->setQuery($query); + // Execute the query to remove Planning_type items + $db->execute(); + + // Remove Planning_type items from the ucm history table + $planning_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $planning_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($planning_type_condition); + $db->setQuery($query); + // Execute the query to remove Planning_type 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 Diagnosis_type alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.diagnosis_type') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $diagnosis_type_found = $db->getNumRows(); + // Now check if there were any rows + if ($diagnosis_type_found) + { + // Since there are load the needed diagnosis_type type ids + $diagnosis_type_ids = $db->loadColumn(); + // Remove Diagnosis_type from the content type table + $diagnosis_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.diagnosis_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($diagnosis_type_condition); + $db->setQuery($query); + // Execute the query to remove Diagnosis_type items + $diagnosis_type_done = $db->execute(); + if ($diagnosis_type_done) + { + // If successfully remove Diagnosis_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.diagnosis_type) type alias was removed from the #__content_type table')); + } + + // Remove Diagnosis_type items from the contentitem tag map table + $diagnosis_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.diagnosis_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($diagnosis_type_condition); + $db->setQuery($query); + // Execute the query to remove Diagnosis_type items + $diagnosis_type_done = $db->execute(); + if ($diagnosis_type_done) + { + // If successfully remove Diagnosis_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.diagnosis_type) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Diagnosis_type items from the ucm content table + $diagnosis_type_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.diagnosis_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($diagnosis_type_condition); + $db->setQuery($query); + // Execute the query to remove Diagnosis_type items + $diagnosis_type_done = $db->execute(); + if ($diagnosis_type_done) + { + // If successfully removed Diagnosis_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.diagnosis_type) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Diagnosis_type items are cleared from DB + foreach ($diagnosis_type_ids as $diagnosis_type_id) + { + // Remove Diagnosis_type items from the ucm base table + $diagnosis_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $diagnosis_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($diagnosis_type_condition); + $db->setQuery($query); + // Execute the query to remove Diagnosis_type items + $db->execute(); + + // Remove Diagnosis_type items from the ucm history table + $diagnosis_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $diagnosis_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($diagnosis_type_condition); + $db->setQuery($query); + // Execute the query to remove Diagnosis_type 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 Nonpay_reason alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.nonpay_reason') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $nonpay_reason_found = $db->getNumRows(); + // Now check if there were any rows + if ($nonpay_reason_found) + { + // Since there are load the needed nonpay_reason type ids + $nonpay_reason_ids = $db->loadColumn(); + // Remove Nonpay_reason from the content type table + $nonpay_reason_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.nonpay_reason') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($nonpay_reason_condition); + $db->setQuery($query); + // Execute the query to remove Nonpay_reason items + $nonpay_reason_done = $db->execute(); + if ($nonpay_reason_done) + { + // If successfully remove Nonpay_reason add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.nonpay_reason) type alias was removed from the #__content_type table')); + } + + // Remove Nonpay_reason items from the contentitem tag map table + $nonpay_reason_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.nonpay_reason') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($nonpay_reason_condition); + $db->setQuery($query); + // Execute the query to remove Nonpay_reason items + $nonpay_reason_done = $db->execute(); + if ($nonpay_reason_done) + { + // If successfully remove Nonpay_reason add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.nonpay_reason) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Nonpay_reason items from the ucm content table + $nonpay_reason_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.nonpay_reason') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($nonpay_reason_condition); + $db->setQuery($query); + // Execute the query to remove Nonpay_reason items + $nonpay_reason_done = $db->execute(); + if ($nonpay_reason_done) + { + // If successfully removed Nonpay_reason add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.nonpay_reason) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Nonpay_reason items are cleared from DB + foreach ($nonpay_reason_ids as $nonpay_reason_id) + { + // Remove Nonpay_reason items from the ucm base table + $nonpay_reason_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $nonpay_reason_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($nonpay_reason_condition); + $db->setQuery($query); + // Execute the query to remove Nonpay_reason items + $db->execute(); + + // Remove Nonpay_reason items from the ucm history table + $nonpay_reason_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $nonpay_reason_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($nonpay_reason_condition); + $db->setQuery($query); + // Execute the query to remove Nonpay_reason 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 Medication alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.medication') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $medication_found = $db->getNumRows(); + // Now check if there were any rows + if ($medication_found) + { + // Since there are load the needed medication type ids + $medication_ids = $db->loadColumn(); + // Remove Medication from the content type table + $medication_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.medication') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($medication_condition); + $db->setQuery($query); + // Execute the query to remove Medication items + $medication_done = $db->execute(); + if ($medication_done) + { + // If successfully remove Medication add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.medication) type alias was removed from the #__content_type table')); + } + + // Remove Medication items from the contentitem tag map table + $medication_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.medication') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($medication_condition); + $db->setQuery($query); + // Execute the query to remove Medication items + $medication_done = $db->execute(); + if ($medication_done) + { + // If successfully remove Medication add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.medication) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Medication items from the ucm content table + $medication_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.medication') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($medication_condition); + $db->setQuery($query); + // Execute the query to remove Medication items + $medication_done = $db->execute(); + if ($medication_done) + { + // If successfully removed Medication add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.medication) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Medication items are cleared from DB + foreach ($medication_ids as $medication_id) + { + // Remove Medication items from the ucm base table + $medication_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $medication_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($medication_condition); + $db->setQuery($query); + // Execute the query to remove Medication items + $db->execute(); + + // Remove Medication items from the ucm history table + $medication_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $medication_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($medication_condition); + $db->setQuery($query); + // Execute the query to remove Medication 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 Payment_amount alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.payment_amount') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $payment_amount_found = $db->getNumRows(); + // Now check if there were any rows + if ($payment_amount_found) + { + // Since there are load the needed payment_amount type ids + $payment_amount_ids = $db->loadColumn(); + // Remove Payment_amount from the content type table + $payment_amount_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.payment_amount') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($payment_amount_condition); + $db->setQuery($query); + // Execute the query to remove Payment_amount items + $payment_amount_done = $db->execute(); + if ($payment_amount_done) + { + // If successfully remove Payment_amount add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.payment_amount) type alias was removed from the #__content_type table')); + } + + // Remove Payment_amount items from the contentitem tag map table + $payment_amount_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.payment_amount') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($payment_amount_condition); + $db->setQuery($query); + // Execute the query to remove Payment_amount items + $payment_amount_done = $db->execute(); + if ($payment_amount_done) + { + // If successfully remove Payment_amount add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.payment_amount) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Payment_amount items from the ucm content table + $payment_amount_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.payment_amount') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($payment_amount_condition); + $db->setQuery($query); + // Execute the query to remove Payment_amount items + $payment_amount_done = $db->execute(); + if ($payment_amount_done) + { + // If successfully removed Payment_amount add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.payment_amount) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Payment_amount items are cleared from DB + foreach ($payment_amount_ids as $payment_amount_id) + { + // Remove Payment_amount items from the ucm base table + $payment_amount_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $payment_amount_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($payment_amount_condition); + $db->setQuery($query); + // Execute the query to remove Payment_amount items + $db->execute(); + + // Remove Payment_amount items from the ucm history table + $payment_amount_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $payment_amount_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($payment_amount_condition); + $db->setQuery($query); + // Execute the query to remove Payment_amount 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 Administration_part alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.administration_part') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $administration_part_found = $db->getNumRows(); + // Now check if there were any rows + if ($administration_part_found) + { + // Since there are load the needed administration_part type ids + $administration_part_ids = $db->loadColumn(); + // Remove Administration_part from the content type table + $administration_part_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.administration_part') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($administration_part_condition); + $db->setQuery($query); + // Execute the query to remove Administration_part items + $administration_part_done = $db->execute(); + if ($administration_part_done) + { + // If successfully remove Administration_part add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.administration_part) type alias was removed from the #__content_type table')); + } + + // Remove Administration_part items from the contentitem tag map table + $administration_part_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.administration_part') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($administration_part_condition); + $db->setQuery($query); + // Execute the query to remove Administration_part items + $administration_part_done = $db->execute(); + if ($administration_part_done) + { + // If successfully remove Administration_part add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.administration_part) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Administration_part items from the ucm content table + $administration_part_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.administration_part') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($administration_part_condition); + $db->setQuery($query); + // Execute the query to remove Administration_part items + $administration_part_done = $db->execute(); + if ($administration_part_done) + { + // If successfully removed Administration_part add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.administration_part) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Administration_part items are cleared from DB + foreach ($administration_part_ids as $administration_part_id) + { + // Remove Administration_part items from the ucm base table + $administration_part_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $administration_part_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($administration_part_condition); + $db->setQuery($query); + // Execute the query to remove Administration_part items + $db->execute(); + + // Remove Administration_part items from the ucm history table + $administration_part_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $administration_part_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($administration_part_condition); + $db->setQuery($query); + // Execute the query to remove Administration_part 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 Payment_type alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.payment_type') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $payment_type_found = $db->getNumRows(); + // Now check if there were any rows + if ($payment_type_found) + { + // Since there are load the needed payment_type type ids + $payment_type_ids = $db->loadColumn(); + // Remove Payment_type from the content type table + $payment_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.payment_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($payment_type_condition); + $db->setQuery($query); + // Execute the query to remove Payment_type items + $payment_type_done = $db->execute(); + if ($payment_type_done) + { + // If successfully remove Payment_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.payment_type) type alias was removed from the #__content_type table')); + } + + // Remove Payment_type items from the contentitem tag map table + $payment_type_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.payment_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($payment_type_condition); + $db->setQuery($query); + // Execute the query to remove Payment_type items + $payment_type_done = $db->execute(); + if ($payment_type_done) + { + // If successfully remove Payment_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.payment_type) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Payment_type items from the ucm content table + $payment_type_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.payment_type') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($payment_type_condition); + $db->setQuery($query); + // Execute the query to remove Payment_type items + $payment_type_done = $db->execute(); + if ($payment_type_done) + { + // If successfully removed Payment_type add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.payment_type) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Payment_type items are cleared from DB + foreach ($payment_type_ids as $payment_type_id) + { + // Remove Payment_type items from the ucm base table + $payment_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $payment_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($payment_type_condition); + $db->setQuery($query); + // Execute the query to remove Payment_type items + $db->execute(); + + // Remove Payment_type items from the ucm history table + $payment_type_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $payment_type_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($payment_type_condition); + $db->setQuery($query); + // Execute the query to remove Payment_type 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 Strength alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.strength') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $strength_found = $db->getNumRows(); + // Now check if there were any rows + if ($strength_found) + { + // Since there are load the needed strength type ids + $strength_ids = $db->loadColumn(); + // Remove Strength from the content type table + $strength_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.strength') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($strength_condition); + $db->setQuery($query); + // Execute the query to remove Strength items + $strength_done = $db->execute(); + if ($strength_done) + { + // If successfully remove Strength add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.strength) type alias was removed from the #__content_type table')); + } + + // Remove Strength items from the contentitem tag map table + $strength_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.strength') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($strength_condition); + $db->setQuery($query); + // Execute the query to remove Strength items + $strength_done = $db->execute(); + if ($strength_done) + { + // If successfully remove Strength add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.strength) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Strength items from the ucm content table + $strength_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.strength') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($strength_condition); + $db->setQuery($query); + // Execute the query to remove Strength items + $strength_done = $db->execute(); + if ($strength_done) + { + // If successfully removed Strength add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.strength) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Strength items are cleared from DB + foreach ($strength_ids as $strength_id) + { + // Remove Strength items from the ucm base table + $strength_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $strength_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($strength_condition); + $db->setQuery($query); + // Execute the query to remove Strength items + $db->execute(); + + // Remove Strength items from the ucm history table + $strength_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $strength_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($strength_condition); + $db->setQuery($query); + // Execute the query to remove Strength 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 Site alias is found + $query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.site') ); + $db->setQuery($query); + // Execute query to see if alias is found + $db->execute(); + $site_found = $db->getNumRows(); + // Now check if there were any rows + if ($site_found) + { + // Since there are load the needed site type ids + $site_ids = $db->loadColumn(); + // Remove Site from the content type table + $site_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.site') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__content_types')); + $query->where($site_condition); + $db->setQuery($query); + // Execute the query to remove Site items + $site_done = $db->execute(); + if ($site_done) + { + // If successfully remove Site add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.site) type alias was removed from the #__content_type table')); + } + + // Remove Site items from the contentitem tag map table + $site_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealth_portal.site') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__contentitem_tag_map')); + $query->where($site_condition); + $db->setQuery($query); + // Execute the query to remove Site items + $site_done = $db->execute(); + if ($site_done) + { + // If successfully remove Site add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.site) type alias was removed from the #__contentitem_tag_map table')); + } + + // Remove Site items from the ucm content table + $site_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealth_portal.site') ); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_content')); + $query->where($site_condition); + $db->setQuery($query); + // Execute the query to remove Site items + $site_done = $db->execute(); + if ($site_done) + { + // If successfully removed Site add queued success message. + $app->enqueueMessage(JText::_('The (com_ehealth_portal.site) type alias was removed from the #__ucm_content table')); + } + + // Make sure that all the Site items are cleared from DB + foreach ($site_ids as $site_id) + { + // Remove Site items from the ucm base table + $site_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $site_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_base')); + $query->where($site_condition); + $db->setQuery($query); + // Execute the query to remove Site items + $db->execute(); + + // Remove Site items from the ucm history table + $site_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $site_id); + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__ucm_history')); + $query->where($site_condition); + $db->setQuery($query); + // Execute the query to remove Site items + $db->execute(); + } + } + + // If All related items was removed queued success message. + $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_base table')); + $app->enqueueMessage(JText::_('All related items was removed from the #__ucm_history table')); + + // Remove ehealth_portal assets from the assets table + $ehealth_portal_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_ehealth_portal%') ); + + // Create a new query object. + $query = $db->getQuery(true); + $query->delete($db->quoteName('#__assets')); + $query->where($ehealth_portal_condition); + $db->setQuery($query); + $site_done = $db->execute(); + if ($site_done) + { + // If successfully removed ehealth_portal add queued success message. + $app->enqueueMessage(JText::_('All related items was removed from the #__assets table')); + } + + // Get the biggest rule column in the assets table at this point. + $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $db->setQuery($get_rule_length); + if ($db->execute()) + { + $rule_length = $db->loadResult(); + // Check the size of the rules column + if ($rule_length < 5120) + { + // Revert the assets table rules column back to the default + $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; + $db->setQuery($revert_rule); + $db->execute(); + $app->enqueueMessage(JText::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); + } + else + { + + $app->enqueueMessage(JText::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); + } + } + // little notice as after service, in case of bad experience with component. + echo '

Did something go wrong? Are you disappointed?

+

Please let me know at oh.martin@vdm.io. +
We at Vast Development Method are committed to building extensions that performs proficiently! You can help us, really! +
Send me your thoughts on improvements that is needed, trust me, I will be very grateful! +
Visit us at https://github.com/namibia/eHealth-Portal today!

'; + } + + /** + * Called on update + * + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success + */ + public function update(JAdapterInstance $parent){} + + /** + * Called before any type of action + * + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success + */ + public function preflight($type, JAdapterInstance $parent) + { + // get application + $app = JFactory::getApplication(); + // is redundant or so it seems ...hmmm let me know if it works again + if ($type === 'uninstall') + { + return true; + } + // the default for both install and update + $jversion = new JVersion(); + if (!$jversion->isCompatible('3.8.0')) + { + $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); + return false; + } + // do any updates needed + if ($type === 'update') + { + } + // do any install needed + if ($type === 'install') + { + } + // check if the PHPExcel stuff is still around + if (File::exists(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/helpers/PHPExcel.php')) + { + // We need to remove this old PHPExcel folder + $this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/helpers/PHPExcel'); + // We need to remove this old PHPExcel file + File::delete(JPATH_ADMINISTRATOR . '/components/com_ehealth_portal/helpers/PHPExcel.php'); + } + return true; + } + + /** + * Called after any type of action + * + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success + */ + public function postflight($type, JAdapterInstance $parent) + { + // get application + $app = JFactory::getApplication(); + // We check if we have dynamic folders to copy + $this->setDynamicF0ld3rs($app, $parent); + // set the default component settings + if ($type === 'install') + { + + // Get The Database object + $db = JFactory::getDbo(); + + // Create the payment content type object. + $payment = new stdClass(); + $payment->type_title = 'Ehealth_portal Payment'; + $payment->type_alias = 'com_ehealth_portal.payment'; + $payment->table = '{"special": {"dbtable": "#__ehealth_portal_payment","key": "id","type": "Payment","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $payment->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","payment_category":"payment_category","payment_type":"payment_type","payment_amount":"payment_amount","nonpay_reason":"nonpay_reason","receipt_no":"receipt_no"}}'; + $payment->router = 'Ehealth_portalHelperRoute::getPaymentRoute'; + $payment->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/payment.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","payment_type","nonpay_reason"],"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": "payment_type","targetTable": "#__ehealth_portal_payment_type","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "nonpay_reason","targetTable": "#__ehealth_portal_nonpay_reason","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $payment_Inserted = $db->insertObject('#__content_types', $payment); + + // Create the general_medical_check_up content type object. + $general_medical_check_up = new stdClass(); + $general_medical_check_up->type_title = 'Ehealth_portal General_medical_check_up'; + $general_medical_check_up->type_alias = 'com_ehealth_portal.general_medical_check_up'; + $general_medical_check_up->table = '{"special": {"dbtable": "#__ehealth_portal_general_medical_check_up","key": "id","type": "General_medical_check_up","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $general_medical_check_up->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","bp_diastolic_one":"bp_diastolic_one","bp_systolic_one":"bp_systolic_one","temp_one":"temp_one","weight":"weight","pulse":"pulse","chronic_medication":"chronic_medication","bp_diastolic_two":"bp_diastolic_two","bp_systolic_two":"bp_systolic_two","temp_two":"temp_two","height":"height","bmi":"bmi","complaint":"complaint","investigations":"investigations","notes":"notes","diagnosis":"diagnosis","referral":"referral","reason":"reason"}}'; + $general_medical_check_up->router = 'Ehealth_portalHelperRoute::getGeneral_medical_check_upRoute'; + $general_medical_check_up->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/general_medical_check_up.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","bp_diastolic_one","bp_systolic_one","pulse","bp_diastolic_two","bp_systolic_two","diagnosis","referral"],"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": "diagnosis","targetTable": "#__ehealth_portal_diagnosis_type","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $general_medical_check_up_Inserted = $db->insertObject('#__content_types', $general_medical_check_up); + + // Create the antenatal_care content type object. + $antenatal_care = new stdClass(); + $antenatal_care->type_title = 'Ehealth_portal Antenatal_care'; + $antenatal_care->type_alias = 'com_ehealth_portal.antenatal_care'; + $antenatal_care->table = '{"special": {"dbtable": "#__ehealth_portal_antenatal_care","key": "id","type": "Antenatal_care","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $antenatal_care->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","foetal_lie":"foetal_lie","foetal_presentation":"foetal_presentation","foetal_engagement":"foetal_engagement","foetal_heart_rate":"foetal_heart_rate","foetal_movements":"foetal_movements","caesarean_sections":"caesarean_sections","last_menstrual_period":"last_menstrual_period","normal_births":"normal_births","still_births":"still_births","miscarriages":"miscarriages","live_births":"live_births","pregnancies_excl":"pregnancies_excl"}}'; + $antenatal_care->router = 'Ehealth_portalHelperRoute::getAntenatal_careRoute'; + $antenatal_care->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/antenatal_care.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","foetal_lie","foetal_presentation","foetal_engagement","foetal_heart_rate","caesarean_sections","normal_births","still_births","miscarriages","live_births","pregnancies_excl"],"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": "foetal_lie","targetTable": "#__ehealth_portal_foetal_lie","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "foetal_presentation","targetTable": "#__ehealth_portal_foetal_presentation","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "foetal_engagement","targetTable": "#__ehealth_portal_foetal_engagement","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $antenatal_care_Inserted = $db->insertObject('#__content_types', $antenatal_care); + + // Create the immunisation content type object. + $immunisation = new stdClass(); + $immunisation->type_title = 'Ehealth_portal Immunisation'; + $immunisation->type_alias = 'com_ehealth_portal.immunisation'; + $immunisation->table = '{"special": {"dbtable": "#__ehealth_portal_immunisation","key": "id","type": "Immunisation","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $immunisation->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","referral":"referral","immunisation_up_to_date":"immunisation_up_to_date","reason":"reason","immunisation_vaccine_type":"immunisation_vaccine_type","administration_part":"administration_part"}}'; + $immunisation->router = 'Ehealth_portalHelperRoute::getImmunisationRoute'; + $immunisation->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/immunisation.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral","immunisation_vaccine_type","administration_part"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "immunisation_vaccine_type","targetTable": "#__ehealth_portal_immunisation_vaccine_type","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "administration_part","targetTable": "#__ehealth_portal_administration_part","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $immunisation_Inserted = $db->insertObject('#__content_types', $immunisation); + + // Create the vmmc content type object. + $vmmc = new stdClass(); + $vmmc->type_title = 'Ehealth_portal Vmmc'; + $vmmc->type_alias = 'com_ehealth_portal.vmmc'; + $vmmc->table = '{"special": {"dbtable": "#__ehealth_portal_vmmc","key": "id","type": "Vmmc","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $vmmc->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","are_you_circumcised":"are_you_circumcised","info_ben_vmcc":"info_ben_vmcc","interested_in_vmmc":"interested_in_vmmc","vmmc_gender":"vmmc_gender","reason":"reason","referral":"referral","partner_circumcised":"partner_circumcised"}}'; + $vmmc->router = 'Ehealth_portalHelperRoute::getVmmcRoute'; + $vmmc->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/vmmc.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $vmmc_Inserted = $db->insertObject('#__content_types', $vmmc); + + // Create the prostate_and_testicular_cancer content type object. + $prostate_and_testicular_cancer = new stdClass(); + $prostate_and_testicular_cancer->type_title = 'Ehealth_portal Prostate_and_testicular_cancer'; + $prostate_and_testicular_cancer->type_alias = 'com_ehealth_portal.prostate_and_testicular_cancer'; + $prostate_and_testicular_cancer->table = '{"special": {"dbtable": "#__ehealth_portal_prostate_and_testicular_cancer","key": "id","type": "Prostate_and_testicular_cancer","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $prostate_and_testicular_cancer->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","ptc_age":"ptc_age","ptc_fam_history":"ptc_fam_history","ptc_diet":"ptc_diet","ptc_phy_activity":"ptc_phy_activity","ptc_overweight":"ptc_overweight","ptc_urinate":"ptc_urinate","ptc_urine_freq":"ptc_urine_freq","referral":"referral","reason":"reason","txt_ptc_fam_history":"txt_ptc_fam_history","txt_ptc_urine_freq":"txt_ptc_urine_freq","txt_ptc_urinate":"txt_ptc_urinate","txt_ptc_overweight":"txt_ptc_overweight","txt_ptc_age":"txt_ptc_age","txt_ptc_phy_activity":"txt_ptc_phy_activity","txt_ptc_diet":"txt_ptc_diet"}}'; + $prostate_and_testicular_cancer->router = 'Ehealth_portalHelperRoute::getProstate_and_testicular_cancerRoute'; + $prostate_and_testicular_cancer->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/prostate_and_testicular_cancer.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $prostate_and_testicular_cancer_Inserted = $db->insertObject('#__content_types', $prostate_and_testicular_cancer); + + // Create the tuberculosis content type object. + $tuberculosis = new stdClass(); + $tuberculosis->type_title = 'Ehealth_portal Tuberculosis'; + $tuberculosis->type_alias = 'com_ehealth_portal.tuberculosis'; + $tuberculosis->table = '{"special": {"dbtable": "#__ehealth_portal_tuberculosis","key": "id","type": "Tuberculosis","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $tuberculosis->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","recurring_night_sweats":"recurring_night_sweats","tb_fever":"tb_fever","persistent_cough":"persistent_cough","blood_streaked_sputum":"blood_streaked_sputum","unusual_tiredness":"unusual_tiredness","pain_in_chest":"pain_in_chest","shortness_of_breath":"shortness_of_breath","diagnosed_with_disease":"diagnosed_with_disease","tb_exposed":"tb_exposed","tb_treatment":"tb_treatment","date_of_treatment":"date_of_treatment","treating_dhc":"treating_dhc","sputum_collection_one":"sputum_collection_one","tb_reason_one":"tb_reason_one","sputum_result_one":"sputum_result_one","referred_second_sputum":"referred_second_sputum","tb_reason_two":"tb_reason_two","sputum_result_two":"sputum_result_two","weight_loss_wdieting":"weight_loss_wdieting","referral":"referral","reason":"reason"}}'; + $tuberculosis->router = 'Ehealth_portalHelperRoute::getTuberculosisRoute'; + $tuberculosis->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/tuberculosis.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $tuberculosis_Inserted = $db->insertObject('#__content_types', $tuberculosis); + + // Create the hiv_counseling_and_testing content type object. + $hiv_counseling_and_testing = new stdClass(); + $hiv_counseling_and_testing->type_title = 'Ehealth_portal Hiv_counseling_and_testing'; + $hiv_counseling_and_testing->type_alias = 'com_ehealth_portal.hiv_counseling_and_testing'; + $hiv_counseling_and_testing->table = '{"special": {"dbtable": "#__ehealth_portal_hiv_counseling_and_testing","key": "id","type": "Hiv_counseling_and_testing","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $hiv_counseling_and_testing->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","counseling_type":"counseling_type","testing_reason":"testing_reason","last_test_date":"last_test_date","prev_test_result":"prev_test_result","test_result_one":"test_result_one","test_result_two":"test_result_two","final_test_result":"final_test_result","eqa":"eqa","referral":"referral","reason":"reason"}}'; + $hiv_counseling_and_testing->router = 'Ehealth_portalHelperRoute::getHiv_counseling_and_testingRoute'; + $hiv_counseling_and_testing->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/hiv_counseling_and_testing.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","testing_reason","referral"],"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": "testing_reason","targetTable": "#__ehealth_portal_testing_reason","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $hiv_counseling_and_testing_Inserted = $db->insertObject('#__content_types', $hiv_counseling_and_testing); + + // Create the family_planning content type object. + $family_planning = new stdClass(); + $family_planning->type_title = 'Ehealth_portal Family_planning'; + $family_planning->type_alias = 'com_ehealth_portal.family_planning'; + $family_planning->table = '{"special": {"dbtable": "#__ehealth_portal_family_planning","key": "id","type": "Family_planning","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $family_planning->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","diagnosis":"diagnosis"}}'; + $family_planning->router = 'Ehealth_portalHelperRoute::getFamily_planningRoute'; + $family_planning->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/family_planning.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","diagnosis"],"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": "diagnosis","targetTable": "#__ehealth_portal_planning_type","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $family_planning_Inserted = $db->insertObject('#__content_types', $family_planning); + + // Create the health_education content type object. + $health_education = new stdClass(); + $health_education->type_title = 'Ehealth_portal Health_education'; + $health_education->type_alias = 'com_ehealth_portal.health_education'; + $health_education->table = '{"special": {"dbtable": "#__ehealth_portal_health_education","key": "id","type": "Health_education","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $health_education->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"education_type":"education_type","health_education_topic":"health_education_topic","patient":"patient"}}'; + $health_education->router = 'Ehealth_portalHelperRoute::getHealth_educationRoute'; + $health_education->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/health_education.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","health_education_topic","patient"],"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": "health_education_topic","targetTable": "#__ehealth_portal_health_education_topic","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $health_education_Inserted = $db->insertObject('#__content_types', $health_education); + + // Create the cervical_cancer content type object. + $cervical_cancer = new stdClass(); + $cervical_cancer->type_title = 'Ehealth_portal Cervical_cancer'; + $cervical_cancer->type_alias = 'com_ehealth_portal.cervical_cancer'; + $cervical_cancer->table = '{"special": {"dbtable": "#__ehealth_portal_cervical_cancer","key": "id","type": "Cervical_cancer","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $cervical_cancer->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","cc_viginal_bleeding":"cc_viginal_bleeding","cc_v_discharge":"cc_v_discharge","cc_periods":"cc_periods","cc_smoking":"cc_smoking","cc_sex_actve":"cc_sex_actve","cc_sex_partner":"cc_sex_partner","pap_smear_collection":"pap_smear_collection","cc_result":"cc_result","referral":"referral","reason":"reason","txt_cc_v_discharge":"txt_cc_v_discharge","txt_cc_sex_actve":"txt_cc_sex_actve","txt_cc_periods":"txt_cc_periods","cc_reason":"cc_reason","txt_cc_smoking":"txt_cc_smoking","txt_cc_viginal_bleeding":"txt_cc_viginal_bleeding","txt_cc_sex_partner":"txt_cc_sex_partner"}}'; + $cervical_cancer->router = 'Ehealth_portalHelperRoute::getCervical_cancerRoute'; + $cervical_cancer->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/cervical_cancer.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $cervical_cancer_Inserted = $db->insertObject('#__content_types', $cervical_cancer); + + // Create the breast_cancer content type object. + $breast_cancer = new stdClass(); + $breast_cancer->type_title = 'Ehealth_portal Breast_cancer'; + $breast_cancer->type_alias = 'com_ehealth_portal.breast_cancer'; + $breast_cancer->table = '{"special": {"dbtable": "#__ehealth_portal_breast_cancer","key": "id","type": "Breast_cancer","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $breast_cancer->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","bc_age_range":"bc_age_range","bc_family_history":"bc_family_history","bc_race":"bc_race","bc_breastfeeding":"bc_breastfeeding","bc_preg_freq":"bc_preg_freq","bc_preg_age":"bc_preg_age","bc_history_hrt":"bc_history_hrt","bc_reg_exercise":"bc_reg_exercise","bc_overweight":"bc_overweight","bc_lump_near_breast":"bc_lump_near_breast","bc_dimpling":"bc_dimpling","bc_inward_nipple":"bc_inward_nipple","bc_nipple_discharge":"bc_nipple_discharge","bc_abnormal_skin":"bc_abnormal_skin","bc_breast_shape":"bc_breast_shape","referral":"referral","reason":"reason","txt_bc_breast_shape":"txt_bc_breast_shape","txt_bc_abnormal_skin":"txt_bc_abnormal_skin","txt_bc_nipple_discharge":"txt_bc_nipple_discharge","txt_bc_dimpling":"txt_bc_dimpling","txt_bc_lump_near_breast":"txt_bc_lump_near_breast","txt_bc_inward_nipple":"txt_bc_inward_nipple"}}'; + $breast_cancer->router = 'Ehealth_portalHelperRoute::getBreast_cancerRoute'; + $breast_cancer->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/breast_cancer.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","bc_preg_freq","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $breast_cancer_Inserted = $db->insertObject('#__content_types', $breast_cancer); + + // Create the test content type object. + $test = new stdClass(); + $test->type_title = 'Ehealth_portal Test'; + $test->type_alias = 'com_ehealth_portal.test'; + $test->table = '{"special": {"dbtable": "#__ehealth_portal_test","key": "id","type": "Test","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $test->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","urine_test_result":"urine_test_result","glucose_first_reading":"glucose_first_reading","glucose_second_reading":"glucose_second_reading","haemoglobin_reading":"haemoglobin_reading","cholesterol_reading":"cholesterol_reading","syphilis_first_reading":"syphilis_first_reading","syphilis_second_reading":"syphilis_second_reading","hepatitis_first_reading":"hepatitis_first_reading","hepatitis_second_reading":"hepatitis_second_reading","malaria_first_reading":"malaria_first_reading","malaria_second_reading":"malaria_second_reading","pregnancy_first_reading":"pregnancy_first_reading","pregnancy_second_reading":"pregnancy_second_reading","referral":"referral","reason":"reason"}}'; + $test->router = 'Ehealth_portalHelperRoute::getTestRoute'; + $test->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/test.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","glucose_first_reading","glucose_second_reading","haemoglobin_reading","cholesterol_reading","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $test_Inserted = $db->insertObject('#__content_types', $test); + + // Create the immunisation_vaccine_type content type object. + $immunisation_vaccine_type = new stdClass(); + $immunisation_vaccine_type->type_title = 'Ehealth_portal Immunisation_vaccine_type'; + $immunisation_vaccine_type->type_alias = 'com_ehealth_portal.immunisation_vaccine_type'; + $immunisation_vaccine_type->table = '{"special": {"dbtable": "#__ehealth_portal_immunisation_vaccine_type","key": "id","type": "Immunisation_vaccine_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $immunisation_vaccine_type->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","administration_part":"administration_part","description":"description","alias":"alias"}}'; + $immunisation_vaccine_type->router = 'Ehealth_portalHelperRoute::getImmunisation_vaccine_typeRoute'; + $immunisation_vaccine_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/immunisation_vaccine_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","administration_part"],"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": "administration_part","targetTable": "#__ehealth_portal_administration_part","targetColumn": "id","displayColumn": "name"}]}'; + + // Set the object into the content types table. + $immunisation_vaccine_type_Inserted = $db->insertObject('#__content_types', $immunisation_vaccine_type); + + // Create the foetal_presentation content type object. + $foetal_presentation = new stdClass(); + $foetal_presentation->type_title = 'Ehealth_portal Foetal_presentation'; + $foetal_presentation->type_alias = 'com_ehealth_portal.foetal_presentation'; + $foetal_presentation->table = '{"special": {"dbtable": "#__ehealth_portal_foetal_presentation","key": "id","type": "Foetal_presentation","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $foetal_presentation->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","description":"description","alias":"alias"}}'; + $foetal_presentation->router = 'Ehealth_portalHelperRoute::getFoetal_presentationRoute'; + $foetal_presentation->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/foetal_presentation.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $foetal_presentation_Inserted = $db->insertObject('#__content_types', $foetal_presentation); + + // Create the foetal_lie content type object. + $foetal_lie = new stdClass(); + $foetal_lie->type_title = 'Ehealth_portal Foetal_lie'; + $foetal_lie->type_alias = 'com_ehealth_portal.foetal_lie'; + $foetal_lie->table = '{"special": {"dbtable": "#__ehealth_portal_foetal_lie","key": "id","type": "Foetal_lie","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $foetal_lie->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","description":"description","alias":"alias"}}'; + $foetal_lie->router = 'Ehealth_portalHelperRoute::getFoetal_lieRoute'; + $foetal_lie->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/foetal_lie.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $foetal_lie_Inserted = $db->insertObject('#__content_types', $foetal_lie); + + // Create the counseling_type content type object. + $counseling_type = new stdClass(); + $counseling_type->type_title = 'Ehealth_portal Counseling_type'; + $counseling_type->type_alias = 'com_ehealth_portal.counseling_type'; + $counseling_type->table = '{"special": {"dbtable": "#__ehealth_portal_counseling_type","key": "id","type": "Counseling_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $counseling_type->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","description":"description","alias":"alias"}}'; + $counseling_type->router = 'Ehealth_portalHelperRoute::getCounseling_typeRoute'; + $counseling_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/counseling_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $counseling_type_Inserted = $db->insertObject('#__content_types', $counseling_type); + + // Create the foetal_engagement content type object. + $foetal_engagement = new stdClass(); + $foetal_engagement->type_title = 'Ehealth_portal Foetal_engagement'; + $foetal_engagement->type_alias = 'com_ehealth_portal.foetal_engagement'; + $foetal_engagement->table = '{"special": {"dbtable": "#__ehealth_portal_foetal_engagement","key": "id","type": "Foetal_engagement","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $foetal_engagement->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","description":"description","alias":"alias"}}'; + $foetal_engagement->router = 'Ehealth_portalHelperRoute::getFoetal_engagementRoute'; + $foetal_engagement->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/foetal_engagement.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $foetal_engagement_Inserted = $db->insertObject('#__content_types', $foetal_engagement); + + // Create the health_education_topic content type object. + $health_education_topic = new stdClass(); + $health_education_topic->type_title = 'Ehealth_portal Health_education_topic'; + $health_education_topic->type_alias = 'com_ehealth_portal.health_education_topic'; + $health_education_topic->table = '{"special": {"dbtable": "#__ehealth_portal_health_education_topic","key": "id","type": "Health_education_topic","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $health_education_topic->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","description":"description","alias":"alias"}}'; + $health_education_topic->router = 'Ehealth_portalHelperRoute::getHealth_education_topicRoute'; + $health_education_topic->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/health_education_topic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $health_education_topic_Inserted = $db->insertObject('#__content_types', $health_education_topic); + + // Create the testing_reason content type object. + $testing_reason = new stdClass(); + $testing_reason->type_title = 'Ehealth_portal Testing_reason'; + $testing_reason->type_alias = 'com_ehealth_portal.testing_reason'; + $testing_reason->table = '{"special": {"dbtable": "#__ehealth_portal_testing_reason","key": "id","type": "Testing_reason","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $testing_reason->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","description":"description","alias":"alias"}}'; + $testing_reason->router = 'Ehealth_portalHelperRoute::getTesting_reasonRoute'; + $testing_reason->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/testing_reason.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $testing_reason_Inserted = $db->insertObject('#__content_types', $testing_reason); + + // Create the clinic content type object. + $clinic = new stdClass(); + $clinic->type_title = 'Ehealth_portal Clinic'; + $clinic->type_alias = 'com_ehealth_portal.clinic'; + $clinic->table = '{"special": {"dbtable": "#__ehealth_portal_clinic","key": "id","type": "Clinic","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $clinic->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "clinic_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": {"clinic_name":"clinic_name","description":"description","clinic_type":"clinic_type","alias":"alias"}}'; + $clinic->router = 'Ehealth_portalHelperRoute::getClinicRoute'; + $clinic->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/clinic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $clinic_Inserted = $db->insertObject('#__content_types', $clinic); + + // Create the immunisation_type content type object. + $immunisation_type = new stdClass(); + $immunisation_type->type_title = 'Ehealth_portal Immunisation_type'; + $immunisation_type->type_alias = 'com_ehealth_portal.immunisation_type'; + $immunisation_type->table = '{"special": {"dbtable": "#__ehealth_portal_immunisation_type","key": "id","type": "Immunisation_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $immunisation_type->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","description":"description","alias":"alias"}}'; + $immunisation_type->router = 'Ehealth_portalHelperRoute::getImmunisation_typeRoute'; + $immunisation_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/immunisation_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $immunisation_type_Inserted = $db->insertObject('#__content_types', $immunisation_type); + + // Create the unit content type object. + $unit = new stdClass(); + $unit->type_title = 'Ehealth_portal Unit'; + $unit->type_alias = 'com_ehealth_portal.unit'; + $unit->table = '{"special": {"dbtable": "#__ehealth_portal_unit","key": "id","type": "Unit","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $unit->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","description":"description","alias":"alias"}}'; + $unit->router = 'Ehealth_portalHelperRoute::getUnitRoute'; + $unit->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/unit.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $unit_Inserted = $db->insertObject('#__content_types', $unit); + + // Create the referral content type object. + $referral = new stdClass(); + $referral->type_title = 'Ehealth_portal Referral'; + $referral->type_alias = 'com_ehealth_portal.referral'; + $referral->table = '{"special": {"dbtable": "#__ehealth_portal_referral","key": "id","type": "Referral","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $referral->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","description":"description","alias":"alias"}}'; + $referral->router = 'Ehealth_portalHelperRoute::getReferralRoute'; + $referral->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/referral.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $referral_Inserted = $db->insertObject('#__content_types', $referral); + + // Create the planning_type content type object. + $planning_type = new stdClass(); + $planning_type->type_title = 'Ehealth_portal Planning_type'; + $planning_type->type_alias = 'com_ehealth_portal.planning_type'; + $planning_type->table = '{"special": {"dbtable": "#__ehealth_portal_planning_type","key": "id","type": "Planning_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $planning_type->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","description":"description","alias":"alias"}}'; + $planning_type->router = 'Ehealth_portalHelperRoute::getPlanning_typeRoute'; + $planning_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/planning_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $planning_type_Inserted = $db->insertObject('#__content_types', $planning_type); + + // Create the diagnosis_type content type object. + $diagnosis_type = new stdClass(); + $diagnosis_type->type_title = 'Ehealth_portal Diagnosis_type'; + $diagnosis_type->type_alias = 'com_ehealth_portal.diagnosis_type'; + $diagnosis_type->table = '{"special": {"dbtable": "#__ehealth_portal_diagnosis_type","key": "id","type": "Diagnosis_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $diagnosis_type->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","description":"description","alias":"alias"}}'; + $diagnosis_type->router = 'Ehealth_portalHelperRoute::getDiagnosis_typeRoute'; + $diagnosis_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/diagnosis_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $diagnosis_type_Inserted = $db->insertObject('#__content_types', $diagnosis_type); + + // Create the nonpay_reason content type object. + $nonpay_reason = new stdClass(); + $nonpay_reason->type_title = 'Ehealth_portal Nonpay_reason'; + $nonpay_reason->type_alias = 'com_ehealth_portal.nonpay_reason'; + $nonpay_reason->table = '{"special": {"dbtable": "#__ehealth_portal_nonpay_reason","key": "id","type": "Nonpay_reason","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $nonpay_reason->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","description":"description","alias":"alias"}}'; + $nonpay_reason->router = 'Ehealth_portalHelperRoute::getNonpay_reasonRoute'; + $nonpay_reason->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/nonpay_reason.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $nonpay_reason_Inserted = $db->insertObject('#__content_types', $nonpay_reason); + + // Create the medication content type object. + $medication = new stdClass(); + $medication->type_title = 'Ehealth_portal Medication'; + $medication->type_alias = 'com_ehealth_portal.medication'; + $medication->table = '{"special": {"dbtable": "#__ehealth_portal_medication","key": "id","type": "Medication","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $medication->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","description":"description","alias":"alias"}}'; + $medication->router = 'Ehealth_portalHelperRoute::getMedicationRoute'; + $medication->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/medication.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $medication_Inserted = $db->insertObject('#__content_types', $medication); + + // Create the payment_amount content type object. + $payment_amount = new stdClass(); + $payment_amount->type_title = 'Ehealth_portal Payment_amount'; + $payment_amount->type_alias = 'com_ehealth_portal.payment_amount'; + $payment_amount->table = '{"special": {"dbtable": "#__ehealth_portal_payment_amount","key": "id","type": "Payment_amount","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $payment_amount->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","description":"description","alias":"alias"}}'; + $payment_amount->router = 'Ehealth_portalHelperRoute::getPayment_amountRoute'; + $payment_amount->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/payment_amount.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $payment_amount_Inserted = $db->insertObject('#__content_types', $payment_amount); + + // Create the administration_part content type object. + $administration_part = new stdClass(); + $administration_part->type_title = 'Ehealth_portal Administration_part'; + $administration_part->type_alias = 'com_ehealth_portal.administration_part'; + $administration_part->table = '{"special": {"dbtable": "#__ehealth_portal_administration_part","key": "id","type": "Administration_part","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $administration_part->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","description":"description","alias":"alias"}}'; + $administration_part->router = 'Ehealth_portalHelperRoute::getAdministration_partRoute'; + $administration_part->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/administration_part.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $administration_part_Inserted = $db->insertObject('#__content_types', $administration_part); + + // Create the payment_type content type object. + $payment_type = new stdClass(); + $payment_type->type_title = 'Ehealth_portal Payment_type'; + $payment_type->type_alias = 'com_ehealth_portal.payment_type'; + $payment_type->table = '{"special": {"dbtable": "#__ehealth_portal_payment_type","key": "id","type": "Payment_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $payment_type->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","description":"description","alias":"alias"}}'; + $payment_type->router = 'Ehealth_portalHelperRoute::getPayment_typeRoute'; + $payment_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/payment_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $payment_type_Inserted = $db->insertObject('#__content_types', $payment_type); + + // Create the strength content type object. + $strength = new stdClass(); + $strength->type_title = 'Ehealth_portal Strength'; + $strength->type_alias = 'com_ehealth_portal.strength'; + $strength->table = '{"special": {"dbtable": "#__ehealth_portal_strength","key": "id","type": "Strength","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $strength->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","description":"description","alias":"alias"}}'; + $strength->router = 'Ehealth_portalHelperRoute::getStrengthRoute'; + $strength->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/strength.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $strength_Inserted = $db->insertObject('#__content_types', $strength); + + // Create the site content type object. + $site = new stdClass(); + $site->type_title = 'Ehealth_portal Site'; + $site->type_alias = 'com_ehealth_portal.site'; + $site->table = '{"special": {"dbtable": "#__ehealth_portal_site","key": "id","type": "Site","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $site->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "site_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": {"site_name":"site_name","description":"description","site_region":"site_region","alias":"alias"}}'; + $site->router = 'Ehealth_portalHelperRoute::getSiteRoute'; + $site->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/site.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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. + $site_Inserted = $db->insertObject('#__content_types', $site); + + + // Install the global extenstion params. + $query = $db->getQuery(true); + // Field to update. + $fields = array( + $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Oh Martin","autorEmail":"oh.martin@vdm.io","check_in":"-1 day","save_history":"1","history_limit":"10"}'), + ); + // Condition. + $conditions = array( + $db->quoteName('element') . ' = ' . $db->quote('com_ehealth_portal') + ); + $query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions); + $db->setQuery($query); + $allDone = $db->execute(); + + // Get the biggest rule column in the assets table at this point. + $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $db->setQuery($get_rule_length); + if ($db->execute()) + { + $rule_length = $db->loadResult(); + // Check the size of the rules column + if ($rule_length <= 44000) + { + // Fix the assets table rules column size + $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';"; + $db->setQuery($fix_rules_size); + $db->execute(); + $app->enqueueMessage(JText::_('The #__assets table rules column was resized to the TEXT datatype for the components possible large permission rules.')); + } + } + echo ' + + '; + } + // do any updates needed + if ($type === 'update') + { + + // Get The Database object + $db = JFactory::getDbo(); + + // Create the payment content type object. + $payment = new stdClass(); + $payment->type_title = 'Ehealth_portal Payment'; + $payment->type_alias = 'com_ehealth_portal.payment'; + $payment->table = '{"special": {"dbtable": "#__ehealth_portal_payment","key": "id","type": "Payment","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $payment->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","payment_category":"payment_category","payment_type":"payment_type","payment_amount":"payment_amount","nonpay_reason":"nonpay_reason","receipt_no":"receipt_no"}}'; + $payment->router = 'Ehealth_portalHelperRoute::getPaymentRoute'; + $payment->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/payment.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","payment_type","nonpay_reason"],"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": "payment_type","targetTable": "#__ehealth_portal_payment_type","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "nonpay_reason","targetTable": "#__ehealth_portal_nonpay_reason","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if payment type is already in content_type DB. + $payment_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($payment->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $payment->type_id = $db->loadResult(); + $payment_Updated = $db->updateObject('#__content_types', $payment, 'type_id'); + } + else + { + $payment_Inserted = $db->insertObject('#__content_types', $payment); + } + + // Create the general_medical_check_up content type object. + $general_medical_check_up = new stdClass(); + $general_medical_check_up->type_title = 'Ehealth_portal General_medical_check_up'; + $general_medical_check_up->type_alias = 'com_ehealth_portal.general_medical_check_up'; + $general_medical_check_up->table = '{"special": {"dbtable": "#__ehealth_portal_general_medical_check_up","key": "id","type": "General_medical_check_up","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $general_medical_check_up->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","bp_diastolic_one":"bp_diastolic_one","bp_systolic_one":"bp_systolic_one","temp_one":"temp_one","weight":"weight","pulse":"pulse","chronic_medication":"chronic_medication","bp_diastolic_two":"bp_diastolic_two","bp_systolic_two":"bp_systolic_two","temp_two":"temp_two","height":"height","bmi":"bmi","complaint":"complaint","investigations":"investigations","notes":"notes","diagnosis":"diagnosis","referral":"referral","reason":"reason"}}'; + $general_medical_check_up->router = 'Ehealth_portalHelperRoute::getGeneral_medical_check_upRoute'; + $general_medical_check_up->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/general_medical_check_up.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","bp_diastolic_one","bp_systolic_one","pulse","bp_diastolic_two","bp_systolic_two","diagnosis","referral"],"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": "diagnosis","targetTable": "#__ehealth_portal_diagnosis_type","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if general_medical_check_up type is already in content_type DB. + $general_medical_check_up_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($general_medical_check_up->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $general_medical_check_up->type_id = $db->loadResult(); + $general_medical_check_up_Updated = $db->updateObject('#__content_types', $general_medical_check_up, 'type_id'); + } + else + { + $general_medical_check_up_Inserted = $db->insertObject('#__content_types', $general_medical_check_up); + } + + // Create the antenatal_care content type object. + $antenatal_care = new stdClass(); + $antenatal_care->type_title = 'Ehealth_portal Antenatal_care'; + $antenatal_care->type_alias = 'com_ehealth_portal.antenatal_care'; + $antenatal_care->table = '{"special": {"dbtable": "#__ehealth_portal_antenatal_care","key": "id","type": "Antenatal_care","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $antenatal_care->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","foetal_lie":"foetal_lie","foetal_presentation":"foetal_presentation","foetal_engagement":"foetal_engagement","foetal_heart_rate":"foetal_heart_rate","foetal_movements":"foetal_movements","caesarean_sections":"caesarean_sections","last_menstrual_period":"last_menstrual_period","normal_births":"normal_births","still_births":"still_births","miscarriages":"miscarriages","live_births":"live_births","pregnancies_excl":"pregnancies_excl"}}'; + $antenatal_care->router = 'Ehealth_portalHelperRoute::getAntenatal_careRoute'; + $antenatal_care->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/antenatal_care.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","foetal_lie","foetal_presentation","foetal_engagement","foetal_heart_rate","caesarean_sections","normal_births","still_births","miscarriages","live_births","pregnancies_excl"],"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": "foetal_lie","targetTable": "#__ehealth_portal_foetal_lie","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "foetal_presentation","targetTable": "#__ehealth_portal_foetal_presentation","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "foetal_engagement","targetTable": "#__ehealth_portal_foetal_engagement","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if antenatal_care type is already in content_type DB. + $antenatal_care_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($antenatal_care->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $antenatal_care->type_id = $db->loadResult(); + $antenatal_care_Updated = $db->updateObject('#__content_types', $antenatal_care, 'type_id'); + } + else + { + $antenatal_care_Inserted = $db->insertObject('#__content_types', $antenatal_care); + } + + // Create the immunisation content type object. + $immunisation = new stdClass(); + $immunisation->type_title = 'Ehealth_portal Immunisation'; + $immunisation->type_alias = 'com_ehealth_portal.immunisation'; + $immunisation->table = '{"special": {"dbtable": "#__ehealth_portal_immunisation","key": "id","type": "Immunisation","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $immunisation->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","referral":"referral","immunisation_up_to_date":"immunisation_up_to_date","reason":"reason","immunisation_vaccine_type":"immunisation_vaccine_type","administration_part":"administration_part"}}'; + $immunisation->router = 'Ehealth_portalHelperRoute::getImmunisationRoute'; + $immunisation->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/immunisation.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral","immunisation_vaccine_type","administration_part"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "immunisation_vaccine_type","targetTable": "#__ehealth_portal_immunisation_vaccine_type","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "administration_part","targetTable": "#__ehealth_portal_administration_part","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if immunisation type is already in content_type DB. + $immunisation_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($immunisation->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $immunisation->type_id = $db->loadResult(); + $immunisation_Updated = $db->updateObject('#__content_types', $immunisation, 'type_id'); + } + else + { + $immunisation_Inserted = $db->insertObject('#__content_types', $immunisation); + } + + // Create the vmmc content type object. + $vmmc = new stdClass(); + $vmmc->type_title = 'Ehealth_portal Vmmc'; + $vmmc->type_alias = 'com_ehealth_portal.vmmc'; + $vmmc->table = '{"special": {"dbtable": "#__ehealth_portal_vmmc","key": "id","type": "Vmmc","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $vmmc->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","are_you_circumcised":"are_you_circumcised","info_ben_vmcc":"info_ben_vmcc","interested_in_vmmc":"interested_in_vmmc","vmmc_gender":"vmmc_gender","reason":"reason","referral":"referral","partner_circumcised":"partner_circumcised"}}'; + $vmmc->router = 'Ehealth_portalHelperRoute::getVmmcRoute'; + $vmmc->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/vmmc.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if vmmc type is already in content_type DB. + $vmmc_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($vmmc->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $vmmc->type_id = $db->loadResult(); + $vmmc_Updated = $db->updateObject('#__content_types', $vmmc, 'type_id'); + } + else + { + $vmmc_Inserted = $db->insertObject('#__content_types', $vmmc); + } + + // Create the prostate_and_testicular_cancer content type object. + $prostate_and_testicular_cancer = new stdClass(); + $prostate_and_testicular_cancer->type_title = 'Ehealth_portal Prostate_and_testicular_cancer'; + $prostate_and_testicular_cancer->type_alias = 'com_ehealth_portal.prostate_and_testicular_cancer'; + $prostate_and_testicular_cancer->table = '{"special": {"dbtable": "#__ehealth_portal_prostate_and_testicular_cancer","key": "id","type": "Prostate_and_testicular_cancer","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $prostate_and_testicular_cancer->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","ptc_age":"ptc_age","ptc_fam_history":"ptc_fam_history","ptc_diet":"ptc_diet","ptc_phy_activity":"ptc_phy_activity","ptc_overweight":"ptc_overweight","ptc_urinate":"ptc_urinate","ptc_urine_freq":"ptc_urine_freq","referral":"referral","reason":"reason","txt_ptc_fam_history":"txt_ptc_fam_history","txt_ptc_urine_freq":"txt_ptc_urine_freq","txt_ptc_urinate":"txt_ptc_urinate","txt_ptc_overweight":"txt_ptc_overweight","txt_ptc_age":"txt_ptc_age","txt_ptc_phy_activity":"txt_ptc_phy_activity","txt_ptc_diet":"txt_ptc_diet"}}'; + $prostate_and_testicular_cancer->router = 'Ehealth_portalHelperRoute::getProstate_and_testicular_cancerRoute'; + $prostate_and_testicular_cancer->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/prostate_and_testicular_cancer.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if prostate_and_testicular_cancer type is already in content_type DB. + $prostate_and_testicular_cancer_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($prostate_and_testicular_cancer->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $prostate_and_testicular_cancer->type_id = $db->loadResult(); + $prostate_and_testicular_cancer_Updated = $db->updateObject('#__content_types', $prostate_and_testicular_cancer, 'type_id'); + } + else + { + $prostate_and_testicular_cancer_Inserted = $db->insertObject('#__content_types', $prostate_and_testicular_cancer); + } + + // Create the tuberculosis content type object. + $tuberculosis = new stdClass(); + $tuberculosis->type_title = 'Ehealth_portal Tuberculosis'; + $tuberculosis->type_alias = 'com_ehealth_portal.tuberculosis'; + $tuberculosis->table = '{"special": {"dbtable": "#__ehealth_portal_tuberculosis","key": "id","type": "Tuberculosis","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $tuberculosis->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","recurring_night_sweats":"recurring_night_sweats","tb_fever":"tb_fever","persistent_cough":"persistent_cough","blood_streaked_sputum":"blood_streaked_sputum","unusual_tiredness":"unusual_tiredness","pain_in_chest":"pain_in_chest","shortness_of_breath":"shortness_of_breath","diagnosed_with_disease":"diagnosed_with_disease","tb_exposed":"tb_exposed","tb_treatment":"tb_treatment","date_of_treatment":"date_of_treatment","treating_dhc":"treating_dhc","sputum_collection_one":"sputum_collection_one","tb_reason_one":"tb_reason_one","sputum_result_one":"sputum_result_one","referred_second_sputum":"referred_second_sputum","tb_reason_two":"tb_reason_two","sputum_result_two":"sputum_result_two","weight_loss_wdieting":"weight_loss_wdieting","referral":"referral","reason":"reason"}}'; + $tuberculosis->router = 'Ehealth_portalHelperRoute::getTuberculosisRoute'; + $tuberculosis->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/tuberculosis.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if tuberculosis type is already in content_type DB. + $tuberculosis_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($tuberculosis->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $tuberculosis->type_id = $db->loadResult(); + $tuberculosis_Updated = $db->updateObject('#__content_types', $tuberculosis, 'type_id'); + } + else + { + $tuberculosis_Inserted = $db->insertObject('#__content_types', $tuberculosis); + } + + // Create the hiv_counseling_and_testing content type object. + $hiv_counseling_and_testing = new stdClass(); + $hiv_counseling_and_testing->type_title = 'Ehealth_portal Hiv_counseling_and_testing'; + $hiv_counseling_and_testing->type_alias = 'com_ehealth_portal.hiv_counseling_and_testing'; + $hiv_counseling_and_testing->table = '{"special": {"dbtable": "#__ehealth_portal_hiv_counseling_and_testing","key": "id","type": "Hiv_counseling_and_testing","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $hiv_counseling_and_testing->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","counseling_type":"counseling_type","testing_reason":"testing_reason","last_test_date":"last_test_date","prev_test_result":"prev_test_result","test_result_one":"test_result_one","test_result_two":"test_result_two","final_test_result":"final_test_result","eqa":"eqa","referral":"referral","reason":"reason"}}'; + $hiv_counseling_and_testing->router = 'Ehealth_portalHelperRoute::getHiv_counseling_and_testingRoute'; + $hiv_counseling_and_testing->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/hiv_counseling_and_testing.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","testing_reason","referral"],"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": "testing_reason","targetTable": "#__ehealth_portal_testing_reason","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if hiv_counseling_and_testing type is already in content_type DB. + $hiv_counseling_and_testing_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($hiv_counseling_and_testing->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $hiv_counseling_and_testing->type_id = $db->loadResult(); + $hiv_counseling_and_testing_Updated = $db->updateObject('#__content_types', $hiv_counseling_and_testing, 'type_id'); + } + else + { + $hiv_counseling_and_testing_Inserted = $db->insertObject('#__content_types', $hiv_counseling_and_testing); + } + + // Create the family_planning content type object. + $family_planning = new stdClass(); + $family_planning->type_title = 'Ehealth_portal Family_planning'; + $family_planning->type_alias = 'com_ehealth_portal.family_planning'; + $family_planning->table = '{"special": {"dbtable": "#__ehealth_portal_family_planning","key": "id","type": "Family_planning","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $family_planning->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","diagnosis":"diagnosis"}}'; + $family_planning->router = 'Ehealth_portalHelperRoute::getFamily_planningRoute'; + $family_planning->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/family_planning.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","diagnosis"],"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": "diagnosis","targetTable": "#__ehealth_portal_planning_type","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if family_planning type is already in content_type DB. + $family_planning_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($family_planning->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $family_planning->type_id = $db->loadResult(); + $family_planning_Updated = $db->updateObject('#__content_types', $family_planning, 'type_id'); + } + else + { + $family_planning_Inserted = $db->insertObject('#__content_types', $family_planning); + } + + // Create the health_education content type object. + $health_education = new stdClass(); + $health_education->type_title = 'Ehealth_portal Health_education'; + $health_education->type_alias = 'com_ehealth_portal.health_education'; + $health_education->table = '{"special": {"dbtable": "#__ehealth_portal_health_education","key": "id","type": "Health_education","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $health_education->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"education_type":"education_type","health_education_topic":"health_education_topic","patient":"patient"}}'; + $health_education->router = 'Ehealth_portalHelperRoute::getHealth_educationRoute'; + $health_education->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/health_education.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","health_education_topic","patient"],"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": "health_education_topic","targetTable": "#__ehealth_portal_health_education_topic","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if health_education type is already in content_type DB. + $health_education_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($health_education->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $health_education->type_id = $db->loadResult(); + $health_education_Updated = $db->updateObject('#__content_types', $health_education, 'type_id'); + } + else + { + $health_education_Inserted = $db->insertObject('#__content_types', $health_education); + } + + // Create the cervical_cancer content type object. + $cervical_cancer = new stdClass(); + $cervical_cancer->type_title = 'Ehealth_portal Cervical_cancer'; + $cervical_cancer->type_alias = 'com_ehealth_portal.cervical_cancer'; + $cervical_cancer->table = '{"special": {"dbtable": "#__ehealth_portal_cervical_cancer","key": "id","type": "Cervical_cancer","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $cervical_cancer->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","cc_viginal_bleeding":"cc_viginal_bleeding","cc_v_discharge":"cc_v_discharge","cc_periods":"cc_periods","cc_smoking":"cc_smoking","cc_sex_actve":"cc_sex_actve","cc_sex_partner":"cc_sex_partner","pap_smear_collection":"pap_smear_collection","cc_result":"cc_result","referral":"referral","reason":"reason","txt_cc_v_discharge":"txt_cc_v_discharge","txt_cc_sex_actve":"txt_cc_sex_actve","txt_cc_periods":"txt_cc_periods","cc_reason":"cc_reason","txt_cc_smoking":"txt_cc_smoking","txt_cc_viginal_bleeding":"txt_cc_viginal_bleeding","txt_cc_sex_partner":"txt_cc_sex_partner"}}'; + $cervical_cancer->router = 'Ehealth_portalHelperRoute::getCervical_cancerRoute'; + $cervical_cancer->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/cervical_cancer.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if cervical_cancer type is already in content_type DB. + $cervical_cancer_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($cervical_cancer->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $cervical_cancer->type_id = $db->loadResult(); + $cervical_cancer_Updated = $db->updateObject('#__content_types', $cervical_cancer, 'type_id'); + } + else + { + $cervical_cancer_Inserted = $db->insertObject('#__content_types', $cervical_cancer); + } + + // Create the breast_cancer content type object. + $breast_cancer = new stdClass(); + $breast_cancer->type_title = 'Ehealth_portal Breast_cancer'; + $breast_cancer->type_alias = 'com_ehealth_portal.breast_cancer'; + $breast_cancer->table = '{"special": {"dbtable": "#__ehealth_portal_breast_cancer","key": "id","type": "Breast_cancer","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $breast_cancer->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","bc_age_range":"bc_age_range","bc_family_history":"bc_family_history","bc_race":"bc_race","bc_breastfeeding":"bc_breastfeeding","bc_preg_freq":"bc_preg_freq","bc_preg_age":"bc_preg_age","bc_history_hrt":"bc_history_hrt","bc_reg_exercise":"bc_reg_exercise","bc_overweight":"bc_overweight","bc_lump_near_breast":"bc_lump_near_breast","bc_dimpling":"bc_dimpling","bc_inward_nipple":"bc_inward_nipple","bc_nipple_discharge":"bc_nipple_discharge","bc_abnormal_skin":"bc_abnormal_skin","bc_breast_shape":"bc_breast_shape","referral":"referral","reason":"reason","txt_bc_breast_shape":"txt_bc_breast_shape","txt_bc_abnormal_skin":"txt_bc_abnormal_skin","txt_bc_nipple_discharge":"txt_bc_nipple_discharge","txt_bc_dimpling":"txt_bc_dimpling","txt_bc_lump_near_breast":"txt_bc_lump_near_breast","txt_bc_inward_nipple":"txt_bc_inward_nipple"}}'; + $breast_cancer->router = 'Ehealth_portalHelperRoute::getBreast_cancerRoute'; + $breast_cancer->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/breast_cancer.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","bc_preg_freq","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if breast_cancer type is already in content_type DB. + $breast_cancer_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($breast_cancer->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $breast_cancer->type_id = $db->loadResult(); + $breast_cancer_Updated = $db->updateObject('#__content_types', $breast_cancer, 'type_id'); + } + else + { + $breast_cancer_Inserted = $db->insertObject('#__content_types', $breast_cancer); + } + + // Create the test content type object. + $test = new stdClass(); + $test->type_title = 'Ehealth_portal Test'; + $test->type_alias = 'com_ehealth_portal.test'; + $test->table = '{"special": {"dbtable": "#__ehealth_portal_test","key": "id","type": "Test","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $test->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","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": {"patient":"patient","urine_test_result":"urine_test_result","glucose_first_reading":"glucose_first_reading","glucose_second_reading":"glucose_second_reading","haemoglobin_reading":"haemoglobin_reading","cholesterol_reading":"cholesterol_reading","syphilis_first_reading":"syphilis_first_reading","syphilis_second_reading":"syphilis_second_reading","hepatitis_first_reading":"hepatitis_first_reading","hepatitis_second_reading":"hepatitis_second_reading","malaria_first_reading":"malaria_first_reading","malaria_second_reading":"malaria_second_reading","pregnancy_first_reading":"pregnancy_first_reading","pregnancy_second_reading":"pregnancy_second_reading","referral":"referral","reason":"reason"}}'; + $test->router = 'Ehealth_portalHelperRoute::getTestRoute'; + $test->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/test.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","patient","glucose_first_reading","glucose_second_reading","haemoglobin_reading","cholesterol_reading","referral"],"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": "referral","targetTable": "#__ehealth_portal_referral","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if test type is already in content_type DB. + $test_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($test->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $test->type_id = $db->loadResult(); + $test_Updated = $db->updateObject('#__content_types', $test, 'type_id'); + } + else + { + $test_Inserted = $db->insertObject('#__content_types', $test); + } + + // Create the immunisation_vaccine_type content type object. + $immunisation_vaccine_type = new stdClass(); + $immunisation_vaccine_type->type_title = 'Ehealth_portal Immunisation_vaccine_type'; + $immunisation_vaccine_type->type_alias = 'com_ehealth_portal.immunisation_vaccine_type'; + $immunisation_vaccine_type->table = '{"special": {"dbtable": "#__ehealth_portal_immunisation_vaccine_type","key": "id","type": "Immunisation_vaccine_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $immunisation_vaccine_type->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","administration_part":"administration_part","description":"description","alias":"alias"}}'; + $immunisation_vaccine_type->router = 'Ehealth_portalHelperRoute::getImmunisation_vaccine_typeRoute'; + $immunisation_vaccine_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/immunisation_vaccine_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","administration_part"],"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": "administration_part","targetTable": "#__ehealth_portal_administration_part","targetColumn": "id","displayColumn": "name"}]}'; + + // Check if immunisation_vaccine_type type is already in content_type DB. + $immunisation_vaccine_type_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($immunisation_vaccine_type->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $immunisation_vaccine_type->type_id = $db->loadResult(); + $immunisation_vaccine_type_Updated = $db->updateObject('#__content_types', $immunisation_vaccine_type, 'type_id'); + } + else + { + $immunisation_vaccine_type_Inserted = $db->insertObject('#__content_types', $immunisation_vaccine_type); + } + + // Create the foetal_presentation content type object. + $foetal_presentation = new stdClass(); + $foetal_presentation->type_title = 'Ehealth_portal Foetal_presentation'; + $foetal_presentation->type_alias = 'com_ehealth_portal.foetal_presentation'; + $foetal_presentation->table = '{"special": {"dbtable": "#__ehealth_portal_foetal_presentation","key": "id","type": "Foetal_presentation","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $foetal_presentation->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","description":"description","alias":"alias"}}'; + $foetal_presentation->router = 'Ehealth_portalHelperRoute::getFoetal_presentationRoute'; + $foetal_presentation->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/foetal_presentation.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if foetal_presentation type is already in content_type DB. + $foetal_presentation_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($foetal_presentation->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $foetal_presentation->type_id = $db->loadResult(); + $foetal_presentation_Updated = $db->updateObject('#__content_types', $foetal_presentation, 'type_id'); + } + else + { + $foetal_presentation_Inserted = $db->insertObject('#__content_types', $foetal_presentation); + } + + // Create the foetal_lie content type object. + $foetal_lie = new stdClass(); + $foetal_lie->type_title = 'Ehealth_portal Foetal_lie'; + $foetal_lie->type_alias = 'com_ehealth_portal.foetal_lie'; + $foetal_lie->table = '{"special": {"dbtable": "#__ehealth_portal_foetal_lie","key": "id","type": "Foetal_lie","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $foetal_lie->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","description":"description","alias":"alias"}}'; + $foetal_lie->router = 'Ehealth_portalHelperRoute::getFoetal_lieRoute'; + $foetal_lie->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/foetal_lie.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if foetal_lie type is already in content_type DB. + $foetal_lie_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($foetal_lie->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $foetal_lie->type_id = $db->loadResult(); + $foetal_lie_Updated = $db->updateObject('#__content_types', $foetal_lie, 'type_id'); + } + else + { + $foetal_lie_Inserted = $db->insertObject('#__content_types', $foetal_lie); + } + + // Create the counseling_type content type object. + $counseling_type = new stdClass(); + $counseling_type->type_title = 'Ehealth_portal Counseling_type'; + $counseling_type->type_alias = 'com_ehealth_portal.counseling_type'; + $counseling_type->table = '{"special": {"dbtable": "#__ehealth_portal_counseling_type","key": "id","type": "Counseling_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $counseling_type->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","description":"description","alias":"alias"}}'; + $counseling_type->router = 'Ehealth_portalHelperRoute::getCounseling_typeRoute'; + $counseling_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/counseling_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if counseling_type type is already in content_type DB. + $counseling_type_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($counseling_type->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $counseling_type->type_id = $db->loadResult(); + $counseling_type_Updated = $db->updateObject('#__content_types', $counseling_type, 'type_id'); + } + else + { + $counseling_type_Inserted = $db->insertObject('#__content_types', $counseling_type); + } + + // Create the foetal_engagement content type object. + $foetal_engagement = new stdClass(); + $foetal_engagement->type_title = 'Ehealth_portal Foetal_engagement'; + $foetal_engagement->type_alias = 'com_ehealth_portal.foetal_engagement'; + $foetal_engagement->table = '{"special": {"dbtable": "#__ehealth_portal_foetal_engagement","key": "id","type": "Foetal_engagement","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $foetal_engagement->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","description":"description","alias":"alias"}}'; + $foetal_engagement->router = 'Ehealth_portalHelperRoute::getFoetal_engagementRoute'; + $foetal_engagement->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/foetal_engagement.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if foetal_engagement type is already in content_type DB. + $foetal_engagement_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($foetal_engagement->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $foetal_engagement->type_id = $db->loadResult(); + $foetal_engagement_Updated = $db->updateObject('#__content_types', $foetal_engagement, 'type_id'); + } + else + { + $foetal_engagement_Inserted = $db->insertObject('#__content_types', $foetal_engagement); + } + + // Create the health_education_topic content type object. + $health_education_topic = new stdClass(); + $health_education_topic->type_title = 'Ehealth_portal Health_education_topic'; + $health_education_topic->type_alias = 'com_ehealth_portal.health_education_topic'; + $health_education_topic->table = '{"special": {"dbtable": "#__ehealth_portal_health_education_topic","key": "id","type": "Health_education_topic","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $health_education_topic->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","description":"description","alias":"alias"}}'; + $health_education_topic->router = 'Ehealth_portalHelperRoute::getHealth_education_topicRoute'; + $health_education_topic->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/health_education_topic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if health_education_topic type is already in content_type DB. + $health_education_topic_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($health_education_topic->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $health_education_topic->type_id = $db->loadResult(); + $health_education_topic_Updated = $db->updateObject('#__content_types', $health_education_topic, 'type_id'); + } + else + { + $health_education_topic_Inserted = $db->insertObject('#__content_types', $health_education_topic); + } + + // Create the testing_reason content type object. + $testing_reason = new stdClass(); + $testing_reason->type_title = 'Ehealth_portal Testing_reason'; + $testing_reason->type_alias = 'com_ehealth_portal.testing_reason'; + $testing_reason->table = '{"special": {"dbtable": "#__ehealth_portal_testing_reason","key": "id","type": "Testing_reason","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $testing_reason->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","description":"description","alias":"alias"}}'; + $testing_reason->router = 'Ehealth_portalHelperRoute::getTesting_reasonRoute'; + $testing_reason->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/testing_reason.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if testing_reason type is already in content_type DB. + $testing_reason_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($testing_reason->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $testing_reason->type_id = $db->loadResult(); + $testing_reason_Updated = $db->updateObject('#__content_types', $testing_reason, 'type_id'); + } + else + { + $testing_reason_Inserted = $db->insertObject('#__content_types', $testing_reason); + } + + // Create the clinic content type object. + $clinic = new stdClass(); + $clinic->type_title = 'Ehealth_portal Clinic'; + $clinic->type_alias = 'com_ehealth_portal.clinic'; + $clinic->table = '{"special": {"dbtable": "#__ehealth_portal_clinic","key": "id","type": "Clinic","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $clinic->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "clinic_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": {"clinic_name":"clinic_name","description":"description","clinic_type":"clinic_type","alias":"alias"}}'; + $clinic->router = 'Ehealth_portalHelperRoute::getClinicRoute'; + $clinic->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/clinic.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if clinic type is already in content_type DB. + $clinic_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($clinic->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $clinic->type_id = $db->loadResult(); + $clinic_Updated = $db->updateObject('#__content_types', $clinic, 'type_id'); + } + else + { + $clinic_Inserted = $db->insertObject('#__content_types', $clinic); + } + + // Create the immunisation_type content type object. + $immunisation_type = new stdClass(); + $immunisation_type->type_title = 'Ehealth_portal Immunisation_type'; + $immunisation_type->type_alias = 'com_ehealth_portal.immunisation_type'; + $immunisation_type->table = '{"special": {"dbtable": "#__ehealth_portal_immunisation_type","key": "id","type": "Immunisation_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $immunisation_type->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","description":"description","alias":"alias"}}'; + $immunisation_type->router = 'Ehealth_portalHelperRoute::getImmunisation_typeRoute'; + $immunisation_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/immunisation_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if immunisation_type type is already in content_type DB. + $immunisation_type_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($immunisation_type->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $immunisation_type->type_id = $db->loadResult(); + $immunisation_type_Updated = $db->updateObject('#__content_types', $immunisation_type, 'type_id'); + } + else + { + $immunisation_type_Inserted = $db->insertObject('#__content_types', $immunisation_type); + } + + // Create the unit content type object. + $unit = new stdClass(); + $unit->type_title = 'Ehealth_portal Unit'; + $unit->type_alias = 'com_ehealth_portal.unit'; + $unit->table = '{"special": {"dbtable": "#__ehealth_portal_unit","key": "id","type": "Unit","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $unit->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","description":"description","alias":"alias"}}'; + $unit->router = 'Ehealth_portalHelperRoute::getUnitRoute'; + $unit->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/unit.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if unit type is already in content_type DB. + $unit_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($unit->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $unit->type_id = $db->loadResult(); + $unit_Updated = $db->updateObject('#__content_types', $unit, 'type_id'); + } + else + { + $unit_Inserted = $db->insertObject('#__content_types', $unit); + } + + // Create the referral content type object. + $referral = new stdClass(); + $referral->type_title = 'Ehealth_portal Referral'; + $referral->type_alias = 'com_ehealth_portal.referral'; + $referral->table = '{"special": {"dbtable": "#__ehealth_portal_referral","key": "id","type": "Referral","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $referral->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","description":"description","alias":"alias"}}'; + $referral->router = 'Ehealth_portalHelperRoute::getReferralRoute'; + $referral->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/referral.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if referral type is already in content_type DB. + $referral_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($referral->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $referral->type_id = $db->loadResult(); + $referral_Updated = $db->updateObject('#__content_types', $referral, 'type_id'); + } + else + { + $referral_Inserted = $db->insertObject('#__content_types', $referral); + } + + // Create the planning_type content type object. + $planning_type = new stdClass(); + $planning_type->type_title = 'Ehealth_portal Planning_type'; + $planning_type->type_alias = 'com_ehealth_portal.planning_type'; + $planning_type->table = '{"special": {"dbtable": "#__ehealth_portal_planning_type","key": "id","type": "Planning_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $planning_type->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","description":"description","alias":"alias"}}'; + $planning_type->router = 'Ehealth_portalHelperRoute::getPlanning_typeRoute'; + $planning_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/planning_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if planning_type type is already in content_type DB. + $planning_type_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($planning_type->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $planning_type->type_id = $db->loadResult(); + $planning_type_Updated = $db->updateObject('#__content_types', $planning_type, 'type_id'); + } + else + { + $planning_type_Inserted = $db->insertObject('#__content_types', $planning_type); + } + + // Create the diagnosis_type content type object. + $diagnosis_type = new stdClass(); + $diagnosis_type->type_title = 'Ehealth_portal Diagnosis_type'; + $diagnosis_type->type_alias = 'com_ehealth_portal.diagnosis_type'; + $diagnosis_type->table = '{"special": {"dbtable": "#__ehealth_portal_diagnosis_type","key": "id","type": "Diagnosis_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $diagnosis_type->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","description":"description","alias":"alias"}}'; + $diagnosis_type->router = 'Ehealth_portalHelperRoute::getDiagnosis_typeRoute'; + $diagnosis_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/diagnosis_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if diagnosis_type type is already in content_type DB. + $diagnosis_type_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($diagnosis_type->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $diagnosis_type->type_id = $db->loadResult(); + $diagnosis_type_Updated = $db->updateObject('#__content_types', $diagnosis_type, 'type_id'); + } + else + { + $diagnosis_type_Inserted = $db->insertObject('#__content_types', $diagnosis_type); + } + + // Create the nonpay_reason content type object. + $nonpay_reason = new stdClass(); + $nonpay_reason->type_title = 'Ehealth_portal Nonpay_reason'; + $nonpay_reason->type_alias = 'com_ehealth_portal.nonpay_reason'; + $nonpay_reason->table = '{"special": {"dbtable": "#__ehealth_portal_nonpay_reason","key": "id","type": "Nonpay_reason","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $nonpay_reason->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","description":"description","alias":"alias"}}'; + $nonpay_reason->router = 'Ehealth_portalHelperRoute::getNonpay_reasonRoute'; + $nonpay_reason->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/nonpay_reason.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if nonpay_reason type is already in content_type DB. + $nonpay_reason_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($nonpay_reason->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $nonpay_reason->type_id = $db->loadResult(); + $nonpay_reason_Updated = $db->updateObject('#__content_types', $nonpay_reason, 'type_id'); + } + else + { + $nonpay_reason_Inserted = $db->insertObject('#__content_types', $nonpay_reason); + } + + // Create the medication content type object. + $medication = new stdClass(); + $medication->type_title = 'Ehealth_portal Medication'; + $medication->type_alias = 'com_ehealth_portal.medication'; + $medication->table = '{"special": {"dbtable": "#__ehealth_portal_medication","key": "id","type": "Medication","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $medication->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","description":"description","alias":"alias"}}'; + $medication->router = 'Ehealth_portalHelperRoute::getMedicationRoute'; + $medication->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/medication.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if medication type is already in content_type DB. + $medication_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($medication->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $medication->type_id = $db->loadResult(); + $medication_Updated = $db->updateObject('#__content_types', $medication, 'type_id'); + } + else + { + $medication_Inserted = $db->insertObject('#__content_types', $medication); + } + + // Create the payment_amount content type object. + $payment_amount = new stdClass(); + $payment_amount->type_title = 'Ehealth_portal Payment_amount'; + $payment_amount->type_alias = 'com_ehealth_portal.payment_amount'; + $payment_amount->table = '{"special": {"dbtable": "#__ehealth_portal_payment_amount","key": "id","type": "Payment_amount","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $payment_amount->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","description":"description","alias":"alias"}}'; + $payment_amount->router = 'Ehealth_portalHelperRoute::getPayment_amountRoute'; + $payment_amount->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/payment_amount.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if payment_amount type is already in content_type DB. + $payment_amount_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($payment_amount->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $payment_amount->type_id = $db->loadResult(); + $payment_amount_Updated = $db->updateObject('#__content_types', $payment_amount, 'type_id'); + } + else + { + $payment_amount_Inserted = $db->insertObject('#__content_types', $payment_amount); + } + + // Create the administration_part content type object. + $administration_part = new stdClass(); + $administration_part->type_title = 'Ehealth_portal Administration_part'; + $administration_part->type_alias = 'com_ehealth_portal.administration_part'; + $administration_part->table = '{"special": {"dbtable": "#__ehealth_portal_administration_part","key": "id","type": "Administration_part","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $administration_part->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","description":"description","alias":"alias"}}'; + $administration_part->router = 'Ehealth_portalHelperRoute::getAdministration_partRoute'; + $administration_part->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/administration_part.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if administration_part type is already in content_type DB. + $administration_part_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($administration_part->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $administration_part->type_id = $db->loadResult(); + $administration_part_Updated = $db->updateObject('#__content_types', $administration_part, 'type_id'); + } + else + { + $administration_part_Inserted = $db->insertObject('#__content_types', $administration_part); + } + + // Create the payment_type content type object. + $payment_type = new stdClass(); + $payment_type->type_title = 'Ehealth_portal Payment_type'; + $payment_type->type_alias = 'com_ehealth_portal.payment_type'; + $payment_type->table = '{"special": {"dbtable": "#__ehealth_portal_payment_type","key": "id","type": "Payment_type","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $payment_type->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","description":"description","alias":"alias"}}'; + $payment_type->router = 'Ehealth_portalHelperRoute::getPayment_typeRoute'; + $payment_type->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/payment_type.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if payment_type type is already in content_type DB. + $payment_type_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($payment_type->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $payment_type->type_id = $db->loadResult(); + $payment_type_Updated = $db->updateObject('#__content_types', $payment_type, 'type_id'); + } + else + { + $payment_type_Inserted = $db->insertObject('#__content_types', $payment_type); + } + + // Create the strength content type object. + $strength = new stdClass(); + $strength->type_title = 'Ehealth_portal Strength'; + $strength->type_alias = 'com_ehealth_portal.strength'; + $strength->table = '{"special": {"dbtable": "#__ehealth_portal_strength","key": "id","type": "Strength","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $strength->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","description":"description","alias":"alias"}}'; + $strength->router = 'Ehealth_portalHelperRoute::getStrengthRoute'; + $strength->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/strength.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if strength type is already in content_type DB. + $strength_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($strength->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $strength->type_id = $db->loadResult(); + $strength_Updated = $db->updateObject('#__content_types', $strength, 'type_id'); + } + else + { + $strength_Inserted = $db->insertObject('#__content_types', $strength); + } + + // Create the site content type object. + $site = new stdClass(); + $site->type_title = 'Ehealth_portal Site'; + $site->type_alias = 'com_ehealth_portal.site'; + $site->table = '{"special": {"dbtable": "#__ehealth_portal_site","key": "id","type": "Site","prefix": "ehealth_portalTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; + $site->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "site_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": {"site_name":"site_name","description":"description","site_region":"site_region","alias":"alias"}}'; + $site->router = 'Ehealth_portalHelperRoute::getSiteRoute'; + $site->content_history_options = '{"formFile": "administrator/components/com_ehealth_portal/models/forms/site.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering"],"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"}]}'; + + // Check if site type is already in content_type DB. + $site_id = null; + $query = $db->getQuery(true); + $query->select($db->quoteName(array('type_id'))); + $query->from($db->quoteName('#__content_types')); + $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($site->type_alias)); + $db->setQuery($query); + $db->execute(); + + // Set the object into the content types table. + if ($db->getNumRows()) + { + $site->type_id = $db->loadResult(); + $site_Updated = $db->updateObject('#__content_types', $site, 'type_id'); + } + else + { + $site_Inserted = $db->insertObject('#__content_types', $site); + } + + + echo ' + + +

Upgrade to Version 1.0.5 Was Successful! Let us know if anything is not working as expected.

'; + } + return true; + } + + /** + * Remove folders with files + * + * @param string $dir The path to folder to remove + * @param boolean $ignore The folders and files to ignore and not remove + * + * @return boolean True in all is removed + * + */ + protected function removeFolder($dir, $ignore = false) + { + if (Folder::exists($dir)) + { + $it = new RecursiveDirectoryIterator($dir); + $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); + // remove ending / + $dir = rtrim($dir, '/'); + // now loop the files & folders + foreach ($it as $file) + { + if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue; + // set file dir + $file_dir = $file->getPathname(); + // check if this is a dir or a file + if ($file->isDir()) + { + $keeper = false; + if ($this->checkArray($ignore)) + { + foreach ($ignore as $keep) + { + if (strpos($file_dir, $dir.'/'.$keep) !== false) + { + $keeper = true; + } + } + } + if ($keeper) + { + continue; + } + Folder::delete($file_dir); + } + else + { + $keeper = false; + if ($this->checkArray($ignore)) + { + foreach ($ignore as $keep) + { + if (strpos($file_dir, $dir.'/'.$keep) !== false) + { + $keeper = true; + } + } + } + if ($keeper) + { + continue; + } + File::delete($file_dir); + } + } + // delete the root folder if not ignore found + if (!$this->checkArray($ignore)) + { + return Folder::delete($dir); + } + return true; + } + return false; + } + + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + */ + protected function checkArray($array, $removeEmptyString = false) + { + if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + foreach ($array as $key => $string) + { + if (empty($string)) + { + unset($array[$key]); + } + } + return $this->checkArray($array, false); + } + return $nr; + } + return false; + } + + /** + * Method to set/copy dynamic folders into place (use with caution) + * + * @return void + */ + protected function setDynamicF0ld3rs($app, $parent) + { + // get the instalation path + $installer = $parent->getParent(); + $installPath = $installer->getPath('source'); + // get all the folders + $folders = Folder::folders($installPath); + // check if we have folders we may want to copy + $doNotCopy = array('media','admin','site'); // Joomla already deals with these + if (count((array) $folders) > 1) + { + foreach ($folders as $folder) + { + // Only copy if not a standard folders + if (!in_array($folder, $doNotCopy)) + { + // set the source path + $src = $installPath.'/'.$folder; + // set the destination path + $dest = JPATH_ROOT.'/'.$folder; + // now try to copy the folder + if (!Folder::copy($src, $dest, '', true)) + { + $app->enqueueMessage('Could not copy '.$folder.' folder into place, please make sure destination is writable!', 'error'); + } + } + } + } + } +}
element because TCPDF + // does not recognize e.g.
element because TCPDF + // does not recognize e.g.